Commit 35abdfe9 authored by pborate's avatar pborate

Updated dashboardUtil.java class.

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@182603 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 4b5d044d
...@@ -2,7 +2,9 @@ package ibase.dashboard.common.hibernate.dao; ...@@ -2,7 +2,9 @@ package ibase.dashboard.common.hibernate.dao;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date;
import java.util.List; import java.util.List;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
...@@ -17,12 +19,10 @@ import org.w3c.dom.NamedNodeMap; ...@@ -17,12 +19,10 @@ import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node; import org.w3c.dom.Node;
import org.w3c.dom.NodeList; import org.w3c.dom.NodeList;
import ibase.dashboard.common.hibernate.bean.Employee;
import ibase.dashboard.common.hibernate.bean.Pophelp; import ibase.dashboard.common.hibernate.bean.Pophelp;
import ibase.dashboard.common.hibernate.utility.HibernateUtil; import ibase.dashboard.common.hibernate.utility.HibernateUtil;
import ibase.utility.CommonConstants; import ibase.utility.CommonConstants;
import ibase.utility.E12GenericUtility; import ibase.utility.E12GenericUtility;
import javassist.bytecode.Descriptor.Iterator;
public class DashboardUtil public class DashboardUtil
{ {
...@@ -87,82 +87,89 @@ public class DashboardUtil ...@@ -87,82 +87,89 @@ public class DashboardUtil
try try
{ {
JSONObject view =dashboardConfig.optJSONObject("view"); if(dashboardConfig.has("view")) {
JSONArray viewArray =new JSONArray();
if(view != null) JSONObject view =dashboardConfig.optJSONObject("view");
{ JSONArray viewArray =new JSONArray();
System.out.println("view in if === "+view); if(view != null)
JSONArray componentDataNewArray = new JSONArray(); {
JSONObject componentData = view.optJSONObject("component"); System.out.println("view in if === "+view);
if(componentData != null) {
componentData = getColumnsData(componentData);
componentDataNewArray.put(componentData);
}
else {
JSONArray componentDataArray = view.optJSONArray("component");
for(int i = 0, size = componentDataArray.length(); i < size; i++) {
componentData = getColumnsData(componentDataArray.optJSONObject(i));
componentDataNewArray.put(componentData);
}
}
view.put("component", componentDataNewArray);
viewArray.put(view);
}
else
{
//System.out.println("view in else === "+view);
JSONArray viewDataArray = dashboardConfig.optJSONArray("view");
//System.out.println("viewDataArray in else === "+viewDataArray);
for(int i = 0, viewsize = viewDataArray.length(); i < viewsize; i++) {
JSONArray componentDataNewArray = new JSONArray(); JSONArray componentDataNewArray = new JSONArray();
JSONObject viewData = viewDataArray.optJSONObject(i); JSONObject componentData = view.optJSONObject("component");
System.out.println("viewData::::::: "+i+">>>"+viewData);
JSONObject componentData = viewData.optJSONObject("component");
if(componentData != null) { if(componentData != null) {
//System.out.println("viewDataArray in else if === "+componentData);
componentData = getColumnsData(componentData); componentData = getColumnsData(componentData);
//System.out.println("viewDataArray in else if>>>>> === "+viewDataArray);
componentDataNewArray.put(componentData); componentDataNewArray.put(componentData);
} }
else { else {
//System.out.println("viewDataArray in else for === "+viewDataArray); JSONArray componentDataArray = view.optJSONArray("component");
JSONArray componentDataArray = componentData.optJSONArray("component"); for(int i = 0, size = componentDataArray.length(); i < size; i++) {
for(int j = 0, size = componentDataArray.length(); j < size; j++) { componentData = getColumnsData(componentDataArray.optJSONObject(i));
componentData = getColumnsData(componentDataArray.optJSONObject(j)); componentDataNewArray.put(componentData);
}
}
view.put("component", componentDataNewArray);
viewArray.put(view);
}
else
{
//System.out.println("view in else === "+view);
JSONArray viewDataArray = dashboardConfig.optJSONArray("view");
//System.out.println("viewDataArray in else === "+viewDataArray);
for(int i = 0, viewsize = viewDataArray.length(); i < viewsize; i++) {
JSONArray componentDataNewArray = new JSONArray();
JSONObject viewData = viewDataArray.optJSONObject(i);
System.out.println("viewData::::::: "+i+">>>"+viewData);
JSONObject componentData = viewData.optJSONObject("component");
if(componentData != null) {
//System.out.println("viewDataArray in else if === "+componentData);
componentData = getColumnsData(componentData);
//System.out.println("viewDataArray in else if>>>>> === "+viewDataArray);
componentDataNewArray.put(componentData); componentDataNewArray.put(componentData);
} }
else {
//System.out.println("viewDataArray in else for === "+viewDataArray);
JSONArray componentDataArray = componentData.optJSONArray("component");
for(int j = 0, size = componentDataArray.length(); j < size; j++) {
componentData = getColumnsData(componentDataArray.optJSONObject(j));
componentDataNewArray.put(componentData);
}
}
//System.out.println("componentDataNewArray in else if>>>>> === "+componentDataNewArray);
viewData.put("component", componentDataNewArray);
viewArray.put(viewData);
} }
//System.out.println("componentDataNewArray in else if>>>>> === "+componentDataNewArray);
viewData.put("component", componentDataNewArray);
viewArray.put(viewData);
} }
System.out.println("viewArray in else if>>>>> === "+viewArray);
popHelpFunction.put("view", viewArray);
} }
System.out.println("viewArray in else if>>>>> === "+viewArray);
popHelpFunction.put("view", viewArray);
System.out.println("popHelpFunction type === "+popHelpFunction); System.out.println("popHelpFunction type === "+popHelpFunction);
String page_title= dashboardConfig.getString("page_title"); if(dashboardConfig.has("page_title")) {
System.out.println("page_title ::::"+page_title); String page_title= dashboardConfig.getString("page_title");
if(page_title.length()>0) System.out.println("page_title ::::"+page_title);
{ if(page_title.length()>0)
popHelpFunction.put("page_title", page_title); {
popHelpFunction.put("page_title", page_title);
}
} }
Object datasourceVal=dashboardConfig.get("datasource"); if(dashboardConfig.has("datasource")) {
JSONArray datasource=new JSONArray(); Object datasourceVal=dashboardConfig.opt("datasource");
System.out.println("datasourceVal ::::"+datasourceVal); JSONArray datasource=new JSONArray();
if(datasourceVal instanceof JSONArray) { System.out.println("datasourceVal ::::"+datasourceVal);
datasource= dashboardConfig.optJSONArray("datasource"); if(datasourceVal instanceof JSONArray) {
System.out.println("datasource ::::["+datasource+"] datasource length ["+datasource.length()+"]"); datasource= dashboardConfig.optJSONArray("datasource");
popHelpFunction.put("datasource", datasource); System.out.println("datasource ::::["+datasource+"] datasource length ["+datasource.length()+"]");
} popHelpFunction.put("datasource", datasource);
else { }
JSONObject datasourceObj= dashboardConfig.optJSONObject("datasource"); else {
datasource.put(datasourceObj); JSONObject datasourceObj= dashboardConfig.optJSONObject("datasource");
System.out.println("datasource obj::::"+datasource); datasource.put(datasourceObj);
popHelpFunction.put("datasource", datasource); System.out.println("datasource obj::::"+datasource);
popHelpFunction.put("datasource", datasource);
}
} }
if(dashboardConfig.has("filters")) { if(dashboardConfig.has("filters")) {
...@@ -343,15 +350,28 @@ public class DashboardUtil ...@@ -343,15 +350,28 @@ public class DashboardUtil
filter =new JSONArray(); filter =new JSONArray();
List<String> systemOption = new ArrayList<String>(); List<String> systemOption = new ArrayList<String>();
for(int i = 0, size = filterTemp.length(); i < size; i++){ for(int i = 0, size = filterTemp.length(); i < size; i++){
System.out.println("size>>>>>>"+size); //System.out.println("size>>>>>>"+size);
JSONObject fil= filterTemp.getJSONObject(i); JSONObject fil= filterTemp.getJSONObject(i);
System.out.println("filter>>>>>> "+i+" "+fil); System.out.println("filter>>>>>> "+i+" "+fil);
String colName=fil.optString("col_name"); String colName=fil.optString("col_name");
String modName=fil.optString("mod_name"); String modName=fil.optString("mod_name");
String type=fil.optString("type"); String type=fil.optString("type");
Object defaultValue=fil.opt("default_value");
System.out.println("defaultValue::::"+defaultValue);
if(defaultValue ==null || defaultValue instanceof JSONObject) {
if(type.equalsIgnoreCase("4")) {
System.out.println("Inside if processDashboardFilter 4::::");
fil.put("default_value", new SimpleDateFormat("dd/MM/yyyy").format(new Date()));
}
else {
fil.put("default_value","");
}
}
System.out.println("default value "+fil);
System.out.println("Inside type processDashboardFilter>>>>>>"+type); System.out.println("Inside type processDashboardFilter>>>>>>"+type);
JSONObject popHelpData = new JSONObject(); JSONObject popHelpData = new JSONObject();
if(type.equalsIgnoreCase("1")) { if(type.equalsIgnoreCase("1")) {
System.out.println("Inside if processDashboardFilter::::"); System.out.println("Inside if processDashboardFilter::::");
fil=processPophelpData(colName, modName,fil); fil=processPophelpData(colName, modName,fil);
...@@ -407,6 +427,7 @@ public class DashboardUtil ...@@ -407,6 +427,7 @@ public class DashboardUtil
filter.put("auto_fil_len", checkNull(pophelpData.getAutoFillLen())); filter.put("auto_fil_len", checkNull(pophelpData.getAutoFillLen()));
filter.put("help_option", checkNull(pophelpData.getHelpOption())); filter.put("help_option", checkNull(pophelpData.getHelpOption()));
filter.put("multi_option", checkNull(pophelpData.getMultiOpt())); filter.put("multi_option", checkNull(pophelpData.getMultiOpt()));
filter.put("key_string", checkNull(pophelpData.getSqlInput()));
} }
else { else {
filter.put("is_pophelp", false); filter.put("is_pophelp", false);
......
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