From 7f535078ef80a7b7efa3e3325bfccb994fbd00e8 Mon Sep 17 00:00:00 2001 From: "Christopher Lott (cl778h)" Date: Thu, 31 Aug 2017 15:16:38 -0400 Subject: Rename packages to org.onap in 1.4.0-SNAPSHOT 19 - remove openecomp 72 - remediate Sonar scan issues 79 - removed unwanted left menu under Report 90 - apply approved license text Issue: PORTAL-19, PORTAL-72, PORTAL-79, PORTAL-90 Change-Id: I41a0ef5fba623d2242574bd15f2d9fb8029a496c Signed-off-by: Christopher Lott (cl778h) --- .../analytics/model/definition/DBColumnInfo.java | 94 ++ .../model/definition/DrillDownParamDef.java | 129 ++ .../analytics/model/definition/Marker.java | 97 ++ .../model/definition/ReportDefinition.java | 1488 ++++++++++++++++++++ .../analytics/model/definition/ReportLogEntry.java | 107 ++ .../analytics/model/definition/ReportMap.java | 104 ++ .../analytics/model/definition/ReportSchedule.java | 1424 +++++++++++++++++++ .../analytics/model/definition/SecurityEntry.java | 62 + .../analytics/model/definition/TableJoin.java | 85 ++ .../analytics/model/definition/TableSource.java | 119 ++ .../model/definition/wizard/ColumnEditJSON.java | 137 ++ .../model/definition/wizard/ColumnJSON.java | 59 + .../model/definition/wizard/DefinitionJSON.java | 252 ++++ .../model/definition/wizard/ElementJSON.java | 51 + .../model/definition/wizard/FormEditJSON.java | 149 ++ .../model/definition/wizard/IdNameBooleanJSON.java | 66 + .../model/definition/wizard/ImportJSON.java | 72 + .../model/definition/wizard/ListJSON.java | 58 + .../model/definition/wizard/MessageJSON.java | 73 + .../model/definition/wizard/NameBooleanJSON.java | 59 + .../model/definition/wizard/QueryJSON.java | 78 + .../model/definition/wizard/QueryResultJSON.java | 88 ++ .../model/definition/wizard/RaptorError.java | 49 + .../model/definition/wizard/RaptorResponse.java | 68 + .../model/definition/wizard/SearchFieldJSON.java | 59 + .../model/definition/wizard/WizardJSON.java | 47 + 26 files changed, 5074 insertions(+) create mode 100644 ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/DBColumnInfo.java create mode 100644 ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/DrillDownParamDef.java create mode 100644 ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/Marker.java create mode 100644 ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/ReportDefinition.java create mode 100644 ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/ReportLogEntry.java create mode 100644 ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/ReportMap.java create mode 100644 ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/ReportSchedule.java create mode 100644 ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/SecurityEntry.java create mode 100644 ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/TableJoin.java create mode 100644 ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/TableSource.java create mode 100644 ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/wizard/ColumnEditJSON.java create mode 100644 ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/wizard/ColumnJSON.java create mode 100644 ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/wizard/DefinitionJSON.java create mode 100644 ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/wizard/ElementJSON.java create mode 100644 ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/wizard/FormEditJSON.java create mode 100644 ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/wizard/IdNameBooleanJSON.java create mode 100644 ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/wizard/ImportJSON.java create mode 100644 ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/wizard/ListJSON.java create mode 100644 ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/wizard/MessageJSON.java create mode 100644 ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/wizard/NameBooleanJSON.java create mode 100644 ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/wizard/QueryJSON.java create mode 100644 ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/wizard/QueryResultJSON.java create mode 100644 ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/wizard/RaptorError.java create mode 100644 ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/wizard/RaptorResponse.java create mode 100644 ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/wizard/SearchFieldJSON.java create mode 100644 ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/wizard/WizardJSON.java (limited to 'ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition') diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/DBColumnInfo.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/DBColumnInfo.java new file mode 100644 index 00000000..6d02a1d5 --- /dev/null +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/DBColumnInfo.java @@ -0,0 +1,94 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the “License”); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + */ +package org.onap.portalsdk.analytics.model.definition; + +import org.onap.portalsdk.analytics.RaptorObject; + +public class DBColumnInfo extends RaptorObject { + private String tableName = null; + + private String colName = null; + + private String colType = null; + + private String label = null; + + // public DBColumnInfo() {} + + public DBColumnInfo(String tableName, String colName, String colType, String label) { + super(); + + setTableName(tableName); + setColName(colName); + setColType(colType); + setLabel(label); + } // DBColumnInfo + + public String getTableName() { + return tableName; + } + + public String getColName() { + return colName; + } + + public String getColType() { + return colType; + } + + public String getLabel() { + return label; + } + + private void setTableName(String tableName) { + this.tableName = tableName; + } + + private void setColName(String colName) { + this.colName = colName; + } + + private void setColType(String colType) { + this.colType = colType; + } + + public void setLabel(String label) { + this.label = label; + } + +} // DBColumnInfo diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/DrillDownParamDef.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/DrillDownParamDef.java new file mode 100644 index 00000000..b024b487 --- /dev/null +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/DrillDownParamDef.java @@ -0,0 +1,129 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the “License”); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + */ +package org.onap.portalsdk.analytics.model.definition; + +import org.onap.portalsdk.analytics.RaptorObject; + +public class DrillDownParamDef extends RaptorObject { + private String fieldName = ""; + + private String valType = "0"; + + private String valValue = ""; + + private String valColId = ""; + + private String valFieldId = ""; + + public DrillDownParamDef(String drillDownParamStr) { + super(); + + drillDownParamStr = nvl(drillDownParamStr).trim(); + if (drillDownParamStr.indexOf('=') >= 0) { + fieldName = drillDownParamStr.substring(0, drillDownParamStr.indexOf('=')); + + if (drillDownParamStr.length() > drillDownParamStr.indexOf('=') + 2 + && drillDownParamStr.charAt(drillDownParamStr.indexOf('=') + 1) == '[' + && drillDownParamStr.charAt(drillDownParamStr.length() - 1) == ']') { + drillDownParamStr = drillDownParamStr.substring( + drillDownParamStr.indexOf('=') + 2, drillDownParamStr.length() - 1); + + if (drillDownParamStr.indexOf('!') < 0) + valColId = drillDownParamStr; + else if (drillDownParamStr.indexOf('!') == 0) + valFieldId = drillDownParamStr.substring(1); + else { + valColId = drillDownParamStr.substring(0, drillDownParamStr.indexOf('!')); + valFieldId = drillDownParamStr + .substring(drillDownParamStr.indexOf('!') + 1); + } // else + + if (valColId.length() > 0 && valFieldId.length() > 0) + valType = "4"; + else if (valFieldId.length() > 0) + valType = "3"; + else if (valColId.length() > 0) + valType = "2"; + } else { + valType = "1"; + valValue = drillDownParamStr.substring(drillDownParamStr.indexOf('=') + 1); + } // else + } // if + } // DrillDownParamDef + + public String getFieldName() { + return fieldName; + } + + public String getValType() { + return valType; + } + + public String getValValue() { + return valValue; + } + + public String getValColId() { + return valColId; + } + + public String getValFieldId() { + return valFieldId; + } + + private void setFieldName(String fieldName) { + this.fieldName = fieldName; + } + + private void setValType(String valType) { + this.valType = valType; + } + + private void setValValue(String valValue) { + this.valValue = valValue; + } + + private void setValColId(String valColId) { + this.valColId = valColId; + } + + private void setValFieldId(String valFieldId) { + this.valFieldId = valFieldId; + } + +} // DrillDownParamDef diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/Marker.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/Marker.java new file mode 100644 index 00000000..8cea0b56 --- /dev/null +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/Marker.java @@ -0,0 +1,97 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the “License”); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + */ +package org.onap.portalsdk.analytics.model.definition; + +import org.onap.portalsdk.analytics.RaptorObject; + +public class Marker extends RaptorObject { + String markerColor = ""; + String addressColumn = ""; + String dataColumn = ""; + String address = ""; + String data = ""; + String color = ""; + public String getAddress() { + return address; + } + + public void setAddress(String address) { + this.address = address; + } + + public String getColor() { + return color; + } + + public void setColor(String color) { + this.color = color; + } + + public String getData() { + return data; + } + + public void setData(String data) { + this.data = data; + } + + public Marker(String markerColor, String addressColumn, String dataColumn){ + this.setMarkerColor(markerColor); + this.setAddressColumn(addressColumn); + this.setDataColumn(dataColumn); + } + + public String getAddressColumn() { + return addressColumn; + } + public void setAddressColumn(String addressColumn) { + this.addressColumn = addressColumn; + } + public String getDataColumn() { + return dataColumn; + } + public void setDataColumn(String dataColumn) { + this.dataColumn = dataColumn; + } + public String getMarkerColor() { + return markerColor; + } + public void setMarkerColor(String markerColor) { + this.markerColor = markerColor; + } +} diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/ReportDefinition.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/ReportDefinition.java new file mode 100644 index 00000000..9e8a6c94 --- /dev/null +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/ReportDefinition.java @@ -0,0 +1,1488 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the “License”); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + */ +package org.onap.portalsdk.analytics.model.definition; + +import java.io.Serializable; +import java.sql.Connection; +import java.util.Calendar; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.StringTokenizer; +import java.util.Vector; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import javax.servlet.http.HttpServletRequest; +import javax.xml.bind.JAXBException; +import javax.xml.datatype.DatatypeConfigurationException; +import javax.xml.datatype.DatatypeFactory; +//import javax.xml.transform.stream.*; + +import org.onap.portalsdk.analytics.controller.WizardSequence; +import org.onap.portalsdk.analytics.controller.WizardSequenceCrossTab; +import org.onap.portalsdk.analytics.controller.WizardSequenceDashboard; +import org.onap.portalsdk.analytics.controller.WizardSequenceLinear; +import org.onap.portalsdk.analytics.controller.WizardSequenceSQLBasedCrossTab; +import org.onap.portalsdk.analytics.controller.WizardSequenceSQLBasedHive; +import org.onap.portalsdk.analytics.controller.WizardSequenceSQLBasedLinear; +import org.onap.portalsdk.analytics.controller.WizardSequenceSQLBasedLinearDatamining; +import org.onap.portalsdk.analytics.error.RaptorException; +import org.onap.portalsdk.analytics.model.DataCache; +import org.onap.portalsdk.analytics.model.ReportLoader; +import org.onap.portalsdk.analytics.model.base.OrderBySeqComparator; +import org.onap.portalsdk.analytics.model.base.OrderSeqComparator; +import org.onap.portalsdk.analytics.model.base.ReportWrapper; +import org.onap.portalsdk.analytics.model.runtime.FormField; +import org.onap.portalsdk.analytics.system.AppUtils; +import org.onap.portalsdk.analytics.system.DbUtils; +import org.onap.portalsdk.analytics.system.Globals; +import org.onap.portalsdk.analytics.util.AppConstants; +import org.onap.portalsdk.analytics.util.DataSet; +import org.onap.portalsdk.analytics.util.Utils; +import org.onap.portalsdk.analytics.xmlobj.ChartAdditionalOptions; +import org.onap.portalsdk.analytics.xmlobj.ChartDrillOptions; +import org.onap.portalsdk.analytics.xmlobj.ColFilterType; +import org.onap.portalsdk.analytics.xmlobj.CustomReportType; +import org.onap.portalsdk.analytics.xmlobj.DataColumnList; +import org.onap.portalsdk.analytics.xmlobj.DataColumnType; +import org.onap.portalsdk.analytics.xmlobj.DataSourceType; +import org.onap.portalsdk.analytics.xmlobj.DataminingOptions; +import org.onap.portalsdk.analytics.xmlobj.FormFieldList; +import org.onap.portalsdk.analytics.xmlobj.FormFieldType; +import org.onap.portalsdk.analytics.xmlobj.FormatList; +import org.onap.portalsdk.analytics.xmlobj.FormatType; +import org.onap.portalsdk.analytics.xmlobj.JavascriptItemType; +import org.onap.portalsdk.analytics.xmlobj.ObjectFactory; +import org.onap.portalsdk.analytics.xmlobj.PredefinedValueList; +import org.onap.portalsdk.analytics.xmlobj.SemaphoreType; +import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; + +/**
+ * This class is part of RAPTOR (Rapid Application Programming Tool for OLAP Reporting)
+ *
+ * + * --------------------------------------------------------------------------------------------------
+ * ReportDefinition.java - This involves in creating and modifying RAPTOR reports. + * --------------------------------------------------------------------------------------------------
+ * + * + * Change Log

+ * + * 18-Aug-2009 : Version 8.5.1 (Sundar); + * 27-Jul-2009 : Version 8.4 (Sundar); + * 22-Jun-2009 : Version 8.4 (Sundar); + * + */ + +public class ReportDefinition extends ReportWrapper implements Serializable { + + private static final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(ReportDefinition.class); + + private ReportSchedule reportSchedule = null; + + private WizardSequence wizardSequence = null; + + + private boolean reportUpdateLogged = false; // Used to avoid multiple + // entries in the report log + // when persisting report on + // each step + + private ReportDefinition(CustomReportType crType, String reportID, String ownerID, + String createID, String createDate, String updateID, String updateDate, + String menuID, boolean menuApproved, HttpServletRequest request) throws RaptorException { + super(crType, reportID, ownerID, createID, createDate, updateID, updateDate, menuID, + menuApproved); + if(reportID.equals("-1")) + reportSchedule = new ReportSchedule(getReportID(), getOwnerID(), false, request); + else + reportSchedule = new ReportSchedule(getReportID(), getOwnerID(), true, request); + generateWizardSequence(null); + } // ReportDefinition + + public ReportDefinition(ReportWrapper rw, HttpServletRequest request)throws RaptorException { + super(rw); + + reportSchedule = new ReportSchedule(reportID, rw.getOwnerID(),false, request); + generateWizardSequence(null); + } // ReportDefinition + + private void setReportID(String reportID) { + this.reportID = reportID; + reportSchedule.setReportID(reportID); + reportSchedule.setScheduleUserID(getOwnerID()); + } // setReportID + + public ReportSchedule getReportSchedule() { + return reportSchedule; + } + + public static ReportDefinition unmarshal(String reportXML, String reportID, HttpServletRequest request) + throws RaptorException { + ReportDefinition rn = null; + CustomReportType crType = ReportWrapper.unmarshalCR(reportXML); + //Log.write("Report [" + reportID + "]: XML unmarshalled", 4); + logger.debug(EELFLoggerDelegate.debugLogger, ("[DEBUG MESSAGE FROM RAPTOR] Report [" + reportID + "]: XML unmarshalled")); + + rn = new ReportDefinition(crType, reportID, null, null, null, null, null, null, false, request); + return rn; + } // unmarshal + + public static ReportDefinition createBlank(HttpServletRequest request) throws RaptorException { + String curTime = Utils.getCurrentDateTime(); + String userID = AppUtils.getUserID(request); + ReportDefinition rd = new ReportDefinition(ReportWrapper.createBlankCR(userID), "-1", + userID, userID, curTime, userID, curTime, "", false, request); + + // Necessary initialization + + return rd; + } // ReportDefinition + + public void setAsCopy(HttpServletRequest request) throws RaptorException { + verifySQLBasedReportAccess(request); + + replaceCustomReportWithClone(); + + setReportID("-1"); + setReportName("Copy: " + getReportName()); + } // setAsCopy + + public WizardSequence getWizardSequence() { + return wizardSequence; + } // getWizardSequence + + public void generateWizardSequence(HttpServletRequest request) throws RaptorException { + boolean userIsAuthorizedToSeeLog = false; + String userId = null; + if(request!=null) { + userId = AppUtils.getUserID(request); + if (userId != null) + userIsAuthorizedToSeeLog = AppUtils.isAdminUser(request) + || AppUtils.isAdminUser(request); + //System.out.println("******** Report Type "+getReportType() + " userIsAuthorizedToSeeLog " + userIsAuthorizedToSeeLog); + } + if (getReportType().equals(AppConstants.RT_LINEAR)){ + if (getReportDefType().equals(AppConstants.RD_SQL_BASED)) + wizardSequence = new WizardSequenceSQLBasedLinear(userIsAuthorizedToSeeLog); + else if (getReportDefType().equals(AppConstants.RD_SQL_BASED_DATAMIN)) + wizardSequence = new WizardSequenceSQLBasedLinearDatamining(userIsAuthorizedToSeeLog); + else + wizardSequence = new WizardSequenceLinear(userIsAuthorizedToSeeLog); + } else if (getReportType().equals(AppConstants.RT_CROSSTAB)) { + if (getReportDefType().equals(AppConstants.RD_SQL_BASED)) + wizardSequence = new WizardSequenceSQLBasedCrossTab(userIsAuthorizedToSeeLog); + else + wizardSequence = new WizardSequenceCrossTab(userIsAuthorizedToSeeLog); + } else if (getReportType().equals(AppConstants.RT_DASHBOARD)) { + wizardSequence = new WizardSequenceDashboard(userIsAuthorizedToSeeLog); + } else if (getReportType().equals(AppConstants.RT_HIVE)) { + wizardSequence = new WizardSequenceSQLBasedHive(userIsAuthorizedToSeeLog); + } else + wizardSequence = new WizardSequence(); + } // generateWizardSequence + + private boolean canPersistDashboard() { + //System.out.println(" getDashBoardReports().getReportsList().size() " + getDashBoardReports().getReportsList().size()); + /* Commented for New DashBoard + if (getDashBoardReports()!=null && getDashBoardReports().getReportsList()!=null && getDashBoardReports().getReportsList().size() > 0) { + for (Iterator iter = getDashBoardReports().getReportsList().iterator(); iter.hasNext();) { + Reports report = (Reports)iter.next(); + try { + if(Integer.parseInt(report.getReportId())>0) return true; + } catch (NumberFormatException ex) {} + } // for + } //if + */ + + //if( ) + return nvl(getDashboardLayoutHTML()).length() > 0; + } //canPersistDashboard + + private boolean canPersistLinearReport() { + System.out.println("&&&&&&&&&&&&&&&&&&&&&& canPersistLinearReport"); + boolean visibleColExist = false; + + if (getDataSourceList().getDataSource().size() > 0) { + for (Iterator iter = getAllColumns().iterator(); iter.hasNext();) { + DataColumnType dct = (DataColumnType) iter.next(); + + if (dct.isVisible()) { + visibleColExist = true; + break; + } + } // for + } // if + + System.out.println("&&&&&&&&&&&&&&&&&&&&&& visibleColExist " + visibleColExist); + return visibleColExist; + } // canPersistLinearReport + + private boolean canPersistCrossTabReport() { + boolean rowColExist = false; + boolean colColExist = false; + boolean valColExist = false; + + if (getDataSourceList().getDataSource().size() > 0) { + for (Iterator iter = getAllColumns().iterator(); iter.hasNext();) { + DataColumnType dct = (DataColumnType) iter.next(); + + if (nvl(dct.getCrossTabValue()).equals(AppConstants.CV_ROW)) + rowColExist = true; + if (nvl(dct.getCrossTabValue()).equals(AppConstants.CV_COLUMN)) + colColExist = true; + if (nvl(dct.getCrossTabValue()).equals(AppConstants.CV_VALUE)) + valColExist = true; + } // for + } // if + + return rowColExist && colColExist && valColExist; + } // canPersistCrossTabReport + + private boolean canPersistReport() { + return getReportType().equals(AppConstants.RT_CROSSTAB) ? canPersistCrossTabReport() + : (getReportType().equals(AppConstants.RT_LINEAR)? canPersistLinearReport():((getReportType().equals(AppConstants.RT_HIVE)? canPersistLinearReport():canPersistDashboard()))); + } // canPersistReport + + public void persistReport(HttpServletRequest request) throws RaptorException { + if (!canPersistReport()) { + System.out.println("&&&&&&&&&&&&&&&&&&&&&& In !canPersistReport ReportType: " + getReportType()); + return; + } else { + System.out.println("&&&&&&&&&&&&&&&&&&&&&& Not In !canPersistReport"); + } + + Connection connection = null; + try { + String userID = AppUtils.getUserID(request); + String reportXML = marshal(); + logger.debug(EELFLoggerDelegate.debugLogger, ("Ocurring during Schedule ")); + System.out.println("&&&&&&&&&&&&&&&&&&&&&& Report ID " + reportID); + if (nvl(reportID, "-1").equals("-1")) { + connection = DbUtils.startTransaction(); + // Add report + String sql = ""; + if (nvl(Globals.getAdhocReportSequence()).length()> 0 && nvl(Globals.getAdhocUserRoldId()).length() > 0 && AppUtils.isUserInRole(request, Globals.getAdhocUserRoldId()) && !AppUtils.isAdminUser(request)) { + //sql = "SELECT "+ Globals.getAdhocReportSequence() + ".nextval FROM dual"; + sql = Globals.getPersistReportAdhoc(); + sql = sql.replace("[Globals.getAdhocReportSequence()]", Globals.getAdhocReportSequence()); + + } else{ + //sql = "SELECT seq_cr_report.nextval FROM dual"; + sql = Globals.getNewReportData(); + } + DataSet ds = DbUtils.executeQuery(connection,sql); + setReportID(ds.getString(0, 0)); + + reportSecurity.reportCreate(reportID, userID, isPublic()); + ReportLoader.createCustomReportRec(connection, this, reportXML); + ReportLoader.createReportLogEntry(connection, reportID, userID, + AppConstants.RLA_CREATE, "", ""); + reportUpdateLogged = true; + logger.debug(EELFLoggerDelegate.debugLogger, ("[DEBUG MESSAGE FROM RAPTOR] DB insert report " + reportID + " succesfull")); + } else { + // Update report + verifySQLBasedReportAccess(request); + reportSecurity.reportUpdate(request); + connection = DbUtils.startTransaction(); + ReportLoader.updateCustomReportRec(connection, this, reportXML); + if (!reportUpdateLogged) { + ReportLoader.createReportLogEntry(connection, reportID, userID, + AppConstants.RLA_UPDATE,"",""); + reportUpdateLogged = true; + } // if + logger.debug(EELFLoggerDelegate.debugLogger, ("[DEBUG MESSAGE FROM RAPTOR] DB update report " + reportID + " succesfull")); + } + + getReportSchedule().persistScheduleData(connection, request); + + DbUtils.commitTransaction(connection); + } catch (RaptorException e) { + e.printStackTrace(); + DbUtils.rollbackTransaction(connection); + throw e; + } finally { + DbUtils.clearConnection(connection); + } + } // persistReport + + public String getCrossTabDisplayValue(String crossTabValue) { + return nvl(crossTabValue).equals(AppConstants.CV_ROW) ? "Row headings" : (nvl( + crossTabValue).equals(AppConstants.CV_COLUMN) ? "Column headings" : (nvl( + crossTabValue).equals(AppConstants.CV_VALUE) ? "Report values" : "Invisible/Filter")); + } // getCrossTabDisplayValue + + public String getCrossTabDisplayValue(DataColumnType dct) { + return getCrossTabDisplayValue(dct.getCrossTabValue()); + } // getCrossTabDisplayValue + + public String getColumnLabel(DataColumnType dct) throws Exception { + String tableName = getTableById(dct.getTableId()).getTableName(); + Vector dbColumns = null; + dbColumns = DataCache.getReportTableDbColumns(tableName, cr.getDbInfo()); + if (dbColumns != null) + for (int i = 0; i < dbColumns.size(); i++) { + DBColumnInfo dbCol = (DBColumnInfo) dbColumns.get(i); + if (dct.getDbColName().equals(dbCol.getColName())) + return dbCol.getLabel(); + } // for + + return ""; + } // getCrossTabDisplayValue + + public String getFilterLabel(ColFilterType cft) { + StringBuffer fLabel = new StringBuffer(); + + fLabel.append(cft.getExpression()); + fLabel.append(" "); + if (cft.getArgType() != null) + if (cft.getArgType().equals(AppConstants.AT_FORMULA)) { + fLabel.append("[" + cft.getArgValue() + "]"); + } else if (cft.getArgType().equals(AppConstants.AT_VALUE)) { + fLabel.append(cft.getArgValue()); + } else if (cft.getArgType().equals(AppConstants.AT_LIST)) { + fLabel.append("(" + cft.getArgValue() + ")"); + } else if (cft.getArgType().equals(AppConstants.AT_COLUMN)) { + DataColumnType dctFilter = getColumnById(cft.getArgValue()); + fLabel.append("[" + dctFilter.getDisplayName() + "]"); + } else if (cft.getArgType().equals(AppConstants.AT_FORM)) { + fLabel.append("[Form Field]"); + } + + return fLabel.toString(); + } // getFilterLabel + + public Vector getReportUsers(HttpServletRequest request) throws RaptorException { + return reportSecurity.getReportUsers(request); + } // getReportUsers + + public Vector getReportRoles(HttpServletRequest request) throws RaptorException { + return reportSecurity.getReportRoles(request); + } // getReportRoles + + /** ************************************************************************************************* */ + + public void clearAllDrillDowns() { + List reportCols = getAllColumns(); + for (int i = 0; i < reportCols.size(); i++) { + DataColumnType dct = (DataColumnType) reportCols.get(i); + dct.setDrillDownURL(null); + dct.setDrillDownParams(null); + dct.setDrillDownType(null); + } // for + } // clearAllDrillDowns + + public void setOuterJoin(DataSourceType curTable, String joinType) { + String refDefinition = nvl(curTable.getRefDefinition()); + int outerJoinIdx = refDefinition.indexOf(" (+)"); + if (outerJoinIdx >= 0) + // Clear existing outer join + if (outerJoinIdx == (refDefinition.length() - 4)) + refDefinition = refDefinition.substring(0, outerJoinIdx); + else + refDefinition = refDefinition.substring(0, outerJoinIdx) + + refDefinition.substring(outerJoinIdx + 4); + + int equalSignIdx = refDefinition.indexOf("="); + if (equalSignIdx < 0) + // Ref. definition not present + return; + + if (refDefinition.indexOf(curTable.getTableId()) < equalSignIdx) { + // Cur. table is on the left side + if (nvl(joinType).equals(AppConstants.OJ_CURRENT)) + refDefinition = refDefinition.substring(0, equalSignIdx) + " (+)" + + refDefinition.substring(equalSignIdx); + else if (nvl(joinType).equals(AppConstants.OJ_JOINED)) + refDefinition = refDefinition + " (+)"; + } else { + // Joined table is on the left side + if (nvl(joinType).equals(AppConstants.OJ_CURRENT)) + refDefinition = refDefinition + " (+)"; + else if (nvl(joinType).equals(AppConstants.OJ_JOINED)) + refDefinition = refDefinition.substring(0, equalSignIdx) + " (+)" + + refDefinition.substring(equalSignIdx); + } + + curTable.setRefDefinition(refDefinition); + } // setOuterJoin + + public void addDataSourceType(ObjectFactory objFactory, String tableId, String tableName, + String tablePK, String displayName, String refTableId, String refDefinition, + String comment) throws RaptorException { + DataSourceType dst = objFactory.createDataSourceType(); + + dst.setTableId(tableId); + dst.setTableName(tableName); + dst.setTablePK(tablePK); + dst.setDisplayName(displayName); + if (nvl(refTableId).length() > 0) + dst.setRefTableId(refTableId); + if (nvl(refDefinition).length() > 0) + dst.setRefDefinition(refDefinition); + if (nvl(comment).length() > 0) + dst.setComment(comment); + + DataColumnList dataColumnList = objFactory.createDataColumnList(); + dst.setDataColumnList(dataColumnList); + + getDataSourceList().getDataSource().add(dst); + + resetCache(true); + } // addDataSourceType + + public void deleteDataSourceType(String tableId) { + super.deleteDataSourceType(tableId); + } // deleteDataSourceType + + public String getUniqueColumnId(String colName) { + String colId = ""; + + int colIdN = getAllColumns().size() + 1; + do { + colId = colName.substring(0, 2).toLowerCase() + (colIdN++); + } while (getColumnById(colId) != null); + + return colId; + } // getUniqueColumnId + + public DataColumnType addDataColumnType(ObjectFactory objFactory, String colId, + String tableId, // Table to which the new column belongs + String dbColName, String crossTabValue, String colName, String displayName, + int displayWidth, String displayAlignment, int orderSeq, boolean visible, + boolean calculated, String colType, String colFormat, boolean groupBreak, + int orderBySeq, String orderByAscDesc, String displayTotal, String colOnChart, + int chartSeq, String drillDownType, String drillDownURL, String drillDownParams, + String semaphoreId, String comment) throws RaptorException { + DataColumnType dct = null; + dct = objFactory.createDataColumnType(); + + dct.setColId(colId); + dct.setTableId(tableId); + dct.setDbColName(dbColName); + if (nvl(crossTabValue).length() > 0) + dct.setCrossTabValue(crossTabValue); + dct.setColName(colName); + dct.setDisplayName(displayName); + if (displayWidth > 0) + dct.setDisplayWidth(displayWidth); + if (nvl(displayAlignment).length() > 0) + dct.setDisplayAlignment(displayAlignment); + if (orderSeq > 0) + dct.setOrderSeq(orderSeq); + else + dct.setOrderSeq(getAllColumns().size() + 1); + dct.setVisible(visible); + dct.setCalculated(calculated); + // dct.setColType(colType); + if (nvl(colFormat).length() > 0) + dct.setColFormat(colFormat); + dct.setGroupBreak(groupBreak); + if (orderBySeq > 0) + dct.setOrderBySeq(orderBySeq); + if (nvl(orderByAscDesc).length() > 0) + dct.setOrderByAscDesc(orderByAscDesc); + if (nvl(displayTotal).length() > 0) + dct.setDisplayTotal(displayTotal); + if (nvl(colOnChart).length() > 0) + dct.setColOnChart(colOnChart); + if (chartSeq > 0) + dct.setChartSeq(chartSeq); + if (nvl(drillDownType).length() > 0) + dct.setDrillDownType(drillDownType); + if (nvl(drillDownURL).length() > 0) + dct.setDrillDownURL(drillDownURL); + if (nvl(drillDownParams).length() > 0) + dct.setDrillDownParams(drillDownParams); + if (nvl(semaphoreId).length() > 0) + dct.setSemaphoreId(semaphoreId); + if (nvl(comment).length() > 0) + dct.setComment(comment); + + dct.setDbColType(colType); + adjustColumnType(dct); + + // ColFilterList colFilterList = objFactory.createColFilterList(); + // dct.setColFilterList(colFilterList); + + getTableById(tableId).getDataColumnList().getDataColumn().add(dct); + + resetCache(false); + + return dct; + } // addDataColumnType + + public void deleteDataColumnType(String colId) { + int colOrder = getColumnById(colId).getOrderSeq(); + + List dcList = getColumnTableById(colId).getDataColumnList().getDataColumn(); + for (Iterator iterC = dcList.iterator(); iterC.hasNext();) { + DataColumnType dct = (DataColumnType) iterC.next(); + + if (dct.getColId().equals(colId) && dct.getOrderSeq() == colOrder) + iterC.remove(); + else if (dct.getOrderSeq() > colOrder) + dct.setOrderSeq(dct.getOrderSeq() - 1); + } // for + + if (getFormFieldList() != null) + for (Iterator iter = getFormFieldList().getFormField().iterator(); iter.hasNext();) { + FormFieldType fft = (FormFieldType) iter.next(); + if (nvl(fft.getColId()).equals(colId)) { + fft.setColId(""); + fft.setFieldType(FormField.FFT_TEXT); + if (nvl(fft.getDefaultValue()).equals(AppConstants.FILTER_MAX_VALUE) + || nvl(fft.getDefaultValue()) + .equals(AppConstants.FILTER_MIN_VALUE)) + fft.setDefaultValue(""); + } // if + } // for + + resetCache(false); + resetColumnOrderValues(); + } // deleteDataColumnType + + public void shiftColumnOrderUp(String colId) { + List reportCols = getAllColumns(); + for (int i = 0; i < reportCols.size(); i++) { + DataColumnType dct = (DataColumnType) reportCols.get(i); + + if (dct.getColId().equals(colId) && (i > 0)) { + DataColumnType dctUp = (DataColumnType) reportCols.get(i - 1); + dctUp.setOrderSeq(dctUp.getOrderSeq() + 1); + dct.setOrderSeq(dct.getOrderSeq() - 1); + break; + } // if + } // for + + Collections.sort(reportCols, new OrderSeqComparator()); + resetCache(true); + resetColumnOrderValues(); + } // shiftColumnOrderUp + + public void shiftColumnOrderDown(String colId) { + List reportCols = getAllColumns(); + for (int i = 0; i < reportCols.size(); i++) { + DataColumnType dct = (DataColumnType) reportCols.get(i); + + if (dct.getColId().equals(colId) && (i < reportCols.size() - 1)) { + DataColumnType dctDown = (DataColumnType) reportCols.get(i + 1); + dctDown.setOrderSeq(dctDown.getOrderSeq() - 1); + dct.setOrderSeq(dct.getOrderSeq() + 1); + break; + } // if + } // for + + Collections.sort(reportCols, new OrderSeqComparator()); + resetCache(true); + resetColumnOrderValues(); + } // shiftColumnOrderDown + + public void resetColumnOrderValues() { + List reportCols = getAllColumns(); + + int colOrder = 0; + for (Iterator iter = reportCols.iterator(); iter.hasNext();) { + DataColumnType dct = (DataColumnType) iter.next(); + dct.setOrderSeq(++colOrder); + } // for + + Collections.sort(reportCols, new OrderSeqComparator()); + } // resetColumnOrderValues + + public void addColFilterType(ObjectFactory objFactory, String colId, // Column + // to + // which + // the + // new + // filter + // belongs + String joinCondition, String openBrackets, String expression, String argType, + String argValue, String closeBrackets, String comment) throws RaptorException { + ColFilterType cft = objFactory.createColFilterType(); + + cft.setColId(colId); + cft.setJoinCondition(nvl(joinCondition, "AND")); + if (nvl(openBrackets).length() > 0) + cft.setOpenBrackets(openBrackets); + cft.setExpression(expression); + if (nvl(argType).length() > 0) + cft.setArgType(argType); + if (nvl(argValue).length() > 0) + cft.setArgValue(argValue); + if (nvl(closeBrackets).length() > 0) + cft.setCloseBrackets(closeBrackets); + if (nvl(comment).length() > 0) + cft.setComment(comment); + + DataColumnType dct = getColumnById(colId); + if (dct != null) { + if (dct.getColFilterList() == null) + dct.setColFilterList(objFactory.createColFilterList()); + + cft.setFilterSeq(dct.getColFilterList().getColFilter().size()); + dct.getColFilterList().getColFilter().add(cft); + } // if + + resetCache(true); + } // addColFilterType + + public void removeColumnFilter(String colId, int filterPos) { + DataColumnType dct = getColumnById(colId); + + if (dct.getColFilterList() != null) + try { + dct.getColFilterList().getColFilter().remove(filterPos); + } catch (IndexOutOfBoundsException e) { + } + + resetCache(true); + } // removeColumnFilter + + public void addColumnSort(String colId, String ascDesc) { + addColumnSort(colId, ascDesc, -1); + } // addColumnSort + + public void addColumnSort(String colId, String ascDesc, int sortOrder) { + if (sortOrder <= 0) { + sortOrder = 1; + List reportCols = getAllColumns(); + for (Iterator iter = reportCols.iterator(); iter.hasNext();) + if (((DataColumnType) iter.next()).getOrderBySeq() > 0) + sortOrder++; + } // if + + DataColumnType dct = getColumnById(colId); + dct.setOrderBySeq(sortOrder); + dct.setOrderByAscDesc(ascDesc); + + resetCache(true); + } // addColumnSort + + public void removeColumnSort(String colId) { + DataColumnType dct = getColumnById(colId); + int sortOrder = dct.getOrderBySeq(); + + dct.setOrderBySeq(0); + dct.setOrderByAscDesc(null); + + if (sortOrder > 0) { + List reportCols = getAllColumns(); + for (Iterator iter = reportCols.iterator(); iter.hasNext();) { + DataColumnType dct2 = (DataColumnType) iter.next(); + + if (dct2.getOrderBySeq() > sortOrder) + dct2.setOrderBySeq(dct2.getOrderBySeq() - 1); + } // for + } // if + + resetCache(true); + } // removeColumnSort + + public void shiftColumnSortUp(String colId) { + List reportCols = getAllColumns(); + Collections.sort(reportCols, new OrderBySeqComparator()); + + for (int i = 0; i < reportCols.size(); i++) { + DataColumnType dct = (DataColumnType) reportCols.get(i); + + if (dct.getColId().equals(colId) && (dct.getOrderBySeq() > 0)) { + DataColumnType dctUp = (DataColumnType) reportCols.get(i - 1); + if (dctUp.getOrderBySeq() > 0) + dctUp.setOrderBySeq(dctUp.getOrderBySeq() + 1); + dct.setOrderBySeq(dct.getOrderBySeq() - 1); + break; + } // if + } // for + + Collections.sort(reportCols, new OrderSeqComparator()); + resetCache(true); + } // shiftColumnSortUp + + public void shiftColumnSortDown(String colId) { + List reportCols = getAllColumns(); + Collections.sort(reportCols, new OrderBySeqComparator()); + + for (int i = 0; i < reportCols.size(); i++) { + DataColumnType dct = (DataColumnType) reportCols.get(i); + + if (dct.getColId().equals(colId) && (dct.getOrderBySeq() > 0)) { + DataColumnType dctDown = (DataColumnType) reportCols.get(i + 1); + if (dctDown.getOrderBySeq() > 0) + dctDown.setOrderBySeq(dctDown.getOrderBySeq() - 1); + dct.setOrderBySeq(dct.getOrderBySeq() + 1); + break; + } // if + } // for + + Collections.sort(reportCols, new OrderSeqComparator()); + resetCache(true); + } // shiftColumnSortDown + + /** ************************************************************************************************* */ + + public String generateNewSemaphoreId() { + if (getSemaphoreList() == null) + return "sem1"; + + String semaphoreId = null; + boolean idExists = true; + for (int i = 1; idExists; i++) { + semaphoreId = "sem" + i; + idExists = false; + for (Iterator iter = getSemaphoreList().getSemaphore().iterator(); iter.hasNext();) + if (semaphoreId.equals(((SemaphoreType) iter.next()).getSemaphoreId())) { + idExists = true; + break; + } + } // for + + return semaphoreId; + } // generateNewSemaphoreId + + public SemaphoreType addSemaphore(ObjectFactory objFactory, SemaphoreType semaphoreType) + throws RaptorException { + SemaphoreType sem = null; + try { + if (getSemaphoreList() == null) + setSemaphoreList(objFactory.createSemaphoreList()); + + String semaphoreName = null; + boolean nameExists = true; + for (int i = 1; nameExists; i++) { + semaphoreName = semaphoreType.getSemaphoreName() + ((i > 1) ? (" v" + i) : ""); + nameExists = false; + for (Iterator iter2 = getSemaphoreList().getSemaphore().iterator(); iter2 + .hasNext();) + if (semaphoreName.equals(((SemaphoreType) iter2.next()).getSemaphoreName())) { + nameExists = true; + break; + } + } // for + + sem = cloneSemaphoreType(objFactory, semaphoreType); + getSemaphoreList().getSemaphore().add(sem); + + sem.setSemaphoreId(generateNewSemaphoreId()); + sem.setSemaphoreName(semaphoreName); + } catch (JAXBException ex) { + throw new RaptorException(ex.getMessage(), ex.getCause()); + } + + return sem; + } // addSemaphore + + public SemaphoreType addSemaphoreType(ObjectFactory objFactory, String semaphoreName, + String semaphoreType, String comment) throws RaptorException { + SemaphoreType sem = null; + if (getSemaphoreList() == null) + setSemaphoreList(objFactory.createSemaphoreList()); + + sem = objFactory.createSemaphoreType(); + getSemaphoreList().getSemaphore().add(sem); + + sem.setSemaphoreId(generateNewSemaphoreId()); + sem.setSemaphoreName(semaphoreName); + sem.setSemaphoreType(nvl(semaphoreType)); + if (nvl(comment).length() > 0) + sem.setComment(comment); + + FormatList formatList = objFactory.createFormatList(); + sem.setFormatList(formatList); + return sem; + } // addSemaphoreType + + + public String getNextIdForJavaScriptElement (ObjectFactory objFactory, String fieldId) throws RaptorException { + String id = ""; + JavascriptItemType jit = null; + int incr = 0; + if (getJavascriptList() == null) { + setJavascriptList(objFactory.createJavascriptList()); + return fieldId + "|1"; + } else { + if(getJavascriptList().getJavascriptItem().iterator().hasNext()) { + for (Iterator iter = getJavascriptList().getJavascriptItem().iterator(); iter.hasNext();) { + jit = (JavascriptItemType) iter.next(); + logger.debug(EELFLoggerDelegate.debugLogger, ("^^^^^JAVASCRIPTITEMTYPE " + jit.getFieldId() + " " + fieldId + " " + id)); + if(nvl(jit.getFieldId()).length()>0 && jit.getFieldId().equals(fieldId)) { + ++incr; + } + } // for + return fieldId + "|"+incr; + } else { + return fieldId + "|1"; + } + + } + //return null; + } + + public JavascriptItemType addJavascriptType(ObjectFactory objFactory, String id) throws RaptorException { + JavascriptItemType javascriptItemType = null; + int flag = 0; // checking whether id existing in the list + if (getJavascriptList() == null) { + setJavascriptList(objFactory.createJavascriptList()); + javascriptItemType = objFactory.createJavascriptItemType(); + getJavascriptList().getJavascriptItem().add(javascriptItemType); + return javascriptItemType; + } else { + + for (Iterator iter = getJavascriptList().getJavascriptItem().iterator(); iter.hasNext();) { + javascriptItemType = (JavascriptItemType)iter.next(); + if(javascriptItemType.getId().equals(id) && !id.startsWith("-1")) { + flag = 1; + break; + } + } + if(flag == 1) return javascriptItemType; + else { + javascriptItemType = objFactory.createJavascriptItemType(); + getJavascriptList().getJavascriptItem().add(javascriptItemType); + return javascriptItemType; + } + } + + } // addSemaphoreType + + public boolean deleteJavascriptType(String id) throws RaptorException { + JavascriptItemType javascriptType = null; + if (getJavascriptList() == null) + return true; + for (Iterator iter = getJavascriptList().getJavascriptItem().iterator(); iter.hasNext();) { + javascriptType = (JavascriptItemType)iter.next(); + if(javascriptType.getId().equals(id)) { + iter.remove(); + return true; + } + } + return false; + } // addSemaphoreType + + public static FormatType addEmptyFormatType(ObjectFactory objFactory, + SemaphoreType semaphore) throws RaptorException { + FormatType fmt = null; + fmt = objFactory.createFormatType(); + semaphore.getFormatList().getFormat().add(fmt); + + String formatId = null; + boolean idExists = true; + for (int i = 1; idExists; i++) { + formatId = semaphore.getSemaphoreId() + "_fmt" + i; + idExists = false; + for (Iterator iter = semaphore.getFormatList().getFormat().iterator(); iter + .hasNext();) + if (formatId.equals(((FormatType) iter.next()).getFormatId())) { + idExists = true; + break; + } + } // for + fmt.setFormatId(formatId); + return fmt; + } // addEmptyFormatType + + public static void deleteFormatType(SemaphoreType semaphore, String formatId) { + for (Iterator iter = semaphore.getFormatList().getFormat().iterator(); iter.hasNext();) + if (formatId.equals(((FormatType) iter.next()).getFormatId())) { + iter.remove(); + break; + } // if + } // deleteFormatType + + public FormFieldType addFormFieldType(ObjectFactory objFactory, String fieldName, + String colId, String fieldType, String validationType, String mandatory, + String defaultValue, String fieldSQL, String comment, Calendar rangeStartDate, Calendar rangeEndDate, + String rangeStartDateSQL, String rangeEndDateSQL) throws RaptorException { + FormFieldType fft = null; + fft = objFactory.createFormFieldType(); + + fft.setFieldName(fieldName); + fft.setColId(colId); + fft.setFieldType(fieldType); + fft.setValidationType(validationType); + fft.setMandatory(nvl(mandatory, "N")); + fft.setDefaultValue(nvl(defaultValue)); + fft.setOrderBySeq((getFormFieldList() == null) ? 1 : getFormFieldList().getFormField() + .size() + 1); + fft.setFieldSQL(fieldSQL); + //fft.setRangeStartDate(rangeStartDate); + //fft.setRangeEndDate(rangeEndDate); + + try { + fft.setRangeStartDate(DatatypeFactory.newInstance() + .newXMLGregorianCalendar(rangeStartDate.YEAR, rangeStartDate.MONTH, rangeStartDate.DAY_OF_WEEK, rangeStartDate.HOUR, rangeStartDate.MINUTE, rangeStartDate.SECOND, rangeStartDate.MILLISECOND, rangeStartDate.ZONE_OFFSET)); + fft.setRangeStartDate(DatatypeFactory.newInstance() + .newXMLGregorianCalendar(rangeEndDate.YEAR, rangeEndDate.MONTH, rangeEndDate.DAY_OF_WEEK, rangeEndDate.HOUR, rangeEndDate.MINUTE, rangeEndDate.SECOND, rangeEndDate.MILLISECOND, rangeEndDate.ZONE_OFFSET)); + /*currField.setRangeEndDate(DatatypeFactory.newInstance() + .newXMLGregorianCalendar(end));*/ + } catch (DatatypeConfigurationException ex) { + + } + + fft.setRangeStartDateSQL(rangeStartDateSQL); + fft.setRangeEndDateSQL(rangeEndDateSQL); + if (nvl(comment).length() > 0) + fft.setComment(comment); + + String fieldId = null; + boolean idExists = true; + for (int i = 1; idExists; i++) { + fieldId = "ff" + i; + idExists = false; + if (getFormFieldList() != null) + for (Iterator iter = getFormFieldList().getFormField().iterator(); iter + .hasNext();) + if (fieldId.equals(((FormFieldType) iter.next()).getFieldId())) { + idExists = true; + break; + } + } // for + fft.setFieldId(fieldId); + + if (getFormFieldList() == null) { + FormFieldList formFieldList = objFactory.createFormFieldList(); + setFormFieldList(formFieldList); + } + + getFormFieldList().getFormField().add(fft); + return fft; + } // addFormFieldType + + //addCustomizedTextForParameters + public void addCustomizedTextForParameters(String comment) throws RaptorException { + getFormFieldList().setComment(comment); + } + + public FormFieldType addFormFieldBlank(ObjectFactory objFactory) throws RaptorException { + FormFieldType fft = null; + fft = objFactory.createFormFieldType(); + + fft.setFieldName("BLANK"); + fft.setColId("bk"); + fft.setFieldType(FormField.FFT_BLANK); + fft.setOrderBySeq((getFormFieldList() == null) ? 1 : getFormFieldList().getFormField() + .size() + 1); + String fieldId = null; + boolean idExists = true; + for (int i = 1; idExists; i++) { + fieldId = "ff" + i; + idExists = false; + if (getFormFieldList() != null) + for (Iterator iter = getFormFieldList().getFormField().iterator(); iter + .hasNext();) + if (fieldId.equals(((FormFieldType) iter.next()).getFieldId())) { + idExists = true; + break; + } + } // for + fft.setFieldId(fieldId); + + if (getFormFieldList() == null) { + FormFieldList formFieldList = objFactory.createFormFieldList(); + setFormFieldList(formFieldList); + } + + getFormFieldList().getFormField().add(fft); + return fft; + } // addFormFieldBlank + + public void replaceFormFieldReferences(String fieldName, String replaceWith) { + if (fieldName.equals(replaceWith)) + return; + + for (Iterator iter = getAllColumns().iterator(); iter.hasNext();) { + DataColumnType dct = (DataColumnType) iter.next(); + + if (dct.isCalculated() && dct.getColName().indexOf(fieldName) >= 0) + dct.setColName(Utils.replaceInString(dct.getColName(), fieldName, nvl( + replaceWith, "NULL"))); + + if (dct.getColFilterList() != null) + for (Iterator iter2 = dct.getColFilterList().getColFilter().iterator(); iter2 + .hasNext();) { + ColFilterType cft = (ColFilterType) iter2.next(); + + if (nvl(cft.getArgType()).equals(AppConstants.AT_FORM) + && nvl(cft.getArgValue()).equals(fieldName)) + cft.setArgValue(replaceWith); + } // for + } // for + } // replaceFormFieldReferences + + public void deleteFormField(String fieldId) { + String fieldDisplayName = null; + + int orderBySeq = Integer.MAX_VALUE; + if (getFormFieldList() != null) + for (Iterator iter = getFormFieldList().getFormField().iterator(); iter.hasNext();) { + FormFieldType fft = (FormFieldType) iter.next(); + + if (fieldId.equals(fft.getFieldId())) { + //orderBySeq = fft.getOrderBySeq(); + fieldDisplayName = getFormFieldDisplayName(fft); + iter.remove(); + } else if (fft.getOrderBySeq()!=null && (fft.getOrderBySeq().intValue() > orderBySeq)) + fft.setOrderBySeq(fft.getOrderBySeq() - 1); + } // for + + if (fieldDisplayName != null) + replaceFormFieldReferences(fieldDisplayName, ""); + } // deleteFormField + + public void shiftFormFieldUp(String fieldId) { + if (getFormFieldList() == null) + return; + + for (int i = 0; i < getFormFieldList().getFormField().size(); i++) { + FormFieldType fft = (FormFieldType) getFormFieldList().getFormField().get(i); + + if (fft.getFieldId().equals(fieldId) && (i > 0)) { + FormFieldType prevFft = (FormFieldType) getFormFieldList().getFormField().get( + i - 1); + prevFft.setOrderBySeq(prevFft.getOrderBySeq() + 1); + fft.setOrderBySeq((fft.getOrderBySeq() == null)?0:fft.getOrderBySeq() - 1); + + getFormFieldList().getFormField().remove(i); + getFormFieldList().getFormField().add(i - 1, fft); + return; + } // if + } // for + } // shiftFormFieldUp + + public void shiftFormFieldDown(String fieldId) { + if (getFormFieldList() == null) + return; + + for (int i = 0; i < getFormFieldList().getFormField().size(); i++) { + FormFieldType fft = (FormFieldType) getFormFieldList().getFormField().get(i); + + if (fft.getFieldId().equals(fieldId) + && (i < getFormFieldList().getFormField().size() - 1)) { + FormFieldType nextFft = (FormFieldType) getFormFieldList().getFormField().get( + i + 1); + nextFft.setOrderBySeq((nextFft.getOrderBySeq() == null)?0:nextFft.getOrderBySeq() - 1); + fft.setOrderBySeq((fft.getOrderBySeq() == null)?0:fft.getOrderBySeq() + 1); + + getFormFieldList().getFormField().remove(i + 1); + getFormFieldList().getFormField().add(i, nextFft); + return; + } // if + } // for + } // shiftFormFieldDown + + public static void addFormFieldPredefinedValue(ObjectFactory objFactory, + FormFieldType formField, String predefinedValue) throws RaptorException { + if (formField.getPredefinedValueList() == null) { + PredefinedValueList predefinedValueList = objFactory.createPredefinedValueList(); + formField.setPredefinedValueList(predefinedValueList); + } // if + + if (predefinedValue.length() > 0) { + formField.getPredefinedValueList().getPredefinedValue().add(predefinedValue); + Collections.sort(formField.getPredefinedValueList().getPredefinedValue()); + } // if + } // addFormFieldPredefinedValue + + public static void deleteFormFieldPredefinedValue(FormFieldType formField, + String predefinedValue) { + if (formField != null && formField.getPredefinedValueList() != null + && predefinedValue.length() > 0) + for (Iterator iter = formField.getPredefinedValueList().getPredefinedValue() + .iterator(); iter.hasNext();) + if (predefinedValue.equals((String) iter.next())) { + iter.remove(); + break; + } // if + } // deleteFormFieldPredefinedValue + + /** ************************************************************************************************* */ + + private int curSQLParsePos = 0; + + private String getNextSQLParseToken(String sql, boolean updateParsePos) { + int braketCount = 0; + boolean isInsideQuote = false; + StringBuffer nextToken = new StringBuffer(); + for (int idxNext = curSQLParsePos; idxNext < sql.length(); idxNext++) { + char ch = sql.charAt(idxNext); + + if (Character.isWhitespace(ch) || ch == ',') { + if (ch == ',') + nextToken.append(ch); + + if (nextToken.length() == 0) + continue; + else if (braketCount == 0 && (!isInsideQuote)) { + if (updateParsePos) + curSQLParsePos = idxNext + ((ch == ',') ? 1 : 0); + break; + } else if (ch != ',' && nextToken.charAt(nextToken.length() - 1) != ' ') + nextToken.append(' '); + } else { + nextToken.append(ch); + + if (ch == '(' || ch == '[') + braketCount++; + else if (ch == ')' || ch == ']') + braketCount--; + else if (ch == '\''/* ||ch=='\"' */) + isInsideQuote = (!isInsideQuote); + } // else + } // for + + return nextToken.toString(); + } // getNextSQLParseToken + + private boolean isParseSQLColID(String token) { + if (nvl(token).length() == 0) + return false; + + for (int i = 0; i < token.length(); i++) { + char ch = token.charAt(i); + + if (i == 0 && ch == '_') + return false; + + if (!(Character.isLetterOrDigit(ch) || ch == '_')) + return false; + } // for + + return true; + } // isParseSQLColID + + private DataColumnType getParseSQLDataColumn(String sqlExpression, String colId, + StringBuffer parsedSQL, Vector updatedReportCols, boolean isCYMBALScript) throws RaptorException { + DataColumnType dct = null; + + if (colId != null) { + if (!isParseSQLColID(colId)) + throw new org.onap.portalsdk.analytics.error.ValidationException( + "[" + + colId + + "] must either be a valid column id consisting only of letters, numbers, and underscores, or there must be a comma in front of it."); + + dct = getColumnById(colId); + } else { + // Getting unique column id + colId = ""; + int colIdN = 0; + for (int i = 0; (i < sqlExpression.length()) && (colIdN < 2); i++) + if (Character.isLetter(sqlExpression.charAt(i))) { + colId += sqlExpression.toLowerCase().charAt(i); + colIdN++; + } // if + + colIdN = getAllColumns().size() + updatedReportCols.size(); + for (boolean idAlreadyUsed = true; idAlreadyUsed; colIdN++) { + String newColId = colId + colIdN; + idAlreadyUsed = false; + + for (Iterator iter = getAllColumns().iterator(); iter.hasNext();) + if (newColId.equals(((DataColumnType) iter.next()).getColId())) { + idAlreadyUsed = true; + break; + } + + if (!idAlreadyUsed) + for (Iterator iter = updatedReportCols.iterator(); iter.hasNext();) + if (newColId.equals(((DataColumnType) iter.next()).getColId())) { + idAlreadyUsed = true; + break; + } + } // for + + colId += (colIdN - 1); + } // else + + if (dct == null) { + dct = (new ObjectFactory()).createDataColumnType(); + dct.setColId(colId); + dct.setDisplayWidth(10); + dct.setDisplayAlignment("Left"); + dct.setVisible(true); + dct.setGroupBreak(false); // ??? + if(!isCYMBALScript) { + boolean isValidIdentifier = Character.isLetterOrDigit(sqlExpression.charAt(0)); + for (int i = 0; i < sqlExpression.length(); i++) + if (!(Character.isLetterOrDigit(sqlExpression.charAt(i)) + || (sqlExpression.charAt(i) == '_') || (sqlExpression.charAt(i) == '$'))) { + isValidIdentifier = false; + break; + } // if + + if (isValidIdentifier) { + dct.setDisplayName(sqlExpression); + } else { + dct.setDisplayName(colId); + } // else + } else dct.setDisplayName(colId); + } // if + if(!isCYMBALScript) + sqlExpression = sqlExpression.replaceAll(", '", ",'"); + dct.setDbColName(sqlExpression); + dct.setColName(sqlExpression); + dct.setCalculated(true); + dct.setColType(AppConstants.CT_CHAR); + dct.setDbColType(AppConstants.CT_CHAR); + adjustColumnType(dct); // ??? + if(!isCYMBALScript) { + if (parsedSQL.toString().equals("SELECT ") + || parsedSQL.toString().equals("SELECT DISTINCT ")) + parsedSQL.append("\n\t"); + else + parsedSQL.append(", \n\t"); + parsedSQL.append(sqlExpression); + parsedSQL.append(" "); + parsedSQL.append(colId); + } + + return dct; + } // getParseSQLDataColumn + + public void parseReportSQL(String sql) throws RaptorException { + StringBuffer parsedSQL = new StringBuffer(); + + Vector updatedReportCols = new Vector(); + + curSQLParsePos = 0; + int lastParsePos = curSQLParsePos; + String lastToken = null; + String nextToken = getNextSQLParseToken(sql, true); + + String dbInfo = getDBInfo(); + boolean isCYMBALScript = false; + if (!isNull(dbInfo) && (!dbInfo.equals(AppConstants.DB_LOCAL))) { + try { + org.onap.portalsdk.analytics.util.RemDbInfo remDbInfo = new org.onap.portalsdk.analytics.util.RemDbInfo(); + String dbType = remDbInfo.getDBType(dbInfo); + if (dbType.equals("DAYTONA") && !(nextToken.toUpperCase().equals("SELECT"))) { + isCYMBALScript = true; + } + } catch (Exception ex) { + throw new RaptorException(ex); + } + } + if ( isCYMBALScript == false ) { + while (nextToken.length() > 0) { + if (parsedSQL.length() == 0) { + if (nextToken.toUpperCase().equals("SELECT")) + parsedSQL.append("SELECT "); + else + throw new org.onap.portalsdk.analytics.error.ValidationException( + "The SQL must start with the SELECT keyword."); + } else if (nextToken.toUpperCase().equals("DISTINCT") + && parsedSQL.toString().equals("SELECT ")) { + parsedSQL.append("DISTINCT "); + } else if (nextToken.equals("*") + && (parsedSQL.toString().equals("SELECT ") || parsedSQL.toString().equals( + "SELECT DISTINCT "))) { + throw new org.onap.portalsdk.analytics.error.ValidationException( + "You cannot use \"SELECT *\". Please specify select columns/expressions."); + } else if (nextToken.toUpperCase().equals("FROM")) { + if (lastToken != null) { + updatedReportCols.add(getParseSQLDataColumn(lastToken, null, parsedSQL, + updatedReportCols, false)); + lastToken = null; + } + + parsedSQL.append(" \n"); + while (lastParsePos < sql.length() + && Character.isWhitespace(sql.charAt(lastParsePos))) + lastParsePos++; + parsedSQL.append(sql.substring(lastParsePos)); + break; + } else { + if (nextToken.charAt(nextToken.length() - 1) == ',') { + // The token ends with , + nextToken = nextToken.substring(0, nextToken.length() - 1); + + if (nextToken.length() == 0) { + if (lastToken != null) { + updatedReportCols.add(getParseSQLDataColumn(lastToken, null, + parsedSQL, updatedReportCols, false)); + lastToken = null; + } // else just comma => ignore it + } else { + if (lastToken != null) { + updatedReportCols.add(getParseSQLDataColumn(lastToken, nextToken, + parsedSQL, updatedReportCols, false)); + lastToken = null; + } else + updatedReportCols.add(getParseSQLDataColumn(nextToken, null, + parsedSQL, updatedReportCols, false)); + } + } else { + // The token doesn't end with , + if (lastToken == null) + lastToken = nextToken; + else { + String token = getNextSQLParseToken(sql, false); + if (!token.toUpperCase().equals("FROM")) + throw new org.onap.portalsdk.analytics.error.ValidationException( + "|FROM keyword or a comma expected after [" + nextToken + + "]."); + + updatedReportCols.add(getParseSQLDataColumn(lastToken, nextToken, + parsedSQL, updatedReportCols, false)); + lastToken = null; + } // else + } // else + } // else + + lastParsePos = curSQLParsePos; + nextToken = getNextSQLParseToken(sql, true); + } // while + } else { // if CYMBAL Script + curSQLParsePos = 0; + Pattern re = null; + Matcher matcher = null; + String extracted = null; + nextToken = getNextCYMBALSQLParseToken(sql,true); + while (nextToken.length() > 0) { + if (lastToken == null) lastToken = nextToken; + + if( lastToken.toUpperCase().startsWith("DO DISPLAY")) { + re = Pattern.compile("each(.*)\\[.(.*?)\\]"); //\\[(.*?)\\] + matcher = re.matcher(nextToken); + if (matcher.find()) { + extracted = matcher.group(); + re = Pattern.compile("\\[(.*?)\\]"); + matcher = re.matcher(nextToken); + if(matcher.find()) { + extracted = matcher.group(); + extracted = extracted.substring(1,extracted.length()-1); + StringTokenizer sToken = new StringTokenizer(extracted, ","); + while(sToken.hasMoreTokens()) { + String str1 = sToken.nextToken().trim().substring(1); + updatedReportCols.add(getParseSQLDataColumn("", str1, + new StringBuffer(""), updatedReportCols, true)); + } + } + + } + + } + lastToken = nextToken; + nextToken = getNextCYMBALSQLParseToken(sql, true); + } + + } + if (updatedReportCols.size() == 0) + throw new org.onap.portalsdk.analytics.error.ValidationException( + "The SQL statement must have at least one column in the SELECT clause."); + if (getDataSourceList().getDataSource().size() == 0) + addDataSourceType(new ObjectFactory(), "du0", "DUAL", "", "DUAL", null, null, null); + DataSourceType dst = (DataSourceType) getDataSourceList().getDataSource().get(0); + dst.getDataColumnList().getDataColumn().clear(); + + for (int i = 0; i < updatedReportCols.size(); i++) { + DataColumnType dct = (DataColumnType) updatedReportCols.get(i); + dct.setTableId(dst.getTableId()); + dct.setOrderSeq(i + 1); + dst.getDataColumnList().getDataColumn().add(dct); + } // for + setReportSQL(parsedSQL.toString()); + resetCache(false); + } // parseReportSQL + + private String getNextCYMBALSQLParseToken(String sql, boolean updateParsePos) { + int braketCount = 0; + boolean isInsideQuote = false; + StringBuffer nextToken = new StringBuffer(); + for (int idxNext = curSQLParsePos; idxNext < sql.length(); idxNext++) { + char ch = sql.charAt(idxNext); + + if (ch!='\n') { + nextToken.append(ch); + if (updateParsePos) + curSQLParsePos = idxNext; + } + else { + curSQLParsePos = idxNext+1; + break; + } + } // for + + return nextToken.toString(); + } // getNextSQLParseToken + + public void addChartAdditionalOptions(ObjectFactory objFactory) throws RaptorException { + ChartAdditionalOptions chartOptions = objFactory.createChartAdditionalOptions(); + cr.setChartAdditionalOptions(chartOptions); + } + + public void addChartDrillOptions(ObjectFactory objFactory) throws RaptorException { + ChartDrillOptions chartOptions = objFactory.createChartDrillOptions(); + cr.setChartDrillOptions(chartOptions); +} + + public void addDataminingOptions(ObjectFactory objFactory) throws RaptorException { + DataminingOptions dataminingOptions = objFactory.createDataminingOptions(); + cr.setDataminingOptions(dataminingOptions); + } + /*public void addChartAdditionalOptions(ObjectFactory objFactory, String chartType, String chartMultiplePieOrder, String chartMultiplePieLabelDisplay, + String chartOrientation, String secondaryChartRenderer, String chartDisplay, String legendPosition, + String labelAngle) throws RaptorException { + try { + ChartAdditionalOptions chartOptions = objFactory.createChartAdditionalOptions(); + + if (nvl(chartMultiplePieOrder).length() > 0) + chartOptions.setChartMultiplePieOrder(chartMultiplePieOrder); + if (nvl(chartMultiplePieLabelDisplay).length() > 0) + chartOptions.setChartMultiplePieLabelDisplay(chartMultiplePieLabelDisplay); + if (nvl(chartOrientation).length() > 0) + chartOptions.setChartOrientation(chartOrientation); + if (nvl(secondaryChartRenderer).length() > 0) + chartOptions.setSecondaryChartRenderer(secondaryChartRenderer); + if (nvl(chartDisplay).length() > 0) + chartOptions.setChartDisplay(chartDisplay); + if (nvl(legendPosition).length() > 0) + chartOptions.setLegendPosition(legendPosition); + if (nvl(labelAngle).length() > 0) + chartOptions.setLabelAngle(labelAngle); + + cr.setChartAdditionalOptions(chartOptions); + } catch (JAXBException ex) { + throw new RaptorException(ex.getMessage(), ex.getCause()); + } + } // addChartAdditionalOptions*/ + + +} // ReportDefinition diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/ReportLogEntry.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/ReportLogEntry.java new file mode 100644 index 00000000..3704e38c --- /dev/null +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/ReportLogEntry.java @@ -0,0 +1,107 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the “License”); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + */ +package org.onap.portalsdk.analytics.model.definition; + +import org.onap.portalsdk.analytics.RaptorObject; + +public class ReportLogEntry extends RaptorObject { + private String logTime = null; + + private String userName = null; + + private String action = null; + + private String timeTaken; + + private String runIcon; + + public ReportLogEntry() { + super(); + } + + public ReportLogEntry(String logTime, String userName, String action, String timeTaken, String runIcon) { + this(); + + setLogTime(logTime); + setUserName(userName); + setAction(action); + setTimeTaken(timeTaken); + setRunIcon(runIcon); + } // ReportLogEntry + + public String getLogTime() { + return logTime; + } + + public String getUserName() { + return userName; + } + + public String getAction() { + return action; + } + + public void setLogTime(String logTime) { + this.logTime = logTime; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public void setAction(String action) { + this.action = action; + } + + public String getTimeTaken() { + return timeTaken; + } + + public void setTimeTaken(String timeTaken) { + this.timeTaken = timeTaken; + } + + public String getRunIcon() { + return runIcon; + } + + public void setRunIcon(String runIcon) { + this.runIcon = runIcon; + } + +} // ReportLogEntry diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/ReportMap.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/ReportMap.java new file mode 100644 index 00000000..8a294e99 --- /dev/null +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/ReportMap.java @@ -0,0 +1,104 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the “License”); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + */ +package org.onap.portalsdk.analytics.model.definition; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import org.onap.portalsdk.analytics.RaptorObject; +import org.onap.portalsdk.analytics.view.DataRow; +import org.onap.portalsdk.analytics.view.DataValue; +import org.onap.portalsdk.analytics.view.ReportData; + +public class ReportMap extends RaptorObject { + String markerColor = ""; + String addressColumn = ""; + String dataColumn = ""; + String isMapAllowedYN = ""; + String addAddressInDataYN = ""; + List markers = new ArrayList(); + + public String getIsMapAllowedYN() { + return isMapAllowedYN; + } + public void setIsMapAllowedYN(String isMapAllowedYN) { + this.isMapAllowedYN = isMapAllowedYN; + } + public ReportMap(String markerColor, String addressColumn, String dataColumn, String isMapAllowed, String addAddressInDataYN){ + this.setMarkerColor(markerColor); + this.setAddressColumn(addressColumn); + this.setDataColumn(dataColumn); + this.setIsMapAllowedYN(isMapAllowed); + this.setAddAddressInDataYN(addAddressInDataYN); + } + public String getAddressColumn() { + return addressColumn; + } + public void setAddressColumn(String addressColumn) { + this.addressColumn = addressColumn; + } + public String getDataColumn() { + return dataColumn; + } + public void setDataColumn(String dataColumn) { + this.dataColumn = dataColumn; + } + public String getMarkerColor() { + return markerColor; + } + public void setMarkerColor(String markerColor) { + this.markerColor = markerColor; + } + public List getMarkers() { + return markers; + } + public void setMarkers(List markers) { + this.markers = markers; + } + public String getAddAddressInDataYN() { + return addAddressInDataYN; + } + public void setAddAddressInDataYN(String addAddressInDataYN) { + this.addAddressInDataYN = addAddressInDataYN; + } + + + + +} diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/ReportSchedule.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/ReportSchedule.java new file mode 100644 index 00000000..23cf79f5 --- /dev/null +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/ReportSchedule.java @@ -0,0 +1,1424 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the “License”); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + */ +package org.onap.portalsdk.analytics.model.definition; + +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.Reader; +import java.io.Writer; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.Vector; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import javax.servlet.http.HttpServletRequest; + +import org.onap.portalsdk.analytics.RaptorObject; +import org.onap.portalsdk.analytics.error.RaptorException; +import org.onap.portalsdk.analytics.error.RaptorRuntimeException; +import org.onap.portalsdk.analytics.error.ReportSQLException; +import org.onap.portalsdk.analytics.error.UserDefinedException; +import org.onap.portalsdk.analytics.model.base.IdNameValue; +import org.onap.portalsdk.analytics.model.base.NameComparator; +import org.onap.portalsdk.analytics.model.runtime.FormField; +import org.onap.portalsdk.analytics.model.runtime.ReportParamValues; +import org.onap.portalsdk.analytics.model.runtime.ReportRuntime; +import org.onap.portalsdk.analytics.system.AppUtils; +import org.onap.portalsdk.analytics.system.ConnectionUtils; +import org.onap.portalsdk.analytics.system.DbUtils; +import org.onap.portalsdk.analytics.system.Globals; +import org.onap.portalsdk.analytics.util.AppConstants; +import org.onap.portalsdk.analytics.util.DataSet; +import org.onap.portalsdk.analytics.util.Utils; +import org.onap.portalsdk.analytics.xmlobj.FormFieldType; +import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; + +public class ReportSchedule extends RaptorObject { + + private static final EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(ReportSchedule.class); + + private String reportID = null; + + private String scheduleUserID = null; + + private String scheduleID = ""; + + private boolean infoUpdated = false; + + private String schedEnabled = "Y"; + + private String startDate = ""; + + private String endDate = ""; + + private String runDate = ""; + + private String runHour = "12"; + + private String runMin = "00"; + + private String runAMPM = "AM"; + + private String endHour = "11"; + + private String endMin = "45"; + + private String endAMPM = "PM"; + + private String recurrence = ""; + + private String conditional = "N"; + + private String conditionSQL = ""; + + private String notify_type = "1"; //1 -- link, 2 -- pdf, 4 -- excel, 3 -- csv + + private String encryptMode = "N"; //1 -- link, 2 -- pdf, 4 -- excel, 3 -- csv + + private String attachment = "Y"; //1 -- link, 2 -- pdf, 4 -- excel, 3 -- csv + + private String downloadLimit = "0"; + + private String formFields = ""; + + private Vector emailToUsers = new Vector(); + + private Vector emailToRoles = new Vector(); + + public ReportSchedule(String reportID, String scheduleUserID, boolean loadData, HttpServletRequest request) { + super(); + + setReportID(reportID); + setScheduleUserID(scheduleUserID); + if(loadData) + loadScheduleData(request); + else + newScheduleData(); + } // ReportSchedule + + public ReportSchedule(String reportID, String scheduleID, String scheduleUserID, HttpServletRequest request) { + super(); + + setReportID(reportID); + setScheduleID(scheduleID); + setScheduleUserID(scheduleUserID); + loadScheduleData(request); + } // ReportSchedule + + void setReportID(String reportID) { + this.reportID = reportID; + } + + public String getSchedEnabled() { + return schedEnabled; + } + + public String getStartDate() { + return startDate; + } + + public String getEndDate() { + return endDate; + } + + public String getRunDate() { + return runDate; + } + + public String getRunHour() { + return runHour; + } + + public String getRunMin() { + return runMin; + } + + public String getRunAMPM() { + return runAMPM; + } + + public String getRecurrence() { + return recurrence; + } + + public String getConditional() { + return conditional; + } + + public String getConditionSQL() { + return conditionSQL; + } + + public List getEmailToUsers() { + return emailToUsers; + } + + public List getEmailToRoles() { + return emailToRoles; + } + + /** + * @return the downloadLimit + */ + public String getDownloadLimit() { + return downloadLimit; + } + + /** + * @param downloadLimit the downloadLimit to set + */ + public void setDownloadLimit(String downloadLimit) { + if(nvl(downloadLimit).equals(this.downloadLimit)) + return; + this.downloadLimit = nvl(downloadLimit,"0"); + infoUpdated = true; + } + + /** + * @return the formFields + */ + public String getFormFields() { + return formFields; + } + + /** + * @param formFields the formFields to set + */ + public void setFormFields(String formFields) { + if(nvl(formFields).equals(this.formFields)) + return; + this.formFields = nvl(formFields); + infoUpdated = true; + } + + public String getNotify_type() { + return notify_type; + } + + /** + * @param notify_type the notify_type to set + * 1 -- link (default), 2 -- pdf, 4 -- excel + */ + public void setNotify_type(String notify_type) { + if(nvl(notify_type).equals(this.notify_type)) + return; + this.notify_type = nvl(notify_type,"1"); + infoUpdated = true; + } + + public void setSchedEnabled(String schedEnabled) { + if (nvl(schedEnabled).equals(this.schedEnabled)) + return; + infoUpdated = true; + this.schedEnabled = nvl(schedEnabled, "N"); + } + + public void setStartDate(String startDate) { + if (nvl(startDate).equals(this.startDate)) + return; + infoUpdated = true; + this.startDate = nvl(startDate); + } + + public void setEndDate(String endDate) { + if (nvl(endDate).equals(this.endDate)) + return; + infoUpdated = true; + this.endDate = nvl(endDate); + } + + public void setRunDate(String runDate) { + if (nvl(runDate).equals(this.runDate)) + return; + infoUpdated = true; + this.runDate = nvl(runDate); + } + + public void setRunHour(String runHour) { + if (nvl(runHour).equals(this.runHour)) + return; + infoUpdated = true; + this.runHour = nvl(runHour, "12"); + } + + public void setRunMin(String runMin) { + if (nvl(runMin).equals(this.runMin)) + return; + infoUpdated = true; + this.runMin = nvl(runMin, "00"); + } + + public void setRunAMPM(String runAMPM) { + if (nvl(runAMPM).equals(this.runAMPM)) + return; + infoUpdated = true; + this.runAMPM = nvl(runAMPM, "AM"); + } + + public void setRecurrence(String recurrence) { + if (nvl(recurrence).equals(this.recurrence)) + return; + infoUpdated = true; + this.recurrence = nvl(recurrence); + } + + public void setConditional(String conditional) { + if (nvl(conditional).equals(this.conditional)) + return; + infoUpdated = true; + this.conditional = nvl(conditional, "N"); + } + + public void setConditionSQL(String conditionSQL) { + if (nvl(conditionSQL).equals(this.conditionSQL)) + return; + infoUpdated = true; + this.conditionSQL = nvl(conditionSQL); + } + + public void addEmailToUser(String userId, String userName) { + if (nvl(userId).length() == 0) + return; + + for (int i = 0; i < emailToUsers.size(); i++) { + IdNameValue selUser = (IdNameValue) emailToUsers.get(i); + if (userId.equals(selUser.getId())) + return; + } // for + + emailToUsers.add(new IdNameValue(userId, userName)); + Collections.sort(emailToUsers, new NameComparator()); + infoUpdated = true; + } // addEmailToUser + + + public void addEmailArrayToUser(ArrayList allSelectedUsers) { + if (allSelectedUsers==null || allSelectedUsers.size()<=0) + return; + emailToUsers.removeAllElements(); + for (int i = 0; i < allSelectedUsers.size(); i++) { + emailToUsers.add(allSelectedUsers.get(i)); + } + Collections.sort(emailToUsers, new NameComparator()); + infoUpdated = true; + } // addEmailArrayToUser + + public void removeEmailToUser(String userId) { + if (nvl(userId).length() == 0) + return; + + for (int i = 0; i < emailToUsers.size(); i++) { + IdNameValue selUser = (IdNameValue) emailToUsers.get(i); + if (userId.equals(selUser.getId())) { + infoUpdated = true; + emailToUsers.remove(i); + return; + } // if + } // for + } // removeEmailToUser + + public void addEmailToRole(String roleId, String roleName) { + if (nvl(roleId).length() == 0) + return; + + for (int i = 0; i < emailToRoles.size(); i++) { + IdNameValue selRole = (IdNameValue) emailToRoles.get(i); + if (roleId.equals(selRole.getId())) + return; + } // for + + emailToRoles.add(new IdNameValue(roleId, roleName)); + Collections.sort(emailToRoles, new NameComparator()); + infoUpdated = true; + } // addEmailToRole + + public void addEmailArrayToRole(ArrayList allSelectedRoles) { + if (allSelectedRoles==null || allSelectedRoles.size()<=0) + return; + emailToRoles.removeAllElements(); + for (int i = 0; i < allSelectedRoles.size(); i++) { + emailToRoles.add(allSelectedRoles.get(i)); + } + Collections.sort(emailToRoles, new NameComparator()); + infoUpdated = true; + } // addEmailArrayToRole + + public void removeEmailToRole(String roleId) { + if (nvl(roleId).length() == 0) + return; + + for (int i = 0; i < emailToRoles.size(); i++) { + IdNameValue selRole = (IdNameValue) emailToRoles.get(i); + if (roleId.equals(selRole.getId())) { + infoUpdated = true; + emailToRoles.remove(i); + return; + } // if + } // for + } // addEmailToRole + + private void loadScheduleData(HttpServletRequest request) { + try { + StringBuffer query = new StringBuffer(""); + //query.append("SELECT rs.enabled_yn, TO_CHAR(rs.start_date, 'MM/DD/YYYY') start_date, TO_CHAR(rs.end_date, 'MM/DD/YYYY') end_date, TO_CHAR(rs.run_date, 'MM/DD/YYYY') run_date, NVL(TO_CHAR(rs.run_date, 'HH'), '12') run_hour, NVL(TO_CHAR(rs.run_date, 'MI'), '00') run_min, NVL(TO_CHAR(rs.run_date, 'AM'), 'AM') run_ampm, rs.recurrence, rs.conditional_yn, rs.notify_type, rs.max_row, rs.initial_formfields, rs.schedule_id, NVL(TO_CHAR(rs.end_date, 'HH'), '11') end_hour, NVL(TO_CHAR(rs.end_date, 'MI'), '45') end_min, NVL(TO_CHAR(rs.end_date, 'AM'), 'PM') end_ampm, encrypt_yn, attachment_yn FROM cr_report_schedule rs WHERE rs.rep_id = " + // + reportID); + String q_sql = Globals.getLoadScheduleData(); + q_sql = q_sql.replace("[reportID]", reportID); + query.append(q_sql); + + if(!AppUtils.isAdminUser(request)) + query.append(" and rs.sched_user_id = " + getScheduleUserID()); + if(nvl(getScheduleID()).length()>0) { + query.append(" and rs.schedule_id = " + getScheduleID()); + } + query.append(" order by rs.run_date desc "); + + DataSet ds = DbUtils + .executeQuery(query.toString()); + + if (ds.getRowCount() > 0) { + schedEnabled = nvl(ds.getString(0, 0), "N"); + startDate = nvl(ds.getString(0, 1)); + endDate = nvl(ds.getString(0, 2)); + runDate = nvl(ds.getString(0, 3)); + runHour = nvl(ds.getString(0, 4), "12"); + runMin = nvl(ds.getString(0, 5), "00"); + runAMPM = nvl(ds.getString(0, 6), "AM"); + recurrence = nvl(ds.getString(0, 7)); + conditional = nvl(ds.getString(0, 8), "N"); + //conditionSQL = nvl(ds.getString(0, 9)); + notify_type = nvl(ds.getString(0, 9), "1"); + downloadLimit = nvl(ds.getString(0, 10), "1000"); + //if(nvl(ds.getString(0, 13).) + formFields = nvl(ds.getString(0, 11)); + setScheduleID(ds.getString(0, 12)); + endHour = nvl(ds.getString(0, 13), "11"); + endMin = nvl(ds.getString(0, 14), "45"); + endAMPM = nvl(ds.getString(0, 15), "PM"); + encryptMode = nvl(ds.getString(0, "encrypt_yn"), "N"); + attachment = nvl(ds.getString(0, "attachment_yn"), "Y"); + conditionSQL = loadConditionalSQL(getScheduleID()); + } else { // if + //DataSet dsSeq = DbUtils.executeQuery("select SEQ_CR_REPORT_SCHEDULE.nextval from dual" ); + String n_sql = Globals.getNewScheduleData(); + DataSet dsSeq = DbUtils.executeQuery(n_sql); + String schedule_id = dsSeq.getString(0,0); + setScheduleID(schedule_id); + } + if(getScheduleID().length() > 0) { + //ds = DbUtils + // .executeQuery("SELECT rsu.user_id, fuser.last_name||', '||fuser.first_name, fuser.login_id FROM cr_report_schedule_users rsu, fn_user fuser WHERE rsu.rep_id = " + // + reportID + " AND rsu.schedule_id = " + getScheduleID() + " and rsu.user_id IS NOT NULL and rsu.user_id = fuser.user_id"); + + String t_sql = Globals.getLoadScheduleGetId(); + t_sql = t_sql.replace("[reportID]", reportID); + t_sql = t_sql.replace("[getScheduleID()]", getScheduleID()); + + ds = DbUtils.executeQuery(t_sql); + + for (int i = 0; i < ds.getRowCount(); i++){ + String nameToDisplay = ds.getString(i, 1); + if (Globals.getUseLoginIdInSchedYN()!= null && Globals.getUseLoginIdInSchedYN().equals("Y")) { + nameToDisplay = ds.getString(i, 2); + } + if(nameToDisplay!=null && nameToDisplay.length() > 0) + emailToUsers.add(new IdNameValue(ds.getString(i, 0), nameToDisplay)); + else + emailToUsers.add(new IdNameValue(ds.getString(i, 0), ds.getString(i, 1))); + } + Collections.sort(emailToUsers, new NameComparator()); + + //ds = DbUtils + // .executeQuery("SELECT rsu.role_id FROM cr_report_schedule_users rsu WHERE rsu.rep_id = " + // + reportID + " AND rsu.schedule_id = " + getScheduleID() + " AND rsu.role_id IS NOT NULL"); + + String r_sql = Globals.getLoadScheduleUsers(); + r_sql = r_sql.replace("[reportID]", reportID); + r_sql = r_sql.replace("[getScheduleID()]", getScheduleID()); + + ds = DbUtils.executeQuery(r_sql); + + for (int i = 0; i < ds.getRowCount(); i++) + emailToRoles.add(new IdNameValue(ds.getString(i, 0), AppUtils.getRoleName(ds + .getString(i, 0)))); + Collections.sort(emailToRoles, new NameComparator()); + + infoUpdated = false; + } + } catch (Exception e) { + throw new RuntimeException( + "[ReportSchedule.loadScheduleData] Unable to load Report " + reportID + + " schedule. Error: " + e.getMessage()); + } + } // loadScheduleData + + private void newScheduleData() { + try { + //DataSet dsSeq = DbUtils.executeQuery("select SEQ_CR_REPORT_SCHEDULE.nextval from dual" ); + String sql = Globals.getNewScheduleData(); + DataSet dsSeq = DbUtils.executeQuery(sql); + + String schedule_id = dsSeq.getString(0,0); + setScheduleID(schedule_id); + } catch (Exception e) { + throw new RuntimeException( + "[ReportSchedule.newScheduleData] Unable to load Report " + reportID + + " schedule. Error: " + e.getMessage()); + } + } // newScheduleData + + private String parseScheduleSQL(HttpServletRequest request, String sql) throws RaptorException { + DataSet ds = null; + + logger.debug(EELFLoggerDelegate.debugLogger, (sql)); + String[] reqParameters = Globals.getRequestParams().split(","); + String[] sessionParameters = Globals.getSessionParams().split(","); + String[] scheduleSessionParameters = Globals.getSessionParamsForScheduling().split(","); + javax.servlet.http.HttpSession session = request.getSession(); + ReportRuntime rr = (ReportRuntime) session.getAttribute(AppConstants.SI_REPORT_RUNTIME); + String userId = AppUtils.getUserID(request); + String dbType = ""; + String dbInfo = rr.getDBInfo(); + ReportParamValues paramValues = rr.getReportParamValues(); + int fieldCount = 0; + // For Daytona removing all formfields which has null param value + Pattern re1 = null; + Matcher matcher = null; + int index = 0; + int posFormField = 0; + int posAnd = 0; + if (!isNull(dbInfo) && (!dbInfo.equals(AppConstants.DB_LOCAL))) { + try { + org.onap.portalsdk.analytics.util.RemDbInfo remDbInfo = new org.onap.portalsdk.analytics.util.RemDbInfo(); + dbType = remDbInfo.getDBType(dbInfo); + } catch (Exception ex) { + throw new RaptorException(ex); + } + } + + sql = sql + " "; + sql = Pattern.compile("(^[\r\n]*|([\\s]))[Ss][Ee][Ll][Ee][Cc][Tt]([\r\n]*|[\\s]*)",Pattern.DOTALL).matcher(sql).replaceAll(" SELECT "); + sql = Pattern.compile("(^[\r\n]*|([\\s]))[Ww][Hh][Ee][Rr][Ee]([\r\n]*|[\\s]*)",Pattern.DOTALL).matcher(sql).replaceAll(" WHERE "); + sql = Pattern.compile("(^[\r\n]*|([\\s]))[Aa][Nn][Dd]([\r\n]*|[\\s]*)",Pattern.DOTALL).matcher(sql).replaceAll(" AND "); + + if (rr.getFormFieldList() != null) { + for (Iterator iter = rr.getFormFieldList().getFormField().iterator(); iter.hasNext();) { + + FormFieldType fft = (FormFieldType) iter.next(); + String fieldId = fft.getFieldId(); + String fieldDisplay = rr.getFormFieldDisplayName(fft); + if(!fft.getFieldType().equals(FormField.FFT_BLANK)) { + if (paramValues.isParameterMultiValue(fieldId)) { + String replaceValue = rr.formatListValue(fieldDisplay, nvl(paramValues.getParamValue(fieldId)), null, false, + true, null, paramValues.getParamBaseSQL(fieldId)); + if(replaceValue.length() > 0) { + sql = Utils.replaceInString(sql, fieldDisplay, replaceValue); + } else { + fieldCount++; + if(fieldCount == 1) { + //sql = sql + " "; + //sql = Pattern.compile("(^[\r\n]*|([\\s]))[Ss][Ee][Ll][Ee][Cc][Tt]([\r\n]*|[\\s]*)",Pattern.DOTALL).matcher(sql).replaceAll(" SELECT "); + //sql = Pattern.compile("(^[\r\n]*|([\\s]))[Ww][Hh][Ee][Rr][Ee]([\r\n]*|[\\s]*)",Pattern.DOTALL).matcher(sql).replaceAll(" WHERE "); + //sql = Pattern.compile("(^[\r\n]*|([\\s]))[Aa][Nn][Dd]([\r\n]*|[\\s]*)",Pattern.DOTALL).matcher(sql).replaceAll(" AND "); + } + //sql = getReportSQL(); + while(sql.indexOf(fieldDisplay) > 0) { +/* sql = Utils.replaceInString(sql, "SELECT ", "select "); + sql = Utils.replaceInString(sql, "WHERE", "where"); + sql = Utils.replaceInString(sql, " AND ", " and "); +*/ + re1 = Pattern.compile("(^[\r\n]|[\\s])AND(.*?[^\r\n]*)"+ "\\["+fft.getFieldName()+ "\\](.*?)\\s", Pattern.DOTALL); + //re1 = Pattern.compile("(^[\r\n]|[\\s])AND(.*?[^\r\n]*)"+ "\\["+fft.getFieldName()+ "\\]", Pattern.DOTALL); +/* posFormField = sql.indexOf(fieldDisplay); + posAnd = sql.lastIndexOf("and", posFormField); + if(posAnd < 0) posAnd = 0; + else if (posAnd > 2) posAnd = posAnd - 2; + matcher = re1.matcher(sql); +*/ + posFormField = sql.indexOf(fieldDisplay); + int posSelectField = sql.lastIndexOf("SELECT ", posFormField); + int whereField = sql.indexOf(" WHERE" , posSelectField); + int andField = 0; + if(posFormField > whereField) + andField = sql.lastIndexOf(" AND ", posFormField); + if (posFormField > andField && andField > whereField) + posAnd = andField; + else + posAnd = 0; + matcher = re1.matcher(sql); + + + if (posAnd > 0 && matcher.find(posAnd-1)) { + //sql = Utils.replaceInString(sql, matcher.group(), " "); + matcher = re1.matcher(sql); + index = sql!=null?sql.lastIndexOf("["+fft.getFieldName()+"]"):-1; + + if(andField>0) + index = andField; + else + index = whereField; + if(index >= 0 && matcher.find(index-1)) { + sql = sql.replace(matcher.group(), " "); + } + } else { + + //sql = sql.replace + re1 = Pattern.compile("(^[\r\n]|[\\s])WHERE(.*?[^\r\n]*)\\["+fft.getFieldName()+ "\\](.*?)\\s", Pattern.DOTALL); + matcher = re1.matcher(sql); + if(matcher.find(whereField-1)) { + matcher = re1.matcher(sql); + index = sql!=null?sql.lastIndexOf("["+fft.getFieldName()+"]"):-1; + if(index >= 0 && matcher.find(index-30)) { + sql = sql.replace(matcher.group(), " WHERE 1=1 "); + } + //sql = Utils.replaceInString(sql, matcher.group(), " where 1=1 "); + } /*else { + replaceValue = formatListValue("", Utils + .oracleSafe(nvl(paramValues.getParamValue(fieldId))), null, false, + true, null, paramValues.getParamBaseSQL(fieldId)); + sql = Utils.replaceInString(sql, fieldDisplay, replaceValue); + }*/ + + } + } + } + + //sql = Utils.replaceInString(sql, " select ", " SELECT "); + //sql = Utils.replaceInString(sql, " where ", " WHERE "); + //sql = Utils.replaceInString(sql, " and ", " AND "); + + } else { + String paramValue = ""; + if(paramValues.isParameterTextAreaValueAndModified(fieldId)) { + String value = ""; + value = nvl(paramValues + .getParamValue(fieldId)); +// value = Utils.oracleSafe(nvl(value)); +// if (!(dbType.equals("DAYTONA") && sql.trim().toUpperCase().startsWith("SELECT"))) { +// value = "('" + Utils.replaceInString(value, ",", "'|'") + "')"; +// value = Utils.replaceInString(value, "|", ","); +// paramValue = XSSFilter.filterRequestOnlyScript(value); +// } else if (nvl(value.trim()).length()>0) { +// value = "('" + Utils.replaceInString(value, ",", "'|'") + "')"; +// value = Utils.replaceInString(value, "|", ","); +// paramValue = XSSFilter.filterRequestOnlyScript(value); +// } + paramValue = value; + } else + paramValue = nvl(paramValues + .getParamValue(fieldId)); + + if (paramValue!=null && paramValue.length() > 0) { + if(paramValue.toLowerCase().trim().startsWith("select ")) { + paramValue = Utils.replaceInString(paramValue, "[LOGGED_USERID]", userId); + paramValue = Utils.replaceInString(paramValue, "[USERID]", userId); + paramValue = Utils.replaceInString(paramValue, "[USER_ID]", userId); + + paramValue = Utils.replaceInString(paramValue, "''", "'"); + ds = ConnectionUtils.getDataSet(paramValue, dbInfo); + if (ds.getRowCount() > 0) paramValue = ds.getString(0, 0); + } + logger.debug(EELFLoggerDelegate.debugLogger, ("SQLSQLBASED B4^^^^^^^^^ " + sql + " " + fft.getValidationType() + " " + fft.getFieldName() + " " + fft.getFieldId())); + if(fft!=null && (fft.getValidationType()!=null && (fft.getValidationType().equals(FormField.VT_TIMESTAMP_HR) || fft.getValidationType().equals(FormField.VT_TIMESTAMP_MIN) ||fft.getValidationType().equals(FormField.VT_TIMESTAMP_SEC) ||fft.getValidationType().equals(FormField.VT_DATE) ))) { + //System.out.println("paramValues.getParamValue(fieldId_Hr) Inside if " + fft.getValidationType() + " " + fieldDisplay); + if(fft.getValidationType().equals(FormField.VT_TIMESTAMP_HR)) { + sql = Utils.replaceInString(sql, fieldDisplay, nvl( + paramValue) +((nvl(paramValues + .getParamValue(fieldId+"_Hr") ).length()>0)?" "+addZero(nvl(paramValues + .getParamValue(fieldId+"_Hr") ) ):"")); + } + else if(fft.getValidationType().equals(FormField.VT_TIMESTAMP_MIN)) { +/* System.out.println("paramValues.getParamValue(fieldId_Hr)" + paramValues + .getParamValue(fieldId+"_Hr") + " " + paramValues + .getParamValue(fieldId+"_Min")) ; +*/ sql = Utils.replaceInString(sql, fieldDisplay, nvl( + paramValue) + ((nvl(paramValues + .getParamValue(fieldId+"_Hr") ).length()>0)?" "+addZero(nvl(paramValues + .getParamValue(fieldId+"_Hr") ) ):"") + ((nvl(paramValues + .getParamValue(fieldId+"_Min") ).length()>0)?":" + addZero(nvl(paramValues + .getParamValue(fieldId+"_Min") ) ) : "") ) ; + } + else if(fft.getValidationType().equals(FormField.VT_TIMESTAMP_SEC)) { + sql = Utils.replaceInString(sql, fieldDisplay, nvl( + paramValue) + ((nvl(paramValues + .getParamValue(fieldId+"_Hr") ).length()>0)?" "+addZero(nvl(paramValues + .getParamValue(fieldId+"_Hr") ) ):"") + ((nvl(paramValues + .getParamValue(fieldId+"_Min") ).length()>0)?":" + addZero(nvl(paramValues + .getParamValue(fieldId+"_Min") ) ) : "") + ((nvl(paramValues + .getParamValue(fieldId+"_Sec") ).length()>0)?":"+addZero(nvl(paramValues + .getParamValue(fieldId+"_Sec") ) ) : "" ) ) ; + } else { + sql = Utils.replaceInString(sql, fieldDisplay, nvl( + paramValue, "NULL")); + } + + + } else { + if(paramValue!=null && paramValue.length() > 0) { + if(sql.indexOf("'"+fieldDisplay+"'")!=-1 || sql.indexOf("'"+fieldDisplay)!=-1 || sql.indexOf(fieldDisplay+"'")!=-1 + || sql.indexOf("'%"+fieldDisplay+"%'")!=-1 || sql.indexOf("'%"+fieldDisplay)!=-1 || sql.indexOf(fieldDisplay+"%'")!=-1 + || sql.indexOf("'_"+fieldDisplay+"_'")!=-1 || sql.indexOf("'_"+fieldDisplay)!=-1 || sql.indexOf(fieldDisplay+"_'")!=-1 + || sql.indexOf("'%_"+fieldDisplay+"_%'")!=-1 || sql.indexOf("^"+fieldDisplay+"^")!=-1 || sql.indexOf("'%_"+fieldDisplay)!=-1 || sql.indexOf(fieldDisplay+"_%'")!=-1) { + sql = Utils.replaceInString(sql, fieldDisplay, nvl( + paramValue, "NULL")); + } else { + if(sql.indexOf(fieldDisplay)!=-1) { + if(nvl(paramValue).length()>0) { + try { + double vD = Double.parseDouble(paramValue); + sql = Utils.replaceInString(sql, fieldDisplay, nvl( + paramValue, "NULL")); + + } catch (NumberFormatException ex) { + if (/*dbType.equals("DAYTONA") &&*/ sql.trim().toUpperCase().startsWith("SELECT")) { + sql = Utils.replaceInString(sql, fieldDisplay, nvl( + paramValue, "NULL")); + } else + throw new UserDefinedException("Expected number, Given String for the form field \"" + fieldDisplay+"\""); + } + /*sql = Utils.replaceInString(sql, fieldDisplay, nvl( + paramValue, "NULL"));*/ + } else + sql = Utils.replaceInString(sql, fieldDisplay, nvl( + paramValue, "NULL")); + + } + } + } + else { + if (dbType.equals("DAYTONA") && sql.trim().toUpperCase().startsWith("SELECT")) { + sql = sql + " "; + re1 = Pattern.compile("(^[\r\n]|[\\s]|[^0-9a-zA-Z])AND(.*?[^\r\n]*)"+ "\\["+fft.getFieldName()+ "\\](.*?)\\s", Pattern.DOTALL); + posFormField = sql.indexOf(fieldDisplay); + posAnd = sql.lastIndexOf(" AND ", posFormField); + if(posAnd < 0) posAnd = 0; + else if (posAnd > 2) posAnd = posAnd - 2; + matcher = re1.matcher(sql); + if (matcher.find(posAnd)) { + sql = sql.replace(matcher.group(), ""); + } + } else { + sql = Utils.replaceInString(sql, "'" + fieldDisplay + "'", nvl( + paramValue, "NULL")); + sql = Utils.replaceInString(sql, fieldDisplay, nvl( + paramValue, "NULL")); + } + } + } + + } + + if (dbType.equals("DAYTONA") && sql.trim().toUpperCase().startsWith("SELECT")) { + sql = sql + " "; + re1 = Pattern.compile("(^[\r\n]|[\\s]|[^0-9a-zA-Z])AND(.*?[^\r\n]*)"+ "\\["+fft.getFieldName()+ "\\](.*?)\\s", Pattern.DOTALL); //+[\'\\)|\'|\\s] + posFormField = sql.indexOf(fieldDisplay); + posAnd = sql.lastIndexOf(" AND ", posFormField); + if(posAnd < 0) posAnd = 0; + else if (posAnd > 2) posAnd = posAnd - 2; + matcher = re1.matcher(sql); + if (matcher.find(posAnd)) { + sql = sql.replace(matcher.group(), " "); + } + } else { + + logger.debug(EELFLoggerDelegate.debugLogger, ("ParamValue |" + paramValue + "| Sql |" + sql + "| Multi Value |" + paramValues.isParameterMultiValue(fieldId))); + sql = Utils.replaceInString(sql, "'" + fieldDisplay + "'", nvl( + paramValue, "NULL")); + sql = Utils.replaceInString(sql, fieldDisplay , nvl( + paramValue, "NULL")); + logger.debug(EELFLoggerDelegate.debugLogger, ("SQLSQLBASED AFTER^^^^^^^^^ " + sql)); + } + + } // else + } // if BLANK + } // for + if(request != null ) { + for (int i = 0; i < reqParameters.length; i++) { + if(!reqParameters[i].startsWith("ff")) { + if (nvl(request.getParameter(reqParameters[i].toUpperCase())).length() > 0) + sql = Utils.replaceInString(sql, "[" + reqParameters[i].toUpperCase()+"]", request.getParameter(reqParameters[i].toUpperCase()) ); + } + else + sql = Utils.replaceInString(sql, "[" + reqParameters[i].toUpperCase()+"]", request.getParameter(reqParameters[i]) ); + } + + for (int i = 0; i < scheduleSessionParameters.length; i++) { + if(nvl(request.getParameter(scheduleSessionParameters[i])).trim().length()>0 ) + sql = Utils.replaceInString(sql, "[" + scheduleSessionParameters[i].toUpperCase()+"]", request.getParameter(scheduleSessionParameters[i]) ); + } + } + if(session != null ) { + for (int i = 0; i < sessionParameters.length; i++) { + //if(!sessionParameters[i].startsWith("ff")) + // paramValue = Utils.replaceInString(paramValue, "[" + sessionParameters[i].toUpperCase()+"]", (String)session.getAttribute(sessionParameters[i].toUpperCase()) ); + // else { + logger.debug(EELFLoggerDelegate.debugLogger, (" Session " + " sessionParameters[i] " + sessionParameters[i] + " " + (String)session.getAttribute(sessionParameters[i]))); + sql = Utils.replaceInString(sql, "[" + sessionParameters[i].toUpperCase()+"]", (String)session.getAttribute(sessionParameters[i]) ); + //} + } + } + } else { + logger.debug(EELFLoggerDelegate.debugLogger, ("BEFORE LOGGED USERID REPLACE " + sql)); + //sql = Utils.replaceInString(sql, "'[logged_userId]'", "'"+userId+"'"); + //debugLogger.debug("Replacing string 2 " + sql); + sql = Utils.replaceInString(sql, "[LOGGED_USERID]", userId); + sql = Utils.replaceInString(sql, "[USERID]", userId); + sql = Utils.replaceInString(sql, "[USER_ID]", userId); + logger.debug(EELFLoggerDelegate.debugLogger, ("AFTER LOGGED USERID REPLACE " + sql)); + // Added for Simon's GM Project where they need to get page_id in their query + logger.debug(EELFLoggerDelegate.debugLogger, ("SQLSQLBASED no formfields " + sql)); + if(request != null ) { + for (int i = 0; i < reqParameters.length; i++) { + sql = Utils.replaceInString(sql, "[" + reqParameters[i].toUpperCase()+"]", request.getParameter(reqParameters[i]) ); + } + } + if(session != null ) { + for (int i = 0; i < sessionParameters.length; i++) { + logger.debug(EELFLoggerDelegate.debugLogger, (" Session " + " sessionParameters[i] " + sessionParameters[i] + " " + (String)session.getAttribute(sessionParameters[i]))); + sql = Utils.replaceInString(sql, "[" + sessionParameters[i].toUpperCase()+"]", (String)session.getAttribute(sessionParameters[i]) ); + } + } + } + // if it is not multiple select and ParamValue is empty this is the place it can be replaced. + sql = Utils.replaceInString(sql, "[LOGGED_USERID]", userId); + sql = Utils.replaceInString(sql, "[USERID]", userId); + sql = Utils.replaceInString(sql, "[USER_ID]", userId); + logger.debug(EELFLoggerDelegate.debugLogger, ("SQLSQLBASED no formfields after" + sql)); + //debugLogger.debug("Replacing String 2 "+ sql); + //debugLogger.debug("Replaced String " + sql); + + sql = Pattern.compile("([\n][\\s]*)",Pattern.DOTALL).matcher(sql).replaceAll(" "); + return sql; + + } + public void persistScheduleData(Connection conn, HttpServletRequest request) throws RaptorException { + if (!infoUpdated) + return; + if (reportID.equals("-1")) + return; + + + try { + String sched_id = ""; + StringBuffer query = new StringBuffer(""); + query.append(" SELECT 1 FROM cr_report_schedule WHERE rep_id = " + reportID + " and schedule_id = " + getScheduleID()); + if(!AppUtils.isAdminUser(request)) + query.append(" and sched_user_id = " + getScheduleUserID()); + DataSet ds = DbUtils.executeQuery(conn, query.toString()); + if (ds.getRowCount() > 0) { + StringBuffer sb = new StringBuffer(); + sb.append("UPDATE cr_report_schedule SET enabled_yn = '"); + sb.append(getSchedEnabled()); + sb.append("', start_date = "); + if (getStartDate().length() > 0) { + sb.append("TO_DATE('"); + sb.append(getStartDate()); + sb.append("', 'MM/DD/YYYY')"); + } else + sb.append("NULL"); + sb.append(", end_date = "); + if (getEndDate().length() > 0) { + sb.append("TO_DATE('"); + sb.append(getEndDate()); + sb.append(" "); + sb.append(getEndHour()); + sb.append(":"); + sb.append(getEndMin()); + sb.append(" "); + sb.append(getEndAMPM()); + sb.append("', 'MM/DD/YYYY HH:MI AM')"); + } else + sb.append("NULL"); + sb.append(", run_date = "); + if (getRunDate().length() > 0) { + sb.append("TO_DATE('"); + sb.append(getRunDate()); + sb.append(" "); + sb.append(getRunHour()); + sb.append(":"); + sb.append(getRunMin()); + sb.append(" "); + sb.append(getRunAMPM()); + sb.append("', 'MM/DD/YYYY HH:MI AM')"); + } else + sb.append("NULL"); + sb.append(", recurrence = "); + if (getRecurrence().length() > 0) { + sb.append("'"); + sb.append(getRecurrence()); + sb.append("'"); + } else + sb.append("NULL"); + sb.append(", conditional_yn = '"); + sb.append(getConditional()); + //sb.append("', condition_sql = "); + sb.append("'"); +/* if (getConditionSQL().length() > 0) { + sb.append("'"); + sb.append(parseScheduleSQL(request, Utils.oracleSafe(getConditionSQL()))); + sb.append("'"); + } else + sb.append("NULL"); +*/ + sb.append(", notify_type = "); + sb.append(getNotify_type()); + sb.append(", encrypt_yn = '"); + sb.append(getEncryptMode()+"'"); + sb.append(", attachment_yn = '"); + sb.append(getAttachmentMode()+"'"); + sb.append(", max_row = "); + sb.append(getDownloadLimit()); + sb.append(", initial_formFields = '"); + sb.append(getFormFields()+"'"); + sb.append(", processed_formfields = ''"); + sb.append(" WHERE rep_id = "); + sb.append(reportID + " and sched_user_id = "); + sb.append(getScheduleUserID()); + sb.append(" and schedule_id = "); + sb.append(getScheduleID()); + + DbUtils.executeUpdate(conn, sb.toString()); + } else { + //DataSet dsSeq = DbUtils.executeQuery("select seq_cr_report_schedule.nextval from dual " ); + String w_sql = Globals.getNewScheduleData(); + DataSet dsSeq = DbUtils.executeQuery(w_sql); + String schedule_id = dsSeq.getString(0,0); + setScheduleID(schedule_id); + StringBuffer sb = new StringBuffer(); + sb.append("INSERT INTO cr_report_schedule (schedule_id, sched_user_id, rep_id, enabled_yn, start_date, end_date, run_date, recurrence, conditional_yn, notify_type, max_row, initial_formfields, encrypt_yn, attachment_yn) VALUES("); + sb.append(getScheduleID() + ", "); + sb.append(getScheduleUserID() + ", "); + sb.append(reportID); + sb.append(", '"); + sb.append(getSchedEnabled()); + sb.append("', "); + if (getStartDate().length() > 0) { + sb.append("TO_DATE('"); + sb.append(getStartDate()); + sb.append("', 'MM/DD/YYYY')"); + } else + sb.append("NULL"); + sb.append(", "); + if (getEndDate().length() > 0) { + sb.append("TO_DATE('"); + sb.append(getEndDate()); + sb.append(" "); + sb.append(getEndHour()); + sb.append(":"); + sb.append(getEndMin()); + sb.append(" "); + sb.append(getEndAMPM()); + sb.append("', 'MM/DD/YYYY HH:MI AM')"); + } else + sb.append("NULL"); + sb.append(", "); + if (getRunDate().length() > 0) { + sb.append("TO_DATE('"); + sb.append(getRunDate()); + sb.append(" "); + sb.append(getRunHour()); + sb.append(":"); + sb.append(getRunMin()); + sb.append(" "); + sb.append(getRunAMPM()); + sb.append("', 'MM/DD/YYYY HH:MI AM')"); + } else + sb.append("NULL"); + sb.append(", "); + if (getRecurrence().length() > 0) { + sb.append("'"); + sb.append(getRecurrence()); + sb.append("'"); + } else + sb.append("NULL"); + sb.append(", '"); + sb.append(getConditional()); + sb.append("', "); +/* if (getConditionSQL().length() > 0) { + sb.append("'"); + sb.append(parseScheduleSQL(request, Utils.oracleSafe(getConditionSQL()))); + sb.append("'"); + } else + sb.append("NULL"); + sb.append(", "); +*/ + sb.append(getNotify_type()); + sb.append(", "); + sb.append(getDownloadLimit()); + sb.append(", '"); + sb.append(getFormFields()+"'"); + sb.append(",'"); + sb.append(getEncryptMode()+"'"); + sb.append(",'"); + sb.append(getAttachmentMode()+"'"); + sb.append(")"); + DbUtils.executeUpdate(conn, sb.toString()); + + } // else + + + //DbUtils.executeUpdate(conn, + // "DELETE cr_report_schedule_users WHERE rep_id = " + reportID+ " and schedule_id = " + getScheduleID()); + + String d_sql = Globals.getExecuteUpdate(); + d_sql = d_sql.replace("[reportID]", reportID); + d_sql = d_sql.replace("[getScheduleID()]", getScheduleID()); + + DbUtils.executeUpdate(conn, d_sql); + + for (int i = 0; i < emailToUsers.size(); i++){ + //DbUtils.executeUpdate(conn, + // "INSERT INTO cr_report_schedule_users (schedule_id, rep_id, user_id, role_id, order_no) VALUES(" + // + getScheduleID() + ", " + // + reportID + ", " + // + ((IdNameValue) emailToUsers.get(i)).getId() + ", NULL, " + // + (i + 1) + ")"); + + String sql = Globals.getExecuteUpdateUsers(); + sql = sql.replace("[getScheduleID()]", getScheduleID()); + sql = sql.replace("[reportID]", reportID); + sql = sql.replace("[emailToUsers.get(i)).getId()]", ((IdNameValue) emailToUsers.get(i)).getId()); + sql = sql.replace("[(i + 1)]", String.valueOf(i + 1)); + DbUtils.executeUpdate(conn, sql); + + } + for (int i = 0; i < emailToRoles.size(); i++){ + //DbUtils.executeUpdate(conn, + // "INSERT INTO cr_report_schedule_users (schedule_id, rep_id, user_id, role_id, order_no) VALUES(" + // + getScheduleID() +", " + // + reportID + ", NULL, " + // + ((IdNameValue) emailToRoles.get(i)).getId() + ", " + // + (emailToUsers.size() + i + 1) + ")"); + + String sql = Globals.getExecuteUpdateRoles(); + sql = sql.replace("[getScheduleID()]", getScheduleID()); + sql = sql.replace("[reportID]", reportID); + sql = sql.replace("[emailToRoles.get(i)).getId()]", ((IdNameValue) emailToRoles.get(i)).getId()); + sql = sql.replace("[((emailToUsers.size() + i + 1)]", String.valueOf(emailToUsers.size() + i + 1)); + + DbUtils.executeUpdate(conn, sql); + } + //if (conn == null) + DbUtils.commitTransaction(conn); + + persistConditionSql(conn, getScheduleID(), parseScheduleSQL(request, getConditionSQL())); + + + logger.debug(EELFLoggerDelegate.debugLogger, ("[DEBUG MESSAGE FROM RAPTOR] DB update report " + reportID + " - schedule data updated")); + //DbUtils.executeUpdate(conn, + // "INSERT into cr_schedule_activity_log (schedule_id, notes, run_time) values ("+getScheduleID()+",'Submitted:Schedule',TO_DATE('"+ getRunDate()+" "+ getRunHour()+":"+getRunMin()+" "+getRunAMPM()+"', 'MM/DD/YYYY HH:MI AM'))"); + String e_sql = Globals.getExecuteUpdateActivity(); + e_sql = e_sql.replace("[getScheduleID()]", getScheduleID()); + e_sql = e_sql.replace("[getRunDate()]", getRunDate()); + e_sql = e_sql.replace("[getRunHour()]", getRunHour()); + e_sql = e_sql.replace("[getRunMin()]", getRunMin()); + e_sql = e_sql.replace("[getRunAMPM()]", getRunAMPM()); + + DbUtils.executeUpdate(conn, e_sql); + + infoUpdated = false; + + } catch (RaptorException e) { + if (conn != null) + DbUtils.rollbackTransaction(conn); + throw e; + } // catch + + } // persistScheduleData + + //deleting the schedule - Start + public void deleteScheduleData(Connection conn) throws RaptorException { + if (reportID.equals("-1")) + return; + + Connection connection = (conn != null) ? conn : DbUtils.startTransaction(); + String sched_id = ""; + try { + //DataSet ds = DbUtils.executeQuery(connection, + // "SELECT 1 FROM cr_report_schedule WHERE rep_id = " + reportID +" and sched_user_id = " + getScheduleUserID() + " and schedule_id = " + getScheduleID()); + String a_sql = Globals.getDeleteScheduleData(); + a_sql = a_sql.replace("[reportID]", reportID); + a_sql = a_sql.replace("[getScheduleUserID()]", getScheduleUserID()); + a_sql = a_sql.replace("[getScheduleID()]", getScheduleID()); + DataSet ds = DbUtils.executeQuery(connection, a_sql); + + if (ds.getRowCount() > 0) { + //DbUtils.executeUpdate(connection, + // "DELETE cr_report_schedule_users WHERE rep_id = " + reportID+ " and schedule_id = " + getScheduleID()); + String b_sql = Globals.getDeleteScheduleDataUsers(); + b_sql = b_sql.replace("[reportID]", reportID); + b_sql = b_sql.replace("[getScheduleID()]", getScheduleID()); + + DbUtils.executeUpdate(connection, b_sql); + + StringBuffer sb = new StringBuffer(); + String c_sql = Globals.getDeleteScheduleDataId(); + c_sql = c_sql.replace("[reportID]", reportID); + c_sql = c_sql.replace("[getScheduleUserID()]", getScheduleUserID()); + c_sql = c_sql.replace("[getScheduleID()]", getScheduleID()); + + sb.append(c_sql); + //sb.append("DELETE FROM cr_report_schedule where rep_id = " + reportID +" and sched_user_id = " + getScheduleUserID() + " and schedule_id = " + getScheduleID()); + + DbUtils.executeUpdate(connection, sb.toString()); + } + if (conn == null) + DbUtils.commitTransaction(connection); + + logger.debug(EELFLoggerDelegate.debugLogger, ("[DEBUG MESSAGE FROM RAPTOR] DB update report " + reportID + " - schedule data deleted")); + } catch (RaptorException e) { + if (conn == null) + DbUtils.rollbackTransaction(connection); + throw e; + } // catch + finally { + if (conn == null) + DbUtils.clearConnection(connection); + } + } //deleteScheduleData + + public String getScheduleUserID() { + return scheduleUserID; + } + + public void setScheduleUserID(String scheduleUserID) { + this.scheduleUserID = scheduleUserID; + } + + public String getScheduleID() { + return nvl(scheduleID); + } + + public void setScheduleID(String scheduleID) { + this.scheduleID = scheduleID; + } + + public String getEndAMPM() { + return endAMPM; + } + + public void setEndAMPM(String endAMPM) { + if (nvl(endAMPM).equals(this.endAMPM)) + return; + infoUpdated = true; + this.endAMPM = nvl(endAMPM, "PM"); + } + + public String getEndHour() { + return endHour; + } + + public void setEndHour(String endHour) { + if (nvl(endHour).equals(this.endHour)) + return; + infoUpdated = true; + this.endHour = nvl(endHour, "11"); + } + + public String getEndMin() { + return endMin; + } + + public void setEndMin(String endMin) { + if (nvl(endMin).equals(this.endMin)) + return; + infoUpdated = true; + this.endMin = nvl(endMin, "45"); + } + + public static boolean isNull(String a) { + if ((a == null) || (a.length() == 0) || a.equalsIgnoreCase("null")) + return true; + else + return false; + } + + public String addZero(String num) { + int numInt = 0; + try { + numInt = Integer.parseInt(num); + }catch(NumberFormatException ex){ + numInt = 0; + } + if(numInt < 10) return "0"+numInt; + else return ""+numInt; + } + + public static String loadConditionalSQL(String scheduleId) + throws RaptorException { + StringBuffer sb = new StringBuffer(); + + PreparedStatement stmt = null; + + ResultSet rs = null; + String condition_sql = ""; + Connection connection = null; + + try { + connection = DbUtils.getConnection(); + + //String sql = "SELECT condition_large_sql FROM cr_report_schedule WHERE schedule_id=?"; + String sql = Globals.getLoadCondSql(); + stmt = connection.prepareStatement(sql); + stmt.setString(1,scheduleId); + rs = stmt.executeQuery(); + if(Globals.isWeblogicServer()) { + java.sql.Clob clob= null; + Object obj = null; + if (rs.next()) { + clob = rs.getClob(1); + } + else + throw new RuntimeException("Schedule ID " + scheduleId + " not found in the database"); + + int len = 0; + 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(); + } else if (Globals.isPostgreSQL() || Globals.isMySQL()) { + String clob= null; + Object obj = null; + if (rs.next()) { + sb.append(rs.getString(1)); + } + else + throw new RaptorException("Schedule ID " + scheduleId + " not found in the database"); + } else { + /*oracle.sql.CLOB clob = null; + if (rs.next()) + clob = (oracle.sql.CLOB) rs.getObject(1); + else + throw new RuntimeException("Schedule ID " + scheduleId + " not found in the database"); + int len = 0; + char[] buffer = new char[512]; + Reader in = null; + if(clob!=null) { + in = clob.getCharacterStream(); + while ((len = in.read(buffer)) != -1) + sb.append(buffer, 0, len); + in.close(); + }*/ + throw new RaptorException("only maria db support for this "); + + } + } catch (SQLException ex) { + try { + StringBuffer query = new StringBuffer(""); + + query.append(" SELECT condition_sql FROM cr_report_schedule WHERE schedule_id = " + scheduleId); + DataSet ds = DbUtils.executeQuery(query.toString()); + if(ds.getRowCount()>0) { + condition_sql = ds.getString(0,0); + } + return condition_sql; + //throw new ReportSQLException (ex.getMessage(), ex.getCause()); + } catch (RaptorException e) { + DbUtils.rollbackTransaction(connection); + throw e; + } // catch + + finally { + DbUtils.clearConnection(connection); + } + + } catch (IOException ex) { + throw new RaptorRuntimeException (ex.getMessage(), ex.getCause()); + } finally { + try { + if (connection != null) + DbUtils.clearConnection(connection); + if(rs!=null) + rs.close(); + if(stmt!=null) + stmt.close(); + } catch (SQLException ex) { + throw new ReportSQLException (ex.getMessage(), ex.getCause()); + } + } + return sb.toString(); + } // loadConditionalSQL + + private static void persistConditionSql(Connection connection, String scheduleId, String conditional_sql) throws RaptorException { + PreparedStatement stmt = null; + ResultSet rs = null; + + try { + //String sql = "update cr_report_schedule set condition_large_sql = EMPTY_CLOB() where schedule_id = " + scheduleId; + String sql = Globals.getPersistCondSqlUpdate(); + sql = sql.replace("[scheduleId]", scheduleId); + + DbUtils.executeUpdate(sql); + //sql = "SELECT condition_large_sql FROM cr_report_schedule cr WHERE schedule_id=? FOR UPDATE"; + sql = Globals.getPersistCondSqlLarge(); + stmt = connection.prepareStatement(sql); + stmt.setString(1,scheduleId); + rs = stmt.executeQuery(); + Writer out = null; + /*if(Globals.isWeblogicServer()) { + java.sql.Clob clob = null; + if (rs.next()) + clob = rs.getClob(1); + else + throw new RuntimeException("Schedule ID " + scheduleId + " not found in the database"); + + if (clob.length() > conditional_sql.length()) + clob.truncate(0); + //clob.trim(reportXML.length()); + out = ((weblogic.jdbc.vendor.oracle.OracleThinClob)clob).getCharacterOutputStream(); + } else*/ + if (Globals.isPostgreSQL() || Globals.isMySQL()) { + if (rs.next()) { + rs.updateString(1,conditional_sql); + rs.updateRow(); + //sb.append(rs.getString(1)); + } + else + throw new RaptorException("Schedule ID " + scheduleId + " not found in the database"); + } else {/* + oracle.sql.CLOB clob = null; + if (rs.next()) + clob = (oracle.sql.CLOB) rs.getObject(1); + else + throw new RuntimeException("Schedule ID " + scheduleId + " not found in the database"); + + if (clob.length() > conditional_sql.length()) + clob.trim(conditional_sql.length()); + out = clob.getCharacterOutputStream();*/ + throw new RaptorException("only maria db support for this "); + + } + out.write(conditional_sql); + out.flush(); + out.close(); + } catch (RaptorException ex) { + if(ex.getMessage().indexOf("invalid identifier")!= -1) { + try { + //String sql = "update cr_report_schedule set condition_sql = ? where schedule_id = " + scheduleId; + String sql = Globals.getPersistCondSqlSet(); + sql = sql.replace("[scheduleId]", scheduleId); + stmt = connection.prepareStatement(sql); + stmt.setString(1,conditional_sql); + stmt.executeUpdate(); + connection.commit(); + } catch (SQLException ex1) { + try { + connection.rollback(); + } catch (SQLException ex2) {} + + } + } else { + try { + connection.rollback(); + } catch (SQLException ex2) { + throw new ReportSQLException (ex2.getMessage(), ex2.getCause()); + } + } + } catch (SQLException ex) { + try { + connection.rollback(); + } catch (SQLException ex2) { + throw new ReportSQLException (ex2.getMessage(), ex2.getCause()); + } + } catch (IOException ex) { + throw new RaptorRuntimeException (ex.getMessage(), ex.getCause()); + } finally { + try { + if(rs!=null) + rs.close(); + if(stmt!=null) + stmt.close(); + } catch (SQLException ex) { + throw new ReportSQLException (ex.getMessage(), ex.getCause()); + } + } + } // persistConditionSql + + /** + * Used to get encryption mode + * @return the encryptMode + */ + public String getEncryptMode() { + return encryptMode; + } + + /** + * Used to set encryption mode + * @param encryptMode the encryptMode to set + */ + public void setEncryptMode(String encryptMode) { + this.encryptMode = encryptMode; + infoUpdated = true; + } + + + /** + * Used to get Attachment mode + * @return the attachment + */ + public String getAttachmentMode() { + return attachment; + } + + public boolean isAttachmentMode() { + return nvl(attachment).toUpperCase().startsWith("Y"); + } + + /** + * Used to set Attachment mode + * @param attachment to set + */ + public void setAttachmentMode(String attachment) { + this.attachment = attachment; + infoUpdated = true; + } +} // ReportSchedule diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/SecurityEntry.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/SecurityEntry.java new file mode 100644 index 00000000..bd4d1549 --- /dev/null +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/SecurityEntry.java @@ -0,0 +1,62 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the “License”); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + */ +package org.onap.portalsdk.analytics.model.definition; + +import org.onap.portalsdk.analytics.model.base.*; + +public class SecurityEntry extends IdNameValue { + private boolean readOnly = true; + + public SecurityEntry() { + super(); + } + + public SecurityEntry(String id, String name, boolean readOnly) { + super(id, name); + setReadOnly(readOnly); + } // SecurityEntry + + public boolean isReadOnly() { + return readOnly; + } + + public void setReadOnly(boolean readOnly) { + this.readOnly = readOnly; + } + +} // SecurityEntry diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/TableJoin.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/TableJoin.java new file mode 100644 index 00000000..6032d5a1 --- /dev/null +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/TableJoin.java @@ -0,0 +1,85 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the “License”); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + */ +package org.onap.portalsdk.analytics.model.definition; + +import org.onap.portalsdk.analytics.RaptorObject; + +public class TableJoin extends RaptorObject { + private String srcTableName = null; + + private String destTableName = null; + + private String joinExpr = null; + + public TableJoin() { + super(); + } + + public TableJoin(String srcTableName, String destTableName, String joinExpr) { + this(); + + setSrcTableName(srcTableName); + setDestTableName(destTableName); + setJoinExpr(joinExpr); + } // TableJoin + + public String getSrcTableName() { + return srcTableName; + } + + public String getDestTableName() { + return destTableName; + } + + public String getJoinExpr() { + return joinExpr; + } + + public void setSrcTableName(String srcTableName) { + this.srcTableName = srcTableName; + } + + public void setDestTableName(String destTableName) { + this.destTableName = destTableName; + } + + public void setJoinExpr(String joinExpr) { + this.joinExpr = joinExpr; + } + +} // TableJoin diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/TableSource.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/TableSource.java new file mode 100644 index 00000000..4ca177e8 --- /dev/null +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/TableSource.java @@ -0,0 +1,119 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the “License”); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + */ +package org.onap.portalsdk.analytics.model.definition; + +import org.onap.portalsdk.analytics.RaptorObject; + +public class TableSource extends RaptorObject { + private String tableName = null; + + private String displayName = null; + + private String pkFields = null; + + private String viewAction = null; + + private String isLargeData = null; + + private String filterSql = null; + + public TableSource() { + super(); + } + + public TableSource(String tableName, String displayName, String pkFields, + String viewAction, String isLargeData, String filterSql) { + this(); + + setTableName(tableName); + setDisplayName(displayName); + setPkFields(pkFields); + setViewAction(viewAction); + setIsLargeData(isLargeData); + setFilterSql(filterSql); + } // TableSource + + public String getTableName() { + return tableName; + } + + public String getDisplayName() { + return displayName; + } + + public String getPkFields() { + return pkFields; + } + + public String getViewAction() { + return viewAction; + } + + public String getIsLargeData() { + return isLargeData; + } + + public String getFilterSql() { + return filterSql; + } + + public void setTableName(String tableName) { + this.tableName = tableName; + } + + public void setDisplayName(String displayName) { + this.displayName = displayName; + } + + public void setPkFields(String pkFields) { + this.pkFields = pkFields; + } + + public void setViewAction(String viewAction) { + this.viewAction = viewAction; + } + + public void setIsLargeData(String isLargeData) { + this.isLargeData = isLargeData; + } + + public void setFilterSql(String filterSql) { + this.filterSql = filterSql; + } + +} // TableSource diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/wizard/ColumnEditJSON.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/wizard/ColumnEditJSON.java new file mode 100644 index 00000000..d3478d77 --- /dev/null +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/wizard/ColumnEditJSON.java @@ -0,0 +1,137 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the “License”); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + */ +package org.onap.portalsdk.analytics.model.definition.wizard; + +public class ColumnEditJSON implements WizardJSON { + + private String tabId; + private String tabName; + + private String colId; + private String colName; + private String displayAlignment; + private String displayHeaderAlignment; + private boolean sortable; + private boolean visible; + + private String drilldownURL; + private String drilldownParams; + private String drilldownType; + private String errorMessage; + private String errorStackTrace; + + public String getTabId() { + return tabId; + } + public String getErrorMessage() { + return errorMessage; + } + public void setErrorMessage(String errorMessage) { + this.errorMessage = errorMessage; + } + public String getErrorStackTrace() { + return errorStackTrace; + } + public void setErrorStackTrace(String errorStackTrace) { + this.errorStackTrace = errorStackTrace; + } + public void setTabId(String tabId) { + this.tabId = tabId; + } + public String getTabName() { + return tabName; + } + public void setTabName(String tabName) { + this.tabName = tabName; + } + public String getColId() { + return colId; + } + public void setColId(String colId) { + this.colId = colId; + } + public String getColName() { + return colName; + } + public void setColName(String colName) { + this.colName = colName; + } + public String getDisplayAlignment() { + return displayAlignment; + } + public void setDisplayAlignment(String displayAlignment) { + this.displayAlignment = displayAlignment; + } + public String getDisplayHeaderAlignment() { + return displayHeaderAlignment; + } + public void setDisplayHeaderAlignment(String displayHeaderAlignment) { + this.displayHeaderAlignment = displayHeaderAlignment; + } + public boolean isSortable() { + return sortable; + } + public void setSortable(boolean sortable) { + this.sortable = sortable; + } + public boolean isVisible() { + return visible; + } + public void setVisible(boolean visible) { + this.visible = visible; + } + public String getDrilldownURL() { + return drilldownURL; + } + public void setDrilldownURL(String drilldownURL) { + this.drilldownURL = drilldownURL; + } + public String getDrilldownParams() { + return drilldownParams; + } + public void setDrilldownParams(String drilldownParams) { + this.drilldownParams = drilldownParams; + } + public String getDrilldownType() { + return drilldownType; + } + public void setDrilldownType(String drilldownType) { + this.drilldownType = drilldownType; + } + +} diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/wizard/ColumnJSON.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/wizard/ColumnJSON.java new file mode 100644 index 00000000..97347037 --- /dev/null +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/wizard/ColumnJSON.java @@ -0,0 +1,59 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the “License”); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + */ +package org.onap.portalsdk.analytics.model.definition.wizard; + +public class ColumnJSON implements ElementJSON { + + private String id; + private String name; + public String getId() { + return id; + } + public void setId(String id) { + this.id = id; + } + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + + + +} diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/wizard/DefinitionJSON.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/wizard/DefinitionJSON.java new file mode 100644 index 00000000..351192b5 --- /dev/null +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/wizard/DefinitionJSON.java @@ -0,0 +1,252 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the “License”); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + */ +package org.onap.portalsdk.analytics.model.definition.wizard; + +import java.util.List; + +public class DefinitionJSON implements WizardJSON { + + private String tabName; + private String tabId; + + private String reportId; + private String reportName; + private String reportDescr; + private String reportType; + private String dbInfo; + private String formHelpText; + private Integer pageSize; + private List displayArea = null; + private Boolean hideFormFieldsAfterRun; + private Integer maxRowsInExcelCSVDownload; + private Integer frozenColumns; + private String dataGridAlign; + private String emptyMessage; + private String dataContainerHeight; + private String dataContainerWidth; + private List displayOptions = null; + private Boolean runtimeColSortDisabled; + private Integer numFormCols; + private String reportTitle; + private String reportSubTitle; + + @Override + public String getTabName() { + return tabName; + } + + @Override + public void setTabName(String tabName) { + this.tabName = tabName; + } + + @Override + public String getTabId() { + return tabId; + } + + @Override + public void setTabId(String tabId) { + this.tabId = tabId; + } + + + + public String getReportId() { + return reportId; + } + + public void setReportId(String reportId) { + this.reportId = reportId; + } + + public String getReportName() { + return reportName; + } + + public void setReportName(String reportName) { + this.reportName = reportName; + } + + public String getReportDescr() { + return reportDescr; + } + + public void setReportDescr(String reportDescr) { + this.reportDescr = reportDescr; + } + + public String getReportType() { + return reportType; + } + + public void setReportType(String reportType) { + this.reportType = reportType; + } + + public String getDbInfo() { + return dbInfo; + } + + public void setDbInfo(String dbInfo) { + this.dbInfo = dbInfo; + } + + public String getFormHelpText() { + return formHelpText; + } + + public void setFormHelpText(String formHelpText) { + this.formHelpText = formHelpText; + } + + public Integer getPageSize() { + return pageSize; + } + + public void setPageSize(Integer pageSize) { + this.pageSize = pageSize; + } + + public List getDisplayArea() { + return displayArea; + } + + public void setDisplayArea(List displayArea) { + this.displayArea = displayArea; + } + + public Boolean getHideFormFieldsAfterRun() { + return hideFormFieldsAfterRun; + } + + public void setHideFormFieldsAfterRun(Boolean hideFormFieldsAfterRun) { + this.hideFormFieldsAfterRun = hideFormFieldsAfterRun; + } + + public Integer getMaxRowsInExcelCSVDownload() { + return maxRowsInExcelCSVDownload; + } + + public void setMaxRowsInExcelCSVDownload(Integer maxRowsInExcelCSVDownload) { + this.maxRowsInExcelCSVDownload = maxRowsInExcelCSVDownload; + } + + public Integer getFrozenColumns() { + return frozenColumns; + } + + public void setFrozenColumns(Integer frozenColumns) { + this.frozenColumns = frozenColumns; + } + + public String getDataGridAlign() { + return dataGridAlign; + } + + public void setDataGridAlign(String dataGridAlign) { + this.dataGridAlign = dataGridAlign; + } + + public String getEmptyMessage() { + return emptyMessage; + } + + public void setEmptyMessage(String emptyMessage) { + this.emptyMessage = emptyMessage; + } + + public String getDataContainerHeight() { + return dataContainerHeight; + } + + public void setDataContainerHeight(String dataContainerHeight) { + this.dataContainerHeight = dataContainerHeight; + } + + public String getDataContainerWidth() { + return dataContainerWidth; + } + + public void setDataContainerWidth(String dataContainerWidth) { + this.dataContainerWidth = dataContainerWidth; + } + + public List getDisplayOptions() { + return displayOptions; + } + + public void setDisplayOptions(List displayOptions) { + this.displayOptions = displayOptions; + } + + public Boolean getRuntimeColSortDisabled() { + return runtimeColSortDisabled; + } + + public void setRuntimeColSortDisabled(Boolean runtimeColSortDisabled) { + this.runtimeColSortDisabled = runtimeColSortDisabled; + } + + public Integer getNumFormCols() { + return numFormCols; + } + + public void setNumFormCols(Integer numFormCols) { + this.numFormCols = numFormCols; + } + + public String getReportTitle() { + return reportTitle; + } + + public void setReportTitle(String reportTitle) { + this.reportTitle = reportTitle; + } + + public String getReportSubTitle() { + return reportSubTitle; + } + + public void setReportSubTitle(String reportSubTitle) { + this.reportSubTitle = reportSubTitle; + } + + + +} diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/wizard/ElementJSON.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/wizard/ElementJSON.java new file mode 100644 index 00000000..a0bee600 --- /dev/null +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/wizard/ElementJSON.java @@ -0,0 +1,51 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the “License”); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + */ +package org.onap.portalsdk.analytics.model.definition.wizard; + +import java.util.ArrayList; +import java.util.Map; + +import org.onap.portalsdk.analytics.view.ColumnHeader; + +public interface ElementJSON { + + // To be defined by child class + public String getId(); + public String getName(); + +} diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/wizard/FormEditJSON.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/wizard/FormEditJSON.java new file mode 100644 index 00000000..3d2dc41a --- /dev/null +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/wizard/FormEditJSON.java @@ -0,0 +1,149 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the “License”); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + */ +package org.onap.portalsdk.analytics.model.definition.wizard; + +import java.util.List; + +public class FormEditJSON implements WizardJSON { + + private String tabId; + private String tabName; + + private String fieldId; + private String fieldName; + private String fieldType; + private boolean visible; + private String defaultValue; + private String fieldDefaultSQL; + private String fieldSQL; + private String validationType; + private List predefinedValueList; + private String message; + private String errorMessage; + private String errorStackTrace; + + + public String getMessage() { + return message; + } + public void setMessage(String message) { + this.message = message; + } + public String getErrorMessage() { + return errorMessage; + } + public void setErrorMessage(String errorMessage) { + this.errorMessage = errorMessage; + } + public String getErrorStackTrace() { + return errorStackTrace; + } + public void setErrorStackTrace(String errorStackTrace) { + this.errorStackTrace = errorStackTrace; + } + public String getTabId() { + return tabId; + } + public void setTabId(String tabId) { + this.tabId = tabId; + } + public String getTabName() { + return tabName; + } + public void setTabName(String tabName) { + this.tabName = tabName; + } + + + public String getFieldId() { + return fieldId; + } + public void setFieldId(String fieldId) { + this.fieldId = fieldId; + } + public String getFieldName() { + return fieldName; + } + public void setFieldName(String fieldName) { + this.fieldName = fieldName; + } + + public String getFieldType() { + return fieldType; + } + public void setFieldType(String fieldType) { + this.fieldType = fieldType; + } + public boolean isVisible() { + return visible; + } + public void setVisible(boolean visible) { + this.visible = visible; + } + public String getDefaultValue() { + return defaultValue; + } + public void setDefaultValue(String defaultValue) { + this.defaultValue = defaultValue; + } + public String getFieldDefaultSQL() { + return fieldDefaultSQL; + } + public void setFieldDefaultSQL(String fieldDefaultSQL) { + this.fieldDefaultSQL = fieldDefaultSQL; + } + public String getValidationType() { + return validationType; + } + public void setValidationType(String validationType) { + this.validationType = validationType; + } + public List getPredefinedValueList() { + return predefinedValueList; + } + public void setPredefinedValueList(List predefinedValueList) { + this.predefinedValueList = predefinedValueList; + } + public String getFieldSQL() { + return fieldSQL; + } + public void setFieldSQL(String fieldSQL) { + this.fieldSQL = fieldSQL; + } + +} diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/wizard/IdNameBooleanJSON.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/wizard/IdNameBooleanJSON.java new file mode 100644 index 00000000..e18302cc --- /dev/null +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/wizard/IdNameBooleanJSON.java @@ -0,0 +1,66 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the “License”); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + */ +package org.onap.portalsdk.analytics.model.definition.wizard; + +public class IdNameBooleanJSON { + + private String id; + private String name; + private boolean selected; + + public String getId() { + return id; + } + public void setId(String id) { + this.id = id; + } + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + + public boolean isSelected() { + return selected; + } + public void setSelected(boolean selected) { + this.selected = selected; + } + +} diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/wizard/ImportJSON.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/wizard/ImportJSON.java new file mode 100644 index 00000000..66bbb7e7 --- /dev/null +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/wizard/ImportJSON.java @@ -0,0 +1,72 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the “License”); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + */ +package org.onap.portalsdk.analytics.model.definition.wizard; + +import java.util.List; + +public class ImportJSON implements WizardJSON { + + private String tabId; + private String tabName; + + private String reportXML; + + + public String getTabId() { + return tabId; + } + public void setTabId(String tabId) { + this.tabId = tabId; + } + public String getTabName() { + return tabName; + } + public void setTabName(String tabName) { + this.tabName = tabName; + } + public String getReportXML() { + return reportXML; + } + public void setReportXML(String reportXML) { + this.reportXML = reportXML; + } + + + + +} diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/wizard/ListJSON.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/wizard/ListJSON.java new file mode 100644 index 00000000..4a842958 --- /dev/null +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/wizard/ListJSON.java @@ -0,0 +1,58 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the “License”); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + */ +package org.onap.portalsdk.analytics.model.definition.wizard; + +import java.util.ArrayList; +import java.util.Map; + +import org.onap.portalsdk.analytics.view.ColumnHeader; + +public class ListJSON { + + private ArrayList elements; + + public ArrayList getElements() { + return elements; + } + + public void setElements(ArrayList elements) { + this.elements = elements; + } + + +} diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/wizard/MessageJSON.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/wizard/MessageJSON.java new file mode 100644 index 00000000..c5891b2e --- /dev/null +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/wizard/MessageJSON.java @@ -0,0 +1,73 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the “License”); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + */ +package org.onap.portalsdk.analytics.model.definition.wizard; + +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Map; + +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; + +import org.json.JSONObject; +import org.onap.portalsdk.analytics.model.base.IdNameValue; +import org.onap.portalsdk.analytics.view.ColumnHeader; +import org.onap.portalsdk.analytics.view.DataValue; +import org.onap.portalsdk.analytics.xmlobj.ColFilterList; +import org.onap.portalsdk.analytics.xmlobj.DataColumnList; +import org.onap.portalsdk.analytics.xmlobj.DataColumnType; + +public class MessageJSON { + + private String message; + private String anyStacktrace; + public String getMessage() { + return message; + } + public void setMessage(String message) { + this.message = message; + } + public String getAnyStacktrace() { + return anyStacktrace; + } + public void setAnyStacktrace(String anyStacktrace) { + this.anyStacktrace = anyStacktrace; + } + + +} diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/wizard/NameBooleanJSON.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/wizard/NameBooleanJSON.java new file mode 100644 index 00000000..f74f9671 --- /dev/null +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/wizard/NameBooleanJSON.java @@ -0,0 +1,59 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the “License”); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + */ +package org.onap.portalsdk.analytics.model.definition.wizard; + +public class NameBooleanJSON { + + private String name; + private boolean selected; + + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + + public boolean isSelected() { + return selected; + } + public void setSelected(boolean selected) { + this.selected = selected; + } + +} diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/wizard/QueryJSON.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/wizard/QueryJSON.java new file mode 100644 index 00000000..d2df77c0 --- /dev/null +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/wizard/QueryJSON.java @@ -0,0 +1,78 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the “License”); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + */ +package org.onap.portalsdk.analytics.model.definition.wizard; + +import java.util.ArrayList; +import java.util.Map; + +import org.onap.portalsdk.analytics.model.definition.wizard.WizardJSON; +import org.onap.portalsdk.analytics.view.ColumnHeader; + +public class QueryJSON implements WizardJSON { + + private String query; + private String tabName; + private String tabId; + + + public String getTabName() { + return tabName; + } + + public void setTabName(String tabName) { + this.tabName = tabName; + } + + public String getTabId() { + return tabId; + } + + public void setTabId(String tabId) { + this.tabId = tabId; + } + + public String getQuery() { + return query; + } + + public void setQuery(String query) { + this.query = query; + } + + +} diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/wizard/QueryResultJSON.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/wizard/QueryResultJSON.java new file mode 100644 index 00000000..794e9813 --- /dev/null +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/wizard/QueryResultJSON.java @@ -0,0 +1,88 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the “License”); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + */ +package org.onap.portalsdk.analytics.model.definition.wizard; + +import java.util.ArrayList; +import java.util.Map; + +import org.onap.portalsdk.analytics.view.ColumnHeader; + +public class QueryResultJSON { + + private String query; + + private int totalRows; + private ArrayList reportDataColumns; + private ArrayList> reportDataRows; + + + public String getQuery() { + return query; + } + + public void setQuery(String query) { + this.query = query; + } + + public int getTotalRows() { + return totalRows; + } + + public void setTotalRows(int totalRows) { + this.totalRows = totalRows; + } + + public ArrayList getReportDataColumns() { + return reportDataColumns; + } + + public void setReportDataColumns(ArrayList reportDataColumns) { + this.reportDataColumns = reportDataColumns; + } + + public ArrayList> getReportDataRows() { + return reportDataRows; + } + + public void setReportDataRows(ArrayList> reportDataRows) { + this.reportDataRows = reportDataRows; + } + + + +} diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/wizard/RaptorError.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/wizard/RaptorError.java new file mode 100644 index 00000000..b04f4d45 --- /dev/null +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/wizard/RaptorError.java @@ -0,0 +1,49 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the “License”); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + */ +package org.onap.portalsdk.analytics.model.definition.wizard; + +public class RaptorError extends RaptorResponse{ + public RaptorError(String theMessage) { + error().put("message", theMessage); + } + + public RaptorError(String theMessage, Throwable theError) { + error().put("message", theMessage) + .put("exception", theError.toString()); + } +} diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/wizard/RaptorResponse.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/wizard/RaptorResponse.java new file mode 100644 index 00000000..d14f4d1a --- /dev/null +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/wizard/RaptorResponse.java @@ -0,0 +1,68 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the “License”); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + */ +package org.onap.portalsdk.analytics.model.definition.wizard; + +import org.json.JSONObject; + +import com.fasterxml.jackson.annotation.JsonRawValue; + +public class RaptorResponse { + private JSONObject data = new JSONObject(), + error = new JSONObject(); + + public RaptorResponse() { + } + + public JSONObject data() { + return this.data; + } + + @JsonRawValue + public String getData() { + return this.data.toString(); + } + + public JSONObject error() { + return this.error; + } + + @JsonRawValue + public String getError() { + return this.error.toString(); + } +} diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/wizard/SearchFieldJSON.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/wizard/SearchFieldJSON.java new file mode 100644 index 00000000..948188cd --- /dev/null +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/wizard/SearchFieldJSON.java @@ -0,0 +1,59 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the “License”); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + */ +package org.onap.portalsdk.analytics.model.definition.wizard; + +public class SearchFieldJSON implements ElementJSON { + + private String id; + private String name; + public String getId() { + return id; + } + public void setId(String id) { + this.id = id; + } + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + + + +} diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/wizard/WizardJSON.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/wizard/WizardJSON.java new file mode 100644 index 00000000..0781f3f5 --- /dev/null +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/wizard/WizardJSON.java @@ -0,0 +1,47 @@ +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the “License”); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + */ +package org.onap.portalsdk.analytics.model.definition.wizard; + +public interface WizardJSON { + + public String getTabName(); + public void setTabName(String tabName); + public String getTabId(); + public void setTabId(String tabId); + +} -- cgit 1.2.3-korg