diff options
14 files changed, 55 insertions, 84 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 diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/error/ReportSQLException.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/error/ReportSQLException.java index 48fcaa72..4aeb667c 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/error/ReportSQLException.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/error/ReportSQLException.java @@ -38,7 +38,7 @@ package org.onap.portalsdk.analytics.error; public class ReportSQLException extends RaptorException { - private String reportSQL = null; + private final String reportSQL; public ReportSQLException(String message, String reportSQL) { super(message); diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/error/ValidationException.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/error/ValidationException.java index a435bdf8..9eeca6ab 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/error/ValidationException.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/error/ValidationException.java @@ -38,14 +38,16 @@ package org.onap.portalsdk.analytics.error; public class ValidationException extends RaptorRuntimeException { - private String fieldID = null; + private final String fieldID; public ValidationException(String message) { super(message); + fieldID = null; } public ValidationException(String message, Throwable ex) { super(message, ex); + fieldID = null; } public ValidationException(String fieldID, String message) { diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/gmap/line/Line.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/gmap/line/Line.java index 6e17ed3d..f3b0cd85 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/gmap/line/Line.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/gmap/line/Line.java @@ -47,20 +47,14 @@ import org.onap.portalsdk.analytics.gmap.map.NovaMap; public class Line { private NovaMap map; private LineCollection lineCollection; - private ArrayList<String> selectionList; - private Set<String> lineIDSet; public Line(NovaMap map) { this.map = map; lineCollection = new LineCollection(); - lineIDSet = new HashSet<String>(); - selectionList = new ArrayList<String>(); } public ArrayList<LineInfo> lineExist(Point2D screenPoint) { ArrayList<LineInfo> existLineInfo = null; - String selectedLine = null; - String selectedType = null; int nearest = -1; int nodeSize = map.getShapeWidth(); nodeSize = nodeSize > 20 ? 20 : nodeSize; @@ -82,17 +76,13 @@ public class Line { diff < (Math.abs(y1 - y2) + Math.abs(x1 - x2)) * (int) (nodeSize * .2)) { if (nearest == -1) { nearest = diff; - selectedLine = lineInfo.getLineID(); - selectedType = lineInfo.getLineType(); } else if (diff <= nearest) { nearest = diff; - selectedLine = lineInfo.getLineID(); - selectedType = lineInfo.getLineType(); } if (existLineInfo == null) { - existLineInfo = new ArrayList<LineInfo>(); + existLineInfo = new ArrayList<>(); } existLineInfo.add(lineInfo); diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/SearchHandler.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/SearchHandler.java index 8b4fc340..22108350 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/SearchHandler.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/SearchHandler.java @@ -84,8 +84,6 @@ import org.onap.portalsdk.analytics.system.Globals; import org.onap.portalsdk.analytics.util.AppConstants; import org.onap.portalsdk.analytics.util.DataSet; import org.onap.portalsdk.analytics.util.HtmlStripper; -import org.onap.portalsdk.core.util.SecurityCodecUtil; -import org.owasp.esapi.ESAPI; public class SearchHandler extends org.onap.portalsdk.analytics.RaptorObject { private static final String HTML_FORM = "forma"; diff --git a/ecomp-sdk/epsdk-app-os/src/main/java/org/onap/portalapp/filter/SecurityXssFilter.java b/ecomp-sdk/epsdk-app-os/src/main/java/org/onap/portalapp/filter/SecurityXssFilter.java index 4bc8b436..91025d14 100644 --- a/ecomp-sdk/epsdk-app-os/src/main/java/org/onap/portalapp/filter/SecurityXssFilter.java +++ b/ecomp-sdk/epsdk-app-os/src/main/java/org/onap/portalapp/filter/SecurityXssFilter.java @@ -170,7 +170,8 @@ public class SecurityXssFilter extends OncePerRequestFilter { } private boolean validateRequestType(HttpServletRequest request) { - return (request.getMethod().equalsIgnoreCase("POST") || request.getMethod().equalsIgnoreCase("PUT") - || request.getMethod().equalsIgnoreCase("DELETE")); + return ("POST".equalsIgnoreCase(request.getMethod() ) || + "PUT".equalsIgnoreCase( request.getMethod() ) || + "DELETE".equalsIgnoreCase( request.getMethod() ) ); } }
\ No newline at end of file diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/onboarding/ueb/Helper.java b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/onboarding/ueb/Helper.java index 581edee8..ee7a7d7d 100644 --- a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/onboarding/ueb/Helper.java +++ b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/onboarding/ueb/Helper.java @@ -62,7 +62,7 @@ public class Helper { String url = PortalApiProperties.getProperty(PortalApiConstants.UEB_URL_LIST); if (url == null) { logger.error("uebUrlList: failed to get property " + PortalApiConstants.UEB_URL_LIST); - return new LinkedList<String>(); + return new LinkedList<>(); } LinkedList<String> urlList = new LinkedList<>(); for (String u : url.split(",")) { @@ -76,6 +76,7 @@ public class Helper { Thread.sleep(milliseconds); } catch (InterruptedException e) { logger.warn("sleep was interrupted", e); + Thread.currentThread().interrupt(); } } diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/LoginExternalAuthServiceImpl.java b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/LoginExternalAuthServiceImpl.java index c31ef75e..d0450966 100644 --- a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/LoginExternalAuthServiceImpl.java +++ b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/LoginExternalAuthServiceImpl.java @@ -126,8 +126,9 @@ public class LoginExternalAuthServiceImpl implements LoginExternalAuthService { if (appuser == null && userHasRoleFunctions(user)) { createUserIfNecessary(user); } else { - appuser.setLastLoginDate(new Date()); - + if (appuser != null) { + appuser.setLastLoginDate(new Date()); + } // update the last logged in date for the user dataAccessService.saveDomainObject(appuser, additionalParams); } |