summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition
diff options
context:
space:
mode:
Diffstat (limited to 'ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition')
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/DBColumnInfo.java76
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/DrillDownParamDef.java111
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/Marker.java79
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/ReportDefinition.java1465
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/ReportLogEntry.java89
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/ReportMap.java82
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/ReportSchedule.java1407
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/SecurityEntry.java44
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/TableJoin.java67
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/TableSource.java101
10 files changed, 3521 insertions, 0 deletions
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/DBColumnInfo.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/DBColumnInfo.java
new file mode 100644
index 00000000..4496fdca
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/DBColumnInfo.java
@@ -0,0 +1,76 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file 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.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.model.definition;
+
+import org.openecomp.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/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/DrillDownParamDef.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/DrillDownParamDef.java
new file mode 100644
index 00000000..8972e54a
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/DrillDownParamDef.java
@@ -0,0 +1,111 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file 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.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.model.definition;
+
+import org.openecomp.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/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/Marker.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/Marker.java
new file mode 100644
index 00000000..a9d9be85
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/Marker.java
@@ -0,0 +1,79 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file 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.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.model.definition;
+
+import org.openecomp.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/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/ReportDefinition.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/ReportDefinition.java
new file mode 100644
index 00000000..71ec9f87
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/ReportDefinition.java
@@ -0,0 +1,1465 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file 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.
+ * ================================================================================
+ */
+package org.openecomp.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.openecomp.portalsdk.analytics.controller.WizardSequence;
+import org.openecomp.portalsdk.analytics.controller.WizardSequenceCrossTab;
+import org.openecomp.portalsdk.analytics.controller.WizardSequenceDashboard;
+import org.openecomp.portalsdk.analytics.controller.WizardSequenceLinear;
+import org.openecomp.portalsdk.analytics.controller.WizardSequenceSQLBasedCrossTab;
+import org.openecomp.portalsdk.analytics.controller.WizardSequenceSQLBasedHive;
+import org.openecomp.portalsdk.analytics.controller.WizardSequenceSQLBasedLinear;
+import org.openecomp.portalsdk.analytics.controller.WizardSequenceSQLBasedLinearDatamining;
+import org.openecomp.portalsdk.analytics.error.RaptorException;
+import org.openecomp.portalsdk.analytics.model.DataCache;
+import org.openecomp.portalsdk.analytics.model.ReportLoader;
+import org.openecomp.portalsdk.analytics.model.base.OrderBySeqComparator;
+import org.openecomp.portalsdk.analytics.model.base.OrderSeqComparator;
+import org.openecomp.portalsdk.analytics.model.base.ReportWrapper;
+import org.openecomp.portalsdk.analytics.model.runtime.FormField;
+import org.openecomp.portalsdk.analytics.system.AppUtils;
+import org.openecomp.portalsdk.analytics.system.DbUtils;
+import org.openecomp.portalsdk.analytics.system.Globals;
+import org.openecomp.portalsdk.analytics.util.AppConstants;
+import org.openecomp.portalsdk.analytics.util.DataSet;
+import org.openecomp.portalsdk.analytics.util.Utils;
+import org.openecomp.portalsdk.analytics.xmlobj.ChartAdditionalOptions;
+import org.openecomp.portalsdk.analytics.xmlobj.ChartDrillOptions;
+import org.openecomp.portalsdk.analytics.xmlobj.ColFilterType;
+import org.openecomp.portalsdk.analytics.xmlobj.CustomReportType;
+import org.openecomp.portalsdk.analytics.xmlobj.DataColumnList;
+import org.openecomp.portalsdk.analytics.xmlobj.DataColumnType;
+import org.openecomp.portalsdk.analytics.xmlobj.DataSourceType;
+import org.openecomp.portalsdk.analytics.xmlobj.DataminingOptions;
+import org.openecomp.portalsdk.analytics.xmlobj.FormFieldList;
+import org.openecomp.portalsdk.analytics.xmlobj.FormFieldType;
+import org.openecomp.portalsdk.analytics.xmlobj.FormatList;
+import org.openecomp.portalsdk.analytics.xmlobj.FormatType;
+import org.openecomp.portalsdk.analytics.xmlobj.JavascriptItemType;
+import org.openecomp.portalsdk.analytics.xmlobj.ObjectFactory;
+import org.openecomp.portalsdk.analytics.xmlobj.PredefinedValueList;
+import org.openecomp.portalsdk.analytics.xmlobj.SemaphoreType;
+import org.openecomp.portalsdk.core.controller.FavoritesController;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+
+/**<HR/>
+ * This class is part of <B><I>RAPTOR (Rapid Application Programming Tool for OLAP Reporting)</I></B><BR/>
+ * <HR/>
+ *
+ * --------------------------------------------------------------------------------------------------<BR/>
+ * <B>ReportDefinition.java</B> - This involves in creating and modifying RAPTOR reports.
+ * --------------------------------------------------------------------------------------------------<BR/>
+ *
+ *
+ * <U>Change Log</U><BR/><BR/>
+ *
+ * 18-Aug-2009 : Version 8.5.1 (Sundar);<UL><LI> request Object is passed to prevent caching user/roles - Datamining/Hosting. </LI></UL>
+ * 27-Jul-2009 : Version 8.4 (Sundar); <UL><LI>userIsAuthorizedToSeeLog is checked for Admin User instead of Super User.</LI></UL>
+ * 22-Jun-2009 : Version 8.4 (Sundar); <UL><LI>A new type ChartAdditionalOptions is introduced in RAPTOR XSD.
+ * For this type a create procedure is added to this class.</LI></UL>
+ *
+ */
+
+public class ReportDefinition extends ReportWrapper implements Serializable {
+
+ static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(FavoritesController.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() {
+ 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
+
+ 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())
+ return;
+
+ Connection connection = null;
+ try {
+ String userID = AppUtils.getUserID(request);
+ String reportXML = marshal();
+ logger.debug(EELFLoggerDelegate.debugLogger, ("Ocurring during Schedule "));
+ 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.openecomp.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.openecomp.portalsdk.analytics.util.RemDbInfo remDbInfo = new org.openecomp.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.openecomp.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.openecomp.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.openecomp.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.openecomp.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/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/ReportLogEntry.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/ReportLogEntry.java
new file mode 100644
index 00000000..db69e9d8
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/ReportLogEntry.java
@@ -0,0 +1,89 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file 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.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.model.definition;
+
+import org.openecomp.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/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/ReportMap.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/ReportMap.java
new file mode 100644
index 00000000..450349c7
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/ReportMap.java
@@ -0,0 +1,82 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file 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.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.model.definition;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.openecomp.portalsdk.analytics.RaptorObject;
+
+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/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/ReportSchedule.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/ReportSchedule.java
new file mode 100644
index 00000000..d95c91b5
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/ReportSchedule.java
@@ -0,0 +1,1407 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file 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.
+ * ================================================================================
+ */
+package org.openecomp.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.openecomp.portalsdk.analytics.RaptorObject;
+import org.openecomp.portalsdk.analytics.error.RaptorException;
+import org.openecomp.portalsdk.analytics.error.RaptorRuntimeException;
+import org.openecomp.portalsdk.analytics.error.ReportSQLException;
+import org.openecomp.portalsdk.analytics.error.UserDefinedException;
+import org.openecomp.portalsdk.analytics.model.base.IdNameValue;
+import org.openecomp.portalsdk.analytics.model.base.NameComparator;
+import org.openecomp.portalsdk.analytics.model.runtime.FormField;
+import org.openecomp.portalsdk.analytics.model.runtime.ReportParamValues;
+import org.openecomp.portalsdk.analytics.model.runtime.ReportRuntime;
+import org.openecomp.portalsdk.analytics.system.AppUtils;
+import org.openecomp.portalsdk.analytics.system.ConnectionUtils;
+import org.openecomp.portalsdk.analytics.system.DbUtils;
+import org.openecomp.portalsdk.analytics.system.Globals;
+import org.openecomp.portalsdk.analytics.util.AppConstants;
+import org.openecomp.portalsdk.analytics.util.DataSet;
+import org.openecomp.portalsdk.analytics.util.Utils;
+import org.openecomp.portalsdk.analytics.xmlobj.FormFieldType;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+
+public class ReportSchedule extends RaptorObject {
+
+ 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<IdNameValue> 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<IdNameValue> 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.openecomp.portalsdk.analytics.util.RemDbInfo remDbInfo = new org.openecomp.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/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/SecurityEntry.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/SecurityEntry.java
new file mode 100644
index 00000000..4feddd6e
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/SecurityEntry.java
@@ -0,0 +1,44 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file 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.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.model.definition;
+
+import org.openecomp.portalsdk.analytics.model.base.IdNameValue;
+
+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/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/TableJoin.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/TableJoin.java
new file mode 100644
index 00000000..6022d5a1
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/TableJoin.java
@@ -0,0 +1,67 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file 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.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.model.definition;
+
+import org.openecomp.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/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/TableSource.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/TableSource.java
new file mode 100644
index 00000000..dc5b385a
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/definition/TableSource.java
@@ -0,0 +1,101 @@
+/*-
+ * ================================================================================
+ * eCOMP Portal SDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file 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.
+ * ================================================================================
+ */
+package org.openecomp.portalsdk.analytics.model.definition;
+
+import org.openecomp.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