Commit f7711f82 authored by prumde's avatar prumde

Changes done for Filters Processing

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@217561 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 69a6cc0e
......@@ -786,23 +786,20 @@ public class DashboardUtil
{
if(filters.has("filter"))
{
JSONArray filter= filters.optJSONArray("filter");
JSONArray filterTemp=filter;
E12GenericUtility genericUtility = new E12GenericUtility();
String sourceDateFormat=genericUtility.getApplDateFormat();
JSONArray filterArray= filters.optJSONArray("filter");
JSONArray filterTemp=filterArray;
if(filter !=null)
if(filterArray !=null)
{
filter =new JSONArray();
List<String> systemOption = new ArrayList<String>();
filterArray =new JSONArray();
for(int i = 0, size = filterTemp.length(); i < size; i++){
//System.out.println("size>>>>>>"+size);
JSONObject fil= filterTemp.getJSONObject(i);
System.out.println("filter>>>>>> "+i+" "+fil);
JSONObject filterObj= filterTemp.getJSONObject(i);
System.out.println("filter>>>>>> "+i+" "+filterObj);
boolean addFilter = true;
String parm_name = fil.optString("parm_name");
String parm_value = fil.optString("parm_value");
String parm_name = filterObj.optString("parm_name");
String parm_value = filterObj.optString("parm_value");
if(parm_name != null && parm_name.length() > 0)
{
String parmVal = getSfaParmVal(parm_name);
......@@ -824,7 +821,7 @@ public class DashboardUtil
}
else
{
if(fil.optString("isDefault").equals("Y"))
if(filterObj.optString("isDefault").equals("Y"))
{
addFilter = true;
}
......@@ -837,6 +834,7 @@ public class DashboardUtil
if(addFilter)
{
/*
String colName=fil.optString("col_name");
String modName=fil.optString("mod_name");
String type=fil.optString("type");
......@@ -883,8 +881,9 @@ public class DashboardUtil
else {
fil.put("is_pophelp", false);
}
filter.put( fil);
*/
filterObj = getFilterObject(filterObj);
filterArray.put( filterObj);
}
}
// filters.put("filter", filter);
......@@ -930,6 +929,7 @@ public class DashboardUtil
if(addFilter)
{
/*
String colName=filterObj.optString("col_name");
String modName=filterObj.optString("mod_name");
String type=filterObj.optString("type");
......@@ -943,14 +943,15 @@ public class DashboardUtil
else {
filterObj.put("is_pophelp", false);
}
filter =new JSONArray();
filter.put(filterObj);
*/
filterObj = getFilterObject(filterObj);
filterArray =new JSONArray();
filterArray.put(filterObj);
// filters.put("filter", filter);
}
}
filters.put("filter", filter);
filters.put("filter", filterArray);
}
}
......@@ -960,6 +961,62 @@ public class DashboardUtil
return filters;
}
private JSONObject getFilterObject(JSONObject filterObj)
{
try
{
String colName=filterObj.optString("col_name");
String modName=filterObj.optString("mod_name");
String type=filterObj.optString("type");
Object defaultValue=filterObj.opt("default_value");
System.out.println("defaultValue::::"+defaultValue);
if(defaultValue == null || defaultValue instanceof JSONObject) {
if(type.equalsIgnoreCase("4")) {
filterObj.put("default_value", "CURRENT_DATE");
}
else {
filterObj.put("default_value","");
}
}
//TO FETCH SITECODE OF USER LOGGED IN
else if(defaultValue !=null && "CURRENT_SITE".equalsIgnoreCase(defaultValue.toString())) {
filterObj.put("default_value",checkNull(userSite).trim()+",");
System.out.println("toget user site code => "+filterObj);
}
//TO FETCH EMPCODE OF USER LOGGED IN
else if(defaultValue !=null && "EMP_CODE".equalsIgnoreCase(defaultValue.toString())) {
filterObj.put("default_value",checkNull(empCode).trim()+",");
System.out.println("toget user emp_code => "+filterObj);
}
else if(defaultValue !=null && "LOGIN_CODE".equalsIgnoreCase(defaultValue.toString()))
{
System.out.println("LOGIN_CODE for column value in hcp Cals => "+this.loginCode);
filterObj.put("default_value",this.loginCode.trim() +",");
System.out.println("toget user login code in hcp calls ["+ filterObj +"]");
}
System.out.println("default value "+filterObj);
System.out.println("Inside type processDashboardFilter>>>>>>"+type);
JSONObject popHelpData = new JSONObject();
//Added by Priyanka B 7 JUN 2019 Start
if(type.equalsIgnoreCase("1") || type.equalsIgnoreCase("7"))
//Added by Priyanka B 7 JUN 2019 End
{
System.out.println("Inside if processDashboardFilter::::");
filterObj=processPophelpData(colName, modName,filterObj);
}
else {
filterObj.put("is_pophelp", false);
}
}
catch(Exception e)
{
}
return filterObj;
}
private JSONObject processPophelpData(String colName , String modName,JSONObject filter ) throws JSONException {
Pophelp pophelpData = fetchAllPophelpData(colName, modName );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment