diff options
Diffstat (limited to 'ecomp-sdk/epsdk-analytics')
7 files changed, 42 insertions, 64 deletions
diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/controller/ActionHandler.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/controller/ActionHandler.java index f76d58df..3eca7c68 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/controller/ActionHandler.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/controller/ActionHandler.java @@ -147,7 +147,7 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject { private static final String REPORT_DOWNLOAD = "report.download"; private static final String REPORT_DOWNLOAD_PAGE = ";report.download.page"; private static final String FALSE = "false"; - + private static final String COLNAME = "[colName]"; private void preserveReportRuntimeAsBackup(HttpServletRequest request) { HttpSession session = request.getSession(); ArrayList repAl = null; @@ -1315,8 +1315,7 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject { FormField ff = rr.getFormField(request.getParameter(AppConstants.RI_FIELD_NAME)); ReportFormFields rff = rr.getReportFormFields(); - - int idx = 0; + FormField ff1 = null; Map fieldNameMap = new HashMap(); int countOfFields = 0 ; @@ -1325,27 +1324,27 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject { String oldSQL = lookup.getOldSql(); if(AppUtils.getRequestFlag(request, AppConstants.RI_TEXTFIELD_POP)) { - for(rff.resetNext(); rff.hasNext(); idx++) { + for(rff.resetNext(); rff.hasNext(); ) { ff1 = rff.getNext(); fieldNameMap.put(ff1.getFieldName(), ff1.getFieldDisplayName()); countOfFields++; } - - - //List formParameter = new ArrayList(); + String formField = ""; HashMap valuesMap = new HashMap(); for(int i = 0 ; i < rff.size(); i++) { - formField = ((FormField)rff.getFormField(i)).getFieldName(); + formField = (rff.getFormField(i)).getFieldName(); if(request.getParameterValues(formField) != null && request.getParameterValues(formField).length > 1 ) { - String[] vals = (String[]) request.getParameterValues(formField); + String[] vals = request.getParameterValues(formField); String value = ""; - StringBuffer valueBuf = new StringBuffer(); + StringBuilder valueBuf = new StringBuilder(); for(int ii = 0 ; ii < vals.length; ii++) { - if(ii == 0) valueBuf.append("("); + if(ii == 0) + valueBuf.append("("); valueBuf.append(vals[ii]); - if(ii == vals.length-1) valueBuf.append(")"); - else valueBuf.append(","); + if(ii == vals.length-1) + valueBuf.append(")"); + else valueBuf.append(","); } value = valueBuf.toString(); valuesMap.put(fieldNameMap.get(formField), value); @@ -1359,16 +1358,18 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject { oldSQL = SQL; Set set = valuesMap.entrySet(); String value = ""; - StringBuffer valueBuf = new StringBuffer(); + StringBuilder valueBuf = new StringBuilder(); for(Iterator iter = set.iterator(); iter.hasNext(); ) { Map.Entry entry = (Entry) iter.next(); if(entry.getValue() instanceof String[]) { String[] vals = (String[]) entry.getValue(); for(int i = 0 ; i < vals.length; i++) { - if(i == 0) valueBuf.append("("); + if(i == 0) + valueBuf.append("("); valueBuf.append(vals[i]); - if(i == vals.length-1) valueBuf.append(")"); - else valueBuf.append(","); + if(i == vals.length-1) + valueBuf.append(")"); + else valueBuf.append(","); } value = valueBuf.toString(); } else { @@ -1427,27 +1428,19 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject { if (Utils.isNull(dbInfo)) { dbInfo = (String) request.getSession().getAttribute("remoteDB"); } - /*String query = "SELECT x FROM (SELECT DISTINCT " - + (colType.equals(AppConstants.CT_DATE) ? ("TO_CHAR(" + colName + ", '" - + nvl(displayFormat, AppConstants.DEFAULT_DATE_FORMAT) + "')") - : colName) + " x FROM " - + rdef.getTableById(tableId).getTableName() + " WHERE " + colName - + " IS NOT NULL ORDER BY 1) xx WHERE ROWNUM <= " - + Globals.getDefaultPageSize();*/ - String q1 = Globals.getReportValuesMapDefA(); String q2 = Globals.getReportValuesMapDefB(); - q2 = q2.replace("[colName]", colName); + q2 = q2.replace(COLNAME, colName); q2 = q2.replace("[nvl(displayFormat, AppConstants.DEFAULT_DATE_FORMAT)]", nvl(displayFormat, AppConstants.DEFAULT_DATE_FORMAT)); String q3 = Globals.getReportValuesMapDefC(); - q3 = q3.replace("[colName]", colName); + q3 = q3.replace(COLNAME, colName); String q4 = Globals.getReportValuesMapDefD(); q4 = q4.replace("[rdef.getTableById(tableId).getTableName()]", rdef.getTableById(tableId).getTableName()); - q4 = q4.replace("[colName]", colName); + q4 = q4.replace(COLNAME, colName); q4 = q4.replace("[Globals.getDefaultPageSize()]", String.valueOf(Globals.getDefaultPageSize())); String query = q1 + (colType.equals(AppConstants.CT_DATE) ? q2 : q3) + q4; @@ -1463,8 +1456,6 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject { public String reportDrillDownToReportDefPopup(HttpServletRequest request, String nextPage) { try { - // ReportDefinition rdef = (ReportDefinition) - // request.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION); String ddReportID = AppUtils .getRequestNvlValue(request, AppConstants.RI_REPORT_ID); ReportRuntime ddRr = (new ReportHandler()).loadReportRuntime(request, ddReportID, diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/controller/WizardProcessor.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/controller/WizardProcessor.java index bd8d778e..8605f208 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/controller/WizardProcessor.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/controller/WizardProcessor.java @@ -109,6 +109,9 @@ import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; public class WizardProcessor extends org.onap.portalsdk.analytics.RaptorObject { private static final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(WizardProcessor.class); + public WizardProcessor() { + } + public static Calendar getCalendar(XMLGregorianCalendar xmlCalendar){ TimeZone timeZone = xmlCalendar.getTimeZone(xmlCalendar.getTimezone()); Calendar calendar = Calendar.getInstance(timeZone); @@ -121,9 +124,6 @@ public class WizardProcessor extends org.onap.portalsdk.analytics.RaptorObject { return calendar; } - public WizardProcessor() { - } - private String adjustDataType(String oracleDataType) { return "VARCHAR2".equals(oracleDataType) ? AppConstants.CT_CHAR : oracleDataType; // Probably should be expanded to convert any CHAR or VARCHAR type to @@ -428,8 +428,6 @@ public class WizardProcessor extends org.onap.portalsdk.analytics.RaptorObject { try { ds = DbUtils.executeQuery(schemaSql); - String prefix = "", desc = ""; - for (int i = 0; i < ds.getRowCount(); i++) { dbType = ds.getItem(i, 2); } @@ -448,7 +446,7 @@ public class WizardProcessor extends org.onap.portalsdk.analytics.RaptorObject { for (int i = 0; i < menuIDs.length; i++) menuID += (menuID.length() == 0 ? "" : "|") + menuIDs[i]; - boolean rRCSDisabled = AppUtils.getRequestNvlValue(request, "runtimeColSortDisabled").equals("Y"); + boolean rRCSDisabled = "Y".equals(AppUtils.getRequestNvlValue(request, "runtimeColSortDisabled")); String reportDefType = AppUtils.getRequestNvlValue(request, "reportDefType"); String dataContainerHeight = nvl(AppUtils.getRequestValue(request, "heightContainer"), "auto"); String dataContainerWidth = nvl(AppUtils.getRequestValue(request, "widthContainer"), "auto"); @@ -489,7 +487,7 @@ public class WizardProcessor extends org.onap.portalsdk.analytics.RaptorObject { rdef.setTopDown(isTopDown?"Y":"N"); rdef.setSizedByContent(isSizedByContent?"Y":"N"); rdef.setMenuID(menuID); - rdef.setMenuApproved(rApproved.equals("Y")); + rdef.setMenuApproved("Y".equals(rApproved)); if (reportDefType.length() > 0) rdef.setReportDefType(reportDefType); @@ -511,20 +509,18 @@ public class WizardProcessor extends org.onap.portalsdk.analytics.RaptorObject { } // if - if (rdef.getWizardSequence() instanceof WizardSequence) - rdef.generateWizardSequence(request); - + rdef.generateWizardSequence(request); reportUpdated = true; - if (rdef.getReportID().equals("-1")) + if ("-1".equals(rdef.getReportID())) // Always need to persist new report - in case it is a copy reportUpdated = true; return reportUpdated; } // processDefinition - private boolean processTableAdd(HttpServletRequest request) throws Exception { + private boolean processTableAdd(HttpServletRequest request) throws RaptorException { ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute( AppConstants.SI_REPORT_DEFINITION); diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/controller/WizardSequenceLinear.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/controller/WizardSequenceLinear.java index 387cdef3..73f84f78 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/controller/WizardSequenceLinear.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/controller/WizardSequenceLinear.java @@ -50,13 +50,11 @@ public class WizardSequenceLinear extends WizardSequence { add(AppConstants.WS_FORM_FIELDS); add(AppConstants.WS_FILTERS); add(AppConstants.WS_SORTING); - //add(AppConstants.WS_JAVASCRIPT); - //add(AppConstants.WS_CHART); add(AppConstants.WS_USER_ACCESS); - //add(AppConstants.WS_SCHEDULE); - if (userIsAuthorizedToSeeLog) - if (Globals.getEnableReportLog()) + + if (userIsAuthorizedToSeeLog && Globals.getEnableReportLog()) add(AppConstants.WS_REPORT_LOG); + add(AppConstants.WS_RUN); } // WizardSequenceLinear diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/controller/WizardSequenceSQLBasedCrossTab.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/controller/WizardSequenceSQLBasedCrossTab.java index 76f14c8a..3ee861e0 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/controller/WizardSequenceSQLBasedCrossTab.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/controller/WizardSequenceSQLBasedCrossTab.java @@ -50,9 +50,8 @@ public class WizardSequenceSQLBasedCrossTab extends WizardSequence { add(AppConstants.WS_FORM_FIELDS); add(AppConstants.WS_JAVASCRIPT); add(AppConstants.WS_USER_ACCESS); - //add(AppConstants.WS_SCHEDULE); - if (userIsAuthorizedToSeeLog) - if (Globals.getEnableReportLog()) + + if (userIsAuthorizedToSeeLog && Globals.getEnableReportLog()) add(AppConstants.WS_REPORT_LOG); add(AppConstants.WS_RUN); } // WizardSequenceSQLBasedCrossTab diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/controller/WizardSequenceSQLBasedHive.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/controller/WizardSequenceSQLBasedHive.java index 1e3943f9..ff605287 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/controller/WizardSequenceSQLBasedHive.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/controller/WizardSequenceSQLBasedHive.java @@ -51,10 +51,8 @@ public class WizardSequenceSQLBasedHive extends WizardSequence { add(AppConstants.WS_JAVASCRIPT); add(AppConstants.WS_CHART); add(AppConstants.WS_USER_ACCESS); - //add(AppConstants.WS_MAP); - //add(AppConstants.WS_SCHEDULE); - if (userIsAuthorizedToSeeLog) - if (Globals.getEnableReportLog()) + + if (userIsAuthorizedToSeeLog && Globals.getEnableReportLog()) add(AppConstants.WS_REPORT_LOG); add(AppConstants.WS_RUN); } // WizardSequenceSQLBasedHive diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/controller/WizardSequenceSQLBasedLinear.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/controller/WizardSequenceSQLBasedLinear.java index c6cb0b1c..349f4466 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/controller/WizardSequenceSQLBasedLinear.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/controller/WizardSequenceSQLBasedLinear.java @@ -48,15 +48,11 @@ public class WizardSequenceSQLBasedLinear extends WizardSequence { add(AppConstants.WS_SQL); add(AppConstants.WS_COLUMNS); add(AppConstants.WS_FORM_FIELDS); - //add(AppConstants.WS_JAVASCRIPT); - //if(!Globals.showAnimatedChartOnly()) - //add(AppConstants.WS_CHART); add(AppConstants.WS_USER_ACCESS); - //add(AppConstants.WS_MAP); - //add(AppConstants.WS_SCHEDULE); - if (userIsAuthorizedToSeeLog) - if (Globals.getEnableReportLog()) + + if (userIsAuthorizedToSeeLog && Globals.getEnableReportLog()) add(AppConstants.WS_REPORT_LOG); + add(AppConstants.WS_RUN); } // WizardSequenceSQLBasedLinear diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/controller/WizardSequenceSQLBasedLinearDatamining.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/controller/WizardSequenceSQLBasedLinearDatamining.java index e2001505..3a303c9a 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/controller/WizardSequenceSQLBasedLinearDatamining.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/controller/WizardSequenceSQLBasedLinearDatamining.java @@ -52,10 +52,10 @@ public class WizardSequenceSQLBasedLinearDatamining extends WizardSequence { add(AppConstants.WS_JAVASCRIPT); add(AppConstants.WS_CHART); add(AppConstants.WS_USER_ACCESS); - //add(AppConstants.WS_SCHEDULE); - if (userIsAuthorizedToSeeLog) - if (Globals.getEnableReportLog()) + + if (userIsAuthorizedToSeeLog && Globals.getEnableReportLog()) add(AppConstants.WS_REPORT_LOG); + add(AppConstants.WS_RUN); } // WizardSequenceSQLBasedLinear |