summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk
diff options
context:
space:
mode:
Diffstat (limited to 'ecomp-sdk')
-rw-r--r--ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/ReportHandler.java107
-rw-r--r--ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/ReportLoader.java59
2 files changed, 12 insertions, 154 deletions
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++) {