diff options
9 files changed, 249 insertions, 288 deletions
@@ -41,5 +41,10 @@ committers: company: 'ATT' id: 'st782s' timezone: 'America/New_York' + - name: 'Lorraine A Welch' + email: 'lb2391@att.com' + company: 'ATT' + id: 'lorraineawelch' + timezone: 'America/New_York' tsc: approval: 'https://lists.onap.org/pipermail/onap-tsc' diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ChartJSONHelper.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ChartJSONHelper.java index 0e36dd0f..29cbca18 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ChartJSONHelper.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ChartJSONHelper.java @@ -80,10 +80,10 @@ public class ChartJSONHelper { private ReportRuntime reportRuntime; private String chartType; - public static final long HOUR = 3600*1000; - public static final long DAY = 3600*1000*24; - public static final long MONTH = 3600*1000*24*31; - public static final long YEAR = 3600*1000*24*365; + public static final long HOUR = 3600L * 1000L; + public static final long DAY = 3600L * 1000L * 24L; + public static final long MONTH = 3600L * 1000L * 24L * 31L; + public static final long YEAR = 3600L * 1000L * 24L * 365L; public ChartJSONHelper() { @@ -108,138 +108,191 @@ public class ChartJSONHelper { this.reportRuntime = rr; } - public String generateJSON(String reportID, HttpServletRequest request, boolean showData) throws RaptorException { - //From annotations chart - clearReportRuntimeBackup(request); - - //HttpServletRequest request = ((ServletRequestAttributes)RequestContextHolder.currentRequestAttributes()).getRequest(); - final Long user_id = new Long((long) UserUtils.getUserId(request)); - //String action = request.getParameter(AppConstants.RI_ACTION); - //String reportID = AppUtils.getRequestValue(request, AppConstants.RI_REPORT_ID); + public String generateJSON(String reportID, HttpServletRequest request, boolean showData) + throws RaptorException { + // From annotations chart + clearReportRuntimeBackup(request); - ReportHandler rh = new ReportHandler(); - //ReportData reportData = null; - HashMap<String, String> chartOptionsMap = new HashMap<String, String>(); - try { - if(reportID !=null) { - reportRuntime = rh.loadReportRuntime(request, reportID, true, 1); - setChartType(reportRuntime.getChartType()); - //reportData = reportRuntime.loadReportData(0, user_id.toString(), 10000,request, false); - } - - - - String rotateLabelsStr = ""; - rotateLabelsStr = AppUtils.nvl(reportRuntime.getLegendLabelAngle()); - if(rotateLabelsStr.toLowerCase().equals("standard")) { - rotateLabelsStr = "0"; - } else if (rotateLabelsStr.toLowerCase().equals("up45")) { - rotateLabelsStr = "45"; - } else if (rotateLabelsStr.toLowerCase().equals("down45")) { - rotateLabelsStr = "-45"; - } else if (rotateLabelsStr.toLowerCase().equals("up90")) { - rotateLabelsStr = "90"; - } else if (rotateLabelsStr.toLowerCase().equals("down90")) { - rotateLabelsStr = "-90"; - } else - rotateLabelsStr = "0"; - - String width = (AppUtils.getRequestNvlValue(request, "width").length()>0?AppUtils.getRequestNvlValue(request, "width"):(AppUtils.nvl(reportRuntime.getChartWidth()).length()>0?reportRuntime.getChartWidth():"700")); - String height = (AppUtils.getRequestNvlValue(request, "height").length()>0?AppUtils.getRequestNvlValue(request, "height"):(AppUtils.nvl(reportRuntime.getChartHeight()).length()>0?reportRuntime.getChartHeight():"300")); - String animationStr = (AppUtils.getRequestNvlValue(request, "animation").length()>0?AppUtils.getRequestNvlValue(request, "animation"):new Boolean(reportRuntime.isAnimateAnimatedChart()).toString()); - - String rotateLabels = (AppUtils.getRequestNvlValue(request, "rotateLabels").length()>0?AppUtils.getRequestNvlValue(request, "rotateLabels"):(rotateLabelsStr.length()>0?rotateLabelsStr:"0")); - String staggerLabelsStr = (AppUtils.getRequestNvlValue(request, "staggerLabels").length()>0?AppUtils.getRequestNvlValue(request, "staggerLabels"):"false"); - String showMaxMinStr = (AppUtils.getRequestNvlValue(request, "showMaxMin").length()>0?AppUtils.getRequestNvlValue(request, "showMaxMin"):"false"); - String showControlsStr = (AppUtils.getRequestNvlValue(request, "showControls").length()>0?AppUtils.getRequestNvlValue(request, "showControls"):new Boolean(reportRuntime.displayBarControls()).toString()); - String showLegendStr = (AppUtils.getRequestNvlValue(request, "showLegend").length()>0?AppUtils.getRequestNvlValue(request, "showLegend"):new Boolean(!new Boolean(reportRuntime.hideChartLegend())).toString()); - String topMarginStr = AppUtils.getRequestNvlValue(request, "topMargin"); - String topMargin = (AppUtils.nvl(topMarginStr).length()<=0)?(reportRuntime.getTopMargin()!=null?reportRuntime.getTopMargin().toString():"30"):topMarginStr; - String bottomMarginStr = AppUtils.getRequestNvlValue(request, "bottomMargin"); - String bottomMargin = (AppUtils.nvl(bottomMarginStr).length()<=0)?(reportRuntime.getBottomMargin()!=null?reportRuntime.getBottomMargin().toString():"50"):bottomMarginStr; - String leftMarginStr = AppUtils.getRequestNvlValue(request, "leftMargin"); - String leftMargin = (AppUtils.nvl(leftMarginStr).length()<=0)?(reportRuntime.getLeftMargin()!=null?reportRuntime.getLeftMargin().toString():"100"):leftMarginStr; - String rightMarginStr = AppUtils.getRequestNvlValue(request, "rightMargin"); - String rightMargin = (AppUtils.nvl(rightMarginStr).length()<=0)?(reportRuntime.getRightMargin()!=null?reportRuntime.getRightMargin().toString():"160"):rightMarginStr; - String showTitleStr = (AppUtils.getRequestNvlValue(request, "showTitle").length()>0?AppUtils.getRequestNvlValue(request, "showTitle"):new Boolean(reportRuntime.displayChartTitle()).toString()); - String subType = AppUtils.getRequestNvlValue(request, "subType").length()>0?AppUtils.getRequestNvlValue(request, "subType"):(AppUtils.nvl(reportRuntime.getTimeSeriesRender()).equals("area")?reportRuntime.getTimeSeriesRender():""); - String stackedStr = AppUtils.getRequestNvlValue(request, "stacked").length()>0?AppUtils.getRequestNvlValue(request, "stacked"):new Boolean(reportRuntime.isChartStacked()).toString(); - String horizontalBar = AppUtils.getRequestNvlValue(request, "horizontalBar").length()>0?AppUtils.getRequestNvlValue(request, "horizontalBar"):new Boolean(reportRuntime.isHorizontalOrientation()).toString(); - String barRealTimeAxis = AppUtils.getRequestNvlValue(request, "barRealTimeAxis"); - String barReduceXAxisLabels = AppUtils.getRequestNvlValue(request, "barReduceXAxisLabels").length()>0?AppUtils.getRequestNvlValue(request, "barReduceXAxisLabels"):new Boolean(reportRuntime.isLessXaxisTickers()).toString();; - String timeAxis = AppUtils.getRequestNvlValue(request, "timeAxis").length()>0?AppUtils.getRequestNvlValue(request, "timeAxis"):new Boolean(reportRuntime.isTimeAxis()).toString(); - String logScale = AppUtils.getRequestNvlValue(request, "logScale").length()>0?AppUtils.getRequestNvlValue(request, "logScale"):new Boolean(reportRuntime.isLogScale()).toString(); - String precision = AppUtils.getRequestNvlValue(request, "precision").length()>0?AppUtils.getRequestNvlValue(request, "precision"):"2"; - + ReportHandler rh = new ReportHandler(); - chartOptionsMap.put("width", width); - chartOptionsMap.put("height", height); - chartOptionsMap.put("animation", animationStr); - chartOptionsMap.put("rotateLabels", rotateLabels); - chartOptionsMap.put("staggerLabels", staggerLabelsStr); - chartOptionsMap.put("showMaxMin", showMaxMinStr); - chartOptionsMap.put("showControls", showControlsStr); - chartOptionsMap.put("showLegend", showLegendStr); - chartOptionsMap.put("topMargin", topMargin); - chartOptionsMap.put("bottomMargin", bottomMargin); - chartOptionsMap.put("leftMargin", leftMargin); - chartOptionsMap.put("rightMargin", rightMargin); - chartOptionsMap.put("showTitle", showTitleStr); - chartOptionsMap.put("subType", subType); - chartOptionsMap.put("stacked", stackedStr); - chartOptionsMap.put("horizontalBar", horizontalBar); - chartOptionsMap.put("timeAxis", timeAxis); - chartOptionsMap.put("barRealTimeAxis", barRealTimeAxis); - chartOptionsMap.put("barReduceXAxisLabels", barReduceXAxisLabels); - - chartOptionsMap.put("logScale", logScale); - chartOptionsMap.put("precision", precision); - - - } catch (RaptorException ex) { - ex.printStackTrace(); - } - return generateJSON(reportRuntime, chartOptionsMap, request, showData); - } + HashMap<String, String> chartOptionsMap = new HashMap<>(); + + try { + if (reportID != null) { + reportRuntime = rh.loadReportRuntime(request, reportID, true, 1); + setChartType(reportRuntime.getChartType()); + } + + String rotateLabelsStr = ""; + rotateLabelsStr = AppUtils.nvl(reportRuntime.getLegendLabelAngle()); + if (rotateLabelsStr.equalsIgnoreCase("standard")) { + rotateLabelsStr = "0"; + } else if (rotateLabelsStr.equalsIgnoreCase("up45")) { + rotateLabelsStr = "45"; + } else if (rotateLabelsStr.equalsIgnoreCase("down45")) { + rotateLabelsStr = "-45"; + } else if (rotateLabelsStr.equalsIgnoreCase("up90")) { + rotateLabelsStr = "90"; + } else if (rotateLabelsStr.equalsIgnoreCase("down90")) { + rotateLabelsStr = "-90"; + } else + rotateLabelsStr = "0"; + + String width = (AppUtils.getRequestNvlValue(request, "width").length() > 0 + ? AppUtils.getRequestNvlValue(request, "width") + : (AppUtils.nvl(reportRuntime.getChartWidth()).length() > 0 + ? reportRuntime.getChartWidth() + : "700")); + String height = (AppUtils.getRequestNvlValue(request, "height").length() > 0 + ? AppUtils.getRequestNvlValue(request, "height") + : (AppUtils.nvl(reportRuntime.getChartHeight()).length() > 0 + ? reportRuntime.getChartHeight() + : "300")); + String animationStr = (AppUtils.getRequestNvlValue(request, "animation").length() > 0 + ? AppUtils.getRequestNvlValue(request, "animation") + : new Boolean(reportRuntime.isAnimateAnimatedChart()).toString()); + + String rotateLabels = (AppUtils.getRequestNvlValue(request, "rotateLabels").length() > 0 + ? AppUtils.getRequestNvlValue(request, "rotateLabels") + : (rotateLabelsStr.length() > 0 ? rotateLabelsStr : "0")); + String staggerLabelsStr = + (AppUtils.getRequestNvlValue(request, "staggerLabels").length() > 0 + ? AppUtils.getRequestNvlValue(request, "staggerLabels") + : "false"); + String showMaxMinStr = (AppUtils.getRequestNvlValue(request, "showMaxMin").length() > 0 + ? AppUtils.getRequestNvlValue(request, "showMaxMin") + : "false"); + String showControlsStr = + (AppUtils.getRequestNvlValue(request, "showControls").length() > 0 + ? AppUtils.getRequestNvlValue(request, "showControls") + : new Boolean(reportRuntime.displayBarControls()).toString()); + String showLegendStr = (AppUtils.getRequestNvlValue(request, "showLegend").length() > 0 + ? AppUtils.getRequestNvlValue(request, "showLegend") + : new Boolean(!new Boolean(reportRuntime.hideChartLegend())).toString()); + String topMarginStr = AppUtils.getRequestNvlValue(request, "topMargin"); + String topMargin = (AppUtils.nvl(topMarginStr).length() <= 0) + ? (reportRuntime.getTopMargin() != null + ? reportRuntime.getTopMargin().toString() + : "30") + : topMarginStr; + String bottomMarginStr = AppUtils.getRequestNvlValue(request, "bottomMargin"); + String bottomMargin = (AppUtils.nvl(bottomMarginStr).length() <= 0) + ? (reportRuntime.getBottomMargin() != null + ? reportRuntime.getBottomMargin().toString() + : "50") + : bottomMarginStr; + String leftMarginStr = AppUtils.getRequestNvlValue(request, "leftMargin"); + String leftMargin = (AppUtils.nvl(leftMarginStr).length() <= 0) + ? (reportRuntime.getLeftMargin() != null + ? reportRuntime.getLeftMargin().toString() + : "100") + : leftMarginStr; + String rightMarginStr = AppUtils.getRequestNvlValue(request, "rightMargin"); + String rightMargin = (AppUtils.nvl(rightMarginStr).length() <= 0) + ? (reportRuntime.getRightMargin() != null + ? reportRuntime.getRightMargin().toString() + : "160") + : rightMarginStr; + String showTitleStr = (AppUtils.getRequestNvlValue(request, "showTitle").length() > 0 + ? AppUtils.getRequestNvlValue(request, "showTitle") + : new Boolean(reportRuntime.displayChartTitle()).toString()); + String subType = AppUtils.getRequestNvlValue(request, "subType").length() > 0 + ? AppUtils.getRequestNvlValue(request, "subType") + : (AppUtils.nvl(reportRuntime.getTimeSeriesRender()).equals("area") + ? reportRuntime.getTimeSeriesRender() + : ""); + String stackedStr = AppUtils.getRequestNvlValue(request, "stacked").length() > 0 + ? AppUtils.getRequestNvlValue(request, "stacked") + : new Boolean(reportRuntime.isChartStacked()).toString(); + String horizontalBar = + AppUtils.getRequestNvlValue(request, "horizontalBar").length() > 0 + ? AppUtils.getRequestNvlValue(request, "horizontalBar") + : new Boolean(reportRuntime.isHorizontalOrientation()).toString(); + String barRealTimeAxis = AppUtils.getRequestNvlValue(request, "barRealTimeAxis"); + String barReduceXAxisLabels = + AppUtils.getRequestNvlValue(request, "barReduceXAxisLabels").length() > 0 + ? AppUtils.getRequestNvlValue(request, "barReduceXAxisLabels") + : new Boolean(reportRuntime.isLessXaxisTickers()).toString();; + String timeAxis = AppUtils.getRequestNvlValue(request, "timeAxis").length() > 0 + ? AppUtils.getRequestNvlValue(request, "timeAxis") + : new Boolean(reportRuntime.isTimeAxis()).toString(); + String logScale = AppUtils.getRequestNvlValue(request, "logScale").length() > 0 + ? AppUtils.getRequestNvlValue(request, "logScale") + : new Boolean(reportRuntime.isLogScale()).toString(); + String precision = AppUtils.getRequestNvlValue(request, "precision").length() > 0 + ? AppUtils.getRequestNvlValue(request, "precision") + : "2"; + + + chartOptionsMap.put("width", width); + chartOptionsMap.put("height", height); + chartOptionsMap.put("animation", animationStr); + chartOptionsMap.put("rotateLabels", rotateLabels); + chartOptionsMap.put("staggerLabels", staggerLabelsStr); + chartOptionsMap.put("showMaxMin", showMaxMinStr); + chartOptionsMap.put("showControls", showControlsStr); + chartOptionsMap.put("showLegend", showLegendStr); + chartOptionsMap.put("topMargin", topMargin); + chartOptionsMap.put("bottomMargin", bottomMargin); + chartOptionsMap.put("leftMargin", leftMargin); + chartOptionsMap.put("rightMargin", rightMargin); + chartOptionsMap.put("showTitle", showTitleStr); + chartOptionsMap.put("subType", subType); + chartOptionsMap.put("stacked", stackedStr); + chartOptionsMap.put("horizontalBar", horizontalBar); + chartOptionsMap.put("timeAxis", timeAxis); + chartOptionsMap.put("barRealTimeAxis", barRealTimeAxis); + chartOptionsMap.put("barReduceXAxisLabels", barReduceXAxisLabels); + + chartOptionsMap.put("logScale", logScale); + chartOptionsMap.put("precision", precision); + + + } catch (RaptorException ex) { + logger.error("Exception in generateJSON", ex); + } + return generateJSON(reportRuntime, chartOptionsMap, request, showData); + } public String generateJSON(ReportRuntime reportRuntime, HttpServletRequest request, boolean showData) throws RaptorException { String rotateLabelsStr = ""; rotateLabelsStr = AppUtils.nvl(reportRuntime.getLegendLabelAngle()); - if(rotateLabelsStr.toLowerCase().equals("standard")) { - rotateLabelsStr = "0"; - } else if (rotateLabelsStr.toLowerCase().equals("up45")) { - rotateLabelsStr = "45"; - } else if (rotateLabelsStr.toLowerCase().equals("down45")) { - rotateLabelsStr = "-45"; - } else if (rotateLabelsStr.toLowerCase().equals("up90")) { - rotateLabelsStr = "90"; - } else if (rotateLabelsStr.toLowerCase().equals("down90")) { - rotateLabelsStr = "-90"; - } else - rotateLabelsStr = "0"; + if (rotateLabelsStr.equalsIgnoreCase("standard")) { + rotateLabelsStr = "0"; + } else if (rotateLabelsStr.equalsIgnoreCase("up45")) { + rotateLabelsStr = "45"; + } else if (rotateLabelsStr.equalsIgnoreCase("down45")) { + rotateLabelsStr = "-45"; + } else if (rotateLabelsStr.equalsIgnoreCase("up90")) { + rotateLabelsStr = "90"; + } else if (rotateLabelsStr.equalsIgnoreCase("down90")) { + rotateLabelsStr = "-90"; + } else { + rotateLabelsStr = "0"; + } - HashMap<String,String> chartOptionsMap = new HashMap<String, String>(); + HashMap<String,String> chartOptionsMap = new HashMap<>(); chartOptionsMap.put("width", reportRuntime.getChartWidth()); chartOptionsMap.put("height", reportRuntime.getChartHeight()); - chartOptionsMap.put("animation", new Boolean(reportRuntime.isAnimateAnimatedChart()).toString()); + chartOptionsMap.put("animation", Boolean.toString(reportRuntime.isAnimateAnimatedChart())); chartOptionsMap.put("rotateLabels", rotateLabelsStr); chartOptionsMap.put("staggerLabels", "false"); chartOptionsMap.put("showMaxMin", "false"); - chartOptionsMap.put("showControls", new Boolean(reportRuntime.displayBarControls()).toString()); - chartOptionsMap.put("showLegend", new Boolean(!reportRuntime.hideChartLegend()).toString()); + chartOptionsMap.put("showControls", Boolean.toString(reportRuntime.displayBarControls())); + chartOptionsMap.put("showLegend", Boolean.toString(!reportRuntime.hideChartLegend())); chartOptionsMap.put("topMargin", reportRuntime.getTopMargin()!=null?reportRuntime.getTopMargin().toString():"30"); chartOptionsMap.put("bottomMargin", reportRuntime.getBottomMargin()!=null?reportRuntime.getBottomMargin().toString():"50"); chartOptionsMap.put("leftMargin", reportRuntime.getLeftMargin()!=null?reportRuntime.getLeftMargin().toString():"100"); chartOptionsMap.put("rightMargin", reportRuntime.getRightMargin()!=null?reportRuntime.getRightMargin().toString():"160"); - chartOptionsMap.put("showTitle", new Boolean(reportRuntime.displayChartTitle()).toString()); + chartOptionsMap.put("showTitle", Boolean.toString(reportRuntime.displayChartTitle())); chartOptionsMap.put("subType", (AppUtils.nvl(reportRuntime.getTimeSeriesRender()).equals("area")?reportRuntime.getTimeSeriesRender():"")); - chartOptionsMap.put("stacked", new Boolean(reportRuntime.isChartStacked()).toString()); - chartOptionsMap.put("horizontalBar", new Boolean(reportRuntime.isHorizontalOrientation()).toString()); - chartOptionsMap.put("timeAxis", new Boolean(reportRuntime.isTimeAxis()).toString()); - chartOptionsMap.put("barReduceXAxisLabels", new Boolean(reportRuntime.isLessXaxisTickers()).toString()); + chartOptionsMap.put("stacked", Boolean.toString(reportRuntime.isChartStacked())); + chartOptionsMap.put("horizontalBar", Boolean.toString(reportRuntime.isHorizontalOrientation())); + chartOptionsMap.put("timeAxis", Boolean.toString(reportRuntime.isTimeAxis())); + chartOptionsMap.put("barReduceXAxisLabels", Boolean.toString(reportRuntime.isLessXaxisTickers())); - chartOptionsMap.put("logScale", new Boolean(reportRuntime.isLogScale()).toString()); + chartOptionsMap.put("logScale", Boolean.toString(reportRuntime.isLogScale())); chartOptionsMap.put("precision", "2"); @@ -247,7 +300,7 @@ public class ChartJSONHelper { return generateJSON(reportRuntime, chartOptionsMap, request, showData); } - public String generateJSON(ReportRuntime reportRuntime, HashMap<String,String> chartOptionsMap, HttpServletRequest request, boolean showData) throws RaptorException { + public String generateJSON(ReportRuntime reportRuntime,Map<String, String> chartOptionsMap, HttpServletRequest request, boolean showData) throws RaptorException { //String width, String height, boolean animation, String rotateLabels, boolean staggerLabels, boolean showMaxMin, boolean showLegend, boolean showControls, String topMargin, String bottomMargin, boolean showTitle, String subType String userId = AppUtils.getUserID(request); @@ -375,97 +428,6 @@ public class ChartJSONHelper { chartColumnJSONList.add(ccJSON); } chartJSON.setChartColumnJSONList(chartColumnJSONList); - /* setting formfields show only showForm got triggered*/ - /*ArrayList<IdNameValue> formFieldValues = new ArrayList<IdNameValue>(); - ArrayList<FormFieldJSON> formFieldJSONList = new ArrayList<FormFieldJSON>(); - if(reportRuntime.getReportFormFields()!=null) { - formFieldJSONList = new ArrayList<FormFieldJSON>(reportRuntime.getReportFormFields().size()); - for (Iterator iter = reportRuntime.getReportFormFields().iterator(); iter.hasNext();) { - formFieldValues = new ArrayList<IdNameValue>(); - FormField ff = (FormField) iter.next(); - ff.setDbInfo(reportRuntime.getDbInfo()); - FormFieldJSON ffJSON = new FormFieldJSON(); - ffJSON.setFieldId(ff.getFieldName()); - ffJSON.setFieldType(ff.getFieldType()); - ffJSON.setFieldDisplayName(ff.getFieldDisplayName()); - ffJSON.setHelpText(ff.getHelpText()); - ffJSON.setValidationType(ff.getValidationType()); - //ffJSON.setTriggerOtherFormFields(ff.getDependsOn()); - IdNameList lookup = null; - lookup = ff.getLookupList(); - String selectedValue = ""; - String oldSQL = ""; - IdNameList lookupList = null; - boolean readOnly = false; - if(lookup!=null) { - if(!ff.hasPredefinedList) { - IdNameSql lu = (IdNameSql) lookup; - String SQL = lu.getSql(); - oldSQL = lu.getSql(); - reportRuntime.setTriggerFormFieldCheck( reportRuntime.getReportFormFields(), ff); - ffJSON.setTriggerOtherFormFields(ff.isTriggerOtherFormFields()); - SQL = reportRuntime.parseAndFillReq_Session_UserValues(request, SQL, userId); - SQL = reportRuntime.parseAndFillWithCurrentValues(request, SQL, ff); - String defaultSQL = lu.getDefaultSQL(); - defaultSQL = reportRuntime.parseAndFillReq_Session_UserValues(request, defaultSQL, userId); - defaultSQL = reportRuntime.parseAndFillWithCurrentValues(request, SQL, ff); - lookup = new IdNameSql(-1,SQL,defaultSQL); - - lookupList = lookup; - try { - lookup.loadUserData(0, "", ff.getDbInfo(), ff.getUserId()); - } catch (Exception e ){ e.printStackTrace(); //throw new RaptorRuntimeException(e); - } - } - lookup.trimToSize(); - - String[] requestValue = request.getParameterValues(ff.getFieldName()); - - if(lookup != null && lookup.size() > 0) { - for (lookup.resetNext(); lookup.hasNext();) { - IdNameValue value = lookup.getNext(); - readOnly = value.isReadOnly(); - if(requestValue != null && Arrays.asList(requestValue).contains(value.getId())) { - //if(value.getId().equals(requestValue)) - value.setDefaultValue(true); - } - if(!(ff.getFieldType().equals(FormField.FFT_CHECK_BOX) || ff.getFieldType().equals(FormField.FFT_COMBO_BOX) || ff.getFieldType().equals(FormField.FFT_LIST_BOX) - || ff.getFieldType().equals(FormField.FFT_LIST_MULTI)) && value.isDefaultValue()) - formFieldValues.add(value); - else if(ff.getFieldType().equals(FormField.FFT_CHECK_BOX) || ff.getFieldType().equals(FormField.FFT_COMBO_BOX) || ff.getFieldType().equals(FormField.FFT_LIST_BOX) - || ff.getFieldType().equals(FormField.FFT_LIST_MULTI)) { - formFieldValues.add(value); - } - //break; - } - } else { - if(requestValue!=null && requestValue.length>0) { - IdNameValue value = new IdNameValue(requestValue[0], requestValue[0], true, false); - formFieldValues.add(value); - } - } - - } else { - String[] requestValue = request.getParameterValues(ff.getFieldName()); - if(requestValue!=null && requestValue.length>0) { - IdNameValue value = new IdNameValue(requestValue[0], requestValue[0], true, false); - formFieldValues.add(value); - } - } - if(!ff.hasPredefinedList) { - if(oldSQL != null && !oldSQL.equals("")) { - ((IdNameSql)lookup).setSQL(oldSQL); - } - } - - - - ffJSON.setFormFieldValues(formFieldValues); - formFieldJSONList.add(ffJSON); - } // for - } - chartJSON.setFormFieldList(formFieldJSONList); - chartJSON.setChartSqlWhole(sql);*/ chartJSON.setChartAvailable(displayChart); ChartTypeJSON chartTypeJSON = new ChartTypeJSON(); @@ -687,7 +649,7 @@ public class ChartJSONHelper { } public boolean getFlagInBoolean(String s) { - return nvl(s).toUpperCase().startsWith("Y") || nvl(s).toLowerCase().equals("true"); + return nvl(s).toUpperCase().startsWith("Y") || nvl(s).equalsIgnoreCase("true"); } public DataSet loadChartData(String userId, HttpServletRequest request) throws RaptorException { diff --git a/ecomp-sdk/epsdk-app-common/db-scripts/EcompSdkDMLMySql_2_5_Common.sql b/ecomp-sdk/epsdk-app-common/db-scripts/EcompSdkDMLMySql_2_5_Common.sql index 50221612..c158719b 100644 --- a/ecomp-sdk/epsdk-app-common/db-scripts/EcompSdkDMLMySql_2_5_Common.sql +++ b/ecomp-sdk/epsdk-app-common/db-scripts/EcompSdkDMLMySql_2_5_Common.sql @@ -135,35 +135,66 @@ INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('tab3.htm',' INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('tab4.htm','menu_tab'); INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('raptor.htm','view_reports'); INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('raptor_blob_extract.htm','view_reports'); -INSERT INTO fn_restricted_url VALUES('admin','menu_admin'); -INSERT INTO fn_restricted_url VALUES('get_role','menu_admin'); -INSERT INTO fn_restricted_url VALUES('get_role_functions','menu_admin'); -INSERT INTO fn_restricted_url VALUES('role_list/*','menu_admin'); -INSERT INTO fn_restricted_url VALUES('role_function_list/*','menu_admin'); -INSERT INTO fn_restricted_url VALUES('addRole','menu_admin'); -INSERT INTO fn_restricted_url VALUES('addRoleFunction','menu_admin'); -INSERT INTO fn_restricted_url VALUES('removeRole','menu_admin'); -INSERT INTO fn_restricted_url VALUES('removeRoleFunction','menu_admin'); -INSERT INTO fn_restricted_url VALUES('profile/*','menu_admin'); -INSERT INTO fn_restricted_url VALUES('samplePage','menu_sample'); -INSERT INTO fn_restricted_url VALUES('workflows','menu_admin'); -INSERT INTO fn_restricted_url VALUES('workflows/list','menu_admin'); -INSERT INTO fn_restricted_url VALUES('workflows/addWorkflow','menu_admin'); -INSERT INTO fn_restricted_url VALUES('workflows/saveCronJob','menu_admin'); -INSERT INTO fn_restricted_url VALUES('workflows/editWorkflow','menu_admin'); -INSERT INTO fn_restricted_url VALUES('workflows/removeWorkflow','menu_admin'); -INSERT INTO fn_restricted_url VALUES('workflows/removeAllWorkflows','menu_admin'); -INSERT INTO fn_restricted_url VALUES('role/saveRole.htm','menu_admin'); -INSERT INTO fn_restricted_url VALUES('post_search/process','menu_admin'); -INSERT INTO fn_restricted_url VALUES('post_search/search','menu_admin'); -INSERT INTO fn_restricted_url VALUES('post_search/search','menu_profile'); -INSERT INTO fn_restricted_url VALUES('report/wizard/retrieve_def_tab_wise_data/*','menu_reports'); -INSERT INTO fn_restricted_url VALUES('report/wizard/retrieve_form_tab_wise_data/*','menu_reports'); -INSERT INTO fn_restricted_url VALUES('report/wizard/retrieve_sql_tab_wise_data/*','menu_reports'); -INSERT INTO fn_restricted_url VALUES('report/wizard/security/*','menu_reports'); -INSERT INTO fn_restricted_url VALUES('report/wizard/copy_report/*','menu_reports'); -INSERT INTO fn_restricted_url VALUES('report/wizard/save_def_tab_data/*','menu_reports'); -INSERT INTO fn_restricted_url VALUES('report/wizard/retrieve_data/true','menu_reports'); +INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('admin','menu_admin'); +INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('get_role','menu_admin'); +INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('get_role_functions','menu_admin'); +INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('role_list/*','menu_admin'); +INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('role_function_list/*','menu_admin'); +INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('addRole','menu_admin'); +INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('addRoleFunction','menu_admin'); +INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('removeRole','menu_admin'); +INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('removeRoleFunction','menu_admin'); +INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('profile/*','menu_admin'); +INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('samplePage','menu_sample'); +INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('workflows','menu_admin'); +INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('workflows/list','menu_admin'); +INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('workflows/addWorkflow','menu_admin'); +INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('workflows/saveCronJob','menu_admin'); +INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('workflows/editWorkflow','menu_admin'); +INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('workflows/removeWorkflow','menu_admin'); +INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('workflows/removeAllWorkflows','menu_admin'); +INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('role/saveRole.htm','menu_admin'); +INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('post_search/process','menu_admin'); +INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('post_search/search','menu_admin'); +INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('post_search/search','menu_profile'); +INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('report/wizard/retrieve_def_tab_wise_data/*','menu_reports'); +INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('report/wizard/retrieve_form_tab_wise_data/*','menu_reports'); +INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('report/wizard/retrieve_sql_tab_wise_data/*','menu_reports'); +INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('report/wizard/security/*','menu_reports'); +INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('report/wizard/copy_report/*','menu_reports'); +INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('report/wizard/save_def_tab_data/*','menu_reports'); +INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('report/wizard/retrieve_data/true','menu_reports'); + +-- new for Dublin +INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('novamap_controller.htm','menu_map'); +INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('/report*','menu_reports'); +INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('/report/*','menu_reports'); +INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('/report/wizard/*','menu_reports'); +INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('/report/wizard/retrieve_col_tab_wise_data/*','menu_reports'); +INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('/report/wizard/retrieve_sql_tab_wise_data/*','menu_reports'); +INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('report/security/*','menu_reports'); +INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('report/security/addReportRole','menu_reports'); +INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('report/security/addReportUser','menu_reports'); +INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('report/wizard/*','menu_reports'); +INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('report/wizard/drill_down_param/*','menu_reports'); +INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('report/wizard/get_report_log/*','menu_reports'); +INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('report/wizard/getDrillDownReportList','menu_reports'); +INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('report/wizard/list_child_report_col/*','menu_reports'); +INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('report/wizard/list_child_report_ff/*','menu_reports'); +INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('report/wizard/list_columns','menu_reports'); +INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('report/wizard/list_formfields','menu_reports'); +INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('report/wizard/retrieve_col_tab_wise_data/*','menu_reports'); +INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('report/wizard/retrieve_data/*','menu_reports'); +INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('report/wizard/retrieve_form_tab_wise_data/*/*','menu_reports'); +INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('report/wizard/retrieveTotalForTheColList','menu_reports'); +INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('report_blob_extract.htm','menu_reports'); +INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('report_email_attachment.htm','menu_reports'); +INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('report_search.htm','menu_reports'); +INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('report2.htm','menu_reports'); +INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('sample_heat_map.htm','menu_tab'); +INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('sample_heat_map_no_header.htm','menu_tab'); +INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('serviceModels','menu_admin'); +INSERT INTO fn_restricted_url (restricted_url, function_cd) VALUES ('welcome','menu_reports'); -- fn_role Insert into fn_role (ROLE_ID,ROLE_NAME,ACTIVE_YN,PRIORITY) values (16,'Standard User','Y',5); @@ -2878,4 +2909,4 @@ INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2016- INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2016-03-07','%Y-%m-%d'),61.86667); INSERT INTO demo_util_chart (TRAFFIC_DATE,UTIL_PERC ) VALUES (str_to_date('2016-03-08','%Y-%m-%d'),62.00000); -commit;
\ No newline at end of file +commit; diff --git a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/RoleFunctionListController.java b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/RoleFunctionListController.java index 699e83ca..4ac5f37a 100644 --- a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/RoleFunctionListController.java +++ b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/core/RoleFunctionListController.java @@ -67,6 +67,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; public class RoleFunctionListController extends RestrictedBaseController { private static final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(RoleFunctionListController.class); + private static final String SUCCESS = "SUCCESS"; @Autowired private RoleService service; @@ -117,7 +118,7 @@ public class RoleFunctionListController extends RestrictedBaseController { RoleFunction domainRoleFunction = service.getRoleFunction(user.getOrgUserId(), code); domainRoleFunction.setName(availableRoleFunction.getName()); domainRoleFunction.setCode(code); - restCallStatus = "success"; + restCallStatus = SUCCESS; service.saveRoleFunction(user.getOrgUserId(), domainRoleFunction); } catch (Exception e) { logger.error(EELFLoggerDelegate.errorLogger, "saveRoleFunction failed", e); @@ -141,7 +142,7 @@ public class RoleFunctionListController extends RestrictedBaseController { RoleFunction availableRoleFunction = mapper.readValue(data, RoleFunction.class); String code = availableRoleFunction.getCode(); List<RoleFunction> currentRoleFunction = service.getRoleFunctions(user.getOrgUserId()); - restCallStatus = "success"; + restCallStatus = SUCCESS; for (RoleFunction roleF : currentRoleFunction) { if (roleF.getCode().equals(code)) { restCallStatus = "code exists"; @@ -177,7 +178,7 @@ public class RoleFunctionListController extends RestrictedBaseController { service.deleteRoleFunction(user.getOrgUserId(), domainRoleFunction); logger.info(EELFLoggerDelegate.auditLogger, "Remove role function " + domainRoleFunction.getName()); - restCallStatus = "success"; + restCallStatus = SUCCESS; } catch (Exception e) { logger.error(EELFLoggerDelegate.errorLogger, "removeRoleFunction failed", e); throw new IOException(e); diff --git a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/CollaborationController.java b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/CollaborationController.java index 93a6f74f..18cd6a6a 100644 --- a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/CollaborationController.java +++ b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/CollaborationController.java @@ -56,7 +56,7 @@ public class CollaborationController extends RestrictedBaseController{ @RequestMapping(value = {"/collaboration" }, method = RequestMethod.GET) public ModelAndView view(HttpServletRequest request) { - Map<String, Object> model = new HashMap<String, Object>(); + Map<String, Object> model = new HashMap<>(); User user = UserUtils.getUserSession(request); model.put("name",(user.getFirstName() + " " + (user.getLastName() != null? user.getLastName().substring(0,1): "" ))); @@ -64,7 +64,7 @@ public class CollaborationController extends RestrictedBaseController{ } @RequestMapping(value = {"/openCollaboration" }, method = RequestMethod.GET) public ModelAndView openCollaboration(HttpServletRequest request) { - Map<String, Object> model = new HashMap<String, Object>(); + Map<String, Object> model = new HashMap<>(); User user = UserUtils.getUserSession(request); model.put("name",(user.getFirstName() + " " + (user.getLastName() != null? user.getLastName().substring(0,1): "" ))); diff --git a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/NetMapController.java b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/NetMapController.java index 38ae6ee8..f3f739f4 100644 --- a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/NetMapController.java +++ b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/NetMapController.java @@ -58,7 +58,7 @@ public class NetMapController extends RestrictedBaseController { @RequestMapping(value = { "/net_map" }, method = RequestMethod.GET) public ModelAndView plot(HttpServletRequest request) { - Map<String, Object> model = new HashMap<String, Object>(); + Map<String, Object> model = new HashMap<>(); model.put("frame_int", "net_map_int"); // This view resolves to page frame_insert.jsp return new ModelAndView("frame_insert", model); diff --git a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/PostDroolsController.java b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/PostDroolsController.java index 43d548f9..cf7fa06a 100644 --- a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/PostDroolsController.java +++ b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/PostDroolsController.java @@ -109,7 +109,7 @@ public class PostDroolsController extends RestrictedBaseController { } @RequestMapping(value = { "/post_drools/execute" }, method = RequestMethod.POST) - public ModelAndView search(HttpServletRequest request, HttpServletResponse response) throws Exception { + public ModelAndView search(HttpServletRequest request, HttpServletResponse response) { try { ObjectMapper mapper = new ObjectMapper(); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); diff --git a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/SamplePageController.java b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/SamplePageController.java index 26a4e444..5adaf66e 100644 --- a/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/SamplePageController.java +++ b/ecomp-sdk/epsdk-app-common/src/main/java/org/onap/portalapp/controller/sample/SamplePageController.java @@ -58,10 +58,8 @@ public class SamplePageController extends RestrictedBaseController { @RequestMapping(value = { "/samplePage" }, method = RequestMethod.GET) public ModelAndView plot(HttpServletRequest request) { - Map<String, Object> model = new HashMap<String, Object>(); - /*model.put("frame_int", "net_map_int"); - // This view resolves to page frame_insert.jsp - return new ModelAndView("frame_insert", model);*/ + Map<String, Object> model = new HashMap<>(); + return new ModelAndView("samplePage", "model", model); } diff --git a/ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/util/MusicProperties.java b/ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/util/MusicProperties.java index 9aae9770..3a03b386 100644 --- a/ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/util/MusicProperties.java +++ b/ecomp-sdk/epsdk-music/src/main/java/org/onap/portalapp/music/util/MusicProperties.java @@ -121,8 +121,6 @@ public class MusicProperties { public static final String EXPIRY_TIME = "EXPIRY_TIME"; public static final String PRINCIPAL_NAME = "PRINCIPAL_NAME"; - - private MusicProperties(){} private static Properties properties; @@ -132,6 +130,7 @@ public class MusicProperties { private static final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(MusicProperties.class); + private MusicProperties(){} /** * Gets the property value for the specified key. If a value is found, leading * and trailing space is trimmed. @@ -185,40 +184,5 @@ public class MusicProperties { } return true; } - - /** - * Tests whether a property value is available for the specified key. - * - * @param key - * Property key - * @return True if the key is known, otherwise false. - */ -/* public static boolean containsProperty(String key) { - return environment.containsProperty(key); - }*/ - - /** - * Returns the property value associated with the given key (never - * {@code null}), after trimming any trailing space. - * - * @param key - * Property key - * @return Property value; the empty string if the environment was not - * autowired, which should never happen. - * @throws IllegalStateException - * if the key is not found - */ -/* public static String getProperty(String key) { - String value = ""; - if (environment == null) { - // logger.error(EELFLoggerDelegate.errorLogger, "getProperty: environment is null, should never happen!"); - } else { - value = environment.getRequiredProperty(key); - // java.util.Properties preserves trailing space - if (value != null) - value = value.trim(); - } - return value; - }*/ } |