diff options
Diffstat (limited to 'ecomp-sdk/epsdk-analytics')
6 files changed, 29 insertions, 430 deletions
diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/gmap/node/NodeCollection.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/gmap/node/NodeCollection.java index e630f52c..320f15c9 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/gmap/node/NodeCollection.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/gmap/node/NodeCollection.java @@ -99,93 +99,11 @@ public class NodeCollection { public HashMap<String,NodeInfo> getNodeCollection() { return nodeCollection; } - -/* public NodeInfo getNode(String nodeID) { - for (NodeInfo nodeInfo : nodeCollection) { - if (nodeInfo.getNodeID().equalsIgnoreCase(nodeID) ) { - return nodeInfo; - } - } - - return null; - } -*/ -/* public NodeInfo getNode(String nodeID, String nodeType) { - for (NodeInfo nodeInfo : nodeCollection) { - if (nodeInfo.getNodeID().equalsIgnoreCase(nodeID) && nodeInfo.getNodeType().equalsIgnoreCase(nodeType)) { - return nodeInfo; - } - } - - return null; - } -*/ + public NodeInfo getNode(String nodeType) { return (NodeInfo)nodeCollection.get(nodeType); } -/* public ArrayList<NodeInfo> getWildCardNode(String nodeID, String nodeType) { - ArrayList<NodeInfo> list = new ArrayList<NodeInfo>(); - - for (NodeInfo nodeInfo : nodeCollection) { - if (nodeInfo.getNodeType().equalsIgnoreCase(nodeType) && - nodeInfo.getNodeID().toLowerCase().indexOf(nodeID.toLowerCase()) != -1) { - list.add(nodeInfo); - } - } - - return list; - }*/ - -/* public NodeInfo removeNode(String nodeID) { - for (int i = 0; i < nodeCollection.size(); i++) { - if (nodeCollection.get(i).getNodeID().equalsIgnoreCase(nodeID)) { - return nodeCollection.remove(i); - } - } - - removeSelectedNode(nodeID); - return null; - } - - public NodeInfo removeNode(String nodeID, String nodeType) { - for (int i = 0; i < nodeCollection.size(); i++) { - if (nodeCollection.get(i).getNodeID().equalsIgnoreCase(nodeID) && - nodeCollection.get(i).getNodeType().equalsIgnoreCase(nodeType)) { - return nodeCollection.remove(i); - } - } - - removeSelectedNode(nodeID, nodeType); - return null; - } -*/ -/* public void removeNode(String nodeType) { - nodeCollection.remove(nodeType); - }*/ - -/* public ArrayList<NodeInfo> getCellsiteLocation(String location, boolean exactMatch) { - ArrayList<NodeInfo> list = new ArrayList<NodeInfo>(); - - for (NodeInfo nodeInfo : nodeCollection) { - if (nodeInfo.getAttribute("Location") == null) { - continue; - } - - if (exactMatch) { - if (nodeInfo.getAttribute("Location").equalsIgnoreCase(location)) { - list.add(nodeInfo); - } - } - else { - if (nodeInfo.getAttribute("Location").toUpperCase().indexOf(location.toUpperCase()) != -1) { - list.add(nodeInfo); - } - } - } - - return list; - } -*/ + public void clearNode() { nodeCollection.clear(); selectedNode.clear(); diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/gmap/utils/MapUtils.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/gmap/utils/MapUtils.java index 6bc6dd5c..0914c12c 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/gmap/utils/MapUtils.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/gmap/utils/MapUtils.java @@ -64,18 +64,4 @@ public class MapUtils { * @return null if not valid number (must be between 2008/01 to 2010/12) */ - -/* public static void saveColor(HttpServletRequest request, DomainService domainService, - String type, String colorValue) { -// String userID = Integer.toString(UserUtils.getUserId(request)); -// MapColorPK colorPK = new MapColorPK(); -// MapColorVO colorVO = new MapColorVO(); -// -// colorPK.setUserID(userID); -// colorPK.setPrefID(type); -// colorVO.setMapColorPK(colorPK); -// colorVO.setColorValue(colorValue); -// -// domainService.saveDomainObject(colorVO); - } */ } diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/DataCache.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/DataCache.java index 5e875f76..41a5ae20 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/DataCache.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/DataCache.java @@ -82,27 +82,20 @@ public class DataCache extends org.onap.portalsdk.analytics.RaptorObject { /* try */{ dataViewActions = new Vector(); - //DataSet ds = DbUtils - // .executeQuery("SELECT ts.web_view_action FROM cr_table_source ts WHERE ts.web_view_action IS NOT NULL"); - String sql = Globals.getTheDataViewActions(); DataSet ds = DbUtils .executeQuery(sql); for (int i = 0; i < ds.getRowCount(); i++) dataViewActions.add(ds.getString(i, 0)); - } // catch(Exception e) {} + } return dataViewActions; } // getDataViewActions public static Vector getPublicReportIdNames() throws RaptorException { - // if(publicReportIdNames==null) => needs to be up-to-date at any time /* try */{ publicReportIdNames = new Vector(); - - //DataSet ds = DbUtils - // .executeQuery("SELECT rep_id, title FROM cr_report WHERE public_yn = 'Y' ORDER BY title"); String sql = Globals.getThePublicReportIdNames(); DataSet ds = DbUtils @@ -116,18 +109,14 @@ public class DataCache extends org.onap.portalsdk.analytics.RaptorObject { } // getPublicReportIdNames public static Vector getPrivateAccessibleReportIdNames(String user_id, Vector userRoles) throws RaptorException { - // if(publicReportIdNames==null) => needs to be up-to-date at any time /* try */{ privateReportIdNames = new Vector(); - // StringBuffer query = new StringBuffer(" SELECT cr.rep_id, cr.title FROM cr_report cr "); String sql = Globals.getThePrivateAccessibleNamesA(); - //query.append(" WHERE cr.rep_id not in (select rep_id from cr_report_access cra where user_id = '"+ user_id+"' "); sql = sql.replace("[user_id]", user_id); StringBuffer query = new StringBuffer(sql); for (int i = 0; i < userRoles.size(); i++) { if( i == 0){ - // query.append(" OR role_id in ("); query.append(Globals.getThePrivateAccessibleNamesIf()); } if(i < (userRoles.size()-1)) @@ -137,8 +126,7 @@ public class DataCache extends org.onap.portalsdk.analytics.RaptorObject { query.append((String)userRoles.get(i)+")"); } - //query.append(" ) "); - //query.append(" AND public_yn = 'N' and cr.owner_id = '"+ user_id+"' order by 2 "); + sql = Globals.getThePrivateAccessibleNamesB(); sql = sql.replace("[user_id]", user_id); query.append(sql); @@ -156,12 +144,9 @@ public class DataCache extends org.onap.portalsdk.analytics.RaptorObject { public static Vector getGroupAccessibleReportIdNames(String user_id, Vector userRoles) throws RaptorException { - // if(publicReportIdNames==null) => needs to be up-to-date at any time /* try */{ groupReportIdNames = new Vector(); - - //StringBuffer query = new StringBuffer(" SELECT cr.rep_id, cr.title FROM cr_report cr "); - //query.append(" WHERE cr.rep_id in (select rep_id from cr_report_access cra where user_id = '"+ user_id+"' "); + String sql = Globals.getTheGroupAccessibleNamesA(); sql = sql.replace("[user_id]", user_id); StringBuffer query = new StringBuffer(sql); @@ -175,8 +160,7 @@ public class DataCache extends org.onap.portalsdk.analytics.RaptorObject { query.append((String)userRoles.get(i)+")"); } - //query.append(" ) "); - //query.append(" AND public_yn = 'N' order by 2 "); + query.append(Globals.getTheGroupAccessibleNamesB()); DataSet ds = DbUtils @@ -185,7 +169,7 @@ public class DataCache extends org.onap.portalsdk.analytics.RaptorObject { for (int i = 0; i < ds.getRowCount(); i++) groupReportIdNames .add(new IdNameValue(ds.getString(i, 0), ds.getString(i, 1))); - } // catch(Exception e) {} + } return groupReportIdNames; } // getGroupAccessibleReportIdNames @@ -218,27 +202,22 @@ public class DataCache extends org.onap.portalsdk.analytics.RaptorObject { if (reportTableSources == null) /* try */{ reportTableSources = new Vector(); - //String query = " SELECT table_name, display_name, pk_fields, web_view_action, large_data_source_yn, filter_sql FROM cr_table_source "; String query = Globals.getTheReportTableSourcesA(); if (dBInfo != null && !dBInfo.equals(AppConstants.DB_LOCAL)){ - //query += " where SOURCE_DB= '" + dBInfo + "'"; query+=Globals.getTheReportTableSourcesWhere(); query = query.replace("[dBInfo]", dBInfo); } else { - //query += " where SOURCE_DB is null or SOURCE_DB = '" + AppConstants.DB_LOCAL - // + "'"; query+=Globals.getTheReportTableSourcesIf(); query = query.replace("[AppConstants.DB_LOCAL]", AppConstants.DB_LOCAL); } - //query += " ORDER BY table_name "; query+=Globals.getTheReportTableSourcesElse(); DataSet ds = DbUtils.executeQuery(query); for (int i = 0; i < ds.getRowCount(); i++) reportTableSources.add(new TableSource(ds.getString(i, 0), ds.getString(i, 1), ds.getString(i, 2), ds.getString(i, 3), ds.getString(i, 4), ds .getString(i, 5))); - } // catch(Exception e) {} + } return reportTableSources; } // getReportTableSources @@ -256,13 +235,9 @@ public class DataCache extends org.onap.portalsdk.analytics.RaptorObject { sb.append(iter.next()); } // for sb.append(")"); - //StringBuffer query = new StringBuffer("SELECT ts.table_name, ts.display_name, ts.pk_fields, "); - // query.append(" ts.web_view_action, ts.large_data_source_yn, ts.filter_sql FROM cr_table_source ts "); - // query.append (" WHERE "); + StringBuffer query = new StringBuffer(Globals.grabTheReportTableA()); - //if(!(AppUtils.isAdminUser(userId) || AppUtils.isSuperUser(userId))) - // query.append (" (EXISTS (SELECT 1 FROM cr_table_role tr WHERE tr.table_name=ts.table_name AND tr.role_id IN "+sb.toString()+")) and "); - //+ " OR (NOT EXISTS (SELECT 1 FROM cr_table_role tr WHERE tr.table_name=ts.table_name)) "; + if (dBInfo != null && !dBInfo.equals(AppConstants.DB_LOCAL)){ String d_sql = Globals.grabTheReportTableIf(); d_sql = d_sql.replace("[dBInfo]", dBInfo); @@ -270,43 +245,35 @@ public class DataCache extends org.onap.portalsdk.analytics.RaptorObject { query.append(d_sql); } else{ - //query.append(" (ts.SOURCE_DB is null or ts.SOURCE_DB = '"+ AppConstants.DB_LOCAL + "')"); String d_sql = Globals.grabTheReportTableElse(); d_sql = d_sql.replace("[AppConstants.DB_LOCAL]", AppConstants.DB_LOCAL); query.append(d_sql); } if(!(AppUtils.isAdminUser(request) || AppUtils.isSuperUser(request))) { - //query.append(" minus "); - - // query.append(" SELECT ts.table_name, ts.display_name, ts.pk_fields, ts.web_view_action, "); - // query.append(" ts.large_data_source_yn, ts.filter_sql from cr_table_source ts where "); - // query.append(" table_name in (select table_name from cr_table_role where role_id not IN "+sb.toString()+") and "); String e_sql = Globals.grabTheReportTableB(); e_sql = e_sql.replace("[sb.toString()]", sb.toString()); query.append(e_sql); if (dBInfo != null && !dBInfo.equals(AppConstants.DB_LOCAL)){ - // query.append( " ts.SOURCE_DB= '" + dBInfo + "'"); String d_sql = Globals.grabTheReportTableIf(); d_sql = d_sql.replace("[dBInfo]", dBInfo); query.append(d_sql); } else{ - //query.append(" (ts.SOURCE_DB is null or ts.SOURCE_DB = '"+ AppConstants.DB_LOCAL + "')"); String d_sql = Globals.grabTheReportTableElse(); d_sql = d_sql.replace("[AppConstants.DB_LOCAL]", AppConstants.DB_LOCAL); query.append(d_sql); } } - //query.append(" ORDER BY 1 "); + query.append(Globals.grabTheReportTableC()); DataSet ds = DbUtils.executeQuery(query.toString()); for (int i = 0; i < ds.getRowCount(); i++) userTableSources.add(new TableSource(ds.getString(i, 0), ds.getString(i, 1), ds.getString(i, 2), ds.getString(i, 3), ds.getString(i, 4), ds .getString(i, 5))); - } // catch(Exception e) {} + } return userTableSources; } // getReportTableSources @@ -316,14 +283,12 @@ public class DataCache extends org.onap.portalsdk.analytics.RaptorObject { /* try */{ reportTableJoins = new Vector(); - //DataSet ds = DbUtils - // .executeQuery("SELECT src_table_name, dest_table_name, join_expr FROM cr_table_join"); DataSet ds = DbUtils .executeQuery(Globals.getTheReportTableCrJoin()); for (int i = 0; i < ds.getRowCount(); i++) reportTableJoins.add(new TableJoin(ds.getString(i, 0), ds.getString(i, 1), ds .getString(i, 2))); - } // catch(Exception e) {} + } return reportTableJoins; } // getReportTableJoins @@ -341,18 +306,6 @@ public class DataCache extends org.onap.portalsdk.analytics.RaptorObject { sb.append(iter.next()); } // for sb.append(")"); - - /*DataSet ds = DbUtils - .executeQuery("SELECT tj.src_table_name, tj.dest_table_name, tj.join_expr FROM cr_table_join tj " - + "WHERE ((EXISTS (SELECT 1 FROM cr_table_role trs WHERE trs.table_name=tj.src_table_name AND trs.role_id IN " - + sb.toString() - + ")) " - + "OR (NOT EXISTS (SELECT 1 FROM cr_table_role trs WHERE trs.table_name=tj.src_table_name))) " - + "AND ((EXISTS (SELECT 1 FROM cr_table_role trd WHERE trd.table_name=tj.dest_table_name AND trd.role_id IN " - + sb.toString() - + ")) " - + "OR (NOT EXISTS (SELECT 1 FROM cr_table_role trd WHERE trd.table_name=tj.dest_table_name)))");*/ - String f_sql = Globals.getTheReportTableJoins(); f_sql = f_sql.replace("[sb.toString()]", sb.toString()); @@ -363,7 +316,7 @@ public class DataCache extends org.onap.portalsdk.analytics.RaptorObject { for (int i = 0; i < ds.getRowCount(); i++) userTableJoins.add(new TableJoin(ds.getString(i, 0), ds.getString(i, 1), ds .getString(i, 2))); - } // catch(Exception e) {} + } return userTableJoins; } // getReportTableJoins @@ -386,10 +339,6 @@ public class DataCache extends org.onap.portalsdk.analytics.RaptorObject { private static String generateReportTableDbUserColumnSQL(String tableName) { StringBuffer sb = new StringBuffer(); - // sb.append("SELECT a.table_name, a.column_name, a.data_type, a.label "); - //sb.append(" FROM user_column_def a "); - // sb.append("WHERE a.table_name = '" + tableName.toUpperCase() + "' "); - // sb.append("ORDER BY a.column_id"); String sql = Globals.getGenerateReportTableCol(); sql = sql.replace("[tableName.toUpperCase()]", tableName.toUpperCase()); @@ -399,15 +348,11 @@ public class DataCache extends org.onap.portalsdk.analytics.RaptorObject { }//generateReportTableDbUserColumnSQL private static String generateReportTableDbColumnsSQL(String tableName, String maskSql) { StringBuffer sb = new StringBuffer(); - //sb.append("SELECT utc.table_name, utc.column_name, utc.data_type, "); sb.append(Globals.getGenerateDbUserSqlA()); if (maskSql == null){ - //sb.append("utc.column_name label "); sb.append(Globals.getGenerateDbUserSqlIf()); } else{ - //sb.append("nvl(x.label, utc.column_name) label "); - //sb.append("FROM user_tab_columns utc "); sb.append(Globals.getGenerateDbUserSqlElse()); } if (maskSql != null) { @@ -415,17 +360,13 @@ public class DataCache extends org.onap.portalsdk.analytics.RaptorObject { sb.append(maskSql); sb.append(") AS x "); } - //sb.append("WHERE utc.table_name = '" + tableName.toUpperCase() + "' "); String g_sql = Globals.getGenerateDbUserSqlB(); g_sql = g_sql.replace("[tableName.toUpperCase()]", tableName.toUpperCase()); sb.append(g_sql); if (maskSql != null){ - //sb.append(" AND utc.table_name = x.table_name AND utc.column_name = x.column_name "); sb.append(Globals.getGenerateDbUserSqlC()); } - //sb.append("ORDER BY utc.column_id"); sb.append(Globals.getGenerateDbUserSqlD()); - //System.out.println(sb.toString()); return sb.toString(); } // generateReportTableDbColumnsSQL @@ -472,7 +413,7 @@ public class DataCache extends org.onap.portalsdk.analytics.RaptorObject { processDollarFields(tableDbColumns); reportTableDbColumns.put(tableName, tableDbColumns); - } // catch(Exception e) {} + } return tableDbColumns; } // getReportTableDbColumns @@ -518,15 +459,7 @@ public class DataCache extends org.onap.portalsdk.analytics.RaptorObject { fieldName); return lookupDBInfo; - } // getLookupTable - - // public static void setRemoteDBPrefix (String remoteDBPrefix) { - // _remoteDBPrefix = remoteDBPrefix; - // } - // - // public static String getRemoteDBPrefix () { - // return _remoteDBPrefix; - // } + } public static void refreshAll() { DataCache.dataViewActions = null; diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/ReportHandler.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/ReportHandler.java index 3443cf6d..2729ebb0 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/ReportHandler.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/ReportHandler.java @@ -193,7 +193,6 @@ public class ReportHandler extends org.onap.portalsdk.analytics.RaptorObject { private HashMap loadStyles(ReportRuntime rr, HSSFWorkbook wb) { HSSFCellStyle styleDefault = wb.createCellStyle(); - //System.out.println("Load Styles"); // Style default will be normal with no background HSSFFont fontDefault = wb.createFont(); // The default will be plain . @@ -206,7 +205,7 @@ public class ReportHandler extends org.onap.portalsdk.analytics.RaptorObject { styleDefault.setBorderTop(BorderStyle.THIN); styleDefault.setBorderLeft(BorderStyle.THIN); styleDefault.setBorderRight(BorderStyle.THIN); - // styleDefault.setFillForegroundColor(HSSFColor.YELLOW.index); + styleDefault.setFillPattern(FillPatternType.NO_FILL); styleDefault.setFont(fontDefault); @@ -271,21 +270,14 @@ public class ReportHandler extends org.onap.portalsdk.analytics.RaptorObject { SemaphoreType sem = (SemaphoreType) iter.next(); if(!semColumnList.contains(sem.getSemaphoreId())) continue; - //System.out.println("SemphoreId ----> " + sem.getSemaphoreId()); FormatList fList = sem.getFormatList(); List formatList = fList.getFormat(); for (Iterator fIter = formatList.iterator(); fIter.hasNext();) { FormatType fmt = (FormatType) fIter.next(); if(fmt!=null){ - //if (fmt.getLessThanValue().length() > 0) { cellStyle = wb.createCellStyle(); HSSFFont cellFont = wb.createFont(); - //System.out.println("Format Id " + fmt.getFormatId()); if (nvl(fmt.getBgColor()).length() > 0) { -// System.out.println("Load Styles " + -// fmt.getFormatId() -// + " " +fmt.getBgColor() + " " + -// ExcelColorDef.getExcelColor(fmt.getBgColor())); cellStyle.setFillForegroundColor(ExcelColorDef.getExcelColor(fmt .getBgColor())); cellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND ); @@ -304,11 +296,9 @@ public class ReportHandler extends org.onap.portalsdk.analytics.RaptorObject { cellFont.setFontName(fmt.getFontFace()); else cellFont.setFontName("Tahoma"); - //cellFont.setFontHeight((short) (10 / 0.05)); if(nvl(fmt.getFontSize()).length()>0) { try { - //cellFont.setFontHeight((short) (Integer.parseInt(fmt.getFontSize()) / 0.05)); cellFont.setFontHeight((short) (font_size/0.05)); } catch(NumberFormatException e){ cellFont.setFontHeight((short) (font_size / 0.05));//10 @@ -337,16 +327,13 @@ public class ReportHandler extends org.onap.portalsdk.analytics.RaptorObject { private void paintExcelParams(final HSSFWorkbook wb, int rowNum, final int col, final List paramsList, final String customizedParamInfo, final HSSFSheet sheet, final String reportTitle, final String reportDescr) throws IOException { - //HSSFSheet sheet = wb.getSheet(getSheetName()); int cellNum = 0; HSSFRow row = null; short s1 = 0, s2 = (short) 1; HtmlStripper strip = new HtmlStripper(); // Name Style HSSFCellStyle styleName = wb.createCellStyle(); - //styleName.setFillBackgroundColor(HSSFColor.GREY_80_PERCENT.index); styleName.setFillForegroundColor(HSSFColor.GREY_25_PERCENT.index); - //styleName.setFillPattern(HSSFCellStyle.SPARSE_DOTS); styleName.setAlignment(HorizontalAlignment.CENTER); styleName.setBorderBottom(BorderStyle.THIN); styleName.setBorderTop(BorderStyle.THIN); @@ -377,16 +364,11 @@ public class ReportHandler extends org.onap.portalsdk.analytics.RaptorObject { styleValue.setBorderTop(BorderStyle.THIN); styleValue.setBorderLeft(BorderStyle.THIN); styleValue.setBorderRight(BorderStyle.THIN); - // styleValue.setFillForegroundColor(HSSFColor.YELLOW.index); styleValue.setFillPattern(FillPatternType.NO_FILL); styleValue.setFont(fontDefault); HSSFCell cell = null; HSSFCellStyle styleDescription = wb.createCellStyle(); - styleDescription.setAlignment(HorizontalAlignment.CENTER); -// styleDescription.setBorderBottom(BorderStyle.THIN); -// styleDescription.setBorderTop(BorderStyle.THIN); -// styleDescription.setBorderRight(BorderStyle.THIN); -// styleDescription.setBorderLeft(BorderStyle.THIN); + styleDescription.setAlignment(HorizontalAlignment.CENTER); HSSFFont fontDescr = wb.createFont(); fontDescr.setFontHeight((short) (font_size / 0.05)); //14 fontDescr.setFontName("Tahoma"); @@ -400,7 +382,6 @@ public class ReportHandler extends org.onap.portalsdk.analytics.RaptorObject { if(!Globals.customizeFormFieldInfo() || customizedParamInfo.length()<=0) { for (Iterator iter = paramsList.iterator(); iter.hasNext();) { IdNameValue value = (IdNameValue) iter.next(); - //System.out.println("\"" + value.getId() + " = " + value.getName() + "\""); if(nvl(value.getId()).trim().length()>0 && (!nvl(value.getId()).trim().equals("BLANK"))) { paramSeq += 1; if(paramSeq <= 1) { @@ -413,11 +394,9 @@ public class ReportHandler extends org.onap.portalsdk.analytics.RaptorObject { strBuf.append(reportTitle+"\n"); - //strBuf.append("Run-time Parameters\n"); } row = sheet.createRow(++rowNum); cellNum = 0; - //System.out.println("RowNum " + rowNum + " " + value.getId() + " " +value.getName()); cell = row.createCell((short) cellNum); cell.setCellValue(value.getId()); cell.setCellStyle(styleName); @@ -425,8 +404,6 @@ public class ReportHandler extends org.onap.portalsdk.analytics.RaptorObject { cell = row.createCell((short) cellNum); cell.setCellValue(value.getName().replaceAll("~",",")); cell.setCellStyle(styleValue); - - //strBuf.append(value.getId()+": "+ value.getName()+"\n"); } } //for } else { @@ -453,15 +430,13 @@ public class ReportHandler extends org.onap.portalsdk.analytics.RaptorObject { s = s.replaceAll(",", "|"); s = s.replaceAll("~", ","); if(s.indexOf(":")!= -1) { - //System.out.println("|"+s+"|"); row = sheet.createRow(++rowNum); cell = row.createCell((short) 0); sheet.addMergedRegion(new CellRangeAddress(rowNum, rowNum, s1, s2)); cellDescr = row.createCell((short) 0); cellDescr.setCellValue("Run-time Parameters"); cellDescr.setCellStyle(styleDescription); - - //strBuf.append("Run-time Parameters\n"); + StringTokenizer st = new StringTokenizer(s.trim(), "|"); while(st.hasMoreTokens()) { token = st.nextToken(); @@ -490,7 +465,6 @@ public class ReportHandler extends org.onap.portalsdk.analytics.RaptorObject { cell = row.createCell((short) cellNum); cell.setCellValue(value.trim()); cell.setCellStyle(styleValue); - //strBuf.append(name.trim()+": "+ value.trim()+"\n"); } /* if(token.endsWith(":") && (value!=null && value.trim().length()<=0) && (name!=null && name.trim().length()>0 && name.endsWith(":"))) { name = name.substring(0, name.indexOf(":")+1); @@ -581,7 +555,6 @@ public class ReportHandler extends org.onap.portalsdk.analytics.RaptorObject { int mb = 1024*1024; Runtime runtime = Runtime.getRuntime(); int returnValue = 0; - // HSSFSheet sheet = wb.getSheetAt(0); HSSFCellStyle styleDefault = wb.createCellStyle(); HSSFCellStyle styleNumber = wb.createCellStyle(); HSSFCellStyle styleDecimalNumber = wb.createCellStyle(); @@ -589,9 +562,7 @@ public class ReportHandler extends org.onap.portalsdk.analytics.RaptorObject { HSSFCellStyle styleCurrencyDecimalNumber = wb.createCellStyle(); HSSFCellStyle styleDate = wb.createCellStyle(); HtmlStripper strip = new HtmlStripper(); - //HSSFSheet sheet = wb.getSheet(getSheetName()); HSSFCellStyle styleDataHeader = wb.createCellStyle(); - // style.setFillBackgroundColor(HSSFColor.AQUA.index); styleDataHeader.setFillForegroundColor(HSSFColor.GREY_40_PERCENT.index); styleDataHeader.setFillPattern(FillPatternType.SOLID_FOREGROUND ); styleDataHeader.setAlignment(HorizontalAlignment.CENTER); @@ -613,25 +584,6 @@ public class ReportHandler extends org.onap.portalsdk.analytics.RaptorObject { ColumnHeaderRow chr = null; String title = ""; -// System.out.println("***************** Size " + rd.reportColumnHeaderRows.size()); -// for (int i = 0; i < rd.reportColumnHeaderRows.size(); i++) { -// for (int j = 0; j < rd.reportColumnHeaderRows.getColumnHeaderRow(i).size(); j++) { -// System.out.println("Column Title " + rd.reportColumnHeaderRows.getColumnHeaderRow(i).getColumnHeader(j).getColumnTitle() -// + " " + rd.reportColumnHeaderRows.getColumnHeaderRow(i).getColumnHeader(j).isVisible()); -// } -// } -/* List dsList = rr.getDataSourceList().getDataSource(); - HashMap dataColumnTypeHashMap = new HashMap(); - for (Iterator iter = dsList.iterator(); iter.hasNext();) { - DataSourceType element = (DataSourceType) iter.next(); - List dcList = element.getDataColumnList().getDataColumn(); - for (Iterator iterator = dcList.iterator(); iterator.hasNext();) { - DataColumnType element1 = (DataColumnType) iterator.next(); - dataTypeMap.put(element1.getColId(), element1.getColType()); - dataColumnTypeHashMap.put(element1.getColName(), element1); - } - } -*/ int columnRows = rr.getVisibleColumnCount() - 1; HttpSession session = request.getSession(); @@ -722,18 +674,6 @@ public class ReportHandler extends org.onap.portalsdk.analytics.RaptorObject { } // for */ - //cellNum = -1; - - -// Set mapSet = dataTypeMap.entrySet(); -// Map.Entry me; -// String element, value ; -// for (Iterator iter = mapSet.iterator(); iter.hasNext();) { -// me=(Map.Entry)iter.next(); -// element = (String) me.getKey(); -// value = (String) me.getValue(); -// System.out.println("DataTypeMap " + element + " " + value); -// } for (chr.resetNext(); chr.hasNext();) { ColumnHeader ch = chr.getNext(); @@ -782,7 +722,6 @@ public class ReportHandler extends org.onap.portalsdk.analytics.RaptorObject { // Data // Create some cell styles. - //HSSFCellStyle styleDefault = wb.createCellStyle(); HSSFCellStyle styleCell = null; HSSFCellStyle styleTotal = wb.createCellStyle(); @@ -813,7 +752,6 @@ public class ReportHandler extends org.onap.portalsdk.analytics.RaptorObject { styleDefault.setBorderTop(BorderStyle.THIN); styleDefault.setBorderLeft(BorderStyle.THIN); styleDefault.setBorderRight(BorderStyle.THIN); - // styleDefault.setFillForegroundColor(HSSFColor.YELLOW.index); styleDefault.setFillPattern(FillPatternType.NO_FILL); styleDefault.setFont(fontDefault); styleDefault.setWrapText(true); @@ -823,11 +761,10 @@ public class ReportHandler extends org.onap.portalsdk.analytics.RaptorObject { styleNumber.setBorderTop(BorderStyle.THIN); styleNumber.setBorderLeft(BorderStyle.THIN); styleNumber.setBorderRight(BorderStyle.THIN); - // styleDefault.setFillForegroundColor(HSSFColor.YELLOW.index); styleNumber.setFillPattern(FillPatternType.NO_FILL); styleNumber.setFont(fontDefault); try { - styleNumber.setDataFormat((short)0x26);//HSSFDataFormat.getBuiltinFormat("(#,##0_);[Red](#,##0)")); + styleNumber.setDataFormat((short)0x26); } catch (Exception e) { } @@ -837,10 +774,9 @@ public class ReportHandler extends org.onap.portalsdk.analytics.RaptorObject { styleDecimalNumber.setBorderTop(BorderStyle.THIN); styleDecimalNumber.setBorderLeft(BorderStyle.THIN); styleDecimalNumber.setBorderRight(BorderStyle.THIN); - // styleDefault.setFillForegroundColor(HSSFColor.YELLOW.index); styleDecimalNumber.setFillPattern(FillPatternType.NO_FILL); styleDecimalNumber.setFont(fontDefault); - styleDecimalNumber.setDataFormat((short)0x27);//HSSFDataFormat.getBuiltinFormat("(#,##0.00_);[Red](#,##0.00)")); + styleDecimalNumber.setDataFormat((short)0x27); //Decimal Number styleDecimalNumberTotal.setAlignment(HorizontalAlignment.CENTER); @@ -848,7 +784,6 @@ public class ReportHandler extends org.onap.portalsdk.analytics.RaptorObject { styleDecimalNumberTotal.setBorderTop(BorderStyle.THIN); styleDecimalNumberTotal.setBorderLeft(BorderStyle.THIN); styleDecimalNumberTotal.setBorderRight(BorderStyle.THIN); - // styleDefault.setFillForegroundColor(HSSFColor.YELLOW.index); styleDecimalNumberTotal.setFillPattern(FillPatternType.NO_FILL); styleDecimalNumberTotal.setFont(fontBold); styleDecimalNumberTotal.setDataFormat((short)0x27);//HSSFDataFormat.getBuiltinFormat("(#,##0.00_);[Red](#,##0.00)")); @@ -859,10 +794,9 @@ public class ReportHandler extends org.onap.portalsdk.analytics.RaptorObject { styleCurrencyDecimalNumber.setBorderTop(BorderStyle.THIN); styleCurrencyDecimalNumber.setBorderLeft(BorderStyle.THIN); styleCurrencyDecimalNumber.setBorderRight(BorderStyle.THIN); - // styleDefault.setFillForegroundColor(HSSFColor.YELLOW.index); styleCurrencyDecimalNumber.setFillPattern(FillPatternType.NO_FILL); styleCurrencyDecimalNumber.setFont(fontDefault); - styleCurrencyDecimalNumber.setDataFormat((short)8);//HSSFDataFormat.getBuiltinFormat("($#,##0.00_);[Red]($#,##0.00)")); + styleCurrencyDecimalNumber.setDataFormat((short)8); //currency number bold styleCurrencyDecimalNumberTotal.setAlignment(HorizontalAlignment.CENTER); @@ -870,7 +804,6 @@ public class ReportHandler extends org.onap.portalsdk.analytics.RaptorObject { styleCurrencyDecimalNumberTotal.setBorderTop(BorderStyle.THIN); styleCurrencyDecimalNumberTotal.setBorderLeft(BorderStyle.THIN); styleCurrencyDecimalNumberTotal.setBorderRight(BorderStyle.THIN); - // styleDefault.setFillForegroundColor(HSSFColor.YELLOW.index); styleCurrencyDecimalNumberTotal.setFillPattern(FillPatternType.NO_FILL); styleCurrencyDecimalNumberTotal.setFont(fontBold); styleCurrencyDecimalNumberTotal.setDataFormat((short)8);//HSSFDataFormat.getBuiltinFormat("($#,##0.00_);[Red]($#,##0.00)")); @@ -885,7 +818,7 @@ public class ReportHandler extends org.onap.portalsdk.analytics.RaptorObject { // styleDefault.setFillForegroundColor(HSSFColor.YELLOW.index); styleCurrencyNumber.setFillPattern(FillPatternType.NO_FILL); styleCurrencyNumber.setFont(fontDefault); - styleCurrencyNumber.setDataFormat((short) 6);//HSSFDataFormat.getBuiltinFormat("($#,##0_);[Red]($#,##0)")); + styleCurrencyNumber.setDataFormat((short) 6); //CurrencyNumber @@ -897,7 +830,7 @@ public class ReportHandler extends org.onap.portalsdk.analytics.RaptorObject { // styleDefault.setFillForegroundColor(HSSFColor.YELLOW.index); styleCurrencyNumberTotal.setFillPattern(FillPatternType.NO_FILL); styleCurrencyNumberTotal.setFont(fontBold); - styleCurrencyNumberTotal.setDataFormat((short) 6);//HSSFDataFormat.getBuiltinFormat("($#,##0_);[Red]($#,##0)")); + styleCurrencyNumberTotal.setDataFormat((short) 6); //Date styleDate.setAlignment(HorizontalAlignment.CENTER); @@ -905,7 +838,6 @@ public class ReportHandler extends org.onap.portalsdk.analytics.RaptorObject { styleDate.setBorderTop(BorderStyle.THIN); styleDate.setBorderLeft(BorderStyle.THIN); styleDate.setBorderRight(BorderStyle.THIN); - // styleDefault.setFillForegroundColor(HSSFColor.YELLOW.index); styleDate.setFillPattern(FillPatternType.NO_FILL); styleDate.setFont(fontDefault); styleDate.setDataFormat((short)0xe);//HSSFDataFormat.getBuiltinFormat("m/d/yy")); @@ -916,9 +848,8 @@ public class ReportHandler extends org.onap.portalsdk.analytics.RaptorObject { styleTotal.setBorderTop(BorderStyle.THIN); styleTotal.setBorderLeft(BorderStyle.THIN); styleTotal.setBorderRight(BorderStyle.THIN); - // styleDefault.setFillForegroundColor(HSSFColor.YELLOW.index); styleTotal.setFillPattern(FillPatternType.NO_FILL); - styleTotal.setDataFormat((short)0x28);//HSSFDataFormat.getBuiltinFormat("(#,##0.00_);[Red](#,##0.00)")); + styleTotal.setDataFormat((short)0x28); styleTotal.setFont(fontBold); styleCurrencyTotal.setAlignment(HorizontalAlignment.CENTER); @@ -926,9 +857,8 @@ public class ReportHandler extends org.onap.portalsdk.analytics.RaptorObject { styleCurrencyTotal.setBorderTop(BorderStyle.THIN); styleCurrencyTotal.setBorderLeft(BorderStyle.THIN); styleCurrencyTotal.setBorderRight(BorderStyle.THIN); - // styleDefault.setFillForegroundColor(HSSFColor.YELLOW.index); styleCurrencyTotal.setFillPattern(FillPatternType.NO_FILL); - styleCurrencyTotal.setDataFormat((short)8);//HSSFDataFormat.getBuiltinFormat("($#,##0.00_);[Red]($#,##0.00)")); + styleCurrencyTotal.setDataFormat((short)8); styleCurrencyTotal.setFont(fontBold); styleDefaultTotal.setAlignment(HorizontalAlignment.CENTER); @@ -936,10 +866,8 @@ public class ReportHandler extends org.onap.portalsdk.analytics.RaptorObject { styleDefaultTotal.setBorderTop(BorderStyle.THIN); styleDefaultTotal.setBorderLeft(BorderStyle.THIN); styleDefaultTotal.setBorderRight(BorderStyle.THIN); - // styleDefault.setFillForegroundColor(HSSFColor.YELLOW.index); styleDefaultTotal.setFillPattern(FillPatternType.NO_FILL); styleDefaultTotal.setDataFormat((short)0x28); - ////styleDefaultTotal.setDataFormat(HSSFDataFormat.getBuiltinFormat("($#,##0.00_);[Red]($#,##0.00)")); styleDefaultTotal.setFont(fontBold); firstPass = true; @@ -1002,7 +930,6 @@ public class ReportHandler extends org.onap.portalsdk.analytics.RaptorObject { rd.reportDataRows.resetNext(); dr = rd.reportDataRows.getNext(); j = 0; - //if(rowCount%1000 == 0) wb.write(sos); /*if(rd.reportTotalRowHeaderCols!=null) { //cellNum = -1; @@ -1022,10 +949,7 @@ public class ReportHandler extends org.onap.portalsdk.analytics.RaptorObject { //} // for }*/ firstPass = false; - //cellNum = -1; for (dr.resetNext(); dr.hasNext();j++) { - //for (chr.resetNext(); chr.hasNext();) { - //ColumnHeader ch = chr.getNext(); styleCell = null; DataValue dv = dr.getNext(); HtmlFormatter htmlFormat = dv.getCellFormatter(); @@ -1040,15 +964,10 @@ public class ReportHandler extends org.onap.portalsdk.analytics.RaptorObject { if(dv.isVisible()) { cellNum += 1; cell = row.createCell((short) cellNum); - //System.out.println("Stripping HTML 1"); //cell.setCellValue(strip.stripHtml(dv.getDisplayValue())); String dataType = (String) (dataTypeMap.get(dv.getColId())); //System.out.println("Value " + value + " " + (( dataType !=null && dataType.equals("DATE")) || (dv.getColName()!=null && dv.getColName().toLowerCase().endsWith("date"))) ); if (dataType!=null && dataType.equals("NUMBER")){ - //cellNumber = row.createCell((short) cellNum); - //cellNumber.setCellType(HSSFCell.CELL_TYPE_NUMERIC); - //cellNumber.setCellValue(dv.getDisplayValue()); - //cellCurrencyNumber = row.createCell((short) cellNum); int zInt = 0; if (value.equals("null")){ cell.setCellValue(zInt); @@ -1057,15 +976,9 @@ public class ReportHandler extends org.onap.portalsdk.analytics.RaptorObject { if ((value.indexOf("."))!= -1){ if ((value.trim().startsWith("$")) || (value.trim().startsWith("-$") )) { - //if (dv.getDisplayValue().startsWith("$")){ - //styleDefault.setDataFormat(HSSFDataFormat.getBuiltinFormat("($#,##0.00);($#,##0.00)")); String tempDollar = dv.getDisplayValue().trim(); tempDollar = tempDollar.replaceAll(" ", "").substring(0); tempDollar = tempDollar.replaceAll("\\$", "").substring(0); - //System.out.println("SUBSTRING |" + tempDollar); - //System.out.println("Before copy Value |" + tempDollar); - //tempDollar = String.copyValueOf(tempDollar.toCharArray(), 1, tempDollar.length()-1); - //System.out.println("After copy Value |" + tempDollar); if ((tempDollar.indexOf(","))!= -1){ tempDollar = tempDollar.replaceAll(",", ""); } diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/ReportLoader.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/ReportLoader.java index 0bdcc6fd..687b9c4d 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/ReportLoader.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/ReportLoader.java @@ -130,11 +130,7 @@ public class ReportLoader extends org.onap.portalsdk.analytics.RaptorObject { char[] buffer = new char[512]; Reader in = null; in = new InputStreamReader(clob.getAsciiStream()); - // if(obj instanceof oracle.sql.CLOB) { - // in = ((oracle.sql.CLOB) obj).getCharacterStream(); - // } else if (obj instanceof weblogic.jdbc.wrapper.Clob) { - // in = ((weblogic.jdbc.base.BaseClob) obj).getCharacterStream(); - // } + while ((len = in.read(buffer)) != -1) sb.append(buffer, 0, len); in.close(); @@ -191,7 +187,6 @@ public class ReportLoader extends org.onap.portalsdk.analytics.RaptorObject { rs.updateString("report_xml", reportXML); rs.updateRow(); connection.commit(); - // sb.append(rs.getString(1)); } else { throw new RaptorException( "Report " + reportID + NOT_FOUND_IN_DB); @@ -286,7 +281,6 @@ public class ReportLoader extends org.onap.portalsdk.analytics.RaptorObject { } public static boolean isReportsAlreadyScheduled(String reportID) throws RaptorException { - // String sql = "select rep_id from cr_report_schedule where rep_id = ?"; String sql = Globals.getIsReportAlreadyScheduled(); Connection connection = DbUtils.getConnection(); @@ -360,11 +354,6 @@ public class ReportLoader extends org.onap.portalsdk.analytics.RaptorObject { sql = sql.replace("[userID]", userID); DataSet ds = DbUtils.executeQuery(sql); - // DataSet ds = DbUtils - // .executeQuery("SELECT cr.rep_id, cr.title FROM cr_report cr WHERE nvl(cr.owner_id, cr.create_id) - // = " - // + userID); - for (int i = 0; i < ds.getRowCount(); i++) reportIdNames.add(new IdNameValue(ds.getString(i, 0), ds.getString(i, 1))); } catch (Exception e) { @@ -458,9 +447,6 @@ public class ReportLoader extends org.onap.portalsdk.analytics.RaptorObject { for (Iterator iter = AppUtils.getUserRoles(request).iterator(); iter.hasNext();) roleList.append("," + ((String) iter.next())); - // DataSet ds = DbUtils.executeQuery("SELECT cr.rep_id, cr.title FROM - // cr_report cr WHERE cr.public_yn = 'Y' AND cr.menu_id = - // '"+nvls(menuId)+"' AND cr.menu_approved_yn = 'Y' ORDER BY cr.title"); // Copied from SearchHandler and simplified /* * String query = "SELECT cr.rep_id, " + "cr.title, " + "cr.descr " + "FROM cr_report cr, " + @@ -590,10 +576,6 @@ public class ReportLoader extends org.onap.portalsdk.analytics.RaptorObject { sql = sql.replace("[roleList.toString()]", roleList.toString()); sql = sql.replace("[folderId]", folderId); - // String user_sql = " AND nvl(cr.owner_id, cr.create_id) = " + userID; - // String public_sql = " AND (nvl(cr.owner_id, cr.create_id) = " + userID - // + " OR cr.public_yn = 'Y' OR ra.read_only_yn IS NOT NULL)"; - String user_sql = Globals.getLoadFolderReportsUser(); user_sql = user_sql.replace("[userID]", userID); String public_sql = Globals.getLoadFolderReportsPublicSql(); @@ -632,7 +614,6 @@ public class ReportLoader extends org.onap.portalsdk.analytics.RaptorObject { */ ReportSearchResult rsr = new ReportSearchResult(-1, ds.getRowCount(), 6, 7); rsr.parseData(ds, request); - // rsr.truncateToPage(pageNo); return rsr; } // loadFolderReports @@ -687,9 +668,6 @@ public class ReportLoader extends org.onap.portalsdk.analytics.RaptorObject { sql = sql.replace("[userID]", userID); sql = sql.replace("[roleList.toString()]", roleList.toString()); - // DataSet ds = DbUtils - // .executeQuery(query.toString()); - DataSet ds = DbUtils .executeQuery(sql); HashMap map = new HashMap(); @@ -725,9 +703,6 @@ public class ReportLoader extends org.onap.portalsdk.analytics.RaptorObject { sql = sql.replace("[userID]", userID); sql = sql.replace("[roleList.toString()]", roleList.toString()); - // DataSet ds = DbUtils - // .executeQuery(query.toString()); - DataSet ds = DbUtils .executeQuery(sql); @@ -749,18 +724,6 @@ public class ReportLoader extends org.onap.portalsdk.analytics.RaptorObject { * append(" and action = 'Report Execution Time' and a.rep_id = cr.rep_id order by log_time desc) x where rownum <= 6 ) y where rownum >= 1" * ); */ - // DataSet ds = DbUtils - // .executeQuery( - // " SELECT a.file_name, b.title,to_char(a.dwnld_start_time, 'Dy DD-Mon-YYYY HH24:MI:SS') as time, - // "+ - // " a.dwnld_start_time " + - // " FROM cr_report_dwnld_log a, cr_report b where a.user_id = "+userID +" and "+ - // " a.rep_id = b.rep_id and (a.dwnld_start_time) >= to_date(to_char(sysdate-24/24, 'mm/dd/yyyy'), - // 'mm/dd/yyyy') " + - // " and a.record_ready_time is not null " + - // " order by a.dwnld_start_time desc"); - // DataSet ds = DbUtils - // .executeQuery(query.toString()); String sql = Globals.getLoadMyRecentLinks(); sql = sql.replace("[userID]", userID); @@ -784,10 +747,6 @@ public class ReportLoader extends org.onap.portalsdk.analytics.RaptorObject { String userID, String action, String executionTime, String form_fields) throws RaptorException { if (form_fields.length() >= 4000) form_fields = ""; - // String stmt = "INSERT INTO cr_report_log (rep_id, log_time, user_id, action, action_value, - // form_fields) VALUES(" - // + reportID + ", SYSDATE, " + userID + ", '" + action + "' , '" + executionTime + "', '"+ - // form_fields +"')"; String stmt = Globals.getCreateReportLogEntry(); stmt = stmt.replace("[reportID]", reportID); @@ -864,11 +823,6 @@ public class ReportLoader extends org.onap.portalsdk.analytics.RaptorObject { * + nvls(reportId)+ " and rl.action != 'Report Run' and fuser.user_id = rl.user_id" ); * query.append(" ORDER BY rl.log_time DESC) x WHERE ROWNUM <= 100"); */ - // DataSet ds = DbUtils - // .executeQuery("SELECT x.log_time, x.user_id, x.action FROM (SELECT TO_CHAR(rl.log_time, 'Month - // DD, YYYY HH:MI:SS AM') log_time, rl.user_id, rl.action FROM cr_report_log rl WHERE rl.rep_id = " - // + nvls(reportId) + " ORDER BY rl.log_time DESC) x WHERE ROWNUM <= 100"); - // DataSet ds = DbUtils.executeQuery(query.toString()); String sql = Globals.getLoadReportLogEntries(); sql = sql.replace("[AppUtils.getRaptorActionURL()]", AppUtils.getRaptorActionURL()); @@ -893,9 +847,7 @@ public class ReportLoader extends org.onap.portalsdk.analytics.RaptorObject { String userId = AppUtils.getUserID(request); if (AppUtils.isAdminUser(request)) return true; - // String query = "select crs.sched_user_id, count(*) from cr_report_schedule crs where - // sched_user_id = " + userId + " group by crs.sched_user_id having count(*) >= " + - // Globals.getScheduleLimit(); + String query = Globals.getDoesUserCanScheduleReport(); query = query.replace("[userId]", userId); query = query.replace("[Globals.getScheduleLimit()]", String.valueOf(Globals.getScheduleLimit())); @@ -910,7 +862,6 @@ public class ReportLoader extends org.onap.portalsdk.analytics.RaptorObject { logger.debug(EELFLoggerDelegate.debugLogger, ("scheduleId " + scheduleId)); if (scheduleId == null || scheduleId.trim().length() <= 0) return !flagLimit; - // query = "select crs.schedule_id from cr_report_schedule crs where schedule_id = " + scheduleId; query = Globals.getDoesUserCanSchedule(); query = query.replace("[scheduleId]", scheduleId); @@ -927,7 +878,6 @@ public class ReportLoader extends org.onap.portalsdk.analytics.RaptorObject { } public static String getSystemDateTime() throws RaptorException { - // String query = "select to_char(sysdate,'MM/dd/yyyy HH24:mi:ss') from dual"; String query = Globals.getTheSystemDateTime(); DataSet ds = DbUtils.executeQuery(query); @@ -940,7 +890,6 @@ public class ReportLoader extends org.onap.portalsdk.analytics.RaptorObject { } public static String getNextDaySystemDateTime() throws RaptorException { - // String query = "select to_char(sysdate+1,'MM/dd/yyyy HH24:mi:ss') from dual"; String query = Globals.getTheNextDayDateTime(); DataSet ds = DbUtils.executeQuery(query); String timeStr = ""; @@ -952,7 +901,6 @@ public class ReportLoader extends org.onap.portalsdk.analytics.RaptorObject { } public static String getNext15MinutesOfSystemDateTime() throws RaptorException { - // String query = "select to_char(sysdate+15/(24*60),'MM/dd/yyyy HH24:mi:ss') from dual"; String query = Globals.getTheNextFifteenMinDateTime(); DataSet ds = DbUtils.executeQuery(query); @@ -965,7 +913,6 @@ public class ReportLoader extends org.onap.portalsdk.analytics.RaptorObject { } public static String getNext30MinutesOfSystemDateTime() throws RaptorException { - // String query = "select to_char(sysdate+30/(24*60),'MM/dd/yyyy HH24:mi:ss') from dual"; String query = Globals.getTheNextThirtyMinDateTime(); DataSet ds = DbUtils.executeQuery(query); String timeStr = ""; @@ -997,7 +944,6 @@ public class ReportLoader extends org.onap.portalsdk.analytics.RaptorObject { public static HashMap loadPDFImgLookUp() throws RaptorException { StringBuffer query = new StringBuffer(""); HashMap pdfImgMap = new HashMap(); - // query.append("select image_id, image_loc from cr_raptor_pdf_img"); query.append(Globals.getLoadPdfImgLookup()); DataSet ds = DbUtils.executeQuery(query.toString()); for (int i = 0; i < ds.getRowCount(); i++) { @@ -1009,7 +955,6 @@ public class ReportLoader extends org.onap.portalsdk.analytics.RaptorObject { public static HashMap loadActionImgLookUp() throws RaptorException { StringBuffer query = new StringBuffer(""); HashMap pdfImgMap = new HashMap(); - // query.append("select image_id, image_loc from cr_raptor_action_img"); query.append(Globals.getLoadActionImgLookup()); DataSet ds = DbUtils.executeQuery(query.toString()); for (int i = 0; i < ds.getRowCount(); i++) { diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/SearchHandler.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/SearchHandler.java index 22108350..5d122cd3 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/SearchHandler.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/SearchHandler.java @@ -176,48 +176,11 @@ public class SearchHandler extends org.onap.portalsdk.analytics.RaptorObject { for (Iterator iter = AppUtils.getUserRoles(request).iterator(); iter.hasNext();) roleList.append("," + ((String) iter.next())); //<a href="#" alt="Run report" onClick="document.forma.r_action.value='report.run'; document.forma.c_master.value='1073';"> - /*String sql = "SELECT cr.rep_id, " - + "cr.rep_id report_id, " - + rep_title_sql+ - "||DECODE(cr.public_yn, 'Y', '', '" - + PRIVATE_ICON - + "')||cr.title||'</a>' title, " - + "cr.descr, " - + "au.first_name||' '||au.last_name owner_name, " - + "TO_CHAR(cr.create_date, 'MM/DD/YYYY') create_date, " - + "DECODE(NVL(cr.owner_id, cr.create_id), " - + userID - + ", 'N', NVL(ra.read_only_yn, 'Y')) read_only_yn, " - + "DECODE(NVL(cr.owner_id, cr.create_id), " - + userID - + ", 'Y', 'N') user_is_owner_yn, " - + "case when report_xml like '%<allowSchedule>N</allowSchedule>%' " - + "then 'N' " - + "when report_xml like '%<allowSchedule>Y</allowSchedule>%' " - + "or 1 = (select distinct 1 from cr_report_schedule where rep_id = cr.rep_id) " - + "then 'Y' " - + "else 'N' end " - + "FROM cr_report cr, " - + "app_user au, " - + "(SELECT rep_id, " - + "MIN(read_only_yn) read_only_yn " - + "FROM ((SELECT ua.rep_id, ua.read_only_yn FROM cr_report_access ua WHERE ua.user_id = " - + userID - + ") " - + "UNION ALL " - + "(SELECT ra.rep_id, ra.read_only_yn FROM cr_report_access ra WHERE ra.role_id IN (" - + roleList.toString() + "))" + ") report_access " + "GROUP BY rep_id) ra " - + "WHERE TO_CHAR(cr.rep_id) = nvl('" + fReportID - + "', TO_CHAR(cr.rep_id)) AND " + "UPPER(cr.title) LIKE UPPER('%" - + fReportName + "%') AND " + "nvl(cr.owner_id, cr.create_id) = au.user_id " - + "AND cr.rep_id = ra.rep_id (+) ";*/ - String sql = Globals.getLoadReportSearchResult(); String rep_id = ""; String rep_id_sql_value = ""; String rep_id_options = ""; String rep_id_sql = Globals.getLoadReportSearchRepIdSql(); - //rep_id_sql = " AND ROUND(cr.rep_id, 0) like coalesce('%%', ROUND(cr.rep_id, 0)) "; if(request.getParameter("rep_id")!=null) { rep_id = request.getParameter("rep_id"); } @@ -308,23 +271,14 @@ public class SearchHandler extends org.onap.portalsdk.analytics.RaptorObject { sql = sql.replace("[fReportName]",rep_name_sql); if (menuId.length() > 0){ - /*sql += "AND INSTR('|'||cr.menu_id||'|', '|'||'" + menuId + "'||'|') > 0 " - * +"AND - * cr.menu_approved_yn = - * 'Y' " - ;*/ String sql_add = Globals.getLoadReportSearchInstr(); sql+= sql_add; } - //String user_sql = " AND nvl(cr.owner_id, cr.create_id) = " + userID; String user_sql = Globals.getLoadReportSearchResultUser(); - //String public_sql = " AND (nvl(cr.owner_id, cr.create_id) = " + userID - // + " OR cr.public_yn = 'Y' OR ra.read_only_yn IS NOT NULL)"; String public_sql = Globals.getLoadReportSearchResultPublic(); - //String fav_sql = " AND cr.rep_id in (select rep_id from cr_favorite_reports where user_id = " + userID +" ) "; String fav_sql = Globals.getLoadReportSearchResultFav(); if (userOnly) @@ -346,15 +300,12 @@ public class SearchHandler extends org.onap.portalsdk.analytics.RaptorObject { // else - not super user - doesn't get access to private reports of // other users (= Public reports); Admin users get edit right // override later - //sql += public_sql; sql += " " + public_sql; } if (sortOrder.equals(AppConstants.RI_F_OWNER_ID)){ - //sql += " ORDER BY DECODE(nvl(cr.owner_id, cr.create_id), " + userID - //+ ", ' ', upper(au.first_name||' '||au.last_name)), upper(cr.title)"; String sql_sort = Globals.getLoadReportSearchResultSort(); sql+=" " + sql_sort; } @@ -366,7 +317,6 @@ public class SearchHandler extends org.onap.portalsdk.analytics.RaptorObject { sql += " ORDER BY cr.public_yn desc"; else - // if(sortOrder.equals(AppConstants.RI_F_REPORT_NAME)) sql += " ORDER BY upper(cr.title)"; sql = sql.replace("[rep_title_sql]", "cr.title"); @@ -374,14 +324,10 @@ public class SearchHandler extends org.onap.portalsdk.analytics.RaptorObject { sql = sql.replace("[userID]", userID); sql = sql.replace("[roleList.toString()]", roleList.toString()); - //System.out.println("query is for search list is : " + sql); DataSet ds = DbUtils.executeQuery(sql, rep_name_sql_value, rep_id_sql_value); ReportSearchResultJSON rsr = new ReportSearchResultJSON(0, 6, 7); rsr.parseData(ds, request, 0, 20, 6, 7); - //saveCSVPageFile(request, rsr); - //rsr.truncateToPage(pageNo); - //saveCSVPageFile(request, rsr); return rsr; } // loadReportSearchResult @@ -413,35 +359,6 @@ public class SearchHandler extends org.onap.portalsdk.analytics.RaptorObject { for (Iterator iter = AppUtils.getUserRoles(request).iterator(); iter.hasNext();) roleList.append("," + ((String) iter.next())); //<a href="#" alt="Run report" onClick="document.forma.r_action.value='report.run'; document.forma.c_master.value='1073';"> - /*String sql = "SELECT cr.rep_id, " - + "cr.rep_id report_id, " - + rep_title_sql+ - "||DECODE(cr.public_yn, 'Y', '', '" - + PRIVATE_ICON - + "')||cr.title||'</a>' title, " - + "cr.descr, " - + "au.first_name||' '||au.last_name owner_name, " - + "TO_CHAR(cr.create_date, 'MM/DD/YYYY') create_date, " - + "DECODE(NVL(cr.owner_id, cr.create_id), " - + userID - + ", 'N', NVL(ra.read_only_yn, 'Y')) read_only_yn, " - + "DECODE(NVL(cr.owner_id, cr.create_id), " - + userID - + ", 'Y', 'N') user_is_owner_yn " - + "FROM cr_report cr, " - + "app_user au, " - + "(SELECT rep_id, " - + "MIN(read_only_yn) read_only_yn " - + "FROM ((SELECT ua.rep_id, ua.read_only_yn FROM cr_report_access ua WHERE ua.user_id = " - + userID - + ") " - + "UNION ALL " - + "(SELECT ra.rep_id, ra.read_only_yn FROM cr_report_access ra WHERE ra.role_id IN (" - + roleList.toString() + "))" + ") report_access " + "GROUP BY rep_id) ra " - + "WHERE TO_CHAR(cr.rep_id) = nvl('" + fReportID - + "', TO_CHAR(cr.rep_id)) AND " + "UPPER(cr.title) LIKE UPPER('%" - + fReportName + "%') AND " + "nvl(cr.owner_id, cr.create_id) = au.user_id " - + "AND cr.rep_id = ra.rep_id (+) ";*/ String sql = Globals.getLoadFolderReportResult(); sql = sql.replace("[rep_title_sql]", rep_title_sql); @@ -452,20 +369,13 @@ public class SearchHandler extends org.onap.portalsdk.analytics.RaptorObject { sql = sql.replace("[fReportName]", fReportName); if (menuId.length() > 0){ - /*sql += "AND INSTR('|'||cr.menu_id||'|', '|'||'" + menuId + "'||'|') > 0 " - * +"AND - * cr.menu_approved_yn = - * 'Y' " - ;*/ + String sql_add = Globals.getLoadReportSearchInstr(); sql+= sql_add; } - //String user_sql = " AND nvl(cr.owner_id, cr.create_id) = " + userID; String user_sql = Globals.getLoadReportSearchResultUser(); - //String public_sql = " AND (nvl(cr.owner_id, cr.create_id) = " + userID - // + " OR cr.public_yn = 'Y' OR ra.read_only_yn IS NOT NULL)"; String public_sql = Globals.getLoadReportSearchResultPublic(); if (userOnly) @@ -489,10 +399,6 @@ public class SearchHandler extends org.onap.portalsdk.analytics.RaptorObject { if (sortOrder.equals(AppConstants.RI_F_OWNER_ID)){ - - //sql += " ORDER BY DECODE(nvl(cr.owner_id, cr.create_id), " + userID - // + ", ' ', au.first_name||' '||au.last_name), cr.title"; - String sql_sort = Globals.getLoadFolderReportResultSort(); sql+=sql_sort; } @@ -503,10 +409,8 @@ public class SearchHandler extends org.onap.portalsdk.analytics.RaptorObject { else if(sortOrder.equals(AppConstants.RI_F_PUBLIC)) sql += " ORDER BY cr.public_yn desc"; else - // if(sortOrder.equals(AppConstants.RI_F_REPORT_NAME)) sql += " ORDER BY cr.title"; - //System.out.println("query is for search list is : " + sql); DataSet ds = DbUtils.executeQuery(sql); ReportSearchResult rsr = new ReportSearchResult(-1, 6, 7); |