diff options
Diffstat (limited to 'ecomp-sdk/epsdk-analytics')
12 files changed, 123 insertions, 93 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 f8f06294..1ffbde28 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 @@ -913,7 +913,7 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject { return jsonInString; } //nextPage = (new ErrorHandler()).processFatalError(request, e); - } catch (Throwable t) { + } catch (Exception t) { t.printStackTrace(); ErrorJSONRuntime errorJSONRuntime = new ErrorJSONRuntime(); errorJSONRuntime.setErrormessage(t.toString()); @@ -1146,7 +1146,7 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject { try { DbUtils.rollbackTransaction(connection); } catch (Exception e1) {e1.printStackTrace();} - } catch (Throwable t) { + } catch (Exception t) { t.printStackTrace(); } finally { @@ -1243,7 +1243,7 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject { try { DbUtils.rollbackTransaction(connection); } catch (Exception e1) {e1.printStackTrace();} - } catch (Throwable t) { + } catch (Exception t) { t.printStackTrace(); } finally { @@ -1284,7 +1284,7 @@ public class ActionHandler extends org.onap.portalsdk.analytics.RaptorObject { (new ErrorHandler()).processError(request, ve); } catch (RaptorException e) { nextPage = (new ErrorHandler()).processFatalError(request, e); - } catch (Throwable t) { + } catch (Exception t) { t.printStackTrace(); } diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/controller/Controller.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/controller/Controller.java index eb6b469b..f8ecd5c1 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/controller/Controller.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/controller/Controller.java @@ -72,8 +72,6 @@ public class Controller extends org.onap.portalsdk.analytics.RaptorObject { } catch (RaptorException e) { logger.debug(EELFLoggerDelegate.debugLogger, ("[Controller.processRequest]Invalid raptor action [" + actionKey + "]. RaptorException: " + e.getMessage())); -// if (actionKey.equals("system_upgrade")) // System override -// return att.raptor.util.upgrade.SystemUpgrade.upgradeDB(request); return (new ErrorHandler()).processFatalError(request, new RaptorRuntimeException( "[Controller.processRequest]Invalid raptor action [" + actionKey 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 1496b9fa..68007062 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 @@ -2329,43 +2329,46 @@ public class WizardProcessor extends org.onap.portalsdk.analytics.RaptorObject { useDefaultSize = "N"; if (repMap == null) rdef.setReportMap(new ObjectFactory().createReportMap()); - repMap.setAddressColumn(addressColumn); - repMap.setDataColumn(dataColumn); - repMap.setIsMapAllowedYN(isMapAllowed); - repMap.setUseDefaultSize(useDefaultSize); - repMap.setMarkerColor(color); - repMap.setAddAddressInDataYN(addAddress); - repMap.setLatColumn(latCol); - repMap.setLongColumn(longCol); - repMap.setColorColumn(colorCol); - repMap.setHeight(height.trim()); - repMap.setWidth(width.trim()); - repMap.setLegendColumn(legendColumn); - //repMap.setLegendDisplayName(legendDisplayName); - - Marker m = new ObjectFactory().createMarker(); - m.setAddressColumn(addressColumn); - m.setDataColumn(dataColumn); - repMap.getMarkers().add(m); - String markerCountString = AppUtils.getRequestNvlValue(request, "markerCount"); - int markerCount = 0; - if (markerCountString != null && markerCountString.equals("") == false){ - markerCount = new Integer(markerCountString).intValue(); - } - for (int i = 1; i < markerCount; i ++){ - String additionalAddressColumn = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "addressColumn" + i)); - String additionalDataHeader = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "dataHeader" + i)); - String additionalData = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "dataColumn" + i)); - String additionalColor = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "markerColor" + i)); - if (additionalAddressColumn.equals("1") == false){ - m = new ObjectFactory().createMarker(); - m.setAddressColumn(additionalAddressColumn); - m.setDataHeader(additionalDataHeader); - m.setDataColumn(additionalData); - m.setMarkerColor(additionalColor); - repMap.getMarkers().add(m); + if(repMap!=null){ + repMap.setAddressColumn(addressColumn); + repMap.setDataColumn(dataColumn); + repMap.setIsMapAllowedYN(isMapAllowed); + repMap.setUseDefaultSize(useDefaultSize); + repMap.setMarkerColor(color); + repMap.setAddAddressInDataYN(addAddress); + repMap.setLatColumn(latCol); + repMap.setLongColumn(longCol); + repMap.setColorColumn(colorCol); + repMap.setHeight(height.trim()); + repMap.setWidth(width.trim()); + repMap.setLegendColumn(legendColumn); + //repMap.setLegendDisplayName(legendDisplayName); + + Marker m = new ObjectFactory().createMarker(); + m.setAddressColumn(addressColumn); + m.setDataColumn(dataColumn); + repMap.getMarkers().add(m); + String markerCountString = AppUtils.getRequestNvlValue(request, "markerCount"); + int markerCount = 0; + if (markerCountString != null && markerCountString.equals("") == false){ + markerCount = new Integer(markerCountString).intValue(); + } + for (int i = 1; i < markerCount; i ++){ + String additionalAddressColumn = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "addressColumn" + i)); + String additionalDataHeader = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "dataHeader" + i)); + String additionalData = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "dataColumn" + i)); + String additionalColor = XSSFilter.filterRequestOnlyScript(AppUtils.getRequestNvlValue(request, "markerColor" + i)); + if (additionalAddressColumn.equals("1") == false){ + m = new ObjectFactory().createMarker(); + m.setAddressColumn(additionalAddressColumn); + m.setDataHeader(additionalDataHeader); + m.setDataColumn(additionalData); + m.setMarkerColor(additionalColor); + repMap.getMarkers().add(m); + } } } + return true; } // processMap /*****For Report Maps - End******/ diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/ReportHandler.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/ReportHandler.java index c81ac0cd..8a5e7e3c 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/ReportHandler.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/ReportHandler.java @@ -321,7 +321,7 @@ public class ReportHandler extends org.onap.portalsdk.analytics.RaptorObject { cellStyle.setBorderRight(HSSFCellStyle.BORDER_THIN); hashMapStyles.put(fmt.getFormatId(), cellStyle); } else { - hashMapStyles.put(fmt.getFormatId(), styleDefault); + // hashMapStyles.put(fmt.getFormatId(), styleDefault); //fmt is null here hashMapStyles.put("default", styleDefault); } } @@ -2783,9 +2783,11 @@ public class ReportHandler extends org.onap.portalsdk.analytics.RaptorObject { AppConstants.SI_REPORT_RUNTIME); HSSFWorkbook wb = new HSSFWorkbook(); HashMap styles = new HashMap(); - if (rr != null) + String xlsFName=""; + if (rr != null){ styles = loadStyles(rr, wb); - String xlsFName = AppUtils.generateUniqueFileName(request, rr.getReportName(), AppConstants.FT_XLS); + xlsFName = AppUtils.generateUniqueFileName(request, rr.getReportName(), AppConstants.FT_XLS); + } logger.debug(EELFLoggerDelegate.debugLogger, ("Xls File name " + AppUtils.getTempFolderPath() + xlsFName)); @@ -3354,11 +3356,13 @@ public class ReportHandler extends org.onap.portalsdk.analytics.RaptorObject { readTemplate = new FileInputStream(AppUtils.getTempFolderPath()+ filename+"."+ nvls(extension, "xlsx")); wb=new XSSFWorkbook(readTemplate); } - if(rrDashRep!=null) - styles = loadXSSFStyles(rrDashRep, wb, styles); - String reportSheetName = new HtmlStripper().stripSpecialCharacters(rrDashRep.getReportName()); - if(nvl(reportSheetName).length()>28) - reportSheetName = reportSheetName.substring(0, 28); + String reportSheetName = ""; + if(rrDashRep!=null){ + styles = loadXSSFStyles(rrDashRep, wb, styles); + reportSheetName = new HtmlStripper().stripSpecialCharacters(rrDashRep.getReportName()); + } + if(nvl(reportSheetName).length()>28) + reportSheetName = reportSheetName.substring(0, 28); sheet = wb.createSheet(count+"-"+reportSheetName); if(!Globals.printExcelInLandscapeMode()) sheet.getPrintSetup().setLandscape(false); @@ -4051,22 +4055,24 @@ public class ReportHandler extends org.onap.portalsdk.analytics.RaptorObject { buf.available(); sos.write (bOut, 0, readBytes); } - - } catch (IOException ex) { - ex.printStackTrace(); - } - catch(Exception e) { + + } catch (IOException ex) { + ex.printStackTrace(); + } catch (Exception e) { e.printStackTrace(); - } finally { - try { - if (sos != null) - sos.close(); - if (buf != null) - buf.close(); - } catch (Exception e1) { - e1.printStackTrace(); + } finally { + try { + if (sos != null) + sos.close(); + if (buf != null) + buf.close(); + if (fileIn!=null) { + fileIn.close(); } - } + } catch (Exception e1) { + e1.printStackTrace(); + } + } File f = new File (AppUtils.getTempFolderPath() + fName); @@ -6460,15 +6466,17 @@ public class ReportHandler extends org.onap.portalsdk.analytics.RaptorObject { for (rd.reportColumnHeaderRows.resetNext(); rd.reportColumnHeaderRows.hasNext();) { chr = rd.reportColumnHeaderRows.getNext(); csvOut.println("<TR>"); - for (chr.resetNext(); chr.hasNext();) { - ColumnHeader ch = chr.getNext(); - if(ch.isVisible()) { - csvOut.print("<TD bgColor=\"8F9381\">" + ch.getColumnTitle() + "</TD>"); - //for (int i = 1; i < ch.getColSpan(); i++) - // csvOut.print(","); - - } - } // for + if(chr!=null){ + for (chr.resetNext(); chr.hasNext();) { + ColumnHeader ch = chr.getNext(); + if(ch.isVisible()) { + csvOut.print("<TD bgColor=\"8F9381\">" + ch.getColumnTitle() + "</TD>"); + //for (int i = 1; i < ch.getColSpan(); i++) + // csvOut.print(","); + + } + } // for + } csvOut.println("</TR>"); } // for @@ -6606,15 +6614,18 @@ public class ReportHandler extends org.onap.portalsdk.analytics.RaptorObject { if(row==null){ sheet.createRow(rowNum); } - for(int colNum=region.getFirstColumn();colNum<=region.getLastColumn();colNum++){ - XSSFCell currentCell = row.getCell(colNum); - if(currentCell==null){ - currentCell = row.createCell(colNum); - } + if(row!=null){ + for(int colNum=region.getFirstColumn();colNum<=region.getLastColumn();colNum++){ + XSSFCell currentCell = row.getCell(colNum); + if(currentCell==null){ + currentCell = row.createCell(colNum); + } - currentCell.setCellStyle(cellStyle); + currentCell.setCellStyle(cellStyle); + } } + } diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/ReportLoader.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/ReportLoader.java index c772d308..0d416ae2 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/ReportLoader.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/ReportLoader.java @@ -927,8 +927,10 @@ public class ReportLoader extends org.onap.portalsdk.analytics.RaptorObject { throw new ReportSQLException (ex.getMessage(), ex.getCause()); } finally { try { - stmt.close(); - connection.close(); + if(stmt!=null) + stmt.close(); + if(connection!=null) + connection.close(); DbUtils.clearConnection(connection); } catch (SQLException ex) { throw new ReportSQLException (ex.getMessage(), ex.getCause()); diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/base/ReportSecurity.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/base/ReportSecurity.java index a9abd558..ecfd40a7 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/base/ReportSecurity.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/base/ReportSecurity.java @@ -328,8 +328,8 @@ public class ReportSecurity extends org.onap.portalsdk.analytics.RaptorObject { if (nvl(reportID).equals("-1")) return; - if (true) //todo: replace with proper check isPublic - return; + /*if (true) //todo: replace with proper check isPublic + return;*/ if (userID.equals(ownerID)) return; diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/base/ReportWrapper.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/base/ReportWrapper.java index a17e411a..0ba8d4c7 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/base/ReportWrapper.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/base/ReportWrapper.java @@ -1887,7 +1887,9 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { for (Iterator iter1 = getFormFieldList().getFormField().iterator(); iter1.hasNext();) { FormFieldType fft = (FormFieldType) iter1.next(); String fieldDisplay = getFormFieldDisplayName(fft); - String fieldId = fft.getFieldId(); + String fieldId = ""; + if(fft!=null) + fieldId = fft.getFieldId(); if(!fft.getFieldType().equals(FormField.FFT_BLANK) && !fft.getFieldType().equals(FormField.FFT_LIST_MULTI) && !fft.getFieldType().equals(FormField.FFT_TEXTAREA)) { String paramValue = Utils.oracleSafe(nvl(reportParamValues.getParamValue(fieldId))); chartYAxis = Utils.replaceInString(chartYAxis, fieldDisplay, nvl( diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/FormField.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/FormField.java index b8c681a8..7884e61f 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/FormField.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/FormField.java @@ -675,8 +675,10 @@ public class FormField extends org.onap.portalsdk.analytics.RaptorObject impleme break; } - fieldDefValue = nvl(idNamevalue.getId()); - fieldDefDisplay = nvl(idNamevalue.getName()); + if(idNamevalue!=null){ + fieldDefValue = nvl(idNamevalue.getId()); + fieldDefDisplay = nvl(idNamevalue.getName()); + } } else { try { // -2 indicates to run the whole sql for matching value @@ -700,7 +702,7 @@ public class FormField extends org.onap.portalsdk.analytics.RaptorObject impleme fieldDefDisplay = nvl(fieldDefValue); } - if(oldSQL != null && !oldSQL.equals("")) { + if(oldSQL != null && !oldSQL.equals("") && lookup!=null) { ((IdNameSql)lookup).setSQL(oldSQL); } diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ReportRuntime.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ReportRuntime.java index 2b01821e..f9d58fee 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ReportRuntime.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ReportRuntime.java @@ -2815,7 +2815,7 @@ public List getMapMarkers(ReportData rd, org.onap.portalsdk.analytics.xmlobj.Rep } } if(!ff.hasPredefinedList) { - if(oldSQL != null && !oldSQL.equals("")) { + if(oldSQL != null && !oldSQL.equals("") && lookup!=null) { ((IdNameSql)lookup).setSQL(oldSQL); } } @@ -2970,7 +2970,7 @@ public List getMapMarkers(ReportData rd, org.onap.portalsdk.analytics.xmlobj.Rep } } if(!ff.hasPredefinedList) { - if(oldSQL != null && !oldSQL.equals("")) { + if(oldSQL != null && !oldSQL.equals("") && lookup!=null) { ((IdNameSql)lookup).setSQL(oldSQL); } } diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/scheduler/SchedulerUtil.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/scheduler/SchedulerUtil.java index 88dc98ad..8404dc2b 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/scheduler/SchedulerUtil.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/scheduler/SchedulerUtil.java @@ -91,7 +91,8 @@ public class SchedulerUtil { stat.executeUpdate(sql); } finally{ - stat.close(); + if(stat!=null) + stat.close(); //conn.close(); } } @@ -113,7 +114,8 @@ public class SchedulerUtil { stat.executeUpdate(); } finally{ - stat.close(); + if(stat!=null) + stat.close(); } } @@ -195,7 +197,8 @@ public class SchedulerUtil { stat.executeUpdate(); } finally{ - stat.close(); + if(stat!=null) + stat.close(); //conn.close(); } } diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/fusion/AntBuild.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/fusion/AntBuild.java index e9a03eec..cc038cab 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/fusion/AntBuild.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/fusion/AntBuild.java @@ -57,8 +57,9 @@ public class AntBuild { } public static void readManifest() { + JarFile jar = null; try { - JarFile jar = new JarFile("./raptor_fusion.jar"); + jar = new JarFile("./raptor_fusion.jar"); Manifest manifest = jar.getManifest(); Attributes attribs = manifest.getMainAttributes(); @@ -80,6 +81,14 @@ public class AntBuild { } catch (IOException e) { System.err.println("Cannot read jar-file manifest: " + e.getMessage()); + } finally { + if (jar != null) { + try { + jar.close(); + } catch (IOException e) { + throw new RuntimeException("Failed to close jar '"); + } + } } } }
\ No newline at end of file diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/fusion/adapter/Lookup.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/fusion/adapter/Lookup.java index ff5fc276..f5447289 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/fusion/adapter/Lookup.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/fusion/adapter/Lookup.java @@ -93,7 +93,7 @@ public class Lookup extends FusionVo implements Serializable { boolean equivalent = false; Lookup lookup = (Lookup)obj; - if( lookup.getValue().equals(getValue()) && lookup.getLabel().equals(getLabel())) { + if(lookup!=null && lookup.getValue().equals(getValue()) && lookup.getLabel().equals(getLabel())) { equivalent = true; } |