diff options
author | 2020-05-05 12:20:30 -0400 | |
---|---|---|
committer | 2020-05-16 01:50:52 +0530 | |
commit | 759e9e75fc0b5978f98f901744c87c0c8d5ef4fd (patch) | |
tree | 4b61ca0a05ec79d45f88b81142264e0407d2ddb3 /ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model | |
parent | 03abc05e6217274f557ec4987aa8e8bd34b2f4a4 (diff) |
Raptor backend java API Code(Analytics), UI Code(Overlay) and pages
component in os project
Issue-ID: PORTAL-902
Change-Id: Id297d9493a77e6816ed0f2a82c15b2eaa1e57a72
Signed-off-by: Sudarshan Kumar <sudarshan.kumar@att.com>
Diffstat (limited to 'ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model')
13 files changed, 515 insertions, 1039 deletions
diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/Dashboard.xlsx b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/Dashboard.xlsx Binary files differnew file mode 100644 index 00000000..be0601d4 --- /dev/null +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/Dashboard.xlsx diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/DashboardChildReport.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/DashboardChildReport.java new file mode 100644 index 00000000..90e4d48d --- /dev/null +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/DashboardChildReport.java @@ -0,0 +1,88 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +package org.onap.portalsdk.analytics.model; + +import java.util.HashMap; + +public class DashboardChildReport { + + private String x; + private String y; + private String cols; + private String rows ; + private HashMap<String, String> hasContent; + public String getX() { + return x; + } + public void setX(String x) { + this.x = x; + } + public String getY() { + return y; + } + public void setY(String y) { + this.y = y; + } + public String getCols() { + return cols; + } + public void setCols(String cols) { + this.cols = cols; + } + public String getRows() { + return rows; + } + public void setRows(String rows) { + this.rows = rows; + } + public HashMap<String, String> getHasContent() { + return hasContent; + } + public void setHasContent(HashMap<String, String> hasContent) { + this.hasContent = hasContent; + } + @Override + public String toString() { + return "DashboardChildReport [x=" + x + ", y=" + y + ", cols=" + cols + ", rows=" + rows + ", hasContent=" + + hasContent + "]"; + } + + + +} diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/base/IdNameSql.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/base/IdNameSql.java index 3091fa96..e9414163 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/base/IdNameSql.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/base/IdNameSql.java @@ -62,13 +62,25 @@ import org.onap.portalsdk.analytics.system.ConnectionUtils; 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.RemDbInfo; import org.onap.portalsdk.analytics.util.Utils; import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +@Component public class IdNameSql extends IdNameList { private static final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(IdNameSql.class); + private static RemDbInfo remDbInfo; + + @SuppressWarnings("static-access") + @Autowired + public void setRemDbInfo(RemDbInfo remDbInfo) { + this.remDbInfo = remDbInfo; + } + protected int dataSize = -1; protected int dataSizeUsedInPopup = -1; @@ -215,7 +227,6 @@ public class IdNameSql extends IdNameList { String dbType = Globals.getDBType(); if (!isNull(dbInfo) && (!dbInfo.equals(AppConstants.DB_LOCAL))) { try { - org.onap.portalsdk.analytics.util.RemDbInfo remDbInfo = new org.onap.portalsdk.analytics.util.RemDbInfo(); dbType = remDbInfo.getDBType(dbInfo); } catch (Exception ex) { throw new RaptorException(ex); @@ -255,9 +266,7 @@ public class IdNameSql extends IdNameList { } if(searchString!=null && searchString.length()>0 && !searchString.equals("%")) { - if(pageNo == -2){ - query.append(" WHERE "); - } + if(pageNo == -2) query.append(" WHERE "); else query.append(" and "); query.append("name like '"+ searchString +"'"); } 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 69837d04..8c95d71a 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 @@ -77,7 +77,9 @@ import org.onap.portalsdk.analytics.system.ConnectionUtils; import org.onap.portalsdk.analytics.system.DbUtils; import org.onap.portalsdk.analytics.system.Globals; import org.onap.portalsdk.analytics.util.AppConstants; +import org.onap.portalsdk.analytics.util.CachingUtils; import org.onap.portalsdk.analytics.util.DataSet; +import org.onap.portalsdk.analytics.util.RemDbInfo; import org.onap.portalsdk.analytics.util.SQLCorrector; import org.onap.portalsdk.analytics.util.Utils; import org.onap.portalsdk.analytics.xmlobj.ChartAdditionalOptions; @@ -111,6 +113,8 @@ import org.onap.portalsdk.analytics.xmlobj.SemaphoreType; import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; import org.onap.portalsdk.core.util.SecurityCodecUtil; import org.owasp.esapi.ESAPI; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; /**<HR/> * This class is part of <B><I>RAPTOR (Rapid Application Programming Tool for OLAP Reporting)</I></B><BR/> @@ -136,10 +140,19 @@ import org.owasp.esapi.ESAPI; * */ +@Component public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { private static final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(ReportWrapper.class); + protected static RemDbInfo remDbInfo; + + @SuppressWarnings("static-access") + @Autowired + public void setRemDbInfo(RemDbInfo remDbInfo) { + this.remDbInfo = remDbInfo; + } + protected CustomReportType cr = null; protected Vector allColumns = null; @@ -152,7 +165,8 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { protected String generatedChartSQL = null; - protected String wholeSQL = null; // For display purposes only + protected String wholeSQL = null; + protected String reportID = null; @@ -168,6 +182,11 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { protected String reportSQLOnlyFirstPart = null; + + public ReportWrapper() { + super(); + } + private ReportWrapper(CustomReportType cr, String reportID, ReportSecurity reportSecurity) { super(); @@ -178,33 +197,24 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { this.reportID = reportID; this.reportSecurity = reportSecurity; - } // ReportWrapper + } public ReportWrapper(ReportWrapper rw) { - this(rw.getCustomReport(), // .cloneCustomReport() + this(rw.getCustomReport(), rw.getReportID(), rw.reportSecurity); this.menuID = rw.getMenuID(); this.menuApproved = rw.isMenuApproved(); this.reportDefType = rw.getReportDefType(); - } // ReportWrapper - + } public ReportWrapper(CustomReportType cr, String reportID, String ownerID, String createID, String createDate, String updateID, String updateDate, String menuID, boolean menuApproved) throws RaptorException { this(cr, reportID, null); if (ownerID == null && !"-1".equals(reportID)) { - // Need to load the report record from the database try { - /* - * DataSet ds = DbUtils - * .executeQuery("SELECT NVL(cr.owner_id, cr.create_id) owner_id, cr.create_id, TO_CHAR(cr.create_date, '" - * + Globals.getOracleTimeFormat() + "') create_date, maint_id, TO_CHAR(cr.maint_date, '" + - * Globals.getOracleTimeFormat() + - * "') update_date, cr.menu_id, cr.menu_approved_yn FROM cr_report cr WHERE cr.rep_id=" + reportID); - */ String rSql = Globals.getReportWrapperFormat(); rSql = rSql.replace("[Globals.getTimeFormat()]", Globals.getTimeFormat()); @@ -222,7 +232,6 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { menuApproved = nvl(ds.getString(0, 6)).equals("Y"); } catch (Exception e) { String eMsg = "ReportWrapper.ReportWrapper: Unable to load report record details. Exception: "; - // Log.write(eMsg); logger.error(EELFLoggerDelegate.debugLogger, ("[EXCEPTION ENCOUNTERED IN RAPTOR] " + eMsg), e); throw new RaptorRuntimeException(eMsg); } @@ -236,8 +245,7 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { reportSecurity = new ReportSecurity(reportID, ownerID, createID, createDate, updateID, updateDate, cr.isPublic()); - } // ReportWrapper - + } public CustomReportType getCustomReport() { return cr; } @@ -379,11 +387,6 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { return cr.getChartHeight() == null ? "500" : cr.getChartHeight(); } - /* - * public boolean isChartMultiSeries() { //String s = cr.getChartMultiSeries(); return return - * (nvl(s).length()>0)? (s.equals("Y")||s.equals("y")||s.equalsIgnoreCase("true")?true:false):true; - * } - */ public boolean displayPieOrderinRunPage() { String s = ""; @@ -866,8 +869,7 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { return cr.isDashboardType() != null ? cr.isDashboardType().booleanValue() : false; } - // public String getCreateId() { return cr.getCreateId(); } - // public Calendar getCreateDate() { return cr.getCreateDate(); } + public String getReportSQL() { return cr.getReportSQL(); } @@ -908,7 +910,7 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { return cr.getDisplayOptions(); } - // Additional Methods + public int getJumpTo() { return cr.getJumpTo() == null ? 1 : cr.getJumpTo(); @@ -998,7 +1000,7 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { else return "top"; - // return cr.getNavPosition(); + } public void setNavPosition(String value) { @@ -1118,7 +1120,6 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { getPDFAdditionalOptions().setPDFFooter2(value); } - // End of Additional Methods public String getDataContainerHeight() { return cr.getDataContainerHeight(); @@ -1137,7 +1138,7 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { return cr.getAllowSchedule(); } - /* Multi Group */ + public boolean isMultiGroupColumn() { String multiGroupColumn = getMultiGroupColumn(); @@ -1155,7 +1156,7 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { private int getColumnGroupLevel(String colId) throws RaptorException { DataColumnType dc = getColumnById(colId); return (dc == null) ? 0 : dc.getLevel(); - } // getColumnGroupLevel + } public int getMaxGroupLevel() { List reportCols = getAllColumns(); @@ -1166,19 +1167,19 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { if (maxLevel < dc.getLevel()) maxLevel = dc.getLevel(); } - } // for + } return maxLevel; - } // getMaxGroupLevel + } private int getColumnGroupStart(String colId) throws RaptorException { DataColumnType dc = getColumnById(colId); return (dc == null) ? 0 : dc.getStart(); - } // getColumnGroupStart + } private int getColumnGroupColSpan(String colId) throws RaptorException { DataColumnType dc = getColumnById(colId); return (dc == null) ? 0 : dc.getColspan(); - } // getColumnGroupColSpan + } public void setTopDown(String value) { cr.setTopDown(value); @@ -1288,6 +1289,10 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { return cr.getDashboardLayoutHTML(); } + public String getDashboardLayoutJSON() { + return cr.getDashboardLayoutJSON(); + } + public FormFieldList getFormFieldList() { return cr.getFormFieldList(); } @@ -1329,12 +1334,10 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { } public void setDBInfo(String value) { - if (!(cr.getDbInfo() != null && cr.getDbInfo().length() > 0)) cr.setDbInfo(value); } public void setDBType(String value) { - if (!(cr.getDbType() != null && cr.getDbType().length() > 0)) cr.setDbType(value); } @@ -1466,8 +1469,6 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { reportSecurity.setPublic(value); } - // public void setCreateId(String value) { cr.setCreateId(value); } - // public void setCreateDate(Calendar value) { cr.setCreateDate(value); } public void setReportSQL(String value) { cr.setReportSQL(value); } @@ -1605,11 +1606,7 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { cr.setChartDrillOptions(chartDrillOptions); } - /**** Report Maps - End ****/ - /** - * ************************************************************************************************* - */ public String getFormHelpText() { String formHelpText = nvl(getComment()); @@ -1618,7 +1615,7 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { formHelpText = formHelpText.substring(formHelpText.lastIndexOf('|') + 1); return formHelpText; - } // getFormHelpText + } public void setFormHelpText(String formHelpText) { String comment = nvl(getComment()); @@ -1629,7 +1626,7 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { comment += '|'; setComment(comment + formHelpText); - } // setFormHelpText + } public boolean isRuntimeColSortDisabled() { String comment = nvl(getComment()); @@ -1638,8 +1635,7 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { return false; return "Y".equals(comment.substring(0, comment.indexOf('|'))); - } // isRuntimeColSortDisabled - + } public void setRuntimeColSortDisabled(boolean value) { String comment = nvl(getComment()); @@ -1647,7 +1643,7 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { comment = comment.substring(comment.indexOf('|') + 1); setComment((value ? "Y" : "N") + "|" + comment); - } // setRuntimeColSortDisabled + } /** * ************************************************************************************************* @@ -1659,7 +1655,7 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { && (!Globals.getAllowSQLBasedReports()) && (!AppUtils.isAdminUser(request))) throw new org.onap.portalsdk.analytics.error.UserAccessException(reportID, "[" + userID + "] " + AppUtils.getUserName(request), AppConstants.UA_WRITE); - } // verifySQLBasedReportAccess + } /** * ************************************************************************************************* @@ -1668,10 +1664,7 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { private String getColumnNameById(String colId) throws RaptorException { DataColumnType dc = getColumnById(colId); return (dc == null) ? "NULL" : dc.getColName(); - } // getColumnNameById - - // Checks if drill-down URL points to individual record display (return - // true) or another report (return false) + } private boolean isViewAction(String value) throws RaptorException { try { Vector viewActions = org.onap.portalsdk.analytics.model.DataCache.getDataViewActions(); @@ -1686,21 +1679,13 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { } return false; - } // isViewAction + } public String getSelectExpr(DataColumnType dct) { - // String colName = - // dct.isCalculated()?dct.getColName():((nvl(dct.getTableId()).length()>0)?(dct.getTableId()+"."+dct.getColName()):dct.getColName()); return getSelectExpr(dct, dct.getColName() /* colName */); - } // getSelectExpr - - /* - * private String getSelectExpr(DataColumnType dct, String colName) { String colType = - * dct.getColType(); if (colType.equals(AppConstants.CT_CHAR) || ((nvl(dct.getColFormat()).length() - * == 0) && (!colType .equals(AppConstants.CT_DATE)))) return colName; else return "TO_CHAR(" + - * colName + ", '" + nvl(dct.getColFormat(), AppConstants.DEFAULT_DATE_FORMAT) + "')"; } // - * getSelectExpr - */ + } + + private String getSelectExpr(DataColumnType dct, String colName) { String colType = dct.getColType(); @@ -1714,35 +1699,32 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { else return "TO_CHAR(" + colName + ", '" + nvl(dct.getColFormat(), AppConstants.DEFAULT_DATE_FORMAT) + "')"; - } // getSelectExpr + } + - /** - * ************************************************************************************************* - */ public DataSourceType getTableById(String tableId) { for (Iterator iter = getDataSourceList().getDataSource().iterator(); iter.hasNext();) { DataSourceType ds = (DataSourceType) iter.next(); if (ds.getTableId().equals(tableId)) return ds; - } // for - + } return null; - } // getTableById + } public DataSourceType getTableByDBName(String tableName) { for (Iterator iter = getDataSourceList().getDataSource().iterator(); iter.hasNext();) { DataSourceType ds = (DataSourceType) iter.next(); if (ds.getTableName().equals(tableName)) return ds; - } // for + } return null; - } // getTableByDBName + } public DataSourceType getColumnTableById(String colId) { return getTableById(getColumnById(colId).getTableId()); - } // getColumnTableById + } public DataColumnType getColumnById(String colId) { List reportCols = getAllColumns(); @@ -1751,10 +1733,10 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { if (dc.getColId().equalsIgnoreCase(colId)) { return dc; } - } // for + } return null; - } // getColumnById + } public DataColumnType getChartLegendColumn() { List reportCols = getAllColumns(); @@ -1762,17 +1744,9 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { DataColumnType dc = (DataColumnType) iter.next(); if (nvl(dc.getColOnChart()).equals(AppConstants.GC_LEGEND)) return dc; - } // for + } return null; - } // getChartLegendColumn - - /* - * public DataColumnType getChartValueColumn() { List reportCols = getAllColumns(); for(Iterator - * iter=reportCols.iterator(); iter.hasNext(); ) { DataColumnType dc = (DataColumnType) iter.next(); - * if(dc.getChartSeq()>0) return dc; } // for - * - * return null; } // getChartValueColumn - */ + } public List getChartValueColumnsList(int filter, HashMap formValues) { /* * filter; all=0;create without new chart =1; @@ -1785,7 +1759,6 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { for (Iterator iter = reportCols.iterator(); iter.hasNext();) { flag = 0; DataColumnType dc = (DataColumnType) iter.next(); - // if(filter == 2 || filter == 1) { flag = getDependsOnFormFieldFlag(dc, formValues); if ((dc.getChartSeq() != null && dc.getChartSeq() > 0) && flag == 0) { @@ -1803,32 +1776,11 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { chartValueCols.add(dc); } } - // } else - // chartValueCols.add(dc); - } // for + + } Collections.sort(chartValueCols, new ChartSeqComparator()); return chartValueCols; - } // getChartValueColumnsList - - /* - * public ListModelList<Item> getChartValueColumnsListModelList( int filter, HashMap formValues) { / - * *filter; all=0;create without new chart =1; createNewChart=2 * / List reportCols = - * getAllColumns(); - * - * ArrayList chartValueCols = new ArrayList(); ListModelList<Item> chartValueListModelList = new - * ListModelList<Item>(); int flag = 0; for (Iterator iter = reportCols.iterator(); iter.hasNext();) - * { flag = 0; DataColumnType dc = (DataColumnType) iter.next(); // if(filter == 2 || filter == 1) { - * flag = getDependsOnFormFieldFlag(dc, formValues); - * - * if( (dc.getChartSeq()!=null && dc.getChartSeq()> 0) && flag == 0 ) { - * if(nvl(dc.getChartGroup()).length()<=0) { if( filter == 2 && (dc.isCreateInNewChart()!=null && - * dc.isCreateInNewChart().booleanValue())) { chartValueCols.add(dc); } else if (filter == 1 && - * (dc.isCreateInNewChart()==null || !dc.isCreateInNewChart().booleanValue())) { - * chartValueCols.add(dc); } else if(filter == 0) chartValueCols.add(dc); } else - * chartValueCols.add(dc); } // } else // chartValueCols.add(dc); chartValueListModelList.add(new - * Item(dc.getColId(), dc.getDisplayName())); } // for Collections.sort(chartValueCols, new - * ChartSeqComparator()); return chartValueListModelList; } // getChartValueColumnsList - */ + } /** Check whether chart has series (Category) columns **/ public boolean hasSeriesColumn() { @@ -1838,14 +1790,11 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { DataColumnType dc = (DataColumnType) iter.next(); if (dc.isChartSeries() != null && dc.isChartSeries().booleanValue()) return true; - } // for + } return false; - } // hasSeriesColumn + } - public List getChartDisplayNamesList(int filter, HashMap formValues) { /* - * filter; all=0;create without new chart =1; - * createNewChart=2 - */ + public List getChartDisplayNamesList(int filter, HashMap formValues) { List reportCols = getAllColumns(); ArrayList chartValueColNames = new ArrayList(); int flag = 0; @@ -1867,24 +1816,19 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { } else if (filter == 0) chartValueColNames.add(dc.getDisplayName()); } - // } else - // chartValueColNames.add(dc.getDisplayName()); + } return chartValueColNames; - } // getChartDisplayNamesList + } - public List getChartColumnColorsList(int filter, HashMap formValues) { /* - * filter; all=0;create without new chart =1; - * createNewChart=2 - */ + public List getChartColumnColorsList(int filter, HashMap formValues) { List reportCols = getAllColumns(); ArrayList chartValueColColors = new ArrayList(); int flag = 0; for (Iterator iter = reportCols.iterator(); iter.hasNext();) { flag = 0; DataColumnType dc = (DataColumnType) iter.next(); - // if(filter == 2 || filter == 1) { flag = getDependsOnFormFieldFlag(dc, formValues); if ((dc.getChartSeq() != null && dc.getChartSeq() > 0) && flag == 0) { @@ -1899,23 +1843,17 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { } else if (filter == 0) chartValueColColors.add(dc.getChartColor()); } - // } else - // chartValueColColors.add(dc.getChartColor()); } return chartValueColColors; - } // getChartColumnColorsList + } - public List getChartValueColumnAxisList(int filter, HashMap formValues) { /* - * filter; all=0;create without new chart - * =1; createNewChart=2 - */ + public List getChartValueColumnAxisList(int filter, HashMap formValues) { List reportCols = getAllColumns(); ArrayList chartValueColAxis = new ArrayList(); int flag = 0; for (Iterator iter = reportCols.iterator(); iter.hasNext();) { flag = 0; DataColumnType dc = (DataColumnType) iter.next(); - // if(filter == 2 || filter == 1) { flag = getDependsOnFormFieldFlag(dc, formValues); if ((dc.getChartSeq() != null && dc.getChartSeq() > 0) && flag == 0) { @@ -1930,18 +1868,17 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { } else if (filter == 0) chartValueColAxis.add(nvl(dc.getColOnChart(), "0")); } - // } else - // chartValueColAxis.add(nvl(dc.getColOnChart(), "0")); } return chartValueColAxis; - } // getChartColumnAxisList + } + public List getChartValueNewChartList() { ArrayList chartValueNewChartAxis = new ArrayList(); for (Iterator iter = getChartValueColumnsList(2, null).iterator(); iter.hasNext();) chartValueNewChartAxis.add(new Boolean(((DataColumnType) iter.next()).isCreateInNewChart())); return chartValueNewChartAxis; - } // getChartValueNewChartList + } public List getAllChartGroups() { ArrayList chartGroups = new ArrayList(); @@ -1958,7 +1895,7 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { } List l = new ArrayList(groupSet); return l; - } // getAllChartGroups + } public HashMap getAllChartYAxis(ReportParamValues reportParamValues) { String chartYAxis = ""; @@ -1990,7 +1927,7 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { } } return hashMap; - } // getAllChartGroups + } public List getChartGroupColumnAxisList(String chartGroupName, HashMap formValues) { /* * filter; all=0;create without @@ -2004,31 +1941,24 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { for (Iterator iter = reportCols.iterator(); iter.hasNext();) { flag = 0; DataColumnType dc = (DataColumnType) iter.next(); - // if(filter == 2 || filter == 1) { flag = getDependsOnFormFieldFlag(dc, formValues); if ((dc.getChartSeq() != null && dc.getChartSeq() > 0) && flag == 0) { if (nvl(dc.getChartGroup()).indexOf("|") > 0 && (nvl(dc.getChartGroup().substring(0, dc.getChartGroup().lastIndexOf("|"))) .equals(chartGroup))) { - // if( nvl(dc.getChartGroup().substring(0,dc.getChartGroup().lastIndexOf("|"))).equals(chartGroup)) - // { - // System.out.println("$$$$$$$DC " + dc.getColId()+ " " + dc.getColOnChart()); chartGroupColAxis.add(dc); } } - // } else - // chartValueColAxis.add(nvl(dc.getColOnChart(), "0")); } Collections.sort(chartGroupColAxis, new ChartSeqComparator()); return chartGroupColAxis; - } // getChartColumnAxisList + } public List getChartGroupValueColumnAxisList(String chartGroupName, HashMap formValues) { List reportCols = getAllColumns(); String index = chartGroupName.substring(chartGroupName.lastIndexOf("|") + 1); String chartGroup = chartGroupName.substring(0, chartGroupName.lastIndexOf("|")); - // System.out.println("$$$$INDEX " + index); ArrayList chartGroupValueColAxis = new ArrayList(); int flag = 0; @@ -2038,21 +1968,15 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { flag = getDependsOnFormFieldFlag(dc, formValues); if ((dc.getChartSeq() != null && dc.getChartSeq() > 0) && flag == 0) { - // System.out.println(" Chartgroup " + - // dc.getChartGroup().substring(0,dc.getChartGroup().lastIndexOf("|"))); if (nvl(dc.getChartGroup()).indexOf("|") > 0 && (nvl(dc.getChartGroup().substring(0, dc.getChartGroup().lastIndexOf("|"))) .equals(chartGroup))) { - // if( nvl(dc.getChartGroup().substring(0,dc.getChartGroup().lastIndexOf("|"))).equals(chartGroup)) - // { - // System.out.println(" Added Chartgroupname " + chartGroup + " " + dc.getChartGroup() + " " + - // index); chartGroupValueColAxis.add(dc); } } } return chartGroupValueColAxis; - } // getChartColumnAxisList + } public List getChartGroupDisplayNamesList(String chartGroupName, HashMap formValues) { List reportCols = getAllColumns(); @@ -2063,7 +1987,6 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { for (Iterator iter = reportCols.iterator(); iter.hasNext();) { flag = 0; DataColumnType dc = (DataColumnType) iter.next(); - // System.out.println("$$$$$CHART " + dc.getChartSeq()+ " " + dc.getChartGroup()+ " " + chartGroup); flag = getDependsOnFormFieldFlag(dc, formValues); if ((dc.getChartSeq() != null && dc.getChartSeq() > 0) && flag == 0) { @@ -2075,7 +1998,8 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { } } return chartGroupValueColNames; - } // getChartDisplayNamesList + } + public List getChartGroupColumnColorsList(String chartGroupName, HashMap formValues) { List reportCols = getAllColumns(); @@ -2091,14 +2015,12 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { if (nvl(dc.getChartGroup()).indexOf("|") > 0 && (nvl(dc.getChartGroup().substring(0, dc.getChartGroup().lastIndexOf("|"))) .equals(chartGroup))) { - // if( nvl(dc.getChartGroup().substring(0,dc.getChartGroup().lastIndexOf("|"))).equals(chartGroup)) - // { chartValueColColors.add(dc.getChartColor()); } } } return chartValueColColors; - } // getChartColumnColorsList + } public List getCrossTabRowColumns() { List reportCols = getAllColumns(); @@ -2108,10 +2030,10 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { DataColumnType dc = (DataColumnType) iter.next(); if (nvl(dc.getCrossTabValue()).equals(AppConstants.CV_ROW)) v.add(dc); - } // for + } return v; - } // getCrossTabRowColumns + } public List getCrossTabColColumns() { List reportCols = getAllColumns(); @@ -2121,10 +2043,10 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { DataColumnType dc = (DataColumnType) iter.next(); if (nvl(dc.getCrossTabValue()).equals(AppConstants.CV_COLUMN)) v.add(dc); - } // for + } return v; - } // getCrossTabColColumns + } public String getCrossTabDisplayTotal(String rowColPos) { DataColumnType dct = getCrossTabValueColumn(); @@ -2142,10 +2064,10 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { displayTotal = displayRowTotal; else if (displayColTotal.equals(displayRowTotal)) displayTotal = displayColTotal; - } // if + } return displayTotal; - } // getCrossTabDisplayTotal + } public DataColumnType getCrossTabValueColumn() { List reportCols = getAllColumns(); @@ -2153,13 +2075,12 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { DataColumnType dc = (DataColumnType) iter.next(); if (nvl(dc.getCrossTabValue()).equals(AppConstants.CV_VALUE)) return dc; - } // for + } return null; - } // getCrossTabValueColumn + } - public int getCrossTabValueColumnIndex() { // Returns the index counting - // only visible columns + public int getCrossTabValueColumnIndex() { List reportCols = getAllColumns(); int idx = 0; @@ -2169,10 +2090,10 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { break; if (dc.isVisible()) idx++; - } // for + } return idx; - } // getCrossTabValueColumnIndex + } public ColFilterType getFilterById(String colId, int filterIndex) { DataColumnType dc = getColumnById(colId); @@ -2182,7 +2103,7 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { logger.error(EELFLoggerDelegate.debugLogger, "Exception occured in getFilterById ", e); return null; } - } // getFilterById + } public boolean needFormInput() { List reportCols = getAllColumns(); @@ -2196,12 +2117,12 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { if (nvl(cft.getArgType()).equals(AppConstants.AT_FORM)) return true; - } // for - } // if - } // for + } + } + } return false; - } // needFormInput + } public int getNumSortColumns() { int numSortCols = 0; @@ -2209,10 +2130,10 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { DataColumnType dct = (DataColumnType) iter.next(); if (dct.getOrderBySeq() != null && dct.getOrderBySeq() > 0) numSortCols++; - } // for + } return numSortCols; - } // getNumSortColumns + } public SemaphoreType getSemaphoreById(String semaphoreId) { if (getSemaphoreList() != null && semaphoreId != null) @@ -2220,24 +2141,24 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { SemaphoreType sem = (SemaphoreType) iter.next(); if (sem.getSemaphoreId().equals(semaphoreId)) return sem; - } // for + } return null; - } // getSemaphoreById + } public void deleteSemaphore(SemaphoreType semaphore) { if (getSemaphoreList() != null) { if (getSemaphoreList().getSemaphore() != null) getSemaphoreList().getSemaphore().remove((SemaphoreType) semaphore); } - } // deleteSemaphore + } public void setSemaphore(SemaphoreType sem) { if (getSemaphoreList() != null) { getSemaphoreList().getSemaphore().add(sem); } - } // setSemaphore + } public static FormatType getSemaphoreFormatById(SemaphoreType semaphore, String formatId) { if (semaphore != null) @@ -2246,10 +2167,10 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { FormatType fmt = (FormatType) iter.next(); if (fmt.getFormatId().equals(formatId)) return fmt; - } // for + } return null; - } // getSemaphoreFormatById + } public FormFieldType getFormFieldById(String fieldId) { if (getFormFieldList() != null && fieldId != null) @@ -2257,30 +2178,25 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { FormFieldType fft = (FormFieldType) iter.next(); if (fft.getFieldId().equals(fieldId)) return fft; - } // for + } return null; - } // getFormFieldById + } public FormFieldType getFormFieldByDisplayValue(String fieldDisplay) { - // fieldDisplay expected to be [fieldName] if (getFormFieldList() != null && fieldDisplay != null) for (Iterator iter = getFormFieldList().getFormField().iterator(); iter.hasNext();) { FormFieldType fft = (FormFieldType) iter.next(); if (fieldDisplay.equals(getFormFieldDisplayName(fft))) return fft; - } // for + } return null; - } // getFormFieldById - + } public String getFormFieldDisplayName(FormFieldType fft) { return "[" + fft.getFieldName() + "]"; - } // getFormFieldDisplayName + } - /** - * ************************************************************************************************* - */ public void resetCache(boolean sqlOnly) { generatedSQL = null; @@ -2288,25 +2204,22 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { allColumns = null; allFilters = null; } - } // resetCache + } public String getOuterJoinType(DataSourceType curTable) { String refDefinition = nvl(curTable.getRefDefinition()); int outerJoinIdx = refDefinition.indexOf(" (+)"); if (outerJoinIdx < 0) - // No outer join return ""; int equalSignIdx = refDefinition.indexOf("="); if (refDefinition.indexOf(curTable.getTableId()) < equalSignIdx) - // Cur. table is on the left side return (outerJoinIdx < equalSignIdx) ? AppConstants.OJ_CURRENT : AppConstants.OJ_JOINED; else - // Joined table is on the left side return (outerJoinIdx < equalSignIdx) ? AppConstants.OJ_JOINED : AppConstants.OJ_CURRENT; - } // getOuterJoinType + } public String getFormFieldName(ColFilterType filter) { FormFieldType fft = null; @@ -2316,7 +2229,7 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { return (fft != null) ? fft.getFieldId() : filter.getColId() + "_f" + filter.getFilterSeq(); - } // getFormFieldName + } public String getFormFieldDisplayName(DataColumnType column, ColFilterType filter) { FormFieldType fft = null; @@ -2326,7 +2239,7 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { return (fft != null) ? fft.getFieldName() : column.getDisplayName() + " " + filter.getExpression(); - } // getFormFieldDisplayName + } public Calendar getFormFieldRangeStart(ColFilterType filter) { FormFieldType fft = null; @@ -2334,16 +2247,14 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { fft = getFormFieldByDisplayValue(filter.getArgValue()); return (fft != null) ? fft.getRangeStartDate().toGregorianCalendar() : null; - } // getFormFieldRangeStart + } public Calendar getFormFieldRangeEnd(ColFilterType filter) { FormFieldType fft = null; if (filter.getArgType().equals(AppConstants.AT_FORM)) fft = getFormFieldByDisplayValue(filter.getArgValue()); - - // System.out.println("as " + fft.getRangeEndDate()); return (fft != null) ? fft.getRangeEndDate().toGregorianCalendar() : null; - } // getFormFieldRangeEnd + } public String getFormFieldRangeStartSQL(ColFilterType filter) { FormFieldType fft = null; @@ -2351,16 +2262,14 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { fft = getFormFieldByDisplayValue(filter.getArgValue()); return (fft != null) ? fft.getRangeStartDateSQL() : null; - } // getFormFieldRangeStart + } public String getFormFieldRangeEndSQL(ColFilterType filter) { FormFieldType fft = null; if (filter.getArgType().equals(AppConstants.AT_FORM)) fft = getFormFieldByDisplayValue(filter.getArgValue()); - - // System.out.println("as " + fft.getRangeEndDate()); return (fft != null) ? fft.getRangeEndDateSQL() : null; - } // getFormFieldRangeEnd + } public String getUniqueTableId(String tableName) { String tableIdPrefix = tableName.startsWith("MSA_") ? tableName.substring(4, 6) @@ -2373,11 +2282,7 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { } while (getTableById(tableId) != null); return tableId; - } // getUniqueTableId - - /** - * ************************************************************************************************* - */ + } protected void deleteDataSourceType(String tableId) { List dsList = getDataSourceList().getDataSource(); @@ -2389,10 +2294,10 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { dst.setRefTableId(null); dst.setRefDefinition(null); } - } // for + } resetCache(false); - } // deleteDataSourceType + } public static void adjustColumnType(DataColumnType dct) { dct.setColType(dct.getDbColType()); @@ -2405,40 +2310,32 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { dct.setColType(AppConstants.CT_NUMBER); else if (dct.getColName().startsWith("DECODE(") || dct.getColName().startsWith("coalesce(")) dct.setColType(AppConstants.CT_CHAR); - } // adjustColumnType - + } public static boolean getColumnNoParseDateFlag(DataColumnType dct) { return (nvls(dct.getComment()).indexOf(AppConstants.CF_NO_PARSE_DATE) >= 0); - } // getColumnNoParseDateFlag + } public static void setColumnNoParseDateFlag(DataColumnType dct, boolean noParseDateFlag) { dct.setComment(noParseDateFlag ? AppConstants.CF_NO_PARSE_DATE : null); - } // setColumnNoParseDateFlag + } - /** - * ************************************************************************************************* - */ public static String getSQLBasedFFTColTableName(String fftColId) { return fftColId.substring(0, fftColId.indexOf('.')); - } // getSQLBasedFFTColTableName + } public static String getSQLBasedFFTColColumnName(String fftColId) { fftColId = (fftColId.indexOf('|') < 0) ? fftColId : fftColId.substring(0, fftColId .indexOf('|')); return fftColId.substring(fftColId.indexOf('.') + 1); - } // getSQLBasedFFTColColumnName - + } public static String getSQLBasedFFTColDisplayFormat(String fftColId) { return (fftColId.indexOf('|') < 0) ? "" : fftColId .substring(fftColId.indexOf('|') + 1); - } // getSQLBasedFFTColDisplayFormat + } - /** - * ************************************************************************************************* - */ public List<DataColumnType> getAllColumns() { if (cr == null) @@ -2450,21 +2347,19 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { List dsList = getDataSourceList().getDataSource(); for (Iterator iter = dsList.iterator(); iter.hasNext();) { DataSourceType ds = (DataSourceType) iter.next(); - - // allColumns.addAll(ds.getDataColumnList().getDataColumn()); List dcList = ds.getDataColumnList().getDataColumn(); for (Iterator iterC = dcList.iterator(); iterC.hasNext();) { DataColumnType dc = (DataColumnType) iterC.next(); allColumns.add(dc); - } // for - } // for + } + } Collections.sort(allColumns, new OrderSeqComparator()); - } // if + } return allColumns; - } // getAllColumns + } public List getOnlyVisibleColumns() { if (cr == null) @@ -2476,22 +2371,19 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { List dsList = getDataSourceList().getDataSource(); for (Iterator iter = dsList.iterator(); iter.hasNext();) { DataSourceType ds = (DataSourceType) iter.next(); - - // allColumns.addAll(ds.getDataColumnList().getDataColumn()); List dcList = ds.getDataColumnList().getDataColumn(); for (Iterator iterC = dcList.iterator(); iterC.hasNext();) { DataColumnType dc = (DataColumnType) iterC.next(); if (dc.isVisible()) allVisibleColumns.add(dc); - } // for - } // for + } + } Collections.sort(allVisibleColumns, new OrderSeqComparator()); - } // if + } return allVisibleColumns; - } // getOnlyVisibleColumns - + } public int getVisibleColumnCount() { if (cr == null) throw new NullPointerException("CustomReport not initialized"); @@ -2499,15 +2391,13 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { List dsList = getDataSourceList().getDataSource(); for (Iterator iter = dsList.iterator(); iter.hasNext();) { DataSourceType ds = (DataSourceType) iter.next(); - - // allColumns.addAll(ds.getDataColumnList().getDataColumn()); List dcList = ds.getDataColumnList().getDataColumn(); for (Iterator iterC = dcList.iterator(); iterC.hasNext();) { DataColumnType dc = (DataColumnType) iterC.next(); if (dc.isVisible()) colCount++; - } // for - } // for + } + } return colCount; } @@ -2516,7 +2406,6 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { if (cr == null) throw new NullPointerException("CustomReport not initialized"); - // if(allFilters==null) { allFilters = new Vector(); List reportCols = getAllColumns(); @@ -2530,19 +2419,15 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { ColFilterType cft = (ColFilterType) iterF.next(); allFilters.add(cft); - } // for - } // if - } // for - - // Collections.sort(allFilters, ??); - // } // if - + } + } + } return allFilters; - } // getAllFilters + } private String formatValue(String value, DataColumnType dc, boolean useDefaultDateFormat) throws RaptorException { return formatValue(value, dc, useDefaultDateFormat, getColumnTableById(dc.getColId()), null); - } // formatValue + } private String formatValue(String value, DataColumnType dc, boolean useDefaultDateFormat, DataSourceType ds, FormFieldType fft) throws RaptorException { @@ -2572,7 +2457,7 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { + "', '" + (useDefaultDateFormat ? AppConstants.DEFAULT_DATE_FORMAT : nvl(dc - .getColFormat(), AppConstants.DEFAULT_DATE_FORMAT));// +" HH24:MI:SS')"; + .getColFormat(), AppConstants.DEFAULT_DATE_FORMAT)); fmtValue = fmtValue + " HH24"; if (fft.getValidationType().equals(FormField.VT_TIMESTAMP_MIN) || fft.getValidationType().equals(FormField.VT_TIMESTAMP_SEC)) @@ -2601,22 +2486,18 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { } return fmtValue; - } // formatValue + } private String formatListValue(String listValue, DataColumnType dc, boolean useDefaultDateFormat, boolean useOnlyPipeDelimiter) throws RaptorException { return formatListValue("", listValue, dc, useDefaultDateFormat, useOnlyPipeDelimiter, getColumnTableById(dc.getColId()), null); - } // formatListValue + } public String formatListValue(String fieldDisplay, String listValue, DataColumnType dc, boolean useDefaultDateFormat, boolean useOnlyPipeDelimiter, DataSourceType ds, String listBaseSQL) throws RaptorException { StringBuffer fmtValue = new StringBuffer(""); - // if(nvl(listValue,"").trim().length()>0) { - // The below statement is commented so that pipe is taken out from parsing for text area form field - // StringTokenizer st = new StringTokenizer(listValue, useOnlyPipeDelimiter ? "|" - // : ",|\n\r\f"); StringTokenizer st = new StringTokenizer(listValue, useOnlyPipeDelimiter ? "|" : ",\n\r\f"); @@ -2625,7 +2506,6 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { fmtValue.append(", "); if (dc == null) { - // For SQL-based reports - value always string String value = st.nextToken().trim(); if (value.startsWith("'")) fmtValue.append(value); @@ -2635,7 +2515,7 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { fmtValue.append(formatValue(st.nextToken().trim(), dc, useDefaultDateFormat, ds, null)); - } // while + } if (fmtValue.length() == 0) { if (nvl(fieldDisplay).length() > 0) { @@ -2649,11 +2529,9 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { fmtValue.insert(0, '('); fmtValue.append(')'); } - /* - * } else { fmtValue = new StringBuffer("()"); } - */ + return fmtValue.toString(); - } // formatListValue + } private String getColumnSelectStr(DataColumnType dc, ReportParamValues paramValues) { String colName = dc.isCalculated() ? dc.getColName() @@ -2679,41 +2557,37 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { paramValue, "NULL")); } } - } // for + } return colName; - } // getColumnSelectStr + } private void addExtraIdSelect(StringBuffer selectExtraIdCl, String drillDownParams, boolean includeSelectExpr) { - // drillDownParams - example value "c_master=[bo1.RECID$]" - drillDownParams = drillDownParams.substring(10, drillDownParams.length() - 1); // i.e. - // "bo1.RECID$" + drillDownParams = drillDownParams.substring(10, drillDownParams.length() - 1); selectExtraIdCl.append(", "); if (includeSelectExpr) { selectExtraIdCl.append(drillDownParams); selectExtraIdCl.append(" "); } // if - selectExtraIdCl.append(drillDownParams.replace('.', '_')); // i.e. - // "bo1_RECID$" - } // addExtraIdSelect + selectExtraIdCl.append(drillDownParams.replace('.', '_')); + } private void addExtraDateSelect(StringBuffer selectExtraDateCl, String drillDownParams, ReportParamValues paramValues, boolean includeSelectExpr) { - // drillDownParams - example value "ff1=[dl1]&fc2=[mo3]" String colId = ""; while (drillDownParams.indexOf('[') >= 0) { int startIdx = drillDownParams.indexOf('['); int endIdx = drillDownParams.indexOf(']'); if (startIdx <= endIdx) { - colId = drillDownParams.substring(startIdx + 1, endIdx); // i.e. + colId = drillDownParams.substring(startIdx + 1, endIdx); } else { drillDownParams = drillDownParams.substring(endIdx + 1); continue; } - // "dl1" + DataColumnType column = getColumnById(colId); if (column != null) @@ -2728,26 +2602,22 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { + getColumnSelectStr(column, paramValues) + ", '" + AppConstants.DEFAULT_DATE_FORMAT + "')"); selectExtraDateCl.append(" "); - } // if - selectExtraDateCl.append(colId + AppConstants.DD_COL_EXTENSION); // i.e. - // "dl1_dde" - } // if + } + selectExtraDateCl.append(colId + AppConstants.DD_COL_EXTENSION); + } drillDownParams = drillDownParams.substring(endIdx + 1); - } // while - } // addExtraDateSelect + } + } + - /* - * public String generateSQL() { return generateSQL(null); } // generateSQL - */ public String generateSQL(String userId, HttpServletRequest request) throws RaptorException { return generateSQL(new ReportParamValues(), userId, request); - } // generateSQL - + } public String generateSQL(ReportParamValues paramValues, String userId, HttpServletRequest request) throws RaptorException { return generateSQL(paramValues, null, AppConstants.SO_ASC, userId, request); - } // generateSQL + } public String generateSQL(ReportParamValues paramValues, String overrideSortByColId, String overrideSortByAscDesc, String userId, HttpServletRequest request) throws RaptorException { @@ -2757,7 +2627,7 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { return getWholeSQL(); if (paramValues.size() > 0) resetCache(true); - // resetCache(true); + if (generatedSQL == null) { if (getReportDefType().equals(AppConstants.RD_SQL_BASED) || getReportDefType().equals(AppConstants.RD_SQL_BASED_DATAMIN)) { @@ -2776,34 +2646,19 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { overrideSortByAscDesc, userId, request); } - // debugLogger.debug("******************"); - // debugLogger.debug("SQL Before Changing new line \n" + generatedSQL); - // debugLogger.debug("******************"); generatedSQL = replaceNewLine(generatedSQL, "" + '\n', " " + '\n' + " "); - // chart sql should not be null if (nvl(generatedChartSQL).trim().length() > 0) generatedChartSQL = replaceNewLine(generatedChartSQL, "" + '\n', " " + '\n' + " "); - // (generatedSQL, "\n", " \n "); - // debugLogger.debug("******************"); - // debugLogger.debug("SQL After Changing new line \n" + generatedSQL); - // debugLogger.debug("******************"); - // generatedSQL = replaceNewLine(generatedSQL, "SELECT", "SELECT "); - // generatedSQL = replaceNewLine(generatedSQL, "select", "select "); - // debugLogger.debug("SQL After Changing new line \n" + generatedSQL); - // debugLogger.debug("[[[[[[[[[[[[[[[[[["); - // generatedSQL = Utils.replaceInString(generatedSQL, "\n", " "); - // generatedSQL = Utils.replaceInString(generatedSQL, "\t", " "); - } // if + } return generatedSQL; - } // generateSQL + } public String generateSQLSQLBased(ReportParamValues paramValues, String overrideSortByColId, String overrideSortByAscDesc, String userId, HttpServletRequest request) throws RaptorException { String sql = getReportSQL(); DataSet ds = null; - // debugLogger.debug(" generateSQLSQLBased " + sql); String[] reqParameters = Globals.getRequestParams().split(","); String[] sessionParameters = Globals.getSessionParams().split(","); String[] scheduleSessionParameters = Globals.getSessionParamsForScheduling().split(","); @@ -2811,7 +2666,6 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { String dbType = ""; String dbInfo = getDBInfo(); int fieldCount = 0; - // For Daytona removing all formfields which has null param value Pattern re1 = null; Matcher matcher = null; int index = 0; @@ -2819,8 +2673,6 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { int posAnd = 0; if (!isNull(dbInfo) && (!dbInfo.equals(AppConstants.DB_LOCAL))) { try { - org.onap.portalsdk.analytics.util.RemDbInfo remDbInfo = - new org.onap.portalsdk.analytics.util.RemDbInfo(); dbType = remDbInfo.getDBType(dbInfo); } catch (Exception ex) { throw new RaptorException(ex); @@ -2830,9 +2682,6 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { sql = sql + " "; sql = Pattern.compile("(^[\r\n]*|([\\s]))[Ss][Ee][Ll][Ee][Cc][Tt]([\r\n]*|[\\s]*)", Pattern.DOTALL).matcher(sql) .replaceAll(" SELECT "); - // sql = - // Pattern.compile("(^[\r\n]*|([\\s]))[Ff][Rr][Oo][Mm]([\r\n]*|[\\s]*)",Pattern.DOTALL).matcher(sql).replaceAll(" - // FROM "); sql = Pattern.compile("(^[\r\n]*|([\\s]))[Ww][Hh][Ee][Rr][Ee]([\r\n]*|[\\s]*)", Pattern.DOTALL).matcher(sql) .replaceAll(" WHERE "); sql = Pattern.compile("(^[\r\n]*|([\\s]))[Ww][Hh][Ee][Nn]([\r\n]*|[\\s]*)", Pattern.DOTALL).matcher(sql) @@ -2856,34 +2705,11 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { } else { fieldCount++; if (fieldCount == 1) { - // sql = sql + " "; - // sql = - // Pattern.compile("(^[\r\n]*|([\\s]))[Ss][Ee][Ll][Ee][Cc][Tt]([\r\n]*|[\\s]*)",Pattern.DOTALL).matcher(sql).replaceAll(" - // SELECT "); - // sql = - // Pattern.compile("(^[\r\n]*|([\\s]))[Ww][Hh][Ee][Rr][Ee]([\r\n]*|[\\s]*)",Pattern.DOTALL).matcher(sql).replaceAll(" - // WHERE "); - // sql = - // Pattern.compile("(^[\r\n]*|([\\s]))[Aa][Nn][Dd]([\r\n]*|[\\s]*)",Pattern.DOTALL).matcher(sql).replaceAll(" - // AND "); } - // sql = getReportSQL(); while (sql.indexOf(fieldDisplay) > 0) { - /* - * sql = Utils.replaceInString(sql, "SELECT ", "select "); sql = - * Utils.replaceInString(sql, "WHERE", "where"); sql = Utils.replaceInString(sql, - * " AND ", " and "); - */ re1 = Pattern.compile( "(^[\r\n]|[\\s])AND(.*?[^\r\n]*)" + "\\[" + fft.getFieldName() + "\\](.*?)\\s", Pattern.DOTALL); - // re1 = Pattern.compile("(^[\r\n]|[\\s])AND(.*?[^\r\n]*)"+ "\\["+fft.getFieldName()+ - // "\\]", Pattern.DOTALL); - /* - * posFormField = sql.indexOf(fieldDisplay); posAnd = sql.lastIndexOf("and", - * posFormField); if(posAnd < 0) posAnd = 0; else if (posAnd > 2) posAnd = posAnd - 2; - * matcher = re1.matcher(sql); - */ posFormField = sql.indexOf(fieldDisplay); int posSelectField = sql.lastIndexOf("SELECT ", posFormField); int andField = 0; @@ -2902,7 +2728,7 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { matcher = re1.matcher(sql); if (posAnd > 0 && matcher.find(posAnd - 1)) { - // sql = Utils.replaceInString(sql, matcher.group(), " "); + matcher = re1.matcher(sql); index = sql != null ? sql.lastIndexOf("[" + fft.getFieldName() + "]") : -1; @@ -2915,7 +2741,6 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { } } else { - // sql = sql.replace re1 = Pattern.compile( "(^[\r\n]|[\\s])WHERE(.*?[^\r\n]*)\\[" + fft.getFieldName() + "\\](.*?)\\s", Pattern.DOTALL); @@ -2927,13 +2752,7 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { if (index >= 0 && matcher.find(index - 30)) { sql = sql.replace(matcher.group(), " WHERE 1=1 "); } - // sql = Utils.replaceInString(sql, matcher.group(), " where 1=1 "); - } /* - * else { replaceValue = formatListValue("", Utils - * .oracleSafe(nvl(paramValues.getParamValue(fieldId))), null, false, true, - * null, paramValues.getParamBaseSQL(fieldId)); sql = - * Utils.replaceInString(sql, fieldDisplay, replaceValue); } - */ + } } else { sql = Utils.replaceInString(sql, fieldDisplay, replaceValue); } @@ -2942,26 +2761,12 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { } } - // sql = Utils.replaceInString(sql, " select ", " SELECT "); - // sql = Utils.replaceInString(sql, " where ", " WHERE "); - // sql = Utils.replaceInString(sql, " and ", " AND "); - } else { String paramValue = ""; if (paramValues.isParameterTextAreaValueAndModified(fieldId)) { String value = ""; value = nvl(paramValues .getParamValue(fieldId)); - // value = Utils.oracleSafe(nvl(value)); - // if (!(dbType.equals("DAYTONA") && sql.trim().toUpperCase().startsWith("SELECT"))) { - // value = "('" + Utils.replaceInString(value, ",", "'|'") + "')"; - // value = Utils.replaceInString(value, "|", ","); - // paramValue = XSSFilter.filterRequestOnlyScript(value); - // } else if (nvl(value.trim()).length()>0) { - // value = "('" + Utils.replaceInString(value, ",", "'|'") + "')"; - // value = Utils.replaceInString(value, "|", ","); - // paramValue = XSSFilter.filterRequestOnlyScript(value); - // } paramValue = value; } else paramValue = Utils.oracleSafe(nvl(paramValues @@ -2978,15 +2783,11 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { if (ds.getRowCount() > 0) paramValue = ds.getString(0, 0); } - // debugLogger.debug("SQLSQLBASED B4^^^^^^^^^ " + sql + " " + fft.getValidationType() + " " - // + fft.getFieldName() + " " + fft.getFieldId()); if (fft != null && (fft.getValidationType() != null && (fft.getValidationType().equals(FormField.VT_TIMESTAMP_HR) || fft.getValidationType().equals(FormField.VT_TIMESTAMP_MIN) || fft.getValidationType().equals(FormField.VT_TIMESTAMP_SEC) || fft.getValidationType().equals(FormField.VT_DATE)))) { - // System.out.println("paramValues.getParamValue(fieldId_Hr) Inside if " + - // fft.getValidationType() + " " + fieldDisplay); if (fft.getValidationType().equals(FormField.VT_TIMESTAMP_HR)) { sql = Utils.replaceInString(sql, fieldDisplay, nvl( paramValue) @@ -2996,11 +2797,7 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { .getParamValue(fieldId + "_Hr")))) : "")); } else if (fft.getValidationType().equals(FormField.VT_TIMESTAMP_MIN)) { - /* - * System.out.println("paramValues.getParamValue(fieldId_Hr)" + paramValues - * .getParamValue(fieldId+"_Hr") + " " + paramValues .getParamValue(fieldId+"_Min")) - * ; - */ sql = Utils.replaceInString(sql, fieldDisplay, nvl( + sql = Utils.replaceInString(sql, fieldDisplay, nvl( paramValue) + ((nvl(paramValues .getParamValue(fieldId + "_Hr")).length() > 0) @@ -3061,7 +2858,7 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { paramValue, "NULL")); } catch (NumberFormatException ex) { - if (/* dbType.equals("DAYTONA") && */ sql.trim().toUpperCase() + if (sql.trim().toUpperCase() .startsWith("SELECT")) { sql = Utils.replaceInString(sql, fieldDisplay, nvl( paramValue, "NULL")); @@ -3070,10 +2867,7 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { "Expected number, Given String for the form field \"" + fieldDisplay + "\""); } - /* - * sql = Utils.replaceInString(sql, fieldDisplay, nvl( paramValue, - * "NULL")); - */ + } else sql = Utils.replaceInString(sql, fieldDisplay, nvl( paramValue, "NULL")); @@ -3124,41 +2918,20 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { if (fft.isGroupFormField() != null && fft.isGroupFormField().booleanValue()) { sql = Pattern.compile("[[\\s*][,]]\\[" + fft.getFieldName() + "\\](.*?)[,]", Pattern.MULTILINE).matcher(sql).replaceAll(" "); - // sql = - // Pattern.compile("[,][\\s*]\\["+fft.getFieldName()+"\\][\\s]",Pattern.MULTILINE).matcher(sql).replaceAll(" - // "); sql = Pattern .compile("(,.+?)[\\s*]\\[" + fft.getFieldName() + "\\][\\s]", Pattern.MULTILINE) .matcher(sql).replaceAll(" "); - // sql = - // Pattern.compile("(?:,?)[\\s*]\\["+fft.getFieldName()+"\\]",Pattern.MULTILINE).matcher(sql).replaceAll(""); - // sql = - // Pattern.compile("[,][\\s*]\\["+fft.getFieldName()+"\\]",Pattern.MULTILINE).matcher(sql).replaceAll(" - // "); - // sql = Pattern.compile( - // "\\["+fft.getFieldName()+"\\](.*?[^\r\n]*)[,]",Pattern.DOTALL).matcher(sql).replaceAll(""); - - // sql = - // Pattern.compile("[,]|(.*?[^\r\n]*)"+fieldDisplay+"(.*?)\\s",Pattern.DOTALL).matcher(sql).replaceAll(""); - // sql = - // Pattern.compile("(.*?[^\r\n]*)"+fieldDisplay+"(.*?)\\s|[,]",Pattern.DOTALL).matcher(sql).replaceAll(""); - /* - * sql = Utils.replaceInString(sql, "," + fieldDisplay , nvl( paramValue, "")); sql = - * Utils.replaceInString(sql, fieldDisplay + "," , nvl( paramValue, "")); - */ } else { - // debugLogger.debug("ParamValue |" + paramValue + "| Sql |" + sql + "| Multi Value |" + - // paramValues.isParameterMultiValue(fieldId)); + } else { sql = Utils.replaceInString(sql, "'" + fieldDisplay + "'", nvl( paramValue, "NULL")); sql = Utils.replaceInString(sql, fieldDisplay, nvl( paramValue, "NULL")); - // debugLogger.debug("SQLSQLBASED AFTER^^^^^^^^^ " + sql); } } - } // else - } // if BLANK - } // for + } + } + } if (request != null) { for (int i = 0; i < reqParameters.length; i++) { if (!reqParameters[i].startsWith("ff")) { @@ -3180,27 +2953,15 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { } if (session != null) { for (int i = 0; i < sessionParameters.length; i++) { - // if(!sessionParameters[i].startsWith("ff")) - // paramValue = Utils.replaceInString(paramValue, "[" + sessionParameters[i].toUpperCase()+"]", - // (String)session.getAttribute(sessionParameters[i].toUpperCase()) ); - // else { - // debugLogger.debug(" Session " + " sessionParameters[i] " + sessionParameters[i] + " " + - // (String)session.getAttribute(sessionParameters[i])); sql = Utils.replaceInString(sql, "[" + sessionParameters[i].toUpperCase() + "]", (String) session.getAttribute(sessionParameters[i])); - // } + } } } else { - // debugLogger.debug("BEFORE LOGGED USERID REPLACE " + sql); - // sql = Utils.replaceInString(sql, "'[logged_userId]'", "'"+userId+"'"); - // debugLogger.debug("Replacing string 2 " + sql); sql = Utils.replaceInString(sql, "[LOGGED_USERID]", userId); sql = Utils.replaceInString(sql, "[USERID]", userId); sql = Utils.replaceInString(sql, "[USER_ID]", userId); - // debugLogger.debug("AFTER LOGGED USERID REPLACE " + sql); - // Added for Simon's GM Project where they need to get page_id in their query - // debugLogger.debug("SQLSQLBASED no formfields " + sql); if (request != null) { for (int i = 0; i < reqParameters.length; i++) { sql = Utils.replaceInString(sql, "[" + reqParameters[i].toUpperCase() + "]", ESAPI.encoder() @@ -3209,23 +2970,17 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { } if (session != null) { for (int i = 0; i < sessionParameters.length; i++) { - // debugLogger.debug(" Session " + " sessionParameters[i] " + sessionParameters[i] + " " + - // (String)session.getAttribute(sessionParameters[i])); sql = Utils.replaceInString(sql, "[" + sessionParameters[i].toUpperCase() + "]", (String) session.getAttribute(sessionParameters[i])); } } } - // if it is not multiple select and ParamValue is empty this is the place it can be replaced. sql = Utils.replaceInString(sql, "[LOGGED_USERID]", ESAPI.encoder().encodeForSQL(SecurityCodecUtil.getCodec(), userId)); sql = Utils.replaceInString(sql, "[USERID]", ESAPI.encoder().encodeForSQL(SecurityCodecUtil.getCodec(), userId)); sql = Utils.replaceInString(sql, "[USER_ID]", ESAPI.encoder().encodeForSQL(SecurityCodecUtil.getCodec(), userId)); - // debugLogger.debug("SQLSQLBASED no formfields after" + sql); - // debugLogger.debug("Replacing String 2 "+ sql); - // debugLogger.debug("Replaced String " + sql); int closeBracketPos = 0; if (nvl(overrideSortByColId).length() > 0) { @@ -3252,15 +3007,15 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { break; braketCount--; } - } // for + } sql = sql.substring(0, idxOrderBy) + " ORDER BY " + overrideSortByColId + " " + overrideSortByAscDesc + sql.substring(idxOrderByClauseEnd); - } // else - } // if + } + } sql = Pattern.compile("([\n][\\s]*)", Pattern.DOTALL).matcher(sql).replaceAll(" "); return sql; - } // generateSQLSQLBased + } public String generateSQLVisual(ReportParamValues paramValues, String overrideSortByColId, String overrideSortByAscDesc, String userId, HttpServletRequest request) throws RaptorException { @@ -3278,7 +3033,6 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { int whereClCarryoverBrackets = 0; int havingClCarryoverBrackets = 0; - // Identifying FROM clause tables and WHERE clause joins List dsList = getDataSourceList().getDataSource(); for (Iterator iter = dsList.iterator(); iter.hasNext();) { DataSourceType ds = (DataSourceType) iter.next(); @@ -3293,8 +3047,7 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { if (whereCl.length() > 0) whereCl.append(" AND "); whereCl.append(ds.getRefDefinition()); - } // if - // Add the condition. + } TableSource tableSource = null; String dBInfo = this.cr.getDbInfo(); Vector userRoles = AppUtils.getUserRoles(request); @@ -3307,8 +3060,8 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { whereCl.append(Utils.replaceInString(Utils.replaceInString(tableSource .getFilterSql(), "[" + ds.getTableName() + "]", ds.getTableId()), "[USER_ID]", userId)); - } // if - } // for + } + } List reportCols = getAllColumns(); @@ -3318,46 +3071,33 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { if (dc.isGroupBreak()) { isGroupStmt = true; break; - } // if - } // for + } + } + - // Identifying SELECT and GROUP BY clause fields and WHERE and HAVING - // clause filters - // Collections.sort(reportCols, new OrderSeqComparator()); for (Iterator iter = reportCols.iterator(); iter.hasNext();) { DataColumnType dc = (DataColumnType) iter.next(); String colName = getColumnSelectStr(dc, paramValues); - // SELECT clause fields - // TODO: Uncomment if it's not working -- if (dc.isVisible()) { if (selectCl.length() > 0) selectCl.append(", "); selectCl.append(getSelectExpr(dc, colName)); selectCl.append(" "); selectCl.append(dc.getColId()); - // TODO } // if - - // Checking for extra fields necessary for drill-down if (nvl(dc.getDrillDownURL()).length() > 0) if (isViewAction(dc.getDrillDownURL())) addExtraIdSelect(selectExtraIdCl, nvl(dc.getDrillDownParams()), true); else addExtraDateSelect(selectExtraDateCl, nvl(dc.getDrillDownParams()), paramValues, true); - - // GROUP BY clause fields if (dc.isGroupBreak()) { if (groupByCl.length() > 0) groupByCl.append(", "); groupByCl.append(colName); - } // if - - // WHERE/HAVING clause fields - // boolean isHavingCl = isGroupStmt && dc.isVisible() && (!dc.isGroupBreak()); + } boolean isHavingCl = isGroupStmt && (!dc.isGroupBreak()); StringBuffer filterCl = isHavingCl ? havingCl : whereCl; - // StringBuffer filterCl = - // isGroupStmt?(dc.isVisible()?(dc.isGroupBreak()?whereCl:havingCl):whereCl):whereCl; + if (dc.getColFilterList() != null) { int fNo = 0; List fList = dc.getColFilterList().getColFilter(); @@ -3397,7 +3137,6 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { FormFieldType fft = getFormFieldByDisplayValue(cf.getArgValue()); if (fft == null) - // If not FormField => applying default value fieldValue = nvl(fieldValue, Utils .oracleSafe(cf.getArgValue())); else @@ -3405,7 +3144,6 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { FormField.FFT_CHECK_BOX) || fft.getFieldType().equals(FormField.FFT_LIST_MULTI); if (fft != null) { - // Added for TimeStamp validation String fieldId = fft.getFieldId(); if (fft.getValidationType().equals(FormField.VT_TIMESTAMP_HR) || fft.getValidationType().equals(FormField.VT_TIMESTAMP_MIN) @@ -3430,11 +3168,7 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { } } } - - // End if (nvl(fieldValue).length() == 0) - // Does not append filter with missing form - // field argument applyFilter = false; else if (isMultiValue || "IN".equals(nvl(cf.getExpression())) || "NOT IN".equals(nvl(cf.getExpression()))) @@ -3461,7 +3195,6 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { .length()) if (nvl(cf.getOpenBrackets()).length() > nvl(cf.getCloseBrackets()) .length()) { - // Carry over opening brackets if (isHavingCl) havingClCarryoverBrackets += (nvl(cf.getOpenBrackets()) .length() - nvl(cf.getCloseBrackets()).length()); @@ -3476,7 +3209,7 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { whereClBracketCount += (nvl(cf.getOpenBrackets()).length() - nvl( cf.getCloseBrackets()).length()); } else { - // Adding closing brackets + if (filterCl.length() > 0) { for (int b = 0; b < nvl(cf.getCloseBrackets()).length() - nvl(cf.getOpenBrackets()).length(); b++) @@ -3488,13 +3221,12 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { else whereClBracketCount += (nvl(cf.getOpenBrackets()).length() - nvl( cf.getCloseBrackets()).length()); - } // if - } // else - } // for - } // if - } // for + } + } + } + } + } - // Identifying ORDER BY clause fields DataColumnType overrideSortByCol = null; if (overrideSortByColId != null) overrideSortByCol = getColumnById(overrideSortByColId); @@ -3504,16 +3236,7 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { orderByCl.append(" "); orderByCl.append(nvl(overrideSortByAscDesc, AppConstants.SO_ASC)); } else if (getReportType().equals(AppConstants.RT_CROSSTAB)) { - /* - * for(Iterator iter=reportCols.iterator(); iter.hasNext(); ) { DataColumnType dc = (DataColumnType) - * iter.next(); - * - * if(nvl(dc.getCrossTabValue()).equals(AppConstants.CV_ROW)||nvl(dc.getCrossTabValue()).equals( - * AppConstants.CV_COLUMN)) { if(orderByCl.length()>0) orderByCl.append(", "); - * orderByCl.append(getColumnSelectStr(dc, paramValues)); orderByCl.append(" "); - * if(dc.getColType().equals(AppConstants.CT_DATE)) orderByCl.append(AppConstants.SO_DESC); else - * orderByCl.append(AppConstants.SO_ASC); } // if } // for - */ + } else { Collections.sort(reportCols, new OrderBySeqComparator()); for (Iterator iter = reportCols.iterator(); iter.hasNext();) { @@ -3525,21 +3248,17 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { orderByCl.append(getColumnSelectStr(dc, paramValues)); orderByCl.append(" "); orderByCl.append(dc.getOrderByAscDesc()); - } // if - } // for + } + } Collections.sort(reportCols, new OrderSeqComparator()); - } // else + } - // Adding up the actual statement StringBuffer sql = new StringBuffer(); - // sql.append("SELECT "); // Need to add PK for /*+ FIRST_ROWS */ "); sql.append(Globals.getGenerateSqlVisualSelect()); - // sql.append((selectCl.length() == 0) ? "COUNT(*) cnt" : selectCl.toString()); sql.append((selectCl.length() == 0) ? Globals.getGenerateSqlVisualCount() : selectCl.toString()); if (groupByCl.length() == 0) sql.append(selectExtraIdCl.toString()); sql.append(selectExtraDateCl.toString()); - // sql.append(" FROM "); sql.append((fromCl.length() == 0) ? Globals.getGenerateSqlVisualDual() : "FROM " + fromCl.toString()); if (whereCl.length() > 0) { if (whereClBracketCount > 0) { @@ -3548,11 +3267,11 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { } else if (whereClBracketCount < 0) { for (int b = 0; b < Math.abs(whereClBracketCount); b++) whereCl.insert(0, '('); - } // else + } sql.append(" WHERE "); sql.append(whereCl.toString()); - } // if + } if (groupByCl.length() > 0) { sql.append(" GROUP BY "); sql.append(groupByCl.toString()); @@ -3564,7 +3283,7 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { } else if (havingClBracketCount < 0) { for (int b = 0; b < Math.abs(havingClBracketCount); b++) havingCl.insert(0, '('); - } // else + } sql.append(" HAVING "); sql.append(havingCl.toString()); @@ -3574,10 +3293,8 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { sql.append(" ORDER BY "); sql.append(orderByCl.toString()); } - // String sqlStr = Utils.replaceInString(sql.toString(), "[LOGGED_USERID]", userId); - // return sqlStr; return sql.toString(); - } // generateSQLVisual + } public String generateSQLCrossTabVisual(ReportParamValues paramValues, String overrideSortByColId, String overrideSortByAscDesc, String userId, HttpServletRequest request) throws RaptorException { @@ -3595,7 +3312,6 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { int whereClCarryoverBrackets = 0; int havingClCarryoverBrackets = 0; - // Identifying FROM clause tables and WHERE clause joins List dsList = getDataSourceList().getDataSource(); for (Iterator iter = dsList.iterator(); iter.hasNext();) { DataSourceType ds = (DataSourceType) iter.next(); @@ -3610,8 +3326,7 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { if (whereCl.length() > 0) whereCl.append(" AND "); whereCl.append(ds.getRefDefinition()); - } // if - // Add the condition. + } TableSource tableSource = null; String dBInfo = this.cr.getDbInfo(); Vector userRoles = AppUtils.getUserRoles(request); @@ -3624,8 +3339,8 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { whereCl.append(Utils.replaceInString(Utils.replaceInString(tableSource .getFilterSql(), "[" + ds.getTableName() + "]", ds.getTableId()), "[USER_ID]", userId)); - } // if - } // for + } + } List reportCols = getAllColumns(); @@ -3635,26 +3350,23 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { if (dc.isGroupBreak()) { isGroupStmt = true; break; - } // if - } // for + } + } - // Identifying SELECT and GROUP BY clause fields and WHERE and HAVING - // clause filters - // Collections.sort(reportCols, new OrderSeqComparator()); for (Iterator iter = reportCols.iterator(); iter.hasNext();) { DataColumnType dc = (DataColumnType) iter.next(); String colName = getColumnSelectStr(dc, paramValues); - // SELECT clause fields + if (dc.isVisible()) { if (selectCl.length() > 0) selectCl.append(", "); selectCl.append(getSelectExpr(dc, colName)); selectCl.append(" "); selectCl.append(dc.getColId()); - } // if + } + - // Checking for extra fields necessary for drill-down if (nvl(dc.getDrillDownURL()).length() > 0) if (isViewAction(dc.getDrillDownURL())) addExtraIdSelect(selectExtraIdCl, nvl(dc.getDrillDownParams()), true); @@ -3662,17 +3374,12 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { addExtraDateSelect(selectExtraDateCl, nvl(dc.getDrillDownParams()), paramValues, true); - // GROUP BY clause fields if (dc.isGroupBreak()) { if (groupByCl.length() > 0) groupByCl.append(", "); groupByCl.append(colName); - } // if - - // WHERE/HAVING clause fields + } boolean isHavingCl = isGroupStmt && dc.isVisible() && (!dc.isGroupBreak()); - // boolean isHavingCl = isGroupStmt && (!dc.isGroupBreak()); - // StringBuffer filterCl = isHavingCl ? havingCl : whereCl; StringBuffer filterCl = isGroupStmt ? (dc.isVisible() ? (dc.isGroupBreak() ? whereCl : havingCl) : whereCl) : whereCl; if (dc.getColFilterList() != null) { @@ -3714,7 +3421,6 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { FormFieldType fft = getFormFieldByDisplayValue(cf.getArgValue()); if (fft == null) - // If not FormField => applying default value fieldValue = nvl(fieldValue, Utils .oracleSafe(cf.getArgValue())); else @@ -3723,8 +3429,6 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { || fft.getFieldType().equals(FormField.FFT_LIST_MULTI); if (nvl(fieldValue).length() == 0) - // Does not append filter with missing form - // field argument applyFilter = false; else if (isMultiValue || "IN".equals(nvl(cf.getExpression())) || "NOT IN".equals(nvl(cf.getExpression()))) @@ -3732,7 +3436,7 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { usePipeDelimiterOnly)); else curFilter.append(formatValue(fieldValue, dc, true)); - } // else + } curFilter.append(nvl(cf.getCloseBrackets())); if (applyFilter) { @@ -3751,7 +3455,6 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { .length()) if (nvl(cf.getOpenBrackets()).length() > nvl(cf.getCloseBrackets()) .length()) { - // Carry over opening brackets if (isHavingCl) havingClCarryoverBrackets += (nvl(cf.getOpenBrackets()) .length() - nvl(cf.getCloseBrackets()).length()); @@ -3766,7 +3469,6 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { whereClBracketCount += (nvl(cf.getOpenBrackets()).length() - nvl( cf.getCloseBrackets()).length()); } else { - // Adding closing brackets if (filterCl.length() > 0) { for (int b = 0; b < nvl(cf.getCloseBrackets()).length() - nvl(cf.getOpenBrackets()).length(); b++) @@ -3778,13 +3480,12 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { else whereClBracketCount += (nvl(cf.getOpenBrackets()).length() - nvl( cf.getCloseBrackets()).length()); - } // if - } // else - } // for - } // if - } // for + } + } + } + } + } - // Identifying ORDER BY clause fields DataColumnType overrideSortByCol = null; if (overrideSortByColId != null) overrideSortByCol = getColumnById(overrideSortByColId); @@ -3794,16 +3495,6 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { orderByCl.append(" "); orderByCl.append(nvl(overrideSortByAscDesc, AppConstants.SO_ASC)); } else if (getReportType().equals(AppConstants.RT_CROSSTAB)) { - /* - * for(Iterator iter=reportCols.iterator(); iter.hasNext(); ) { DataColumnType dc = (DataColumnType) - * iter.next(); - * - * if(nvl(dc.getCrossTabValue()).equals(AppConstants.CV_ROW)||nvl(dc.getCrossTabValue()).equals( - * AppConstants.CV_COLUMN)) { if(orderByCl.length()>0) orderByCl.append(", "); - * orderByCl.append(getColumnSelectStr(dc, paramValues)); orderByCl.append(" "); - * if(dc.getColType().equals(AppConstants.CT_DATE)) orderByCl.append(AppConstants.SO_DESC); else - * orderByCl.append(AppConstants.SO_ASC); } // if } // for - */ } else { Collections.sort(reportCols, new OrderBySeqComparator()); for (Iterator iter = reportCols.iterator(); iter.hasNext();) { @@ -3815,21 +3506,18 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { orderByCl.append(getColumnSelectStr(dc, paramValues)); orderByCl.append(" "); orderByCl.append(dc.getOrderByAscDesc()); - } // if - } // for + } + } Collections.sort(reportCols, new OrderSeqComparator()); - } // else + } + - // Adding up the actual statement StringBuffer sql = new StringBuffer(); - // sql.append("SELECT "); // Need to add PK for /*+ FIRST_ROWS */ "); sql.append(Globals.getGenerateSqlVisualSelect()); - // sql.append((selectCl.length() == 0) ? "COUNT(*) cnt" : selectCl.toString()); sql.append((selectCl.length() == 0) ? Globals.getGenerateSqlVisualCount() : selectCl.toString()); if (groupByCl.length() == 0) sql.append(selectExtraIdCl.toString()); sql.append(selectExtraDateCl.toString()); - // sql.append(" FROM "); sql.append((fromCl.length() == 0) ? Globals.getGenerateSqlVisualDual() : "FROM " + fromCl.toString()); if (whereCl.length() > 0) { if (whereClBracketCount > 0) { @@ -3838,11 +3526,11 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { } else if (whereClBracketCount < 0) { for (int b = 0; b < Math.abs(whereClBracketCount); b++) whereCl.insert(0, '('); - } // else + } sql.append(" WHERE "); sql.append(whereCl.toString()); - } // if + } if (groupByCl.length() > 0) { sql.append(" GROUP BY "); sql.append(groupByCl.toString()); @@ -3854,8 +3542,7 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { } else if (havingClBracketCount < 0) { for (int b = 0; b < Math.abs(havingClBracketCount); b++) havingCl.insert(0, '('); - } // else - + } sql.append(" HAVING "); sql.append(havingCl.toString()); } @@ -3867,10 +3554,8 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { logger.debug(EELFLoggerDelegate.debugLogger, "Created SQL statement: {}", sql); - // String sqlStr = Utils.replaceInString(sql.toString(), "[LOGGED_USERID]", userId); - // return sqlStr; return sql.toString(); - } // generateSQLCrossTabVisual + } public String generatePagedSQL(int pageNo, String userId, HttpServletRequest request, boolean getColumnNamesFromReportSQL, ReportParamValues paramValues) throws RaptorException { @@ -3879,17 +3564,17 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { counter = 1; return generateSubsetSQL(pageNo * getPageSize() + counter, ((pageNo + 1) * getPageSize()) + ((pageNo == 0) ? 1 : 0), userId, request, getColumnNamesFromReportSQL, paramValues); - } // generatePagedSQL + } public String generateSubsetSQL(int startRow, int endRow, String userId, HttpServletRequest request, boolean getColumnNamesFromReportSQL, ReportParamValues paramValues) throws RaptorException { - // debugLogger.debug(" ******** End Row ********* " + endRow); String dbInfo = getDBInfo(); String dbType = ""; + String partSql = ""; + String reportSQL = getWholeSQL(); + if (!CachingUtils.isReportSqlExists(request.getSession().getId()+reportSQL)) { if (!isNull(dbInfo) && (!dbInfo.equals(AppConstants.DB_LOCAL))) { try { - org.onap.portalsdk.analytics.util.RemDbInfo remDbInfo = - new org.onap.portalsdk.analytics.util.RemDbInfo(); dbType = remDbInfo.getDBType(dbInfo); } catch (Exception ex) { throw new RaptorException(ex); @@ -3897,7 +3582,6 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { } List reportCols = getAllColumns(); String wholeSQL_OrderBy = getWholeSQL(); - String reportSQL = getWholeSQL(); reportSQL = reportSQL.replace(";", ""); setWholeSQL(reportSQL); if (nvl(reportSQL).length() > 0) @@ -3907,8 +3591,7 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { if (nvl(reportSQL).toUpperCase().indexOf("GROUP BY ") < 0) if (getDataSourceList().getDataSource().size() > 0) { - DataSourceType dst = (DataSourceType) getDataSourceList().getDataSource() - .get(0); + DataSourceType dst = (DataSourceType) getDataSourceList().getDataSource().get(0); String tId = dst.getTableId(); String tPK = dst.getTablePK(); if (nvl(tPK).length() > 0) { @@ -3920,23 +3603,20 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { sortBy.append(tId); sortBy.append("."); sortBy.append(st.nextToken()); - } // while } - } // if + } + } if (nvl(reportSQL).trim().toUpperCase().startsWith("SELECT")) { - // if (!(dbType.equals("DAYTONA") && reportSQL.trim().toUpperCase().startsWith("SELECT"))) - // reportSQL += " ORDER BY " + ((sortBy == null) ? "1" : sortBy.toString()); + } } StringBuffer colNames = new StringBuffer(); StringBuffer colExtraIdNames = new StringBuffer(); StringBuffer colExtraDateNames = new StringBuffer(); -// if (getDBType() != null && getDBType().equals(AppConstants.ORACLE)) { -// colNames.append("rownum rnum"); -// } if (getColumnNamesFromReportSQL) { - DataSet ds = ConnectionUtils.getDataSet(reportSQL, dbInfo); + String getColumnDef = "SELECT * FROM ( "+reportSQL+ ") derivedtable WHERE 1 > 2 "; + DataSet ds = ConnectionUtils.getDataSet(getColumnDef, dbInfo); List reportCols1 = getAllColumns(); reportCols = new Vector(); outer: for (Iterator iter = reportCols1.iterator(); iter.hasNext();) { @@ -3972,73 +3652,44 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { for (Iterator iter = reportCols.iterator(); iter.hasNext();) { DataColumnType dc = (DataColumnType) iter.next(); - // TODO: commented if (dc.isVisible()) { if (colNames.length() > 0) colNames.append(", "); colNames.append(dc.getColId()); - // TODO uncomment if it's not working} // if - - // Checking for extra fields necessary for drill-down if (nvl(dc.getDrillDownURL()).length() > 0) if (isViewAction(dc.getDrillDownURL())) addExtraIdSelect(colExtraIdNames, nvl(dc.getDrillDownParams()), false); else - addExtraDateSelect(colExtraDateNames, nvl(dc.getDrillDownParams()), null, - false); - } // for + addExtraDateSelect(colExtraDateNames, nvl(dc.getDrillDownParams()), null, false); + } if (reportSQL.toUpperCase().indexOf("GROUP BY ") < 0) colNames.append(colExtraIdNames.toString()); - // commented to avoid coldId_dde - // colNames.append(colExtraDateNames.toString()); - - /* - * if(pageNo==0) if(reportSQL.toUpperCase().indexOf(" WHERE ")<0) - * if(reportSQL.toUpperCase().indexOf(" GROUP BY ")<0) reportSQL = reportSQL.substring(0, - * reportSQL.toUpperCase().indexOf(" ORDER BY "))+" WHERE ROWNUM <= - * "+getPageSize()+reportSQL.substring(reportSQL.toUpperCase().indexOf(" ORDER BY - * ")); else reportSQL = "SELECT "+colNames.toString()+" FROM (SELECT ROWNUM rnum, - * "+colNames.toString()+" FROM ("+reportSQL+") x) y WHERE rnum <= "+getPageSize()+" ORDER BY rnum"; - * else reportSQL = reportSQL.substring(0, reportSQL.toUpperCase().indexOf(" WHERE "))+" WHERE - * ROWNUM <= "+getPageSize()+" AND "+reportSQL.substring(reportSQL.toUpperCase().indexOf(" WHERE - * ")+7); else reportSQL = "SELECT "+colNames.toString()+" FROM (SELECT ROWNUM rnum, - * "+colNames.toString()+" FROM ("+reportSQL+") x) y WHERE rnum >= "+(pageNo*getPageSize()+1)+" AND - * rnum <= "+((pageNo+1)*getPageSize())+" ORDER BY rnum"; - */ + if ("DAYTONA".equals(dbType) && reportSQL.trim().toUpperCase().startsWith("SELECT")) { if (endRow == -1) - endRow = (getMaxRowsInExcelDownload() > 0) ? getMaxRowsInExcelDownload() : Globals.getDownloadLimit(); + endRow = (getMaxRowsInExcelDownload() > 0) ? getMaxRowsInExcelDownload() + : Globals.getDownloadLimit(); reportSQL = reportSQL + " LIMIT TO " + (startRow == 0 ? startRow + 1 : startRow) + "->" + endRow; return reportSQL; } else if ("DAYTONA".equals(dbType)) { return reportSQL; } - // reportSQL = "SELECT " + colNames.toString() + " FROM (SELECT ROWNUM rnum, " - // + colNames.toString() + " FROM (" + reportSQL + ") x "; String rSQL = Globals.getGenerateSubsetSql(); rSQL = rSQL.replace("[colNames.toString()]", colNames.toString()); rSQL = rSQL.replace("[reportSQL]", reportSQL); reportSQL = rSQL; - // added rownum for total report where row header need to be shown - // reportSQLOnlyFirstPart = "SELECT rnum," + colNames.toString() + " FROM (SELECT ROWNUM rnum, " - // + colNames.toString() + " FROM (" ; reportSQLOnlyFirstPart = Globals.getReportSqlOnlyFirstPart(); reportSQLOnlyFirstPart = reportSQLOnlyFirstPart.replace("[colNames.toString()]", colNames.toString()); reportSQLWithRowNum = reportSQL; - /* - * if( endRow != -1) reportSQL += " WHERE ROWNUM <= " + endRow; reportSQL += " ) y WHERE rnum >= " + - * startRow + " ORDER BY rnum"; return reportSQL; - */ String parta = Globals.getReportSqlOnlySecondPartA(); String partb = Globals.getReportSqlOnlySecondPartB(); - String partSql = ""; if (!AppUtils.isNotEmpty(getDBType())) { setDBType(Globals.getDBType()); } @@ -4057,50 +3708,41 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { partSql += " " + orderbyclause + " "; } + CachingUtils.putPageSql(request.getSession().getId()+getWholeSQL(), partSql); + CachingUtils.putReportSql(request.getSession().getId()+getWholeSQL(), reportSQL); + }else { + if (!AppUtils.isNotEmpty(getDBType())) { + setDBType(Globals.getDBType()); + } + } + if(startRow >= 0 && CachingUtils.isReportSqlExists(request.getSession().getId()+getWholeSQL()) ) { + partSql = CachingUtils.getPageSql(request.getSession().getId()+getWholeSQL()); + reportSQL = CachingUtils.getReportSql(request.getSession().getId()+getWholeSQL()); + } + if (getDBType().equals(AppConstants.MYSQL)) { partSql = partSql + " LIMIT " + String.valueOf(startRow) + " , " + String.valueOf(endRow); } else if (getDBType().equals(AppConstants.ORACLE)) { - reportSQL = reportSQL.replace(" AS ", " "); partSql = "where rnum >= " + String.valueOf(startRow) + " and rnum <= " - + (Integer.parseInt(String.valueOf(startRow)) + Integer.parseInt(String.valueOf(endRow))); + + ( Integer.parseInt(String.valueOf(endRow))); } else if (getDBType().equals(AppConstants.POSTGRESQL)) { - partSql = partSql + " LIMIT " + String.valueOf(endRow) + " , " + String.valueOf(startRow);// limit - // [pageSize] - // offset - // [startRow] + partSql = partSql + " LIMIT " + String.valueOf(endRow) + " , " + String.valueOf(startRow); } - // Limit only to MYSQL or MariaDB - // if (reportSQL.toUpperCase().indexOf("ORDER BY ") < 0) - // partSql += " ORDER BY 1"; - // else { - - /* - * if(!Globals.isMySQL()) parta = parta.replace("[endRow]", String.valueOf(endRow)); else parta = - * parta.replace("[startRow]", String.valueOf(startRow)); - * - * //String partb = Globals.getReportSqlOnlySecondPartB(); if(!Globals.isMySQL()) partb = - * partb.replace("[startRow]", String.valueOf(startRow)); else partb = partb.replace("[pageSize]", - * String.valueOf(getPageSize())); - * - * if( endRow != -1) reportSQL += parta; - */ + reportSQL += partSql; return reportSQL; - } // generateSubsetSQL + } public String generateChartSQL(ReportParamValues paramValues, String userId, HttpServletRequest request) throws RaptorException { List reportCols = getAllColumns(); - List chartValueCols = getChartValueColumnsList(AppConstants.CHART_ALL_COLUMNS, null); // parameter is 0 has this - // requires all columns. + List chartValueCols = getChartValueColumnsList(AppConstants.CHART_ALL_COLUMNS, null); String reportSQL = generateSQL(userId, request); - // if(nvl(reportSQL).length()>0) reportSQL = generatedChartSQL; logger.debug(EELFLoggerDelegate.debugLogger, ("SQL " + reportSQL)); String legendCol = "1 a"; - // String valueCol = "1"; StringBuffer groupCol = new StringBuffer(); StringBuffer seriesCol = new StringBuffer(); StringBuffer valueCols = new StringBuffer(); @@ -4110,39 +3752,25 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { String colName = getColumnSelectStr(dc, paramValues); if (nvl(dc.getColOnChart()).equals(AppConstants.GC_LEGEND)) legendCol = getSelectExpr(dc, colName) + " " + dc.getColId(); - // if(dc.getChartSeq()>0) - // valueCol = "NVL("+colName+", 0) "+dc.getColId(); if ((!nvl(dc.getColOnChart()).equals(AppConstants.GC_LEGEND)) && (dc.getChartSeq() == null || dc.getChartSeq() <= 0) && dc.isGroupBreak()) { groupCol.append(", "); groupCol.append(colName + " " + dc.getColId()); } - } // for + } for (Iterator iter = reportCols.iterator(); iter.hasNext();) { DataColumnType dc = (DataColumnType) iter.next(); if (dc.isChartSeries() != null && dc.isChartSeries().booleanValue()) { - // System.out.println("*****************, "+ " " +getColumnSelectStr(dc, paramValues)+ " "+ - // getSelectExpr(dc,getColumnSelectStr(dc, paramValues))); seriesCol.append(", " + getSelectExpr(dc, getColumnSelectStr(dc, paramValues)) + " " + dc.getColId()); } } - /* - * for (Iterator iter = reportCols.iterator(); iter.hasNext();) { DataColumnType dc = - * (DataColumnType) iter.next(); if(!dc.isChartSeries() && - * !(nvl(dc.getColOnChart()).equals(AppConstants.GC_LEGEND))) { - * //System.out.println("*****************, "+ " " +getColumnSelectStr(dc, paramValues)+ " "+ - * getSelectExpr(dc,getColumnSelectStr(dc, paramValues))); seriesCol.append(", "+ - * formatChartColumn(getSelectExpr(dc,getColumnSelectStr(dc, paramValues)))+ " " + dc.getColId()); } - * } - */ for (Iterator iter = chartValueCols.iterator(); iter.hasNext();) { DataColumnType dc = (DataColumnType) iter.next(); String colName = getColumnSelectStr(dc, paramValues); - // valueCols.append(", NVL(" + formatChartColumn(colName) + ",0) " + dc.getColId()); seriesCol.append("," + formatChartColumn(colName) + " " + dc.getColId()); - } // for + } for (Iterator iter = reportCols.iterator(); iter.hasNext();) { DataColumnType dc = (DataColumnType) iter.next(); @@ -4165,38 +3793,11 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { seriesCol.append(", " + AppConstants.RI_ANOMALY_TEXT + " " + AppConstants.RI_ANOMALY_TEXT); } - // debugLogger.debug("ReportSQL Chart " + reportSQL ); - /* - * for (Iterator iter = chartValueCols.iterator(); iter.hasNext();) { DataColumnType dc = - * (DataColumnType) iter.next(); String colName = getColumnSelectStr(dc, paramValues); - * //valueCols.append(", NVL(" + formatChartColumn(colName) + ",0) " + dc.getColId()); - * valueCols.append("," + formatChartColumn(colName) + " " + dc.getColId()); } // for for (Iterator - * iter = reportCols.iterator(); iter.hasNext();) { DataColumnType dc = (DataColumnType) - * iter.next(); String colName = getColumnSelectStr(dc, paramValues); - * //if(colName.equals(AppConstants.RI_CHART_TOTAL_COL) || - * colName.equals(AppConstants.RI_CHART_COLOR)) { - * if(colName.equals(AppConstants.RI_CHART_TOTAL_COL)) valueCols.append(", " + - * AppConstants.RI_CHART_TOTAL_COL + " " + AppConstants.RI_CHART_TOTAL_COL ); if - * (colName.equals(AppConstants.RI_CHART_COLOR)) valueCols.append(", " + AppConstants.RI_CHART_COLOR - * + " " + AppConstants.RI_CHART_COLOR ); if (colName.equals(AppConstants.RI_CHART_INCLUDE)) - * valueCols.append(", " + AppConstants.RI_CHART_INCLUDE + " " + AppConstants.RI_CHART_INCLUDE ); - * //} } - */ + String final_sql = ""; reportSQL = Utils.replaceInString(reportSQL, " from ", " FROM "); reportSQL = Utils.replaceInString(reportSQL, " select ", " SELECT "); reportSQL = Utils.replaceInString(reportSQL, " union ", " UNION "); - // reportSQL = reportSQL.replaceAll("[\\s]*\\(", "("); - // if(reportSQL.indexOf("UNION") != -1) { - // if(reportSQL.indexOf("FROM(")!=-1) - // final_sql += " "+reportSQL.substring(reportSQL.indexOf("FROM(") ); - // else if (reportSQL.indexOf("FROM (")!=-1) - // final_sql += " "+reportSQL.substring(reportSQL.indexOf("FROM (") ); - // //TODO ELSE THROW ERROR - // } - // else { - // final_sql += " "+reportSQL.substring(reportSQL.toUpperCase().indexOf(" FROM ")); - // } int pos = 0; int pos_first_select = 0; int pos_dup_select = 0; @@ -4205,11 +3806,10 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { if (reportSQL.indexOf("FROM", pos) != -1) { pos = reportSQL.indexOf("FROM", pos); pos_dup_select = reportSQL.lastIndexOf("SELECT", pos); - pos_first_select = reportSQL.indexOf("SELECT");// ,pos); + pos_first_select = reportSQL.indexOf("SELECT"); logger.debug(EELFLoggerDelegate.debugLogger, ("pos_select " + pos_first_select + " " + pos_dup_select)); if (pos_dup_select > pos_first_select) { logger.debug(EELFLoggerDelegate.debugLogger, ("********pos_dup_select ********" + pos_dup_select)); - // pos_dup_select1 = pos_dup_select; pos_prev_select = pos_first_select; pos_last_select = pos_dup_select; while (pos_last_select > pos_prev_select) { @@ -4232,7 +3832,7 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { logger.debug(EELFLoggerDelegate.debugLogger, ("Final sql in generateChartSQL " + sql)); return sql; - } // generateChartSQL + } private String formatChartColumn(String colName) { @@ -4240,7 +3840,6 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { colName = colName.trim(); colName = Utils.replaceInString(colName, "TO_CHAR", "to_char"); colName = Utils.replaceInString(colName, "to_number", "TO_NUMBER"); - // reportSQL = reportSQL.replaceAll("[\\s]*\\(", "("); colName = colName.replaceAll(",[\\s]*\\(", ",("); StringBuffer colNameBuf = new StringBuffer(colName); int pos = 0; @@ -4257,15 +3856,11 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { colNameBuf.insert(pos, " TO_NUMBER ( CR_RAPTOR.SAFE_TO_NUMBER ("); pos = colNameBuf.indexOf("to_char"); colNameBuf.replace(pos, pos + 7, "TO_CHAR"); - // colName = Utils.replaceInString(colNameBuf.toString(), "to_char", " TO_NUMBER ( - // CR_RAPTOR.SAFE_TO_NUMBER ( TO_CHAR "); logger.debug(EELFLoggerDelegate.debugLogger, ("After adding to_number " + colNameBuf.toString())); - // posFormatStart = colNameBuf.lastIndexOf(",'")+1; posFormatStart = colNameBuf.indexOf(",'", pos) + 1; posFormatEnd = colNameBuf.indexOf(")", posFormatStart); logger.debug(EELFLoggerDelegate.debugLogger, (posFormatStart + " " + posFormatEnd + " " + pos)); format = colNameBuf.substring(posFormatStart, posFormatEnd); - // posFormatEnd = colNameBuf.indexOf(")",posFormatEnd); colNameBuf.insert(posFormatEnd + 1, " ," + format + ") , " + format + ")"); logger.debug(EELFLoggerDelegate.debugLogger, ("colNameBuf " + colNameBuf.toString())); } @@ -4278,7 +3873,6 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { throws RaptorException { List reportCols = getAllColumns(); String reportSQL = generateSQL(userId, request); - // debugLogger.debug("After GenerateSQL " + reportSQL); StringBuffer sbSelect = new StringBuffer(); StringBuffer sbTotal = new StringBuffer(); @@ -4293,9 +3887,6 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { for (Iterator iter = reportCols.iterator(); iter.hasNext();) { DataColumnType dct = (DataColumnType) iter.next(); - // if (!dct.isVisible()) - // continue; - String colName = getColumnSelectStr(dct, paramValues); sbSelect.append((sbSelect.length() == 0) ? "SELECT " : ", "); @@ -4306,8 +3897,6 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { sbTotal.append((sbTotal.length() == 0) ? "SELECT " : ", "); if (nvl(dct.getDisplayTotal()).length() > 0) { - // sbTotal.append(getSelectExpr(dct, - // dct.getDisplayTotal()+dct.getColId()+")")); String displayTotal = dct.getDisplayTotal(); StringBuffer sb = new StringBuffer(); for (int i = 0; i < displayTotal.length(); i++) { @@ -4315,28 +3904,21 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { if (ch == '+' || ch == '-') sb.append(dct.getColId() + ")"); sb.append(ch); - } // for + } sb.append(dct.getColId() + ")"); - - // debugLogger.debug("SB " + sb.toString() + "\n " + getSelectExpr(dct, sb.toString())); sbTotal.append(getSelectExpr(dct, sb.toString())); - // debugLogger.debug("SBTOTAL " + sbTotal.toString()); } else sbTotal.append("NULL"); sbTotal.append(" total_"); sbTotal.append(dct.getColId()); - } // for + } - // debugLogger.debug(" ****** " + sbTotal.toString()); logger.debug(EELFLoggerDelegate.debugLogger, ("REPORTWRAPPER " + reportSQL)); int pos = 0; int pos_first_select = 0; int pos_dup_select = 0; int pos_prev_select = 0; int pos_last_select = 0; - - // reportSQL = Utils.replaceInString(reportSQL, " from ", " FROM "); - // reportSQL = Utils.replaceInString(reportSQL, "select ", "SELECT "); reportSQL = replaceNewLine(reportSQL, " from ", " FROM "); reportSQL = replaceNewLine(reportSQL, "from ", " FROM "); reportSQL = replaceNewLine(reportSQL, "FROM ", " FROM "); @@ -4351,7 +3933,6 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { logger.debug(EELFLoggerDelegate.debugLogger, ("pos_select " + pos_first_select + " " + pos_dup_select)); if (pos_dup_select > pos_first_select) { logger.debug(EELFLoggerDelegate.debugLogger, ("********pos_dup_select ********" + pos_dup_select)); - // pos_dup_select1 = pos_dup_select; pos_prev_select = pos_first_select; pos_last_select = pos_dup_select; while (pos_last_select > pos_prev_select) { @@ -4366,10 +3947,7 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { } - // sbSelect.append(reportSQL.substring(reportSQL.toUpperCase().indexOf(" FROM "))); - logger.debug(EELFLoggerDelegate.debugLogger, (" *************** " + pos + " " + reportSQL)); - // sbSelect.append(" "+ reportSQL.substring(pos)); sbSelect.append(" " + reportSQL.substring(pos)); logger.debug(EELFLoggerDelegate.debugLogger, (" **************** " + sbSelect.toString())); sbTotal.append(" FROM ("); @@ -4380,8 +3958,6 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { String dbInfo = getDBInfo(); if (!isNull(dbInfo) && (!dbInfo.equals(AppConstants.DB_LOCAL))) { try { - org.onap.portalsdk.analytics.util.RemDbInfo remDbInfo = - new org.onap.portalsdk.analytics.util.RemDbInfo(); dbType = remDbInfo.getDBType(dbInfo); } catch (Exception ex) { throw new RaptorException(ex); @@ -4393,14 +3969,12 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { String sql = sbTotal.toString(); sql = Utils.replaceInString(sql, " from ", " FROM "); sql = Utils.replaceInString(sql, "select ", "SELECT "); - // sql = Utils.replaceInString(sql, " select ", " SELECT "); logger.debug(EELFLoggerDelegate.debugLogger, ("Before SQL Corrector " + sql)); String corrected_SQL = new SQLCorrector().fixSQL(new StringBuffer(sql)); logger.debug(EELFLoggerDelegate.debugLogger, ("************")); logger.debug(EELFLoggerDelegate.debugLogger, ("Corrected SQL " + corrected_SQL)); return corrected_SQL; - // return sbTotal.toString(); - } // generateTotalSQLLinear + } public String generateTotalSQLCrossTab(String sql, String rowColPos, String userId, HttpServletRequest request, ReportParamValues paramValues) throws RaptorException { @@ -4409,7 +3983,6 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { StringBuffer sbSelect = new StringBuffer(); StringBuffer sbGroup = new StringBuffer(); - // StringBuffer sbOrder = new StringBuffer(); StringBuffer sbTotal = new StringBuffer(); StringBuffer colNames = new StringBuffer(); for (Iterator iter = reportCols.iterator(); iter.hasNext();) { @@ -4431,32 +4004,26 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { sbSelect.append((sbSelect.length() == 0) ? "SELECT " : ", "); if (nvl(dct.getCrossTabValue()).equals(rowColPos)) { - // sbSelect.append(colExpr); sbSelect.append(dct.getColId()); sbGroup.append((sbGroup.length() == 0) ? " GROUP BY " : ", "); sbGroup.append(dct.getColId()); - /* - * sbOrder.append((sbOrder.length()==0)?" ORDER BY ":", "); sbOrder.append(dct.getColId()); - * if(dct.getColType().equals(AppConstants.CT_DATE)) sbOrder.append(" DESC"); - */ - sbTotal.append((sbTotal.length() == 0) ? "SELECT " : ", "); sbTotal.append(dct.getColId()); } else if (nvl(dct.getCrossTabValue()).equals(AppConstants.CV_VALUE)) { - // sbSelect.append(colName); + sbSelect.append(dct.getColId()); String displayTotal = getCrossTabDisplayTotal(rowColPos); if (displayTotal.length() > 0) { - // displayTotal += dct.getColId()+")"; + StringBuffer sb = new StringBuffer(); for (int i = 0; i < displayTotal.length(); i++) { char ch = displayTotal.charAt(i); if (ch == '+' || ch == '-') sb.append(dct.getColId() + ")"); sb.append(ch); - } // for + } sb.append(dct.getColId() + ")"); displayTotal = sb.toString(); @@ -4468,13 +4035,13 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { sbTotal.append(" total_"); sbTotal.append(dct.getColId()); } else { - // sbSelect.append(colExpr); + sbSelect.append(dct.getColId()); - } // if + } sbSelect.append(" "); sbSelect.append(dct.getColId()); - } // for + } sbSelect.append(reportSQL.substring(reportSQL.toUpperCase().indexOf(" FROM "))); @@ -4486,8 +4053,6 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { String dbInfo = getDBInfo(); if (!isNull(dbInfo) && (!dbInfo.equals(AppConstants.DB_LOCAL))) { try { - org.onap.portalsdk.analytics.util.RemDbInfo remDbInfo = - new org.onap.portalsdk.analytics.util.RemDbInfo(); dbType = remDbInfo.getDBType(dbInfo); } catch (Exception ex) { throw new RaptorException(ex); @@ -4497,10 +4062,6 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { sbTotal.append("(" + colNames + ")"); } - // sbTotal.append(sbOrder.toString()); - - // debugLogger.debug(getReportDefType() + " " + AppConstants.RD_SQL_BASED); - // debugLogger.debug("SQL To Delete " + sbTotal.toString()); sql = ""; if (getReportDefType().equals(AppConstants.RD_SQL_BASED)) { sql = Utils.replaceInString(sbTotal.toString(), " from ", " FROM "); @@ -4510,7 +4071,7 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { return sbTotal.toString(); - } // generateTotalSQLCrossTab + } public String generateTotalSQLCrossTab(ReportParamValues paramValues, String rowColPos, String userId, HttpServletRequest request) throws RaptorException { @@ -4519,7 +4080,6 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { StringBuffer sbSelect = new StringBuffer(); StringBuffer sbGroup = new StringBuffer(); - // StringBuffer sbOrder = new StringBuffer(); StringBuffer sbTotal = new StringBuffer(); StringBuffer colNames = new StringBuffer(); for (Iterator iter = reportCols.iterator(); iter.hasNext();) { @@ -4546,11 +4106,6 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { sbGroup.append((sbGroup.length() == 0) ? " GROUP BY " : ", "); sbGroup.append(dct.getColId()); - /* - * sbOrder.append((sbOrder.length()==0)?" ORDER BY ":", "); sbOrder.append(dct.getColId()); - * if(dct.getColType().equals(AppConstants.CT_DATE)) sbOrder.append(" DESC"); - */ - sbTotal.append((sbTotal.length() == 0) ? "SELECT " : ", "); sbTotal.append(dct.getColId()); } else if (nvl(dct.getCrossTabValue()).equals(AppConstants.CV_VALUE)) { @@ -4558,14 +4113,13 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { String displayTotal = getCrossTabDisplayTotal(rowColPos); if (displayTotal.length() > 0) { - // displayTotal += dct.getColId()+")"; StringBuffer sb = new StringBuffer(); for (int i = 0; i < displayTotal.length(); i++) { char ch = displayTotal.charAt(i); if (ch == '+' || ch == '-') sb.append(dct.getColId() + ")"); sb.append(ch); - } // for + } sb.append(dct.getColId() + ")"); displayTotal = sb.toString(); @@ -4578,11 +4132,11 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { sbTotal.append(dct.getColId()); } else { sbSelect.append(colExpr); - } // if + } sbSelect.append(" "); sbSelect.append(dct.getColId()); - } // for + } sbSelect.append(reportSQL.substring(reportSQL.toUpperCase().indexOf(" FROM "))); @@ -4594,8 +4148,6 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { String dbInfo = getDBInfo(); if (!isNull(dbInfo) && (!dbInfo.equals(AppConstants.DB_LOCAL))) { try { - org.onap.portalsdk.analytics.util.RemDbInfo remDbInfo = - new org.onap.portalsdk.analytics.util.RemDbInfo(); dbType = remDbInfo.getDBType(dbInfo); } catch (Exception ex) { throw new RaptorException(ex); @@ -4605,10 +4157,6 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { sbTotal.append("(" + colNames + ")"); } - // sbTotal.append(sbOrder.toString()); - - // debugLogger.debug(getReportDefType() + " " + AppConstants.RD_SQL_BASED); - // debugLogger.debug("SQL To Delete " + sbTotal.toString()); String sql = ""; if (getReportDefType().equals(AppConstants.RD_SQL_BASED)) { sql = Utils.replaceInString(sbTotal.toString(), " from ", " FROM "); @@ -4618,7 +4166,7 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { return sbTotal.toString(); - } // generateTotalSQLCrossTab + } public String generateDistinctValuesSQL(ReportParamValues paramValues, DataColumnType dct, String userId, HttpServletRequest request) throws RaptorException { @@ -4631,8 +4179,6 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { if (getReportDefType().equals(AppConstants.RD_SQL_BASED)) { sb.append(dct.getColId()); sb.append(" FROM ("); - // paramvalues added below to filter distinct values based on formfields. - // sb.append(generateSQL(paramValues, userId, request)); sb.append(rr.getWholeSQL()); sb.append(") " + (Globals.isPostgreSQL() || Globals.isMySQL() ? " AS " : "") + " report_sql ORDER BY 1"); } else { @@ -4642,7 +4188,7 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { if (!colExpr.equals(colName)) { sb.append(", "); sb.append(colName); - } // if + } sb.append(" FROM "); sb.append(dst.getTableName()); sb.append(" "); @@ -4651,14 +4197,10 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { sb.append(colName); if (dct.getColType().equals(AppConstants.CT_DATE)) sb.append(" DESC"); - } // else + } return sb.toString(); - } // generateDistinctValuesSQL - - /** - * ************************************************************************************************* - */ + } public DataSourceType getTableWithoutColumns() { List dsList = getDataSourceList().getDataSource(); @@ -4667,10 +4209,10 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { if (ds.getDataColumnList().getDataColumn().isEmpty()) return ds; - } // for + } return null; - } // getTableWithoutColumns + } public CustomReportType cloneCustomReportClearTables() throws RaptorException { ReportWrapper nrw = new ReportWrapper(cloneCustomReport(), reportID, getOwnerID(), @@ -4682,7 +4224,7 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { nrw.deleteDataSourceType(ndst.getTableId()); return nrw.getCustomReport(); - } // cloneCustomReportClearTables + } public String marshal() throws RaptorException { StringWriter sw = new StringWriter(); @@ -4692,9 +4234,6 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { JAXBContext jc = JAXBContext.newInstance("org.onap.portalsdk.analytics.xmlobj"); Marshaller m = jc.createMarshaller(); m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); - // JAXBElement jaxbElement = new JAXBElement(new QName("customReport"), Object.class, ""); - // m.marshal( System.out ); - // m.marshal(jaxbElement, new StreamResult(sw)); m.marshal( (getTableWithoutColumns() == null) ? objFactory.createCustomReport(cr) : objFactory.createCustomReport(cloneCustomReportClearTables()), @@ -4704,10 +4243,9 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { throw new RaptorException(ex.getMessage(), ex.getCause()); } return sw.toString(); - } // marshal + } public static CustomReportType unmarshalCR(String reportXML) throws RaptorException { - // CustomReport cr = null; try { JAXBContext jc = JAXBContext.newInstance("org.onap.portalsdk.analytics.xmlobj"); Unmarshaller u = jc.createUnmarshaller(); @@ -4720,19 +4258,16 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { throw new RaptorException(ex.getMessage(), ex.getCause()); } - } // unmarshal + + } protected static CustomReportType createBlankCR() throws RaptorException { return createBlankCR("N/A"); - } // createBlank - + } protected static CustomReportType createBlankCR(String createID) throws RaptorException { ObjectFactory objFactory = new ObjectFactory(); CustomReportType cr = objFactory.createCustomReportType(); - // CustomReport cr = null; try { - // cr = (CustomReport) objFactory.createCustomReport(customReportType); - cr.setReportName(""); cr.setReportDescr(""); cr.setChartType(""); @@ -4749,7 +4284,7 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { throw new RaptorException(ex.getMessage(), ex.getCause()); } return cr; - } // createBlank + } protected void replaceCustomReportWithClone() throws RaptorException { try { @@ -4765,11 +4300,7 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { + reportID + "]. Exception: " + e.getMessage(), e.getCause()); } - } // replaceCustomReportWithClone - - /** - * ************************************************************************************************* - */ + } public FormatType cloneFormatType(ObjectFactory objFactory, FormatType ft) throws JAXBException { @@ -4796,7 +4327,7 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { nft.setFormatId(ft.getFormatId()); return nft; - } // cloneFormatType + } public SemaphoreType cloneSemaphoreType(ObjectFactory objFactory, SemaphoreType st) throws JAXBException { @@ -4818,7 +4349,7 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { } // if return nst; - } // cloneSemaphoreType + } public Reports cloneDashboardType(ObjectFactory objFactory, Reports rpt) throws JAXBException { @@ -4827,7 +4358,7 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { nrpt.setReportId(rpt.getReportId()); nrpt.setBgcolor(rpt.getBgcolor()); return nrpt; - } // cloneDashboardType + } public Marker cloneMarkerType(ObjectFactory objFactory, Marker marker) throws JAXBException { @@ -4837,7 +4368,7 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { nMarker.setDataHeader(marker.getDataHeader()); nMarker.setMarkerColor(marker.getMarkerColor()); return nMarker; - } // cloneDashboardType + } public ChartDrillFormfield cloneChartDrillFormfield(ObjectFactory objFactory, ChartDrillFormfield chartDrillFormfield) @@ -4845,7 +4376,7 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { ChartDrillFormfield nChartDrillFormfield = objFactory.createChartDrillFormfield(); nChartDrillFormfield.setFormfield(chartDrillFormfield.getFormfield()); return nChartDrillFormfield; - } // cloneDashboardType + } public boolean isChartDrillDownContainsName(String name) { for (Iterator iter = getChartDrillOptions().getTargetFormfield().iterator(); iter @@ -4868,16 +4399,16 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { nfft.setFieldType(fft.getFieldType()); if (nvl(fft.getVisible()).length() > 0) nfft.setVisible(fft.getVisible()); - if (nvl(fft.getValidationType()).length() > 0) + if (nvl(fft.getValidationType()).length() > 0 || (fft.getValidationType() != null && fft.getValidationType().isEmpty())) nfft.setValidationType(fft.getValidationType()); if (nvl(fft.getMandatory()).length() > 0) nfft.setMandatory(fft.getMandatory()); - if (nvl(fft.getDefaultValue()).length() > 0) + if (nvl(fft.getDefaultValue()).length() > 0 || (fft.getDefaultValue() != null && fft.getDefaultValue().isEmpty())) nfft.setDefaultValue(fft.getDefaultValue()); nfft.setOrderBySeq(fft.getOrderBySeq()); - if (nvl(fft.getFieldSQL()).length() > 0) + if (nvl(fft.getFieldSQL()).length() > 0 || (fft.getFieldSQL() != null && fft.getFieldSQL().isEmpty())) nfft.setFieldSQL(fft.getFieldSQL()); - if (nvl(fft.getFieldDefaultSQL()).length() > 0) + if (nvl(fft.getFieldDefaultSQL()).length() > 0 || (fft.getFieldDefaultSQL() != null && fft.getFieldDefaultSQL().isEmpty())) nfft.setFieldDefaultSQL(fft.getFieldDefaultSQL()); if (fft.getRangeStartDate() != null) nfft.setRangeStartDate(fft.getRangeStartDate()); @@ -4898,7 +4429,7 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { for (Iterator iter = fft.getPredefinedValueList().getPredefinedValue().iterator(); iter .hasNext();) predefinedValueList.getPredefinedValue().add(new String((String) iter.next())); - } // if + } if (nvl(fft.getDependsOn()).length() > 0) nfft.setDependsOn(fft.getDependsOn()); @@ -4909,7 +4440,7 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { nfft.setFieldId(fft.getFieldId()); return nfft; - } // cloneFormFieldType + } public JavascriptItemType cloneJavascriptType(ObjectFactory objFactory, JavascriptItemType jit) throws JAXBException { @@ -4919,7 +4450,7 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { njit.setFieldId(jit.getFieldId()); njit.setCallText(jit.getCallText()); return njit; - } // cloneJavascriptType + } public ColFilterType cloneColFilterType(ObjectFactory objFactory, ColFilterType cft) throws JAXBException { @@ -4941,7 +4472,7 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { ncft.setComment(cft.getComment()); return ncft; - } // cloneColFilterType + } public DataColumnType cloneDataColumnType(ObjectFactory objFactory, DataColumnType dct) throws JAXBException { @@ -5022,7 +4553,7 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { .hasNext();) colFilterList.getColFilter().add( cloneColFilterType(objFactory, (ColFilterType) iter.next())); - } // if + } if (nvl(dct.getSemaphoreId()).length() > 0) ndct.setSemaphoreId(dct.getSemaphoreId()); @@ -5055,11 +4586,8 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { ndct.setColId(dct.getColId()); - // ndct.setSemaphoreId(nvl(dct.getSemaphoreId())); - // if(nvl(dct.getDbColType()).length()>0) - // ndct.setDbColType(dct.getDbColType()); return ndct; - } // cloneDataColumnType + } public DataSourceType cloneDataSourceType(ObjectFactory objFactory, DataSourceType dst) throws JAXBException { @@ -5084,21 +4612,20 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { ndst.setTableId(dst.getTableId()); return ndst; - } // cloneDataSourceType + } public CustomReportType cloneCustomReport() throws RaptorException { ObjectFactory objFactory = new ObjectFactory(); CustomReportType ncr = objFactory.createCustomReportType(); - - // CustomReport ncr = null; try { - // ncr = (CustomReport) objFactory.createCustomReport(customReportType); ncr.setReportName(cr.getReportName()); ncr.setReportDescr(cr.getReportDescr()); if (nvl(cr.getNumDashCols()).length() > 0) ncr.setNumDashCols(cr.getNumDashCols()); if (nvl(cr.getDashboardLayoutHTML()).length() > 0) ncr.setDashboardLayoutHTML(cr.getDashboardLayoutHTML()); + if (nvl(cr.getDashboardLayoutJSON()).length() > 0) + ncr.setDashboardLayoutJSON(cr.getDashboardLayoutJSON()); if (nvl(cr.getDbInfo()).length() > 0) ncr.setDbInfo(cr.getDbInfo()); ncr.setChartType(cr.getChartType()); @@ -5137,31 +4664,17 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { ncr.setWidthNoColumn(cr.getWidthNoColumn()); if (nvl(cr.getDataGridAlign()).length() > 0) ncr.setDataGridAlign(cr.getDataGridAlign()); - -// if (nvl(cr.getReportFooter()).length() > 0) ncr.setReportFooter(cr.getReportFooter()); -// if (nvl(cr.getNumFormCols()).length() > 0) ncr.setNumFormCols(cr.getNumFormCols()); -// if (nvl(cr.getDisplayOptions()).length() > 0) ncr.setDisplayOptions(cr.getDisplayOptions()); -// if (nvl(cr.getDataContainerHeight()).length() > 0) ncr.setDataContainerHeight(cr.getDataContainerHeight()); -// if (nvl(cr.getDataContainerWidth()).length() > 0) ncr.setDataContainerWidth(cr.getDataContainerWidth()); -// if (nvl(cr.getAllowSchedule()).length() > 0) ncr.setAllowSchedule(cr.getAllowSchedule()); -// if (nvl(cr.getTopDown()).length() > 0) ncr.setTopDown(cr.getTopDown()); -// if (nvl(cr.getSizedByContent()).length() > 0) ncr.setSizedByContent(cr.getSizedByContent()); -// if (nvl(cr.getComment()).length() > 0) ncr.setComment(cr.getComment()); -// if (nvl(cr.getDashboardOptions()).length() > 0) ncr.setDashboardOptions(cr.getDashboardOptions()); - -// if (cr.isDashboardType() != null) ncr.setDashboardType(cr.isDashboardType()); -// if (cr.isReportInNewWindow() != null) ncr.setReportInNewWindow(cr.isReportInNewWindow()); ncr.setDisplayFolderTree(cr.isDisplayFolderTree()); if (cr.getDashBoardReports() == null) { @@ -5176,23 +4689,16 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { ncr.setDrillURLInPoPUpPresent( (cr.isDrillURLInPoPUpPresent() != null && cr.isDrillURLInPoPUpPresent().booleanValue()) ? true : false); - -// if (nvl(cr.getIsOneTimeScheduleAllowed()).length() > 0) ncr.setIsOneTimeScheduleAllowed(cr.getIsOneTimeScheduleAllowed()); -// if (nvl(cr.getIsHourlyScheduleAllowed()).length() > 0) ncr.setIsHourlyScheduleAllowed(cr.getIsHourlyScheduleAllowed()); -// if (nvl(cr.getIsDailyScheduleAllowed()).length() > 0) ncr.setIsDailyScheduleAllowed(cr.getIsDailyScheduleAllowed()); -// if (nvl(cr.getIsDailyMFScheduleAllowed()).length() > 0) ncr.setIsDailyMFScheduleAllowed(cr.getIsDailyMFScheduleAllowed()); -// if (nvl(cr.getIsWeeklyScheduleAllowed()).length() > 0) ncr.setIsWeeklyScheduleAllowed(cr.getIsWeeklyScheduleAllowed()); -// if (nvl(cr.getIsMonthlyScheduleAllowed()).length() > 0) ncr.setIsMonthlyScheduleAllowed(cr.getIsMonthlyScheduleAllowed()); ncr.setPageSize(cr.getPageSize()); ncr.setReportType(cr.getReportType()); - + ncr.setFormFieldGroupsJSON(cr.getFormFieldGroupsJSON()); DataSourceList dataSourceList = objFactory.createDataSourceList(); ncr.setDataSourceList(dataSourceList); @@ -5211,7 +4717,7 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { formFieldList.getFormField().add( cloneFormFieldType(objFactory, (FormFieldType) iter.next())); formFieldList.setComment(cr.getFormFieldList().getComment()); - } // if + } if (cr.getJavascriptList() != null) { JavascriptList javascriptList = objFactory.createJavascriptList(); @@ -5221,7 +4727,7 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { .hasNext();) javascriptList.getJavascriptItem().add( cloneJavascriptType(objFactory, (JavascriptItemType) iter.next())); - } // if + } if (cr.getSemaphoreList() != null) { SemaphoreList semaphoreList = objFactory.createSemaphoreList(); @@ -5232,7 +4738,7 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { semaphoreList.getSemaphore().add( cloneSemaphoreType(objFactory, (SemaphoreType) iter.next())); } - } // if + } if (nvl(cr.getDashboardOptions()).length() > 0) ncr.setDashboardOptions(cr.getDashboardOptions()); @@ -5255,7 +4761,7 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { dashboardReports.getReportsList().add( cloneDashboardType(objFactory, (Reports) iter.next())); } - } // if + } if (cr.getChartAdditionalOptions() != null) { ChartAdditionalOptions chartAdditionalOptions = objFactory.createChartAdditionalOptions(); @@ -5362,7 +4868,7 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { : new Integer(60)); ncr.setChartAdditionalOptions(chartAdditionalOptions); - } // if + } if (nvl(cr.getJavascriptElement()).length() > 0) ncr.setJavascriptElement(cr.getJavascriptElement()); @@ -5391,18 +4897,11 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { ncr.setChartDrillOptions(chartDrillOptions); } - -// if (nvl(cr.getIsOneTimeScheduleAllowed()).length() > 0) ncr.setIsOneTimeScheduleAllowed(cr.getIsOneTimeScheduleAllowed()); -// if (nvl(cr.getIsHourlyScheduleAllowed()).length() > 0) ncr.setIsHourlyScheduleAllowed(cr.getIsHourlyScheduleAllowed()); -// if (nvl(cr.getIsDailyScheduleAllowed()).length() > 0) ncr.setIsDailyScheduleAllowed(cr.getIsDailyScheduleAllowed()); -// if (nvl(cr.getIsDailyMFScheduleAllowed()).length() > 0) ncr.setIsDailyMFScheduleAllowed(cr.getIsDailyMFScheduleAllowed()); -// if (nvl(cr.getIsWeeklyScheduleAllowed()).length() > 0) ncr.setIsWeeklyScheduleAllowed(cr.getIsWeeklyScheduleAllowed()); -// if (nvl(cr.getIsMonthlyScheduleAllowed()).length() > 0) ncr.setIsMonthlyScheduleAllowed(cr.getIsMonthlyScheduleAllowed()); ncr.setPageSize(cr.getPageSize()); @@ -5447,194 +4946,15 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { ncr.setReportMap(repMap); } - } catch (JAXBException ex) { // try + } catch (JAXBException ex) { logger.error(EELFLoggerDelegate.debugLogger, "Exception occured in cloneCustomReport ", ex); throw new RaptorException(ex.getMessage(), ex.getCause()); } return ncr; - } // cloneCustomReport + } - /** - * ************************************************************************************************* - */ - // public void printFormatType(FormatType ft) { - // System.out.println("------------------------------------------------"); - // System.out.println("Semaphore Col Format"); - // System.out.println("------------------------------------------------"); - // System.out.println("FormatId: [" + ft.getFormatId() + "]"); - // System.out.println("LessThanValue: [" + ft.getLessThanValue() + "]"); - // System.out.println("Expression: [" + ft.getExpression() + "]"); - // System.out.println("Bold: [" + ft.isBold() + "]"); - // System.out.println("Italic: [" + ft.isItalic() + "]"); - // System.out.println("Underline: [" + ft.isUnderline() + "]"); - // System.out.println("BgColor: [" + ft.getBgColor() + "]"); - // System.out.println("FontColor: [" + ft.getFontColor() + "]"); - // System.out.println("FontFace: [" + ft.getFontFace() + "]"); - // System.out.println("FontSize: [" + ft.getFontSize() + "]"); - // System.out.println("Alignment: [" + ft.getAlignment() + "]"); - // System.out.println("Comment: [" + ft.getComment() + "]"); - // System.out.println("------------------------------------------------"); - // } // printFormatType - - // public void printSemaphoreType(SemaphoreType st) { - // System.out.println("------------------------------------------------"); - // System.out.println("Semaphore"); - // System.out.println("------------------------------------------------"); - // System.out.println("SemaphoreId: [" + st.getSemaphoreId() + "]"); - // System.out.println("SemaphoreName: [" + st.getSemaphoreName() + "]"); - // System.out.println("SemaphoreType: [" + st.getSemaphoreType() + "]"); - // System.out.println("Comment: [" + st.getComment() + "]"); - // - // if (st.getFormatList() != null) - // for (Iterator iter = st.getFormatList().getFormat().iterator(); iter.hasNext();) - // printFormatType((FormatType) iter.next()); - // - // System.out.println("------------------------------------------------"); - // } // printSemaphoreType - - // public void printFormFieldType(FormFieldType fft) { - // System.out.println("------------------------------------------------"); - // System.out.println("Form Field"); - // System.out.println("------------------------------------------------"); - // System.out.println("FieldId: [" + fft.getFieldId() + "]"); - // System.out.println("ColId: [" + fft.getColId() + "]"); - // System.out.println("FieldName: [" + fft.getFieldName() + "]"); - // System.out.println("FieldType: [" + fft.getFieldType() + "]"); - // System.out.println("ValidationType: [" + fft.getValidationType() + "]"); - // System.out.println("Mandatory: [" + fft.getMandatory() + "]"); - // System.out.println("DefaultValue: [" + fft.getDefaultValue() + "]"); - // System.out.println("OrderBySeq: [" + fft.getOrderBySeq() + "]"); - // System.out.println("FieldSQL: [" + fft.getFieldSQL() + "]"); - // System.out.println("Comment: [" + fft.getComment() + "]"); - // if (fft.getPredefinedValueList() != null) - // for (Iterator iter = fft.getPredefinedValueList().getPredefinedValue().iterator(); iter - // .hasNext();) - // System.out.println("PredefinedValues: [" + ((String) iter.next()) + "]"); - // - // System.out.println("------------------------------------------------"); - // } // printFormFieldType - - // public void printColFilterType(ColFilterType cft) { - // System.out.println("------------------------------------------------"); - // System.out.println("Col Filter"); - // System.out.println("------------------------------------------------"); - // System.out.println("ColId: [" + cft.getColId() + "]"); - // System.out.println("FilterSeq: [" + cft.getFilterSeq() + "]"); - // System.out.println("JoinCondition: [" + cft.getJoinCondition() + "]"); - // System.out.println("OpenBrackets: [" + cft.getOpenBrackets() + "]"); - // System.out.println("Expression: [" + cft.getExpression() + "]"); - // System.out.println("ArgType: [" + cft.getArgType() + "]"); - // System.out.println("ArgValue: [" + cft.getArgValue() + "]"); - // System.out.println("CloseBrackets: [" + cft.getCloseBrackets() + "]"); - // System.out.println("Comment: [" + cft.getComment() + "]"); - // System.out.println("------------------------------------------------"); - // } // printColFilterType - - // public void printDataColumnType(DataColumnType dct) { - // System.out.println("------------------------------------------------"); - // System.out.println("Data Column"); - // System.out.println("------------------------------------------------"); - // System.out.println("ColId: [" + dct.getColId() + "]"); - // System.out.println("TableId: [" + dct.getTableId() + "]"); - // System.out.println("DbColName: [" + dct.getDbColName() + "]"); - // System.out.println("CrossTabValue: [" + dct.getCrossTabValue() + "]"); - // System.out.println("ColName: [" + dct.getColName() + "]"); - // System.out.println("DisplayName: [" + dct.getDisplayName() + "]"); - // System.out.println("DisplayWidth: [" + dct.getDisplayWidth() + "]"); - // System.out.println("DisplayAlignment: [" + dct.getDisplayAlignment() + "]"); - // System.out.println("DisplayHeaderAlignment: [" + dct.getDisplayHeaderAlignment() + "]"); - // System.out.println("OrderSeq(): [" + dct.getOrderSeq() + "]"); - // System.out.println("Visible: [" + dct.isVisible() + "]"); - // System.out.println("Calculated: [" + dct.isCalculated() + "]"); - // System.out.println("ColType: [" + dct.getColType() + "]"); - // System.out.println("ColFormat: [" + dct.getColFormat() + "]"); - // System.out.println("GroupBreak: [" + dct.isGroupBreak() + "]"); - // System.out.println("OrderBySeq: [" + dct.getOrderBySeq() + "]"); - // System.out.println("OrderByAscDesc: [" + dct.getOrderByAscDesc() + "]"); - // System.out.println("DisplayTotal: [" + dct.getDisplayTotal() + "]"); - // System.out.println("ColOnChart: [" + dct.getColOnChart() + "]"); - // System.out.println("ChartSeq: [" + dct.getChartSeq() + "]"); - // System.out.println("ChartColor: [" + dct.getChartColor() + "]"); - // System.out.println("DrillDownType: [" + dct.getDrillDownType() + "]"); - // System.out.println("DrillDownURL: [" + dct.getDrillDownURL() + "]"); - // System.out.println("DrillDownParams: [" + dct.getDrillDownParams() + "]"); - // System.out.println("Comment: [" + dct.getComment() + "]"); - // - // if (dct.getColFilterList() != null) - // for (Iterator iter = dct.getColFilterList().getColFilter().iterator(); iter - // .hasNext();) - // printColFilterType((ColFilterType) iter.next()); - // - // System.out.println("SemaphoreId: [" + dct.getSemaphoreId() + "]"); - // System.out.println("DbColType: [" + dct.getDbColType() + "]"); - // System.out.println("------------------------------------------------"); - // } // printDataColumnType - - // public void printDataSourceType(DataSourceType dst) { - // System.out.println("------------------------------------------------"); - // System.out.println("Data Source"); - // System.out.println("------------------------------------------------"); - // System.out.println("TableId: [" + dst.getTableId() + "]"); - // System.out.println("TableName: [" + dst.getTableName() + "]"); - // System.out.println("TablePK: [" + dst.getTablePK() + "]"); - // System.out.println("DisplayName: [" + dst.getDisplayName() + "]"); - // System.out.println("RefTableId: [" + dst.getRefTableId() + "]"); - // System.out.println("RefDefinition: [" + dst.getRefDefinition() + "]"); - // System.out.println("Comment: [" + dst.getComment() + "]"); - // - // for (Iterator iter = dst.getDataColumnList().getDataColumn().iterator(); iter - // .hasNext();) - // printDataColumnType((DataColumnType) iter.next()); - // - // System.out.println("------------------------------------------------"); - // } // printDataSourceType - - // public void print() { - // System.out.println("------------------------------------------------"); - // System.out.println("ReportWrapper object"); - // System.out.println("------------------------------------------------"); - // System.out.println("PageSize: [" + getPageSize() + "]"); - // System.out.println("ReportType: [" + getReportType() + "]"); - // System.out.println("ReportName: [" + getReportName() + "]"); - // System.out.println("ReportDescr: [" + getReportDescr() + "]"); - // System.out.println("ChartType: [" + getChartType() + "]"); - // System.out.println("ChartTypeFixed: [" + getChartTypeFixed() + "]"); - // //System.out.println("ChartLeftAxisLabel: [" + getChartLeftAxisLabel() + "]"); - // //System.out.println("ChartRightAxisLabel: [" + getChartRightAxisLabel() + "]"); - // System.out.println("ChartWidth: [" + getChartWidth() + "]"); - // System.out.println("ChartHeight: [" + getChartHeight() + "]"); - // System.out.println("Public: [" + isPublic() + "]"); - // System.out.println("CreateId: NOT USED ANYMORE[" + /* getCreateId()+ */"]"); - // System.out.println("CreateDate: NOT USED ANYMORE[" + /* getCreateDate()+ */"]"); - // System.out.println("ReportSQL: [" + getReportSQL() + "]"); - // System.out.println("ReportTitle: [" + getReportTitle() + "]"); - // System.out.println("DbInfo: [" + getDBInfo() + "]"); - // System.out.println("ReportSubTitle: [" + getReportSubTitle() + "]"); - // System.out.println("ReportHeader: [" + getReportHeader() + "]"); - // System.out.println("ReportFooter: [" + getReportFooter() + "]"); - // System.out.println("NumFormCols: [" + getNumFormCols() + "]"); - // System.out.println("DisplayOptions: [" + getDisplayOptions() + "]"); - // System.out.println("Comment: [" + getComment() + "]"); - // - // for (Iterator iter = cr.getDataSourceList().getDataSource().iterator(); iter.hasNext();) - // printDataSourceType((DataSourceType) iter.next()); - // - // if (cr.getFormFieldList() != null) - // for (Iterator iter = cr.getFormFieldList().getFormField().iterator(); iter - // .hasNext();) - // printFormFieldType((FormFieldType) iter.next()); - // - // if (cr.getSemaphoreList() != null) - // for (Iterator iter = cr.getSemaphoreList().getSemaphore().iterator(); iter - // .hasNext();) - // printSemaphoreType((SemaphoreType) iter.next()); - // - // System.out.println("------------------------------------------------"); - // System.out.println("ReportWrapper object end"); - // System.out.println("------------------------------------------------"); - // } // print private int getIntValue(String value, int defaultValue) { int iValue = defaultValue; @@ -5645,58 +4965,41 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { } return iValue; - } // getIntValue + } public static String replaceNewLine(String strSource, String strFind, String chrReplace) { - // buffer to hold the target string after replacement is done. StringBuffer sbfTemp = new StringBuffer(); try { - // for each occurrence of strFind in strSource, replace it with chrReplace. int intIndex = strSource.indexOf(strFind, 0); - - // check if there is any instace of strFind in strSource if (intIndex >= 0) { - // holds the index from where the search is supposed to happen. int intStart = 0; - // size of the source string int intTotalSize = strSource.length(); while (intStart < intTotalSize && ((intIndex = strSource.indexOf(strFind, intStart)) >= 0)) { - // check if strFind is at the beginning... i.e., at index intStart if (intIndex == intStart) { - /* - * starts with strFind...just append chrReplace to the target - */ sbfTemp.append(chrReplace); } else { - // append the sub-string...plus chrReplace sbfTemp.append(strSource.substring(intStart, intIndex)); sbfTemp.append(chrReplace); } - - // advance string index intStart = intIndex + strFind.length(); } - - // append the last portion of the source string. sbfTemp.append(strSource.substring(intStart)); } else { - // strFind not found... just copy the text as it is. sbfTemp.append(strSource); } } catch (Exception expGeneral) { logger.error(EELFLoggerDelegate.debugLogger, "Exception occured in replaceNewLine ", expGeneral); - // in case of any exception, return the source string as it is. sbfTemp = new StringBuffer(strSource); } return sbfTemp.toString(); } - /* folder id */ + public String getFolderId() { return nvl(cr.getFolderId()).length() > 0 ? cr.getFolderId() : "NULL"; } @@ -5801,8 +5104,6 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { return flag; } - /* Datamining Getter Setter */ - public String getClassifier() { return (cr.getDataminingOptions() != null ? cr.getDataminingOptions().getClassifier() : ""); } @@ -5879,7 +5180,6 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { this.reportSQLWithRowNum = reportSQLWithRowNum; } - // used for Zk sort public void setReportSQLOnlyFirstPart(String reportSQLOnlyFirstPart) { this.reportSQLOnlyFirstPart = reportSQLOnlyFirstPart; } @@ -5912,7 +5212,6 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { } public void setDrillReportIdForChart(String reportId) { - // (cr.getChartDrillOptions()!=null)?cr.getChartDrillOptions().setDrillReportId():""; cr.getChartDrillOptions().setDrillReportId(reportId); } @@ -5921,7 +5220,6 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { } public void setDrillXAxisFormField(String formField) { - // (cr.getChartDrillOptions()!=null)?cr.getChartDrillOptions().setDrillReportId():""; cr.getChartDrillOptions().setDrillXAxisFormField(formField); } @@ -5930,7 +5228,6 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { } public void setDrillYAxisFormField(String formField) { - // (cr.getChartDrillOptions()!=null)?cr.getChartDrillOptions().setDrillReportId():""; cr.getChartDrillOptions().setDrillYAxisFormField(formField); } @@ -5939,7 +5236,6 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { } public void setDrillSeriesFormField(String formField) { - // (cr.getChartDrillOptions()!=null)?cr.getChartDrillOptions().setDrillReportId():""; cr.getChartDrillOptions().setDrillSeriesFormField(formField); } @@ -5954,7 +5250,7 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { DataColumnType dc = (DataColumnType) iter.next(); if (dc.isEnhancedPagination() != null && dc.isEnhancedPagination().booleanValue()) return true; - } // for + } return false; } @@ -5965,7 +5261,7 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { DataColumnType dc = (DataColumnType) iter.next(); if (dc.isEnhancedPagination() != null && dc.isEnhancedPagination().booleanValue()) return dc; - } // for + } return null; } @@ -5993,4 +5289,4 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { return wholeSQL; } -} // ReportWrapper +} diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/ReportDefinition.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/ReportDefinition.java index e51913e4..11adb35b 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/ReportDefinition.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/ReportDefinition.java @@ -73,6 +73,7 @@ import org.onap.portalsdk.analytics.system.DbUtils; 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.RemDbInfo; import org.onap.portalsdk.analytics.util.Utils; import org.onap.portalsdk.analytics.xmlobj.ChartAdditionalOptions; import org.onap.portalsdk.analytics.xmlobj.ChartDrillOptions; @@ -91,6 +92,8 @@ import org.onap.portalsdk.analytics.xmlobj.ObjectFactory; import org.onap.portalsdk.analytics.xmlobj.PredefinedValueList; import org.onap.portalsdk.analytics.xmlobj.SemaphoreType; import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; /**<HR/> * This class is part of <B><I>RAPTOR (Rapid Application Programming Tool for OLAP Reporting)</I></B><BR/> @@ -110,10 +113,19 @@ import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; * */ +@Component public class ReportDefinition extends ReportWrapper implements Serializable { private static transient final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(ReportDefinition.class); + protected static RemDbInfo remDbInfo; + + @SuppressWarnings("static-access") + @Autowired + public void setRemDbInfo(RemDbInfo remDbInfo) { + this.remDbInfo = remDbInfo; + } + private ReportSchedule reportSchedule = null; private WizardSequence wizardSequence = null; @@ -124,6 +136,10 @@ public class ReportDefinition extends ReportWrapper implements Serializable { // when persisting report on // each step + public ReportDefinition() { + super(); + } + private ReportDefinition(CustomReportType crType, String reportID, String ownerID, String createID, String createDate, String updateID, String updateDate, String menuID, boolean menuApproved, HttpServletRequest request) throws RaptorException { @@ -214,7 +230,7 @@ public class ReportDefinition extends ReportWrapper implements Serializable { private boolean canPersistDashboard() { - return nvl(getDashboardLayoutHTML()).length() > 0; + return nvl(getDashboardLayoutJSON()).length() > 0; } //canPersistDashboard private boolean canPersistLinearReport() { @@ -1272,7 +1288,6 @@ public class ReportDefinition extends ReportWrapper implements Serializable { boolean isCYMBALScript = false; if (!isNull(dbInfo) && (!dbInfo.equals(AppConstants.DB_LOCAL))) { try { - org.onap.portalsdk.analytics.util.RemDbInfo remDbInfo = new org.onap.portalsdk.analytics.util.RemDbInfo(); String dbType = remDbInfo.getDBType(dbInfo); if (dbType.equals("DAYTONA") && !(nextToken.toUpperCase().equals("SELECT"))) { isCYMBALScript = true; @@ -1419,7 +1434,6 @@ public class ReportDefinition extends ReportWrapper implements Serializable { boolean isCYMBALScript = false; if (!isNull(dbInfo) && (!dbInfo.equals(AppConstants.DB_LOCAL))) { try { - org.onap.portalsdk.analytics.util.RemDbInfo remDbInfo = new org.onap.portalsdk.analytics.util.RemDbInfo(); String dbType = remDbInfo.getDBType(dbInfo); if (dbType.equals("DAYTONA") && !(nextToken.toUpperCase().equals("SELECT"))) { isCYMBALScript = true; diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/ReportSchedule.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/ReportSchedule.java index 5db298b8..dbc68008 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/ReportSchedule.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/ReportSchedule.java @@ -72,12 +72,16 @@ import org.onap.portalsdk.analytics.system.DbUtils; 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.RemDbInfo; import org.onap.portalsdk.analytics.util.Utils; import org.onap.portalsdk.analytics.xmlobj.FormFieldType; import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; import org.onap.portalsdk.core.util.SecurityCodecUtil; import org.owasp.esapi.ESAPI; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +@Component public class ReportSchedule extends RaptorObject implements Serializable{ /** @@ -87,6 +91,14 @@ public class ReportSchedule extends RaptorObject implements Serializable{ private static transient final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(ReportSchedule.class); + private static RemDbInfo remDbInfo; + + @SuppressWarnings("static-access") + @Autowired + public void setRemDbInfo(RemDbInfo remDbInfo) { + this.remDbInfo = remDbInfo; + } + private String reportID = null; private String scheduleUserID = null; @@ -135,6 +147,10 @@ public class ReportSchedule extends RaptorObject implements Serializable{ private Vector emailToRoles = new Vector(); + public ReportSchedule() { + super(); + } + public ReportSchedule(String reportID, String scheduleUserID, boolean loadData, HttpServletRequest request) { super(); @@ -539,7 +555,6 @@ public class ReportSchedule extends RaptorObject implements Serializable{ int posAnd = 0; if (!isNull(dbInfo) && (!dbInfo.equals(AppConstants.DB_LOCAL))) { try { - org.onap.portalsdk.analytics.util.RemDbInfo remDbInfo = new org.onap.portalsdk.analytics.util.RemDbInfo(); dbType = remDbInfo.getDBType(dbInfo); } catch (Exception ex) { throw new RaptorException(ex); @@ -1321,7 +1336,7 @@ public class ReportSchedule extends RaptorObject implements Serializable{ stmt = connection.prepareStatement(sql); stmt.setString(1,scheduleId); rs = stmt.executeQuery(); - //Writer out = null; + Writer out = null; /*if(Globals.isWeblogicServer()) { java.sql.Clob clob = null; if (rs.next()) diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/wizard/ColumnEditJSON.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/wizard/ColumnEditJSON.java index 3281eee7..af7e6e8c 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/wizard/ColumnEditJSON.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/wizard/ColumnEditJSON.java @@ -37,6 +37,8 @@ */ package org.onap.portalsdk.analytics.model.definition.wizard; +import org.onap.portalsdk.analytics.xmlobj.SemaphoreList; + public class ColumnEditJSON implements WizardJSON { private String tabId; @@ -69,7 +71,22 @@ public class ColumnEditJSON implements WizardJSON { private Integer colspan; private String displayName; private String displayTotal; + private SemaphoreList semaphoreList; + private String semaphoreId; + + public SemaphoreList getSemaphoreList() { + return semaphoreList; + } + public void setSemaphoreList(SemaphoreList semaphoreList) { + this.semaphoreList = semaphoreList; + } + public String getSemaphoreId() { + return semaphoreId; + } + public void setSemaphoreId(String semaphoreId) { + this.semaphoreId = semaphoreId; + } public String getTabId() { return tabId; } diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/wizard/FormEditJSON.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/wizard/FormEditJSON.java index e8238534..b7ddc3b8 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/wizard/FormEditJSON.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/wizard/FormEditJSON.java @@ -49,6 +49,8 @@ public class FormEditJSON implements WizardJSON { private String fieldType; private boolean visible; private boolean groupFormField; + private String lastUpdatedFieldId; + private String defaultValue; private String fieldDefaultSQL; private String fieldSQL; @@ -160,5 +162,12 @@ public class FormEditJSON implements WizardJSON { } + public String getLastUpdatedFieldId() { + return lastUpdatedFieldId; + } + public void setLastUpdatedFieldId(String lastUpdatedFieldId) { + this.lastUpdatedFieldId = lastUpdatedFieldId; + } + } diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ChartD3Helper.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ChartD3Helper.java index 52077aa8..217c81e8 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ChartD3Helper.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ChartD3Helper.java @@ -59,10 +59,10 @@ import java.util.TimeZone; import java.util.TreeSet; import java.util.regex.Matcher; import java.util.regex.Pattern; + import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; - import org.apache.commons.lang.time.DateUtils; import org.onap.portalsdk.analytics.error.RaptorException; import org.onap.portalsdk.analytics.model.base.ChartSeqComparator; diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ErrorJSONRuntime.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ErrorJSONRuntime.java index 24c46180..f670da40 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ErrorJSONRuntime.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ErrorJSONRuntime.java @@ -41,6 +41,7 @@ public class ErrorJSONRuntime { private String errormessage; private String stacktrace; + private boolean allowEdit; public String getErrormessage() { return errormessage; @@ -54,8 +55,12 @@ public class ErrorJSONRuntime { public void setStacktrace(String stacktrace) { this.stacktrace = stacktrace; } - - + public boolean isAllowEdit() { + return allowEdit; + } + public void setAllowEdit(boolean allowEdit) { + this.allowEdit = allowEdit; + } } 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 3af59e56..f3633a67 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 @@ -70,7 +70,7 @@ import java.util.Map; import java.util.Map.Entry; import java.util.Set; import java.util.regex.Matcher; -import java.util.regex.Pattern; +import java.util.regex.Pattern; import org.onap.portalsdk.analytics.error.RaptorRuntimeException; import org.onap.portalsdk.analytics.error.UserDefinedException; @@ -80,6 +80,7 @@ import org.onap.portalsdk.analytics.model.base.IdNameSql; import org.onap.portalsdk.analytics.model.base.IdNameValue; import org.onap.portalsdk.analytics.system.AppUtils; import org.onap.portalsdk.analytics.system.ConnectionUtils; +import org.onap.portalsdk.analytics.system.ExecuteQuery; import org.onap.portalsdk.analytics.system.Globals; import org.onap.portalsdk.analytics.util.DataSet; import org.onap.portalsdk.analytics.util.Utils; @@ -139,7 +140,10 @@ public class FormField extends org.onap.portalsdk.analytics.RaptorObject impleme public static final String FFT_TEXT = "TEXT"; - public static final String FFT_TEXTAREA = "TEXTAREA"; + public static final String FFT_TEXTAREA = "TEXT"; + +// Changed to "TEXT" +// public static final String FFT_TEXTAREA = "TEXTAREA"; public static final String FFT_COMBO_BOX = "COMBO_BOX"; diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ReportJSONRuntime.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ReportJSONRuntime.java index 916791e1..d3d44ac3 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ReportJSONRuntime.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ReportJSONRuntime.java @@ -544,6 +544,8 @@ public class ReportJSONRuntime { private String formfield_comments; private ArrayList<ColumnHeader> reportDataColumns; private ArrayList<Map<String,Object>> reportDataRows; + private ArrayList<ColumnHeader> reportTotalDataColumns; + private ArrayList<Map<String,Object>> reportTotalDataRows; private int totalRows; private int pageSize; private String sqlWhole; @@ -712,8 +714,18 @@ public class ReportJSONRuntime { public void setHideFormFieldsAfterRun(boolean hideFormFieldsAfterRun) { this.hideFormFieldsAfterRun = hideFormFieldsAfterRun; } - - + public ArrayList<ColumnHeader> getReportTotalDataColumns() { + return reportTotalDataColumns; + } + public void setReportTotalDataColumns(ArrayList<ColumnHeader> reportTotalDataColumns) { + this.reportTotalDataColumns = reportTotalDataColumns; + } + public ArrayList<Map<String, Object>> getReportTotalDataRows() { + return reportTotalDataRows; + } + public void setReportTotalDataRows(ArrayList<Map<String, Object>> reportTotalDataRows) { + this.reportTotalDataRows = reportTotalDataRows; + } } diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/search/SearchResultField.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/search/SearchResultField.java index 209ffea1..9f32eeba 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/search/SearchResultField.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/search/SearchResultField.java @@ -51,7 +51,15 @@ public class SearchResultField extends org.onap.portalsdk.analytics.RaptorObject private String confirmationText = null; + private boolean isAuthorized = false; + public boolean isAuthorized() { + return isAuthorized; + } + + public void setAuthorized(boolean isAuthorized) { + this.isAuthorized = isAuthorized; + } public String getConfirmationText() { return confirmationText; @@ -82,13 +90,12 @@ public class SearchResultField extends org.onap.portalsdk.analytics.RaptorObject setColumnId(column.getColumnId()); setDisplayValue(displayValue); setAlignment(column.getAlignment()); + setAuthorized(isAuthorized); if(column.getColumnId().equals("edit")) { -// setDrillDownLink("report_wizard.htm?action=report.edit&c_master="+linkIdValue); setDrillDownLink("report#/report_wizard/"+linkIdValue); setDrillDownImage(column.getLinkImg()); setConfirmationText(null); } else if(column.getColumnId().equals("copy")) { -// setDrillDownLink("report_wizard.htm?action=report.copy&c_master="+linkIdValue); setDrillDownLink("report#/report_wizard/copy/"+linkIdValue); setDrillDownImage(column.getLinkImg()); setConfirmationText(column.getLinkConfirmMsg()); |