diff options
Diffstat (limited to 'ecomp-sdk/epsdk-analytics/src/main/java/org/onap')
7 files changed, 56 insertions, 31 deletions
diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/pdf/PdfReportHandler.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/pdf/PdfReportHandler.java index b42bdf9c..d77e6bc7 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/pdf/PdfReportHandler.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/pdf/PdfReportHandler.java @@ -1,7 +1,7 @@ /* * ============LICENSE_START========================================== * ONAP Portal SDK - * =================================================================== + * =================================================================== * Copyright © 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * @@ -10,7 +10,7 @@ * you may not use this software except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -124,7 +124,7 @@ import org.onap.portalsdk.analytics.view.ReportData; import org.onap.portalsdk.analytics.view.RowHeader; import org.onap.portalsdk.analytics.view.RowHeaderCol; import org.onap.portalsdk.analytics.xmlobj.DataColumnType; -import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; /** * @author mwliu and sundar @@ -161,7 +161,8 @@ public class PdfReportHandler extends org.onap.portalsdk.analytics.RaptorObject{ int returnValue = 0; ReportRuntime rr = null; - if(rr==null) rr = (ReportRuntime) request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME); + if(rr==null) + rr = (ReportRuntime) request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME); boolean isDashboard = false; if ((request.getSession().getAttribute(AppConstants.SI_DASHBOARD_REP_ID)!=null) && ( ((String) request.getSession().getAttribute(AppConstants.SI_DASHBOARD_REP_ID)).equals(rr.getReportID())) ) { @@ -247,17 +248,21 @@ public class PdfReportHandler extends org.onap.portalsdk.analytics.RaptorObject{ //ReportRuntime rr = (ReportRuntime) request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME); //ReportData rd = (ReportData) request.getSession().getAttribute(AppConstants.RI_REPORT_DATA); rr = null; - ReportData rd = null; + ReportData rd = null; String parent = ""; int parentFlag = 0; - if(!nvl(request.getParameter("parent"), "").equals("N")) parent = nvl(request.getParameter("parent"), ""); - if(parent.startsWith("parent_")) parentFlag = 1; + if(!nvl(request.getParameter("parent"), "").equals("N")) + parent = nvl(request.getParameter("parent"), ""); + if(parent.startsWith("parent_")) + parentFlag = 1; if(parentFlag == 1) { rr = (ReportRuntime) request.getSession().getAttribute(parent+"_rr"); rd = (ReportData) request.getSession().getAttribute(parent+"_rd"); } - if(rr==null) rr = (ReportRuntime) request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME); - if(rd==null) rd = (ReportData) request.getSession().getAttribute(AppConstants.RI_REPORT_DATA); + if(rr==null) + rr = (ReportRuntime) request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME); + if(rd==null) + rd = (ReportData) request.getSession().getAttribute(AppConstants.RI_REPORT_DATA); pb = preparePdfBean(request,rr); FONT_FAMILY = rr.getPDFFont(); @@ -738,9 +743,11 @@ public class PdfReportHandler extends org.onap.portalsdk.analytics.RaptorObject{ //System.out.println("chartGroupOrg " + chartGroupOrg); if(nvl(chartGroupOrg).length()>0) tempChartGroupCurrent = chartGroupOrg.substring(0,chartGroupOrg.lastIndexOf("|")); - if(i>0) tempChartGroupPrev = ((String) lGroups.get(i-1)).substring(0,((String) lGroups.get(i-1)).lastIndexOf("|")); + if(i>0) + tempChartGroupPrev = ((String) lGroups.get(i-1)).substring(0,((String) lGroups.get(i-1)).lastIndexOf("|")); //System.out.println("TEMPCHARTGROUP " + tempChartGroupCurrent + " " + tempChartGroupPrev); - if(tempChartGroupCurrent.equals(tempChartGroupPrev)) continue; + if(tempChartGroupCurrent.equals(tempChartGroupPrev)) + continue; //System.out.println("CHARTGROUPORG " + chartGroupOrg + " " + lGroups) ; //String chartGroup = chartGroupOrg.substring(0,chartGroupOrg.lastIndexOf("|")); String chartGroup = chartGroupOrg; @@ -1422,7 +1429,8 @@ public class PdfReportHandler extends org.onap.portalsdk.analytics.RaptorObject{ DataRow dr = rd.reportDataRows.getNext(); for(dr.resetNext();dr.hasNext();) { DataValue dv = dr.getNext(); - if(!dv.isVisible()) totalVisbleColumn--; + if(!dv.isVisible()) + totalVisbleColumn--; } break; diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ReportParamValues.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ReportParamValues.java index 2d46326b..2cff3e63 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ReportParamValues.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ReportParamValues.java @@ -132,7 +132,8 @@ public class ReportParamValues extends Hashtable { long currentTime = System.currentTimeMillis(); //System.out.println("ReportParamValues setParamValues called " + refresh); boolean paramUpdated = false; - if(refresh) clearValues(); + if(refresh) + clearValues(); for (Enumeration enKeys = keys(); enKeys.hasMoreElements();) { String key = (String) enKeys.nextElement(); String oldValue = XSSFilter.filterRequestOnlyScript(getParamValue(key)); diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ReportParamValuesForPDFExcel.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ReportParamValuesForPDFExcel.java index 98718686..483e9fe4 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ReportParamValuesForPDFExcel.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ReportParamValuesForPDFExcel.java @@ -111,7 +111,8 @@ public class ReportParamValuesForPDFExcel extends Hashtable { //debugLogger.debug("ReportParamValues for PDF Excel setParamValues called " + refresh); long currentTime = System.currentTimeMillis(); boolean paramUpdated = false; - if(refresh) clearValues(); + if(refresh) + clearValues(); String name = null; String value = null; String value1 = ""; @@ -193,7 +194,8 @@ public class ReportParamValuesForPDFExcel extends Hashtable { } if(sql!=null && sql.trim().length()>0){ name = ""; - if(name.length()<=0) name = ff.getFieldName(); + if(name.length()<=0) + name = ff.getFieldName(); value = rr.getParamValue(name); //debugLogger.debug("Name "+ name+ " value:" + value); String paramValue = ESAPI.encoder().encodeForSQL( SecurityCodecUtil.getCodec(), getParamValueForSQL(name, value)); @@ -280,7 +282,8 @@ public class ReportParamValuesForPDFExcel extends Hashtable { put(ff.getFieldName(), nvl(value1)); } else { - if(ds!=null && ds.getRowCount()>0) put(ff.getFieldName(), nvl(ds.getString(0,1))); + if(ds!=null && ds.getRowCount()>0) + put(ff.getFieldName(), nvl(ds.getString(0,1))); else put(ff.getFieldName(), nvl(value)); } } @@ -315,7 +318,8 @@ public class ReportParamValuesForPDFExcel extends Hashtable { //debugLogger.debug("77777777777777 " + value1); } else value1 = nvl(rr.getParamValue(ff.getFieldName())); - if(value1.length()<=0) value1 = nvl(ff.getDefaultValue()); + if(value1.length()<=0) + value1 = nvl(ff.getDefaultValue()); put(ff.getFieldName(), nvl(value1)); } @@ -431,7 +435,8 @@ public class ReportParamValuesForPDFExcel extends Hashtable { }catch(NumberFormatException ex){ numInt = 0; } - if(numInt < 10) return "0"+numInt; + if(numInt < 10) + return "0"+numInt; else return ""+numInt; } diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/scheduler/SendEmail.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/scheduler/SendEmail.java index f698e556..144c6ea8 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/scheduler/SendEmail.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/scheduler/SendEmail.java @@ -39,7 +39,6 @@ package org.onap.portalsdk.analytics.scheduler; import java.io.File; import java.io.FileInputStream; -import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/AppUtils.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/AppUtils.java index 547937f2..972cf721 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/AppUtils.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/AppUtils.java @@ -165,7 +165,8 @@ public class AppUtils /* implements IAppUtils */{ // This is changed to check for Admin User as admin user also need super user privilege if explicitly specified in properties file. public static boolean isSuperUser(HttpServletRequest request)throws RaptorException { - if(Globals.isAdminRoleEquivalenttoSuperRole()) return isAdminUser(request); + if(Globals.isAdminRoleEquivalenttoSuperRole()) + return isAdminUser(request); else return isUserInRole(request, getSuperRoleID()); } // isSuperUser diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/Globals.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/Globals.java index 6718e427..6f55037b 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/Globals.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/Globals.java @@ -1140,7 +1140,8 @@ return sheetName; StringTokenizer st = new StringTokenizer(vals, "|"); if(st.countTokens()>0) { while(st.hasMoreTokens()) { - if(isMultiValue) value.append("'"); + if(isMultiValue) + value.append("'"); String token = st.nextToken(); try { if(token !=null && token.length() > 0) @@ -1149,7 +1150,8 @@ return sheetName; catch (IllegalArgumentException ex1){} catch (Exception ex2){} value.append(token); - if(isMultiValue) value.append("'"); + if(isMultiValue) + value.append("'"); if(st.hasMoreTokens()) { value.append(","); } @@ -1163,7 +1165,8 @@ return sheetName; valuesMap.put(fieldNameMap.get(formField), valueStr); valueStr = ""; } - if(isMultiValue) value.append(")"); + if(isMultiValue) + value.append(")"); valuesMap.put(fieldNameMap.get(formField), value.toString()); if(ff.getValidationType().equals(FormField.VT_TIMESTAMP_HR) || ff.getValidationType().equals(FormField.VT_TIMESTAMP_MIN) || ff.getValidationType().equals(FormField.VT_TIMESTAMP_SEC)) { @@ -1209,7 +1212,8 @@ return sheetName; StringTokenizer st = new StringTokenizer(vals, "|"); if(st.countTokens()>0) { while(st.hasMoreTokens()) { - if(isMultiValue) value.append("'"); + if(isMultiValue) + value.append("'"); String token = st.nextToken(); try { if(token !=null && token.length() > 0) @@ -1218,7 +1222,8 @@ return sheetName; catch (IllegalArgumentException ex1){} catch (Exception ex2){} value.append(token); - if(isMultiValue) value.append("'"); + if(isMultiValue) + value.append("'"); if(st.hasMoreTokens()) { value.append(","); } @@ -1231,7 +1236,8 @@ return sheetName; valuesMap.put(fieldNameMap.get(formField), valueStr); valueStr = ""; } - if(isMultiValue) value.append(")"); + if(isMultiValue) + value.append(")"); valuesMap.put(fieldNameMap.get(formField), value.toString()); @@ -1405,7 +1411,8 @@ return sheetName; value.append("("); } for(int j = 0 ; j < vals.length; j++) { - if(isMultiValue) value.append("'"); + if(isMultiValue) + value.append("'"); try { if(vals[j] !=null && vals[j].length() > 0) { vals[j] = Utils.oracleSafe(vals[j]); @@ -1420,7 +1427,8 @@ return sheetName; } - if(isMultiValue) value.append("'"); + if(isMultiValue) + value.append("'"); if(j != vals.length -1) { value.append(","); @@ -1542,7 +1550,8 @@ return sheetName; public static int getMemoryThreshold() { int threshold = Integer.parseInt(nvls(raptorProperties.getProperty("memory_threshold_percentage"),"0").trim()); - if(threshold <= 0) threshold = 0; + if(threshold <= 0) + threshold = 0; return threshold; } diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/RemDbUtils.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/RemDbUtils.java index 2a9d487a..c28f6e6c 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/RemDbUtils.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/RemDbUtils.java @@ -179,8 +179,10 @@ public class RemDbUtils /* implements IDbUtils */{ public static DataSet executeQuery(Connection con, String sql, int maxRowLimit, String dbKey) throws ReportSQLException { try { - if (con==null || con.isClosed()) con = getConnection(dbKey); - if(con==null) throw new ReportSQLException("Remote Connection not configured for "+ dbKey); + if (con==null || con.isClosed()) + con = getConnection(dbKey); + if(con==null) + throw new ReportSQLException("Remote Connection not configured for "+ dbKey); try(Statement stmt = con.createStatement(); ResultSet rs = stmt.executeQuery(sql);){ logger.debug(EELFLoggerDelegate.debugLogger, ("[SQL CALL FROM RAPTOR] [SQL] " + sql)); |