diff options
Diffstat (limited to 'ecomp-sdk/epsdk-analytics/src/main')
3 files changed, 433 insertions, 416 deletions
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 156572f6..dd14f5b1 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 @@ -5198,182 +5198,182 @@ public class ReportWrapper extends org.onap.portalsdk.analytics.RaptorObject { /** ************************************************************************************************* */ - 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 +// 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; diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ReportRuntime.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ReportRuntime.java index 171dc7c8..a9352ec9 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ReportRuntime.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ReportRuntime.java @@ -183,6 +183,12 @@ public class ReportRuntime extends ReportWrapper implements Cloneable, Serializa private int DATE_OPTION = -1; + + public void setReportFormFields(ReportFormFields reportFormFields) { + this.reportFormFields = reportFormFields; + } + + /* * private ReportRuntime(CustomReport cr, String reportID, * HttpServletRequest request) { super(cr, reportID); @@ -595,6 +601,11 @@ public class ReportRuntime extends ReportWrapper implements Cloneable, Serializa return reportFormFields; } // getReportFormFields + public void setChartDataCache(DataSet chartDataCache) { + this.chartDataCache = chartDataCache; + } + + /** ************** Report Data processing *************** */ public DataSet loadChartData(String userId, HttpServletRequest request) throws RaptorException { if (nvl(getChartType()).length() == 0) @@ -2077,65 +2088,65 @@ public class ReportRuntime extends ReportWrapper implements Cloneable, Serializa return this.cr.getDbInfo(); } - private String fixSQL(StringBuffer sql) { - int pos = 0; - int pos_f_format = 0; - int pos_t_format = 0; - int pos_alias = 0; - String format = ""; - String alias = null; - if(sql.indexOf("SELECT", 7)!= -1) { - pos = sql.indexOf("SELECT", 7); - if(sql.indexOf("TO_CHAR", pos)!= -1){ - pos = sql.indexOf("TO_CHAR", pos); - if(sql.indexOf("999",pos)!= -1) { - pos = sql.indexOf("999",pos); - pos_f_format = sql.lastIndexOf(", '", pos); - if(pos_f_format == -1 || (pos - pos_f_format > 10)) { - pos_f_format = sql.lastIndexOf(",'", pos); - pos_f_format -= 1; - } - pos = pos_f_format; - if(sql.indexOf("')", pos)!= -1) { - pos_t_format = sql.indexOf("')", pos); - //debugLogger.debug("pos_t - " + pos_t_format + " " + pos); - if(pos_t_format == -1 || (pos_t_format - pos > 20)) { - pos_t_format = sql.indexOf("' )", pos); - pos_t_format += 3; - } - else if (pos_t_format != -1) - pos_t_format += 2; - format = sql.substring(pos_f_format+3, pos_t_format); - //alias = sql.substring(pos_t_format+3, pos_t_format+6); - pos_alias = sql.indexOf(" ", pos_t_format); - alias = sql.substring(pos_alias+1, pos_alias+4); - } - } - } - - if(sql.indexOf(alias)!=-1) { - pos = sql.indexOf(alias); - //debugLogger.debug(pos + " " + alias.length()+1 + "\n" + sql); - sql.delete(pos,pos+4); - sql.insert(pos, "TO_NUMBER("+alias+", '"+format+"')),'"+ format + "')"); - pos = sql.lastIndexOf("SUM", pos); - if(pos==-1) - pos = sql.lastIndexOf("AVG", pos); - else if (pos==-1) - pos = sql.lastIndexOf("COUNT", pos); - else if (pos == -1) - pos = sql.lastIndexOf("STDDEV", pos); - else if (pos == -1) - pos = sql.lastIndexOf("VARIANCE", pos); - sql.insert(pos, "TO_CHAR ("); - } - - } - - //debugLogger.debug("Alias|" + alias + "| Format " + format); - //debugLogger.debug(sql.toString()); - return sql.toString(); - } // FixSQL +// private String fixSQL(StringBuffer sql) { +// int pos = 0; +// int pos_f_format = 0; +// int pos_t_format = 0; +// int pos_alias = 0; +// String format = ""; +// String alias = null; +// if(sql.indexOf("SELECT", 7)!= -1) { +// pos = sql.indexOf("SELECT", 7); +// if(sql.indexOf("TO_CHAR", pos)!= -1){ +// pos = sql.indexOf("TO_CHAR", pos); +// if(sql.indexOf("999",pos)!= -1) { +// pos = sql.indexOf("999",pos); +// pos_f_format = sql.lastIndexOf(", '", pos); +// if(pos_f_format == -1 || (pos - pos_f_format > 10)) { +// pos_f_format = sql.lastIndexOf(",'", pos); +// pos_f_format -= 1; +// } +// pos = pos_f_format; +// if(sql.indexOf("')", pos)!= -1) { +// pos_t_format = sql.indexOf("')", pos); +// //debugLogger.debug("pos_t - " + pos_t_format + " " + pos); +// if(pos_t_format == -1 || (pos_t_format - pos > 20)) { +// pos_t_format = sql.indexOf("' )", pos); +// pos_t_format += 3; +// } +// else if (pos_t_format != -1) +// pos_t_format += 2; +// format = sql.substring(pos_f_format+3, pos_t_format); +// //alias = sql.substring(pos_t_format+3, pos_t_format+6); +// pos_alias = sql.indexOf(" ", pos_t_format); +// alias = sql.substring(pos_alias+1, pos_alias+4); +// } +// } +// } +// +// if(sql.indexOf(alias)!=-1) { +// pos = sql.indexOf(alias); +// //debugLogger.debug(pos + " " + alias.length()+1 + "\n" + sql); +// sql.delete(pos,pos+4); +// sql.insert(pos, "TO_NUMBER("+alias+", '"+format+"')),'"+ format + "')"); +// pos = sql.lastIndexOf("SUM", pos); +// if(pos==-1) +// pos = sql.lastIndexOf("AVG", pos); +// else if (pos==-1) +// pos = sql.lastIndexOf("COUNT", pos); +// else if (pos == -1) +// pos = sql.lastIndexOf("STDDEV", pos); +// else if (pos == -1) +// pos = sql.lastIndexOf("VARIANCE", pos); +// sql.insert(pos, "TO_CHAR ("); +// } +// +// } +// +// //debugLogger.debug("Alias|" + alias + "| Format " + format); +// //debugLogger.debug(sql.toString()); +// return sql.toString(); +// } // FixSQL public String parseReportSQL(String sql) throws RaptorException { StringBuffer parsedSQL = new StringBuffer(); @@ -3017,189 +3028,189 @@ public List getMapMarkers(ReportData rd, org.onap.portalsdk.analytics.xmlobj.Rep } - private void refreshFormFieldsWithLatestValue(HttpServletRequest request, String userId, FormField ff_src, ArrayList<FormFieldJSON> formFieldJSONList) { - ArrayList<IdNameValue> formFieldValues = new ArrayList<IdNameValue>(); - List<String> requestValueList = null; - IdNameList lookup = null; - lookup = ff_src.getLookupList(); - IdNameSql lu = (IdNameSql) lookup; - String SQL = "" ; - String oldSQL = ""; - String oldDefaultSQL = ""; - String defaultSQL = ""; - IdNameList lookupList = null; - if(lu != null) { - SQL = lu.getSql(); - oldSQL = lu.getSql(); - oldDefaultSQL = lu.getDefaultSQL(); - defaultSQL = lu.getDefaultSQL(); - } - boolean readOnly = false; - for (Iterator iter1 = formFieldJSONList.iterator(); iter1.hasNext();) { - FormFieldJSON ffJSON = (FormFieldJSON) iter1.next(); - if((ffJSON.getFieldId().equals(ff_src.getFieldName())) && ffJSON.isVisible()) { - for (Iterator iter = reportFormFields.iterator(); iter.hasNext();) { - formFieldValues = new ArrayList<IdNameValue>(); - FormField ff = (FormField) iter.next(); - if(!ff.getFieldName().equals(ff_src.getFieldName())) { - //IdNameList lookup = null; - //lookup = ff.getLookupList(); - String selectedValue = ""; - - - - String [] requestParam = request.getParameterValues(ff.getFieldName()); - if(requestParam != null) { - requestValueList = Arrays.asList(request.getParameterValues(ff.getFieldName())); - - } else { - requestValueList = new ArrayList<String>(); - } - - - if(nvl(ff_src.getBaseSQL()).length()>0 && ff_src.getBaseSQL().indexOf("["+ff.getFieldDisplayName() +"]")!= -1) { - if(lookup!=null) { - try { - if(!ff_src.hasPredefinedList) { - String formatSelected = null; - if(ff_src.getFieldType().equals(FormField.FFT_LIST_MULTI) || ff_src.getFieldType().equals(FormField.FFT_CHECK_BOX)) { - formatSelected = formatSelectedItems(requestValueList, ff_src.getFieldType()); - } else - formatSelected = requestValueList.size()>0?requestValueList.get(0):""; - SQL = Utils.replaceInString(SQL, "["+ff_src.getFieldDisplayName()+"]", formatSelected); - defaultSQL = Utils.replaceInString(defaultSQL, "["+ff_src.getFieldDisplayName()+"]", formatSelected); - defaultSQL = parseAndFillWithCurrentValues(request, defaultSQL, ff_src); - defaultSQL = parseAndFillReq_Session_UserValues(request, defaultSQL, userId); - SQL = parseAndFillReq_Session_UserValues(request, SQL, userId); - SQL = parseAndFillWithCurrentValues(request, SQL, ff_src); - - } - } catch (Exception ex) { - ex.printStackTrace(); - } - - } - - } - } - } - - if(nvl(ff_src.getBaseSQL()).length()>0) { - lookup = new IdNameSql(-1,SQL,defaultSQL); - lookupList = lookup; - try { - lookup.loadUserData(0, "", ff_src.getDbInfo(), ff_src.getUserId()); - } catch (Exception e ){ - e.printStackTrace(); //throw new RaptorRuntimeException(e); - } - if(!ff_src.hasPredefinedList) { - lookup.trimToSize(); - for (lookup.resetNext(); lookup.hasNext();) { - IdNameValue value = lookup.getNext(); - readOnly = value.isReadOnly(); - formFieldValues.add(value); - } - } - ffJSON.setFormFieldValues(formFieldValues); - } - if(!ff_src.hasPredefinedList) { - if(oldSQL != null && !oldSQL.equals("")) { - ((IdNameSql)lookup).setSQL(oldSQL); - } - if(oldDefaultSQL != null && !oldDefaultSQL.equals("")) { - ((IdNameSql)lookup).setDefaultSQL(oldDefaultSQL); - } - } - - } - } - - } +// private void refreshFormFieldsWithLatestValue(HttpServletRequest request, String userId, FormField ff_src, ArrayList<FormFieldJSON> formFieldJSONList) { +// ArrayList<IdNameValue> formFieldValues = new ArrayList<IdNameValue>(); +// List<String> requestValueList = null; +// IdNameList lookup = null; +// lookup = ff_src.getLookupList(); +// IdNameSql lu = (IdNameSql) lookup; +// String SQL = "" ; +// String oldSQL = ""; +// String oldDefaultSQL = ""; +// String defaultSQL = ""; +// IdNameList lookupList = null; +// if(lu != null) { +// SQL = lu.getSql(); +// oldSQL = lu.getSql(); +// oldDefaultSQL = lu.getDefaultSQL(); +// defaultSQL = lu.getDefaultSQL(); +// } +// boolean readOnly = false; +// for (Iterator iter1 = formFieldJSONList.iterator(); iter1.hasNext();) { +// FormFieldJSON ffJSON = (FormFieldJSON) iter1.next(); +// if((ffJSON.getFieldId().equals(ff_src.getFieldName())) && ffJSON.isVisible()) { +// for (Iterator iter = reportFormFields.iterator(); iter.hasNext();) { +// formFieldValues = new ArrayList<IdNameValue>(); +// FormField ff = (FormField) iter.next(); +// if(!ff.getFieldName().equals(ff_src.getFieldName())) { +// //IdNameList lookup = null; +// //lookup = ff.getLookupList(); +// String selectedValue = ""; +// +// +// +// String [] requestParam = request.getParameterValues(ff.getFieldName()); +// if(requestParam != null) { +// requestValueList = Arrays.asList(request.getParameterValues(ff.getFieldName())); +// +// } else { +// requestValueList = new ArrayList<String>(); +// } +// +// +// if(nvl(ff_src.getBaseSQL()).length()>0 && ff_src.getBaseSQL().indexOf("["+ff.getFieldDisplayName() +"]")!= -1) { +// if(lookup!=null) { +// try { +// if(!ff_src.hasPredefinedList) { +// String formatSelected = null; +// if(ff_src.getFieldType().equals(FormField.FFT_LIST_MULTI) || ff_src.getFieldType().equals(FormField.FFT_CHECK_BOX)) { +// formatSelected = formatSelectedItems(requestValueList, ff_src.getFieldType()); +// } else +// formatSelected = requestValueList.size()>0?requestValueList.get(0):""; +// SQL = Utils.replaceInString(SQL, "["+ff_src.getFieldDisplayName()+"]", formatSelected); +// defaultSQL = Utils.replaceInString(defaultSQL, "["+ff_src.getFieldDisplayName()+"]", formatSelected); +// defaultSQL = parseAndFillWithCurrentValues(request, defaultSQL, ff_src); +// defaultSQL = parseAndFillReq_Session_UserValues(request, defaultSQL, userId); +// SQL = parseAndFillReq_Session_UserValues(request, SQL, userId); +// SQL = parseAndFillWithCurrentValues(request, SQL, ff_src); +// +// } +// } catch (Exception ex) { +// ex.printStackTrace(); +// } +// +// } +// +// } +// } +// } +// +// if(nvl(ff_src.getBaseSQL()).length()>0) { +// lookup = new IdNameSql(-1,SQL,defaultSQL); +// lookupList = lookup; +// try { +// lookup.loadUserData(0, "", ff_src.getDbInfo(), ff_src.getUserId()); +// } catch (Exception e ){ +// e.printStackTrace(); //throw new RaptorRuntimeException(e); +// } +// if(!ff_src.hasPredefinedList) { +// lookup.trimToSize(); +// for (lookup.resetNext(); lookup.hasNext();) { +// IdNameValue value = lookup.getNext(); +// readOnly = value.isReadOnly(); +// formFieldValues.add(value); +// } +// } +// ffJSON.setFormFieldValues(formFieldValues); +// } +// if(!ff_src.hasPredefinedList) { +// if(oldSQL != null && !oldSQL.equals("")) { +// ((IdNameSql)lookup).setSQL(oldSQL); +// } +// if(oldDefaultSQL != null && !oldDefaultSQL.equals("")) { +// ((IdNameSql)lookup).setDefaultSQL(oldDefaultSQL); +// } +// } +// +// } +// } +// +// } - private void triggerOtherFormFieldsWithThisValue(HttpServletRequest request, String userId, FormField ff_src, ArrayList<String> requestValueList, ArrayList<FormFieldJSON> formFieldJSONList) { - ArrayList<IdNameValue> formFieldValues = new ArrayList<IdNameValue>(); - //ArrayList<FormFieldJSON> formFieldJSONList = new ArrayList<FormFieldJSON>(); - for (Iterator iter = reportFormFields.iterator(); iter.hasNext();) { - formFieldValues = new ArrayList<IdNameValue>(); - FormField ff = (FormField) iter.next(); - if(!ff_src.getFieldName().equals(ff.getFieldName())) { - for (Iterator iter1 = formFieldJSONList.iterator(); iter1.hasNext();) { - FormFieldJSON ffJSON = (FormFieldJSON) iter1.next(); - if(ffJSON.getFieldId().equals(ff.getFieldName()) && ffJSON.isVisible()) { - if(nvl(ff.getBaseSQL()).length()>0 && ff.getBaseSQL().indexOf("["+ff_src.getFieldDisplayName() +"]")!= -1) { - IdNameList lookup = null; - lookup = ff.getLookupList(); - String selectedValue = ""; - String oldSQL = ""; - String oldDefaultSQL = ""; - IdNameList lookupList = null; - boolean readOnly = false; - if(lookup!=null) { - try { - if(!ff.hasPredefinedList) { - IdNameSql lu = (IdNameSql) lookup; - String SQL = lu.getSql(); - oldSQL = lu.getSql(); - oldDefaultSQL = lu.getDefaultSQL(); - String defaultSQL = lu.getDefaultSQL(); - String formatSelected = null; - if(ff_src.getFieldType().equals(FormField.FFT_LIST_MULTI) || ff_src.getFieldType().equals(FormField.FFT_CHECK_BOX)) { - formatSelected = formatSelectedItems(requestValueList, ff.getFieldType()); - } - else - formatSelected = requestValueList.size()>0?requestValueList.get(0):""; - SQL = Utils.replaceInString(SQL, "["+ff_src.getFieldDisplayName()+"]", formatSelected); - defaultSQL = Utils.replaceInString(defaultSQL, "["+ff_src.getFieldDisplayName()+"]", formatSelected); - defaultSQL = parseAndFillWithCurrentValues(request, defaultSQL, ff_src); - defaultSQL = parseAndFillReq_Session_UserValues(request, defaultSQL, userId); - SQL = parseAndFillReq_Session_UserValues(request, SQL, userId); - SQL = parseAndFillWithCurrentValues(request, SQL, ff_src); - lookup = new IdNameSql(-1,SQL,defaultSQL); - lookupList = lookup; - try { - lookup.loadUserData(0, "", ff.getDbInfo(), ff.getUserId()); - } catch (Exception e ){ - e.printStackTrace(); //throw new RaptorRuntimeException(e); - } - } - lookup.trimToSize(); - - - - for (lookup.resetNext(); lookup.hasNext();) { - IdNameValue value = lookup.getNext(); - readOnly = value.isReadOnly(); -// if(nvl(requestValue).length()>0) { -// if(value.getId().equals(requestValue)) -// value.setDefaultValue(true); +// private void triggerOtherFormFieldsWithThisValue(HttpServletRequest request, String userId, FormField ff_src, ArrayList<String> requestValueList, ArrayList<FormFieldJSON> formFieldJSONList) { +// ArrayList<IdNameValue> formFieldValues = new ArrayList<IdNameValue>(); +// //ArrayList<FormFieldJSON> formFieldJSONList = new ArrayList<FormFieldJSON>(); +// for (Iterator iter = reportFormFields.iterator(); iter.hasNext();) { +// formFieldValues = new ArrayList<IdNameValue>(); +// FormField ff = (FormField) iter.next(); +// if(!ff_src.getFieldName().equals(ff.getFieldName())) { +// for (Iterator iter1 = formFieldJSONList.iterator(); iter1.hasNext();) { +// FormFieldJSON ffJSON = (FormFieldJSON) iter1.next(); +// if(ffJSON.getFieldId().equals(ff.getFieldName()) && ffJSON.isVisible()) { +// if(nvl(ff.getBaseSQL()).length()>0 && ff.getBaseSQL().indexOf("["+ff_src.getFieldDisplayName() +"]")!= -1) { +// IdNameList lookup = null; +// lookup = ff.getLookupList(); +// String selectedValue = ""; +// String oldSQL = ""; +// String oldDefaultSQL = ""; +// IdNameList lookupList = null; +// boolean readOnly = false; +// if(lookup!=null) { +// try { +// if(!ff.hasPredefinedList) { +// IdNameSql lu = (IdNameSql) lookup; +// String SQL = lu.getSql(); +// oldSQL = lu.getSql(); +// oldDefaultSQL = lu.getDefaultSQL(); +// String defaultSQL = lu.getDefaultSQL(); +// String formatSelected = null; +// if(ff_src.getFieldType().equals(FormField.FFT_LIST_MULTI) || ff_src.getFieldType().equals(FormField.FFT_CHECK_BOX)) { +// formatSelected = formatSelectedItems(requestValueList, ff.getFieldType()); +// } +// else +// formatSelected = requestValueList.size()>0?requestValueList.get(0):""; +// SQL = Utils.replaceInString(SQL, "["+ff_src.getFieldDisplayName()+"]", formatSelected); +// defaultSQL = Utils.replaceInString(defaultSQL, "["+ff_src.getFieldDisplayName()+"]", formatSelected); +// defaultSQL = parseAndFillWithCurrentValues(request, defaultSQL, ff_src); +// defaultSQL = parseAndFillReq_Session_UserValues(request, defaultSQL, userId); +// SQL = parseAndFillReq_Session_UserValues(request, SQL, userId); +// SQL = parseAndFillWithCurrentValues(request, SQL, ff_src); +// lookup = new IdNameSql(-1,SQL,defaultSQL); +// lookupList = lookup; +// try { +// lookup.loadUserData(0, "", ff.getDbInfo(), ff.getUserId()); +// } catch (Exception e ){ +// e.printStackTrace(); //throw new RaptorRuntimeException(e); +// } +// } +// lookup.trimToSize(); +// +// +// +// for (lookup.resetNext(); lookup.hasNext();) { +// IdNameValue value = lookup.getNext(); +// readOnly = value.isReadOnly(); +//// if(nvl(requestValue).length()>0) { +//// if(value.getId().equals(requestValue)) +//// value.setDefaultValue(true); +//// } +// formFieldValues.add(value); +// //break; +// } +// +// ffJSON.setFormFieldValues(formFieldValues); +// +// if(!ff.hasPredefinedList) { +// if(oldSQL != null && !oldSQL.equals("")) { +// ((IdNameSql)lookup).setSQL(oldSQL); // } - formFieldValues.add(value); - //break; - } - - ffJSON.setFormFieldValues(formFieldValues); - - if(!ff.hasPredefinedList) { - if(oldSQL != null && !oldSQL.equals("")) { - ((IdNameSql)lookup).setSQL(oldSQL); - } - if(oldDefaultSQL != null && !oldDefaultSQL.equals("")) { - ((IdNameSql)lookup).setDefaultSQL(oldDefaultSQL); - } - } - } catch (Exception ex) { - ex.printStackTrace(); - } - } - - } //ff baseSQL - } - } - } - } - - } +// if(oldDefaultSQL != null && !oldDefaultSQL.equals("")) { +// ((IdNameSql)lookup).setDefaultSQL(oldDefaultSQL); +// } +// } +// } catch (Exception ex) { +// ex.printStackTrace(); +// } +// } +// +// } //ff baseSQL +// } +// } +// } +// } +// +// } public String formatSelectedItems(List selectedItems, String type) { StringBuffer value = new StringBuffer(""); diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/xmlobj/JavascriptList.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/xmlobj/JavascriptList.java index 69ed5138..39d62ccc 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/xmlobj/JavascriptList.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/xmlobj/JavascriptList.java @@ -79,8 +79,14 @@ import javax.xml.bind.annotation.XmlType; public class JavascriptList { protected List<JavascriptItemType> javascriptItem; + - /** + public void setJavascriptItem(List<JavascriptItemType> javascriptItem) { + this.javascriptItem = javascriptItem; + } + + + /** * Gets the value of the javascriptItem property. * * <p> |