summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system
diff options
context:
space:
mode:
authortalasila <talasila@research.att.com>2017-02-07 11:47:55 -0500
committertalasila <talasila@research.att.com>2017-02-07 12:51:32 -0500
commit1faf201e8608dfa4d7af3460fd3d1fc7ebec398b (patch)
tree2208f76271cc6b1a81dbfb9143cd7118b071a909 /ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system
parentca23569858b8cc9f60010e193b7041feb2d3227b (diff)
Initial OpenECOMP Portal SDK commit
Change-Id: I66a3491600a4b9ea241128dc29267eed6a78ed76 Signed-off-by: talasila <talasila@research.att.com>
Diffstat (limited to 'ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system')
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/AppUtils.java333
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/ConnectionUtils.java69
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/DbUtils.java1298
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/ExecuteQuery.java60
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/Globals.java2282
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/IAppUtils.java175
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/IDbUtils.java35
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/RDbUtils.java36
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/RemDbUtils.java200
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/AntBuild.java66
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/AppUtils.java363
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/DbUtils.java75
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/RemoteDbUtils.java50
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/adapter/AdapterSessionFactoryContainer.java39
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/adapter/DateUtils.java287
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/adapter/FusionAdapter.java135
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/adapter/IdName.java59
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/adapter/Item.java55
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/adapter/Lookup.java85
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/adapter/RaptorAdapter.java368
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/adapter/SpringContext.java37
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/controller/FileServletController.java206
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/domain/CR_Report.java306
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/domain/QuickLink.java61
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/domain/RaptorSearch.java188
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/domain/ReportInfo.java159
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/service/RaptorService.java36
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/service/RaptorServiceImpl.java163
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/web/RaptorController.java191
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/web/RaptorControllerAsync.java410
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/web/ReportsSearchListController.java74
31 files changed, 7901 insertions, 0 deletions
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/AppUtils.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/AppUtils.java
new file mode 100644
index 00000000..ce070c3a
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/AppUtils.java
@@ -0,0 +1,333 @@
+/*-
+ * ================================================================================
+ * 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.system;
+
+import java.io.File;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Vector;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.openecomp.portalsdk.analytics.error.RaptorException;
+import org.openecomp.portalsdk.analytics.util.AppConstants;
+import org.openecomp.portalsdk.analytics.util.HtmlStripper;
+
+public class AppUtils /* implements IAppUtils */{
+ private static String baseURL = null;
+
+ private AppUtils() {
+ }
+
+ /** ******************************************************** */
+
+ public static String generateFileName(HttpServletRequest request, String fileTypeExtension) {
+ return AppConstants.FILE_PREFIX + getUserID(request) + fileTypeExtension;
+ } // generateFileName
+
+ public static String generateUniqueFileName(HttpServletRequest request, String reportName, String fileTypeExtension) {
+ String formattedReportName = new HtmlStripper().stripSpecialCharacters(reportName);
+ String formattedDate = new SimpleDateFormat("MMddyyyyHHmm").format(new Date());
+ return formattedReportName+formattedDate+getUserID(request)+fileTypeExtension;
+ } // generateFileName
+
+ public static String getRequestValue(HttpServletRequest request, String valueID) {
+ String value = (String) request.getAttribute(valueID);
+ if (value == null)
+ value = request.getParameter(valueID);
+ return value;
+ } // getRequestValue
+
+ public static String getRequestNvlValue(HttpServletRequest request, String valueID) {
+ String value = getRequestValue(request, valueID);
+ return (value == null) ? "" : value;
+ } // getRequestValue
+
+ public static boolean getRequestFlag(HttpServletRequest request, String valueID) {
+ String value = getRequestNvlValue(request, valueID);
+ return value.toLowerCase().equals("true") || value.toUpperCase().startsWith("Y");
+ } // getRequestFlag
+
+ /** ******************************************************** */
+
+ public static String getUserID(HttpServletRequest request) {
+ return Globals.getAppUtils().getUserID(request);
+ } // getUserID
+
+ public static String getUserName(HttpServletRequest request) {
+ return Globals.getAppUtils().getUserName(request);
+ } // getUserName
+
+ public static String getUserName(String userId) {
+ return Globals.getAppUtils().getUserName(userId);
+ } // getUserName
+
+ public static String getUserEmail(String userId) {
+ return Globals.getAppUtils().getUserEmail(userId);
+ } // getUserEmail
+
+ public static String getUserEmail(HttpServletRequest request) {
+ return Globals.getAppUtils().getUserEmail(request);
+ } // getUserEmail
+
+ public static String getUserLoginId(HttpServletRequest request) {
+ return Globals.getAppUtils().getUserLoginId(request);
+ } // getUserLoginId
+
+ public static String getUserLoginId(String userId) {
+ return Globals.getAppUtils().getUserLoginId(userId);
+ } // getUserLoginId
+
+ public static String getUserBackdoorLoginId(HttpServletRequest request) {
+ return Globals.getAppUtils().getUserBackdoorLoginId(request);
+ } // getUserBackdoorLoginId
+
+ public static Vector getAllUsers(String customizedQuery, String param, boolean isAdmin) {
+ return Globals.getAppUtils().getAllUsers(customizedQuery, param, isAdmin);
+ } // getAllUsers
+
+ public static String getRoleName(String roleId) {
+ return Globals.getAppUtils().getRoleName(roleId);
+ } // getRoleName
+
+ public static Vector getAllRoles(String customizedQuery, String param, boolean isAdmin) {
+ return Globals.getAppUtils().getAllRoles(customizedQuery, param, isAdmin);
+ } // getAllRoles
+
+ public static boolean isUserInRole(HttpServletRequest request, String roleId) throws RaptorException {
+ return Globals.getAppUtils().isUserInRole(request,roleId);
+ } // isUserInRole
+
+// public static boolean isUserInRole(String userId, String roleId) throws RaptorException {
+// return Globals.getAppUtils().isUserInRole(userId, roleId);
+// } // isUserInRole
+
+ public static Vector getUserRoles(HttpServletRequest request) throws RaptorException {
+ return Globals.getAppUtils().getUserRoles(request);
+ } // getUserRoles
+
+ public static Vector getUserRoles(String userID) throws RaptorException {
+ return Globals.getAppUtils().getUserRoles(userID);
+ } // getUserRoles
+
+// public static Vector getUserRoles(HttpServletRequest request) throws RaptorException {
+// return Globals.getAppUtils().getUserRoles(request);
+// } // getUserRoles
+
+ public static void resetUserCache() {
+ Globals.getAppUtils().resetUserCache();
+ } // resetUserCache
+
+ public static String getSuperRoleID() {
+ return Globals.getAppUtils().getSuperRoleID();
+ } // getSuperRoleID
+
+ public static Vector getAdminRoleIDs() {
+ return Globals.getAppUtils().getAdminRoleIDs();
+ } // getAdminRoleIDs
+
+ // This is changed to check for Admin User as admin user also need super user privilege if explicitly specified in properties file.
+ public static boolean isSuperUser(HttpServletRequest request)throws RaptorException {
+ if(Globals.isAdminRoleEquivalenttoSuperRole()) return isAdminUser(request);
+ else return isUserInRole(request, getSuperRoleID());
+ } // isSuperUser
+
+ /*public static boolean isSuperUser(String userId) throws RaptorException {
+ if(Globals.isAdminRoleEquivalenttoSuperRole()) return isAdminUser(userId);
+ else return isUserInRole(userId, getSuperRoleID());
+ } // isSuperUser
+ */
+
+ public static boolean isAdminUser(HttpServletRequest request) throws RaptorException {
+ if (isSuperUser(request))
+ return true;
+ for (int i = 0; i < getAdminRoleIDs().size(); i++)
+ if (isUserInRole(request, (String) getAdminRoleIDs().get(i)))
+ return true;
+
+ return false;
+ } // isAdminUser
+
+ /*public static boolean isAdminUser(String userId) throws RaptorException {
+ if (isSuperUser(userId))
+ return true;
+
+ for (int i = 0; i < getAdminRoleIDs().size(); i++)
+ if (isUserInRole(userId, (String) getAdminRoleIDs().get(i)))
+ return true;
+
+ return false;
+ } // isAdminUser
+ */
+
+ public static String getTempFolderPath() {
+ String path = Globals.getAppUtils().getTempFolderPath();
+ if (path.endsWith(File.separator) || path.endsWith("/")){
+ return path;
+ } else {
+ path = path + File.separator;
+ return path;
+ }
+ } // getTempFolderPath
+
+ public static String getUploadFolderPath() {
+ String path = Globals.getAppUtils().getUploadFolderPath();
+ if (path.endsWith(File.separator)){
+ return path;
+ } else {
+ path = path + File.separator;
+ return path;
+ }
+ } // getUploadFolderPath
+
+ public static String getTempFolderURL() {
+ return Globals.getAppUtils().getTempFolderURL();
+ } // getTempFolderURL
+
+ public static String getUploadFolderURL() {
+ return Globals.getAppUtils().getUploadFolderURL();
+ } // getUploadFolderURL
+
+ public static String getSMTPServer()throws Exception {
+ return Globals.getAppUtils().getSMTPServer();
+ } // getSMTPServer
+
+ public static String getDefaultEmailSender() throws RaptorException {
+ return Globals.getAppUtils().getDefaultEmailSender();
+ } // getDefaultEmailSender
+
+ public static String getErrorPage() {
+ return getJspContextPath() + Globals.getAppUtils().getErrorPage();
+ } // getErrorPage
+
+ public static String getErrorPageWMenu() {
+ return getJspContextPath() + Globals.getAppUtils().getErrorPageWMenu();
+ } // getErrorPage
+
+ public static String getJspContextPath() {
+ return Globals.getAppUtils().getJspContextPath();
+ } // getJspContextPath
+
+ public static String getImgFolderURL() {
+ return Globals.getAppUtils().getImgFolderURL();
+ } // getImgFolderURL
+
+ public static String getBaseFolderURL() {
+ return Globals.getAppUtils().getBaseFolderURL();
+ } // getBaseFolderURL
+
+ /*
+ * public static String getReportExecuteActionURL() { return
+ * Globals.getAppUtils().getReportExecuteActionURL(); } //
+ * getReportExecuteActionURL
+ *
+ * public static String getDataViewActionURL() { return
+ * Globals.getAppUtils().getDataViewActionURL(); } // getDataViewActionURL
+ *
+ * public static String getDataViewActionParam() { return
+ * Globals.getAppUtils().getDataViewActionParam(); } //
+ * getDataViewActionParam
+ */
+ public static String getDirectAccessURL() {
+ return Globals.getAppUtils().getDirectAccessURL();
+ } // getDirectAccessURL
+
+ public static String getBaseURL() {
+ if (baseURL == null) {
+ baseURL = getBaseActionURL();
+ if (baseURL.indexOf("?") > 0)
+ baseURL = baseURL.substring(0, baseURL.indexOf("?"));
+ } // if
+
+ return baseURL;
+ } // getBaseURL
+
+ public static String getBaseActionURL() {
+ return Globals.getAppUtils().getBaseActionURL();
+ } // getBaseActionURL
+
+ public static String getDrillActionURL() {
+ return Globals.getAppUtils().getDrillActionURL();
+ } // getBaseActionURL
+
+ public static String getRaptorActionURL() {
+ return Globals.getAppUtils().getBaseActionURL() + "raptor&" + AppConstants.RI_ACTION
+ + "=";
+ } // getRaptorActionURL
+
+ public static String getRaptorActionURLNG() {
+ return Globals.getAppUtils().getBaseActionURLNG();
+ } // getRaptorActionURL
+
+ public static String getReportExecuteActionURL() {
+ return getRaptorActionURL() + "report.run.container&" + AppConstants.RI_REPORT_ID + "="; // getBaseActionParam();
+ } // getReportExecuteActionURL
+
+ public static String getReportExecuteActionURLNG() {
+ return getRaptorActionURLNG() + "report_run/"; // getBaseActionParam();
+ } // getReportExecuteActionURL
+
+ public static String getBaseActionParam() {
+ return Globals.getAppUtils().getBaseActionParam();
+ } // getBaseActionParam
+
+ public static Vector getQuickLinksMenuIDs() {
+ return Globals.getAppUtils().getQuickLinksMenuIDs();
+ } // getQuickLinksMenuIDs
+
+ public static String getMenuLabel(String menuId) {
+ return Globals.getAppUtils().getMenuLabel(menuId);
+ } // getMenuLabel
+
+ public static String getReportDbColsMaskSQL() {
+ return Globals.getAppUtils().getReportDbColsMaskSQL();
+ } // getReportDbColsMaskSQL
+
+ public static String getReportDbLookupsSQL() {
+ return Globals.getAppUtils().getReportDbLookupsSQL();
+ } // getReportDbLookupsSQL
+
+ public static void processErrorNotification(HttpServletRequest request, RaptorException e) {
+ Globals.getAppUtils().processErrorNotification(request, e);
+ } // processErrorNotification
+
+ public static String getExcelTemplatePath() {
+ String path = Globals.getAppUtils().getExcelTemplatePath();
+ if (path.endsWith(File.separator)){
+ return path;
+ } else {
+ path = path + File.separator;
+ return path;
+ }
+ } // getTempFolderPath
+
+ public static String nvl(String s) {
+ return (s == null) ? "" : s;
+ }
+
+ public static boolean isNotEmpty(String s) {
+ return nvl(s).length()>0;
+ }
+ public static String nvls(String s, String sDefault) {
+ return nvl(s).equals("") ? sDefault : s;
+ }
+
+} // AppUtils
+
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/ConnectionUtils.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/ConnectionUtils.java
new file mode 100644
index 00000000..58fb3f25
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/ConnectionUtils.java
@@ -0,0 +1,69 @@
+/*-
+ * ================================================================================
+ * 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.system;
+
+import java.sql.Connection;
+
+import org.openecomp.portalsdk.analytics.error.RaptorException;
+import org.openecomp.portalsdk.analytics.error.ReportSQLException;
+import org.openecomp.portalsdk.analytics.util.AppConstants;
+import org.openecomp.portalsdk.analytics.util.DataSet;
+
+public class ConnectionUtils {
+
+ public static DataSet getDataSet(String sql, String remoteDbPrefix)
+ throws RaptorException {
+ return getDataSet(sql, remoteDbPrefix, false);
+ }
+
+ public static Connection getConnection(String remoteDbPrefix) throws ReportSQLException {
+ if (!isNull(remoteDbPrefix) && (!remoteDbPrefix.equals(AppConstants.DB_LOCAL)) && !Globals.getSystemType().equals(Globals.ST_GENERIC) ) {
+ return RemDbUtils.getConnection(remoteDbPrefix);
+ } else {
+ return DbUtils.getConnection();
+ }
+ }
+
+ public static DataSet getDataSet(String sql, String remoteDbPrefix,
+ boolean pagesize) throws ReportSQLException {
+ DataSet ds = null;
+ if (!isNull(remoteDbPrefix) && (!remoteDbPrefix.equals(AppConstants.DB_LOCAL)) && !Globals.getSystemType().equals(Globals.ST_GENERIC) ) {
+ if (pagesize == false)
+ ds = RemDbUtils.executeQuery(sql,remoteDbPrefix);
+ else
+ ds = RemDbUtils.executeQuery(sql, Globals.getDefaultPageSize() + 1,remoteDbPrefix);
+ } else {
+ if (pagesize == false)
+ ds = DbUtils.executeQuery(sql);
+ else
+ ds = DbUtils.executeQuery(sql, Globals.getDefaultPageSize() + 1);
+ }
+ return ds;
+ }
+
+ public static boolean isNull(String a) {
+ if ((a == null) || (a.length() == 0) || a.equalsIgnoreCase("null"))
+ return true;
+ else
+ return false;
+ }
+
+
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/DbUtils.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/DbUtils.java
new file mode 100644
index 00000000..859931f9
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/DbUtils.java
@@ -0,0 +1,1298 @@
+/*-
+ * ================================================================================
+ * 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.system;
+
+import java.sql.CallableStatement;
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.sql.Types;
+
+import javax.sql.DataSource;
+
+import org.openecomp.portalsdk.analytics.error.RaptorException;
+import org.openecomp.portalsdk.analytics.error.ReportSQLException;
+import org.openecomp.portalsdk.analytics.model.runtime.ReportRuntime;
+import org.openecomp.portalsdk.analytics.util.DataSet;
+import org.openecomp.portalsdk.analytics.xmlobj.DataColumnType;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.openecomp.portalsdk.core.web.support.AppUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+
+public class DbUtils /* implements IDbUtils */{
+
+ static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(DbUtils.class);
+
+
+
+ private static DataSource dataSource;
+
+
+ public DbUtils() {
+ }
+
+ public static Connection getConnection() throws ReportSQLException {
+ try {
+ return AppUtils.getDatasource().getConnection();
+ } catch(SQLException ex) {
+ ex.printStackTrace();
+ }
+ return null;
+ //return Globals.getDbUtils().getConnection();
+ } // getConnection
+
+ public static void clearConnection(Connection con) throws ReportSQLException {
+ try {
+ if ((con != null) && !con.isClosed())
+ Globals.getDbUtils().clearConnection(con);
+ } catch (SQLException ex) {
+ throw new ReportSQLException(ex.getMessage(), ex.getCause());
+ } catch (Exception ex2 ) {
+ throw new ReportSQLException (ex2.getMessage(), ex2.getCause());
+ }
+ } // clearConnection
+
+ public static Connection startTransaction() throws ReportSQLException {
+ Connection con = null;
+ try {
+ con = getConnection();
+ con.setAutoCommit(false);
+ } catch (SQLException ex) {
+ throw new ReportSQLException (ex.getMessage(), ex.getCause());
+ } catch (Exception ex2 ) {
+ throw new ReportSQLException (ex2.getMessage(), ex2.getCause());
+ }
+ return con;
+ } // startTransaction
+
+ public static void commitTransaction(Connection con) throws ReportSQLException {
+ try {
+ con.commit();
+ } catch (SQLException ex) {
+ throw new ReportSQLException (ex.getMessage(), ex.getCause());
+ } catch (Exception ex2 ) {
+ throw new ReportSQLException (ex2.getMessage(), ex2.getCause());
+ }
+
+ //clearConnection(con);
+ } // commitTransaction
+
+ public static void rollbackTransaction(Connection con) throws ReportSQLException {
+ try {
+ con.rollback();
+ clearConnection(con);
+ } catch (SQLException ex) {
+ throw new ReportSQLException (ex.getMessage(), ex.getCause());
+ } catch (Exception ex2 ) {
+ throw new ReportSQLException (ex2.getMessage(), ex2.getCause());
+ }
+ } // rollbackTransaction
+
+ public static String executeCall(Connection con, String sql, boolean expectResult)
+ throws ReportSQLException {
+ String result = null;
+
+ try {
+ if(con.isClosed()) con = getConnection();
+ logger.debug(EELFLoggerDelegate.debugLogger, ("[SQL CALL FROM RAPTOR] [SQL Call] " + sql));
+ CallableStatement stmt = con.prepareCall(sql);
+ if (expectResult)
+ stmt.registerOutParameter(1, Types.CHAR);
+ stmt.executeUpdate();
+ if (expectResult)
+ result = stmt.getString(1);
+ stmt.close();
+ con.commit();
+ } catch (SQLException e) {
+ throw new ReportSQLException(e.getMessage(), sql);
+ } finally {
+ clearConnection(con);
+ }
+
+ return result;
+ } // executeCall
+
+ public static String executeCall(String sql, boolean expectResult)
+ throws RaptorException {
+ Connection con = null;
+ con = getConnection();
+ String result = executeCall(con, sql, expectResult);
+ //con.commit();
+ return result;
+ } // executeCall
+
+ public static int executeUpdate(Connection con, String sql) throws ReportSQLException {
+ int rcode = -1;
+ try {
+ Statement stmt = con.createStatement();
+ logger.debug(EELFLoggerDelegate.debugLogger, ("[SQL CALL FROM RAPTOR] [SQL Update] " + sql));
+ rcode = stmt.executeUpdate(sql);
+ stmt.close();
+ //con.commit();
+ } catch (SQLException e) {
+ //e.printStackTrace();
+ throw new ReportSQLException(e.getMessage(), sql);
+ }
+ return rcode;
+ } // executeUpdate
+
+ /* public static int batchUpdate(Connection con, String sql) throws ReportSQLException, Exception {
+ int rcode = -1;
+ try {
+ Statement stmt = con.createStatement();
+ debugLogger.debug("[SQL CALL FROM RAPTOR] [SQL Update] " + sql, 4);
+ rcode = stmt.executeUpdate(sql);
+ stmt.close();
+ } catch (SQLException e) {
+ e.printStackTrace();
+ throw new ReportSQLException(e.getMessage(), sql);
+ }
+ return rcode;
+ } // batchUpdate
+*/
+
+ public static int executeUpdate(String sql) throws ReportSQLException {
+ Connection con = null;
+ try {
+ con = getConnection();
+ int rcode = executeUpdate(con, sql);
+ if(Globals.getDBType().equals("oracle"))
+ con.commit();
+
+ return rcode;
+ } catch (SQLException e) {
+ throw new ReportSQLException(e.getMessage(), sql);
+ } finally {
+ clearConnection(con);
+ }
+ } // executeUpdate
+
+ public static DataSet executeQuery(Connection con, String sql) throws ReportSQLException {
+ return executeQuery(con, sql, Integer.MAX_VALUE);
+ } // executeQuery
+
+ public static DataSet executeQuery(Connection con, String sql, int maxRowLimit)
+ throws ReportSQLException {
+ try {
+ if(con.isClosed()) con = getConnection();
+ //con.
+ Statement stmt = con.createStatement();
+
+ logger.debug(EELFLoggerDelegate.debugLogger, ("[SQL CALL FROM RAPTOR] [SQL] " + sql));
+ ResultSet rs = stmt.executeQuery(sql);
+ DataSet ds = new DataSet(rs, maxRowLimit);
+
+ if(rs!=null)
+ rs.close();
+ if(stmt!=null)
+ stmt.close();
+
+ return ds;
+ } catch (SQLException e) {
+ throw new ReportSQLException(e.getMessage(), sql);
+ }
+ } // executeQuery
+
+ public static DataSet executeQuery(String sql) throws ReportSQLException {
+ return executeQuery(sql, Integer.MAX_VALUE);
+ } // executeQuery
+
+ public static DataSet executeQuery(String sql, int maxRowLimit) throws ReportSQLException {
+ Connection con = null;
+ try {
+ con = getConnection();
+ return executeQuery(con, sql, maxRowLimit);
+ }catch (ReportSQLException ex) {
+ logger.error(EELFLoggerDelegate.debugLogger, ("Error " + sql));
+ throw new ReportSQLException(ex.getMessage(), ex);
+ }catch(Exception ex1) {
+ throw new ReportSQLException(ex1.getMessage(), ex1.getCause());
+ } finally {
+ clearConnection(con);
+ }
+ } // executeQuery
+
+ //For ZK Support
+
+ public static int executeQuery(ReportRuntime rr, int dateOption) {
+ Connection con = null;
+ int rowCount = 0;
+ try {
+ con = ConnectionUtils.getConnection(rr.getDBInfo());
+ String wholeSql = rr.getWholeSQL();
+
+ DataColumnType dc = rr.getColumnWhichNeedEnhancedPagination();
+ String date_ColId = dc.getColId();
+ String dataFormat = dc.getColFormat();
+ if(dataFormat!=null && dataFormat.length()>0)
+ date_ColId = "to_date("+date_ColId+", '"+ dataFormat +"')";
+ String sql = "";
+ if(dateOption == 1)
+ sql = "select count(distinct to_char("+date_ColId+", 'YYYY/MM')) from ("+wholeSql+")";
+ else if (dateOption == 3)
+ sql = "select count(distinct to_char("+date_ColId+", 'YYYY/MM/DD')) from ("+wholeSql+")";
+ else if (dateOption == 2)
+ sql = "select count(distinct to_char("+date_ColId+", 'YYYY')) from ("+wholeSql+")";
+ DataSet ds = executeQuery(con, sql.toString());
+ rowCount = ds.getInt(0,0);
+ } catch (ReportSQLException ex) {
+ ex.printStackTrace();
+ }catch(Exception ex1) {
+ ex1.printStackTrace();
+ } finally {
+ try {
+ clearConnection(con);
+ } catch (ReportSQLException ex2) {
+ ex2.printStackTrace();
+ }
+ }
+ return rowCount;
+ }
+
+// public static List executeQuery(ReportRuntime rr, String filterClause, int itemStartNumber, int itemEndNumber, boolean topDown, String _orderBy, boolean asc, RaptorRunHandler raptorRunHandler) {
+// Connection con = null;
+// List rowList = new ArrayList();
+// String totalSql = raptorRunHandler.getTotalSql();
+// ReportData rd = null;
+// boolean totalAvailable = false;
+// if(nvls(totalSql).length()>0) totalAvailable = true;
+// /*if(totalAvailable) {
+// if(itemStartNumber > 0) itemStartNumber--;
+// itemEndNumber--;
+// //if(itemEndNumber > 2) itemEndNumber = itemEndNumber - 2;
+// }*/
+// try {
+//
+//
+//
+// con = ConnectionUtils.getConnection(rr.getDBInfo());
+// //if client side sorting is needed we could disable the comment line below for quicker development
+// // until we do it in "client" end.
+// //StringBuffer sql = new StringBuffer(rr.getReportSQLWithRowNum());
+// StringBuffer sql = new StringBuffer("");
+// String dbType = raptorRunHandler.getDbType();
+// if(rr.getDateOption() == -1) {
+// if (!dbType.equals("DAYTONA")) {
+// sql = new StringBuffer(rr.getReportSQLWithRowNum(_orderBy, asc));
+// //if( /*itemEndNumber > 1 &&*/ itemEndNumber > itemStartNumber)
+// if(topDown) {
+// sql.append(")"+ (Globals.isPostgreSQL()?" AS ":"") +" y");
+//
+// if(Globals.getDBType().equals("postgresql"))
+// sql.append(" WHERE RNUM < " + (itemEndNumber));
+// else
+// sql.append(" WHERE ROWNUM < " + (itemEndNumber));
+// }
+// else {
+// //sql.append(" WHERE ROWNUM <= " + (itemEndNumber));
+// String a_sql = Globals.getReportSqlOnlySecondPartA();
+// a_sql = a_sql.replace("[endRow]", String.valueOf(itemEndNumber));
+// String b_sql = Globals.getReportSqlOnlySecondPartBNoOrderBy();
+// b_sql = b_sql.replace("[startRow]", String.valueOf(itemStartNumber));
+// sql.append(") "+ (Globals.isPostgreSQL()?" AS ":"") +" a ");
+// sql.append(a_sql);
+// sql.append(b_sql);
+//
+// }
+// // sql.append(" ) y WHERE rnum >= " + (topDown?itemStartNumber:(itemStartNumber+1)));
+// if(nvls(_orderBy).length()>0)
+// sql.append(" ORDER BY "+ _orderBy + " "+ (asc ? "ASC" : "DESC"));
+// else
+// sql.append(" ORDER BY rnum");
+// // sql = String.format(sql, _orderBy, asc ? "ASC" : "DESC");
+// } else {
+// sql = new StringBuffer(rr.getWholeSQL());
+// if( sql.toString().trim().toUpperCase().startsWith("SELECT")) {
+// sql.append(" LIMIT TO "+ (itemStartNumber+1)+"->"+itemEndNumber);
+// }
+// //return sql;
+// }
+// System.out.println("ZK RAPTOR RUN " + sql);
+// } else {
+// String wholeSql = rr.getWholeSQL();
+// DataColumnType dc = rr.getColumnWhichNeedEnhancedPagination();
+// String date_ColId = dc.getColId();
+// String dataFormat = dc.getColFormat();
+// if(dataFormat!=null && dataFormat.length()>0)
+// date_ColId = "to_date("+date_ColId+", '"+ dataFormat +"')";
+// StringBuffer dateSql = new StringBuffer(" select y.rownum1, y.datetime from (select rownum rownum1, datetime from ");
+// if(rr.getDateOption() == 1) {
+// dateSql.append( "(select distinct to_char("+date_ColId+", 'YYYY/MM') datetime from ( " + wholeSql + ") order by 1 desc");
+// } else if (rr.getDateOption() == 2) {
+// dateSql.append( "(select distinct to_char("+date_ColId+", 'YYYY') datetime from ( " + wholeSql + ") order by 1 desc");
+// } else if (rr.getDateOption() == 3) {
+// dateSql.append( "(select distinct to_char("+date_ColId+", 'YYYY/MM/DD') datetime from ( " + wholeSql + ") order by 1 desc");
+// }
+// dateSql.append(")) y where y.rownum1 = "+ (itemStartNumber+1));
+// DataSet ds = executeQuery(con, dateSql.toString());
+// String dateStr = "";
+// if(ds.getRowCount() > 0)
+// dateStr = ds.getString(0,1);
+//
+// sql = new StringBuffer(rr.getReportSQLWithRowNum(_orderBy, asc));
+// if(rr.getDateOption() == 1) {
+// sql.append(" WHERE to_char("+ date_ColId + ", 'YYYY/MM') = '"+ dateStr +"')");
+// } else if (rr.getDateOption() == 2) {
+// sql.append(" WHERE to_char("+ date_ColId + ", 'YYYY') = '"+ dateStr +"')");
+// } else if (rr.getDateOption() == 3) {
+// sql.append(" WHERE to_char("+ date_ColId + ", 'YYYY/MM/DD') = '"+ dateStr +"')");
+// }
+// if(nvls(_orderBy).length()>0)
+// sql.append(" ORDER BY "+ _orderBy + " "+ (asc ? "ASC" : "DESC"));
+// else
+// sql.append(" ORDER BY rnum");
+// System.out.println("ZK RAPTOR RUN MONTHLY " + sql);
+// }
+//
+// debugLogger.error(" ************** just a test **************** ");
+// debugLogger.error(" SQL " + sql);
+// debugLogger.error(" ******************************************* ");
+//
+// DataSet ds = ConnectionUtils.getDataSet(sql.toString(), rr.getDBInfo());
+// DataSet ds1 = null;
+// //DataSet ds = executeQuery(sql.toString());
+// List reportCols = rr.getAllColumns();
+// Vector formatProcessors = new Vector(reportCols.size());
+//
+// String oldValue = "";
+// String value = "";
+// String groupByColValue = "";
+// int subTotalFlag = -1;
+// //String newValue = "";
+// for (int r = 0; r < ds.getRowCount(); r++) {
+// DataRow dr = new DataRow();
+// //rd.reportDataRows.addDataRow(dr);
+// //rd = raptorRunHandler.getReportData();
+// //RowHeaderCol rhc = new RowHeaderCol();
+// //reportRowHeaderCols.addRowHeaderCol(0, rhc);
+// //rhc.setColumnWidth("5%");
+// int formatCount = -1; //added for auxillary head check
+// String drillDownURL = "";
+//
+// int changedFlag = 0;
+// for (int c = 0; c < reportCols.size(); c++) {
+// if(reportCols.get(c)!=null) {
+// DataColumnType dct = (DataColumnType) reportCols.get(c);
+// if(dct.getLevel()!=null && dct.getLevel() > 0) continue;
+// else formatCount++;
+// //
+// formatProcessors.add(formatCount,new FormatProcessor(
+// rr.getSemaphoreById(dct.getSemaphoreId()), dct.getColType(), dct
+// .getColFormat(), rr.getReportDefType().equals(
+// AppConstants.RD_SQL_BASED)));
+// //
+// if(!(dct.getColName().startsWith("[") && dct.getDisplayName() == null)) {
+// value = "";
+//
+// if(ds.getColumnIndex(dct.getColId())!= -1) {
+// value = ds.getString(r, dct.getColId());
+// if(dct.getGroupByPos()!=null && dct.getGroupByPos()>0) {
+// groupByColValue = ds.getString(r, dct.getColId());
+// if(oldValue.length()> 0 && !oldValue.equals(groupByColValue)) {
+// //newValue = value;
+// if(subTotalFlag > 0) {
+// changedFlag = -1;
+// oldValue = groupByColValue;
+// subTotalFlag = 0;
+// } else {
+// changedFlag = 1;
+// //oldValue = groupByColValue;
+// r--;
+// }
+// } else if (oldValue.length()<=0) {
+// oldValue = groupByColValue;
+// changedFlag = -1;
+// } else if (oldValue.equals(groupByColValue)) {
+// //oldValue = value;
+// changedFlag = 0;
+// }
+// }
+// }
+//
+// if(changedFlag > 0) {
+// StringBuffer subTotalSql = new StringBuffer(" select ");
+// StringBuffer whereClause = new StringBuffer("");
+// //get all colids
+// for (int d = 0; d < reportCols.size(); d++) {
+// if(reportCols.get(d)!=null) {
+// DataColumnType dct1 = (DataColumnType) reportCols.get(d);
+// if(dct1.getGroupByPos()!=null && dct1.getGroupByPos()>0){
+// subTotalSql.append(dct1.getColId() + " " );
+// whereClause.append(" where "+ dct1.getColId() + " = '" + oldValue + "' " + " group by "+ dct1.getColId() );
+// }
+// if(dct1.getDisplayTotal()!=null && dct1.getDisplayTotal().length() > 0) {
+// subTotalSql.append(", sum("+dct1.getColId()+")");
+// }
+// }
+// }
+//
+// subTotalSql.append(" from (");
+// subTotalSql.append(rr.getWholeSQL());
+// subTotalSql.append (")");
+// subTotalSql.append(whereClause);
+// ds1 = ConnectionUtils.getDataSet(subTotalSql.toString(),rr.getDbInfo());
+// dr = new DataRow();
+// DataValue dv = new DataValue();
+// int count = 0;
+// //dv.setColName("#");
+// for (int c1 = 0; c1 < reportCols.size(); c1++) {
+// dct = (DataColumnType) reportCols.get(c1);
+// if(dct.getLevel()!=null && dct.getLevel() > 0) continue;
+// if ( dct != null && dct.isVisible()) {
+// count++;
+//
+// dv = new DataValue();
+// //if(count==1) {
+// if(dct.getGroupByPos()!=null && dct.getGroupByPos()>0) {
+// dr.addDataValue(dv);
+// if(AppUtils.nvl(dct.getSubTotalCustomText()).length()>0) {
+// dv.setDisplayValue(dct.getSubTotalCustomText());
+// } else {
+// dv.setDisplayValue("Sub Total");
+// }
+// dv.setColName(dct.getColName());
+// dv.setDisplayName(dct.getDisplayName());
+// dv.setColId(dct.getColId());
+// dv.setBold(true);
+// } else {
+// if(dct.getDisplayTotal()!=null && dct.getDisplayTotal().length() > 0) {
+// dr.addDataValue(dv);
+// String subtotalValue = "";
+// if (ds1 != null) {
+// subtotalValue = ds1.getString(0, "sum("+dct.getColId()+")");
+// dv.setDisplayValue(Utils.truncateTotalDecimals(subtotalValue));
+// } else {
+// dv.setDisplayValue("");
+// }
+// } else {
+// if(dv.isVisible())
+// dr.addDataValue(dv);
+// dv.setDisplayValue("");
+// }
+// dv.setAlignment(dct.getDisplayAlignment());
+// dv.setColName(dct.getColName());
+// dv.setDisplayName(dct.getDisplayName());
+// dv.setColId(dct.getColId());
+// dv.setNowrap(nvl(dct.getNowrap(),"null").equals("false")?"null":nvl(dct.getNowrap(),"null"));
+// dv.setIndentation(new Integer((dct.getIndentation()==null)?new Integer("0"):dct.getIndentation()).toString());
+// dv.setDisplayTotal(dct.getDisplayTotal());
+// dv.setBold(true);
+// }
+// } // dct check
+// } // for
+// //if(!topDown) {
+// //rowList.add(dr);
+// //}
+// //oldValue = value;
+// if(changedFlag == 1) changedFlag = 0;
+// subTotalFlag = 1;
+// } else {
+//
+// if(nvls(value).length()>0 && !nvls(value).equals("'")) {
+// DataValue dv = new DataValue();
+// dr.addDataValue(dv);
+// if(dct.getGroupByPos()!=null && dct.getGroupByPos()>0) {
+// if(changedFlag == 0) {
+// dv.setDisplayValue("");
+// } else {
+// dv.setDisplayValue(nvls(value));
+// }
+// } else {
+// dv.setDisplayValue(nvls(value));
+// }
+// dv.setColName(dct.getColName());
+// dv.setColId(dct.getColId());
+// if(dct.getColType().equals(AppConstants.CT_HYPERLINK)) {
+// dv.setHyperlinkURL(dct.getHyperlinkURL());
+// dv.setDisplayType(dct.getHyperlinkType());
+// if(dct.getHyperlinkType().equals("IMAGE"))
+// dv.setActionImg(dct.getActionImg());
+// }
+// dv.setIndentation(new Integer((dct.getIndentation()==null)?new Integer("0"):dct.getIndentation()).toString());
+// //dv.setNowrap(nvl(dct.getNowrap(),"null").equals("false")?"null":nvl(dct.getNowrap(),"null"));
+// if(dct.isVisible()) {
+//
+// dv.setVisible(true);
+// dv.setAlignment(dct.getDisplayAlignment());
+// dv.setDisplayTotal(dct.getDisplayTotal());
+// dv.setDisplayName(dct.getDisplayName());
+// dv.setNowrap(nvl(dct.getNowrap(),"null").equals("false")?"null":nvl(dct.getNowrap(),"null"));
+// //Add Drilldown URL to dv
+// if (nvls(dct.getDrillDownURL()).length() > 0) {
+//
+// if(dv.getDisplayValue().length() > 0) {
+// dv.setDrillDownURL(raptorRunHandler.parseDrillDownURL(r, /* c, */ds, dct,null));
+// dv.setDrillDowninPoPUp(dct.isDrillinPoPUp()!=null?dct.isDrillinPoPUp():false);
+// }
+//
+// if (dv.getDisplayValue().length() == 0) {
+// //dv.setDisplayValue("[NULL]");
+// dv.setDisplayValue("");
+// }
+// } // if
+//
+// } else {
+// dv.setVisible(false);
+// dv.setHidden(true);
+// }
+// //System.out.println("in Linear report b4" + dr.getFormatId() + dr.getBgColorHtml() + dv.getDisplayValue());
+//
+// /* if(dr.getFormatId()!=null)
+// ((FormatProcessor) formatProcessors.get(formatCount)).setHtmlFormatters(dv, dr, true);
+// else
+// ((FormatProcessor) formatProcessors.get(formatCount)).setHtmlFormatters(dv, dr, false);
+// */
+//
+// //System.out.println("in Linear report After" + dr.getFormatId() + dr.getBgColorHtml() + dv.getDisplayValue());
+//
+// if(topDown) {
+// if(!dv.getColId().endsWith("_calc") && dv.isVisible())
+// rowList.add(dv);
+// for (int cInner = 0; cInner < reportCols.size(); cInner++) {
+// if(reportCols.get(cInner)!=null) {
+// DataColumnType dctInner = (DataColumnType) reportCols.get(cInner);
+// if((dv.getColId()+"_calc").equals(dctInner.getColId())) {
+// /* DataValue dvInner = new DataValue();
+// dvInner.setDisplayValue(ds.getString(r, c));
+// dvInner.setColName(dct.getColName());
+// dvInner.setColId(dct.getColId());
+// rowList.add(dvInner);
+// */ dv.setDisplayCalculatedValue(ds.getString(r, dctInner.getColId()));
+// }
+// }
+// }
+// }
+// } else { //dv value check
+// DataValue dv = new DataValue();
+// dr.addDataValue(dv);
+// dv.setDisplayValue(nvls(value));
+// dv.setColName(dct.getColName());
+// dv.setColId(dct.getColId());
+// if(dct.isVisible())
+// dv.setVisible(true);
+// else
+// dv.setVisible(false);
+// /* if(dr.getFormatId()!=null)
+// ((FormatProcessor) formatProcessors.get(formatCount)).setHtmlFormatters(dv, dr, true);
+// else
+// ((FormatProcessor) formatProcessors.get(formatCount)).setHtmlFormatters(dv, dr, false);
+// */
+//
+// if(topDown) {
+// if(!dv.getColId().endsWith("_calc") && dv.isVisible())
+// rowList.add(dv);
+// for (int cInner = 0; cInner < reportCols.size(); cInner++) {
+// if(reportCols.get(cInner)!=null) {
+// DataColumnType dctInner = (DataColumnType) reportCols.get(cInner);
+// if((dv.getColId()+"_calc").equals(dctInner.getColId())) {
+// dv.setDisplayCalculatedValue(ds.getString(r, cInner));
+// }
+// }
+// }
+// }
+// }
+// } //changedFlag > 1
+// }
+// } // if reportCols
+//
+//
+// } // for
+//
+// //format
+//
+// for (int c = 0; c < reportCols.size(); c++) {
+// if(reportCols.get(c)!=null) {
+// DataColumnType dct = (DataColumnType) reportCols.get(c);
+// //Modified since ds is null.
+// DataValue dv = new DataValue();
+// dv = dr.getDataValue(c);
+// if(dr.getFormatId()!=null)
+// ((FormatProcessor) formatProcessors.get(c)).setHtmlFormatters(dv, dr, true);
+// else
+// ((FormatProcessor) formatProcessors.get(c)).setHtmlFormatters(dv, dr, false);
+// }
+// }
+// //add dr to rowList after all column is done.
+// if(!topDown) {
+// rowList.add(dr);
+// }
+// } // for
+//
+///* //rd.addRowNumbers(pageNo, getPageSize());
+// rd = raptorRunHandler.getReportData();
+// RowHeaderCol rhc = new RowHeaderCol();
+// rd.reportRowHeaderCols.addRowHeaderCol(0, rhc);
+// rhc.setColumnWidth("5%");
+// rhc.add(new RowHeader(""#, "15"));
+//*/
+//
+// //String totalSql = raptorRunHandler.getTotalSql();
+//
+// if(subTotalFlag >=0) {
+// StringBuffer subTotalSql = new StringBuffer(" select ");
+// StringBuffer whereClause = new StringBuffer("");
+// //get all colids
+// for (int d = 0; d < reportCols.size(); d++) {
+// if(reportCols.get(d)!=null) {
+// DataColumnType dct1 = (DataColumnType) reportCols.get(d);
+// if(dct1.getGroupByPos()!=null && dct1.getGroupByPos()>0){
+// subTotalSql.append(dct1.getColId() + " " );
+// whereClause.append(" where "+ dct1.getColId() + " = '" + oldValue + "' " + " group by "+ dct1.getColId() );
+// }
+// if(dct1.getDisplayTotal()!=null && dct1.getDisplayTotal().length() > 0) {
+// subTotalSql.append(", sum("+dct1.getColId()+")");
+// }
+// }
+// }
+//
+// subTotalSql.append(" from (");
+// subTotalSql.append(rr.getWholeSQL());
+// subTotalSql.append (")");
+// subTotalSql.append(whereClause);
+// ds1 = ConnectionUtils.getDataSet(subTotalSql.toString(),rr.getDbInfo());
+// DataRow dr = new DataRow();
+// DataValue dv = new DataValue();
+// int count = 0;
+// //dv.setColName("#");
+// DataColumnType dct = null;
+// for (int c1 = 0; c1 < reportCols.size(); c1++) {
+// dct = (DataColumnType) reportCols.get(c1);
+// if(dct.getLevel()!=null && dct.getLevel() > 0) continue;
+// if ( dct != null && dct.isVisible()) {
+// count++;
+//
+// dv = new DataValue();
+// //if(count==1) {
+// if(dct.getGroupByPos()!=null && dct.getGroupByPos()>0) {
+// dr.addDataValue(dv);
+// if(AppUtils.nvl(dct.getSubTotalCustomText()).length()>0) {
+// dv.setDisplayValue(dct.getSubTotalCustomText());
+// } else {
+// dv.setDisplayValue("Sub Total");
+// }
+// dv.setColName(dct.getColName());
+// dv.setDisplayName(dct.getDisplayName());
+// dv.setColId(dct.getColId());
+// dv.setBold(true);
+// } else {
+// if(dct.getDisplayTotal()!=null && dct.getDisplayTotal().length() > 0) {
+// dr.addDataValue(dv);
+// String subtotalValue = "";
+// if (ds1 != null) {
+// subtotalValue = ds1.getString(0, "sum("+dct.getColId()+")");
+// dv.setDisplayValue(Utils.truncateTotalDecimals(subtotalValue));
+// } else {
+// dv.setDisplayValue("");
+// }
+// } else {
+// if(dv.isVisible())
+// dr.addDataValue(dv);
+// dv.setDisplayValue("");
+// }
+// dv.setAlignment(dct.getDisplayAlignment());
+// dv.setColName(dct.getColName());
+// dv.setDisplayName(dct.getDisplayName());
+// dv.setColId(dct.getColId());
+// dv.setNowrap(nvl(dct.getNowrap(),"null").equals("false")?"null":nvl(dct.getNowrap(),"null"));
+// dv.setIndentation(new Integer((dct.getIndentation()==null)?new Integer("0"):dct.getIndentation()).toString());
+// dv.setDisplayTotal(dct.getDisplayTotal());
+// dv.setBold(true);
+// }
+// } // dct check
+// } // for
+// if(!topDown) {
+// rowList.add(dr);
+// }
+// }
+// if(nvls(totalSql).length()>0) {
+// ds = ConnectionUtils.getDataSet(totalSql,rr.getDbInfo());
+// DataRow dr = new DataRow();
+// DataValue dv = new DataValue();
+// int count = 0;
+// //dv.setColName("#");
+// for (int c = 0; c < reportCols.size(); c++) {
+// DataColumnType dct = (DataColumnType) reportCols.get(c);
+// if(dct.getLevel()!=null && dct.getLevel() > 0) continue;
+// if ( dct != null && dct.isVisible()) {
+// count++;
+//
+// dv = new DataValue();
+// if(count==1) {
+// dr.addDataValue(dv);
+// dv.setDisplayValue("Total (for all Records)");
+// dv.setColName(dct.getColName());
+// dv.setDisplayName(dct.getDisplayName());
+// dv.setColId(dct.getColId());
+// dv.setBold(true);
+// } else {
+// if(dv.isVisible())
+// dr.addDataValue(dv);
+//
+// String totalValue = "";
+// if (ds != null)
+// totalValue = ds.getString(0, "TOTAL_"+dct.getColId());
+// if (nvls(dct.getDisplayTotal()).length() > 0
+// && (!dct.getDisplayTotal().equals(AppConstants.TOTAL_SUM_ID)))
+// totalValue = nvls(AppConstants.TOTAL_FUNCTIONS.getNameById(dct
+// .getDisplayTotal()))
+// + ": " + totalValue;
+// dv.setDisplayValue(Utils.truncateTotalDecimals(totalValue));
+//
+// dv.setAlignment(dct.getDisplayAlignment());
+// dv.setColName(dct.getColName());
+// dv.setDisplayName(dct.getDisplayName());
+// dv.setColId(dct.getColId());
+// dv.setNowrap(nvl(dct.getNowrap(),"null").equals("false")?"null":nvl(dct.getNowrap(),"null"));
+// /*StringBuffer indentation = new StringBuffer("");
+// if(dct.getIndentation()!=null && dct.getIndentation()>0) {
+// for (int indent=0; indent< dct.getIndentation(); indent++) {
+// indentation.append("\t");
+// }
+// dv.setNowrap("true");
+// }
+// dv.setIndentation(indentation.toString());*/
+// dv.setIndentation(new Integer((dct.getIndentation()==null)?new Integer("0"):dct.getIndentation()).toString());
+// dv.setDisplayTotal(dct.getDisplayTotal());
+// dv.setBold(true);
+// }
+// } // dct check
+// } // for
+// if(!topDown) {
+// rowList.add(dr);
+// }
+//
+// }
+//
+//
+//
+// } catch (ReportSQLException ex) {
+// ex.printStackTrace();
+// }catch(Exception ex1) {
+// ex1.printStackTrace();
+// } finally {
+// try {
+// clearConnection(con);
+// } catch (ReportSQLException ex2) {
+// ex2.printStackTrace();
+// }
+// }
+// return rowList;
+// }
+
+
+ //For ZK Support
+
+// public static List executeQuery(ReportRuntime rr, String filterClause, int itemStartNumber, int itemEndNumber, boolean topDown, String _orderBy, boolean asc, DashboardReportRunHandler dashboardReportRunHandler) {
+// Connection con = null;
+// List rowList = new ArrayList();
+// String totalSql = rr.getTotalSql();
+// boolean totalAvailable = false;
+// if(nvls(totalSql).length()>0) totalAvailable = true;
+// if(totalAvailable) {
+// itemStartNumber--;
+// itemEndNumber--;
+// }
+// try {
+// con = ConnectionUtils.getConnection(rr.getDBInfo());
+// //if client side sorting is needed we could disable the comment line below for quicker development
+// // until we do it in "client" end.
+// //StringBuffer sql = new StringBuffer(rr.getReportSQLWithRowNum());
+// StringBuffer sql = new StringBuffer("");
+// if (!rr.getReportType().equals(AppConstants.RT_HIVE)) {
+// sql = new StringBuffer(rr.getReportSQLWithRowNum(_orderBy, asc));
+// //if( /*itemEndNumber > 1 &&*/ itemEndNumber > itemStartNumber)
+//
+// if(topDown) {
+// sql.append(") "+ (Globals.isPostgreSQL()?" AS ":"") +" y");
+// if(Globals.getDBType().equals("postgresql"))
+// sql.append(" WHERE RNUM < " + (itemEndNumber));
+// else
+// sql.append(" WHERE ROWNUM < " + (itemEndNumber));
+// }
+// else {
+// //sql.append(" WHERE ROWNUM <= " + (itemEndNumber));
+// String a_sql = Globals.getReportSqlOnlySecondPartA();
+// a_sql = a_sql.replace("[endRow]", String.valueOf(itemEndNumber));
+// String b_sql = Globals.getReportSqlOnlySecondPartBNoOrderBy();
+// b_sql = b_sql.replace("[startRow]", String.valueOf(itemStartNumber));
+// sql.append(") "+ (Globals.isPostgreSQL()?" AS ":"") +" a ");
+// sql.append(a_sql);
+// sql.append(b_sql);
+// }
+//
+// // sql.append(" ) y WHERE rnum >= " + (topDown?itemStartNumber:(itemStartNumber+1)));
+// if(nvls(_orderBy).length()>0)
+// sql.append(" ORDER BY "+ _orderBy + " "+ (asc ? "ASC" : "DESC"));
+// else
+// sql.append(" ORDER BY rnum");
+// // sql = String.format(sql, _orderBy, asc ? "ASC" : "DESC");
+//
+// /*//sql.append(" WHERE ROWNUM <= " + (topDown?itemEndNumber:(itemEndNumber)));
+// sql.append(" ) y WHERE rnum >= " + (topDown?itemStartNumber:(itemStartNumber+1)));
+// if(nvls(_orderBy).length()>0)
+// sql.append(" ORDER BY "+ _orderBy + " "+ (asc ? "ASC" : "DESC"));
+// else
+// sql.append(" ORDER BY rnum");
+// // sql = String.format(sql, _orderBy, asc ? "ASC" : "DESC");*/
+// itemStartNumber = 0;
+// } else {
+// sql.append(rr.getWholeSQL());
+// int count = rr.getReportDataSize();
+// System.out.println("Count "+ count+ " " + itemEndNumber);
+// if(count < itemEndNumber)
+// sql.append(" " + "limit "+ count);
+// else
+// sql.append(" " + "limit "+ itemEndNumber);
+// }
+// System.out.println("ZK RAPTOR RUN " + sql);
+// DataSet ds = null;
+// if (!rr.getReportType().equals(AppConstants.RT_HIVE)) {
+// ds = executeQuery(con, sql.toString());
+// } else {
+// String dbInfo = rr.getDBInfo();
+// ds = ConnectionUtils.getDataSet(sql.toString(), dbInfo);
+// }
+// List reportCols = rr.getAllColumns();
+// Vector formatProcessors = new Vector(reportCols.size());
+//
+// for (int r = itemStartNumber; r < ds.getRowCount(); r++) {
+// DataRow dr = new DataRow();
+// //rd.reportDataRows.addDataRow(dr);
+//
+// int formatCount = -1; //added for auxillary head check
+// for (int c = 0; c < reportCols.size(); c++) {
+// if(reportCols.get(c)!=null) {
+// DataColumnType dct = (DataColumnType) reportCols.get(c);
+// if(dct.getLevel()!=null && dct.getLevel() > 0) continue;
+// else formatCount++;
+// //
+// formatProcessors.add(formatCount,new FormatProcessor(
+// rr.getSemaphoreById(dct.getSemaphoreId()), dct.getColType(), dct
+// .getColFormat(), rr.getReportDefType().equals(
+// AppConstants.RD_SQL_BASED)));
+// //
+// if(!(dct.getColName().startsWith("[") && dct.getDisplayName() == null)) {
+// String value = "";
+// if(ds.getColumnIndex(dct.getColId())!= -1) {
+// value = ds.getString(r, dct.getColId());
+// }
+// if(nvls(value).length()>0 && !nvls(value).equals("'")) {
+// DataValue dv = new DataValue();
+// dr.addDataValue(dv);
+// dv.setDisplayValue(nvls(value));
+// dv.setColName(dct.getColName());
+// dv.setColId(dct.getColId());
+// if(dct.getColType().equals(AppConstants.CT_HYPERLINK)) {
+// dv.setHyperlinkURL(dct.getHyperlinkURL());
+// dv.setDisplayType(dct.getHyperlinkType());
+// if(dct.getHyperlinkType().equals("IMAGE"))
+// dv.setActionImg(dct.getActionImg());
+// }
+// dv.setIndentation(new Integer((dct.getIndentation()==null)?new Integer("0"):dct.getIndentation()).toString());
+// //dv.setNowrap(nvl(dct.getNowrap(),"null").equals("false")?"null":nvl(dct.getNowrap(),"null"));
+// if(dct.isVisible()) {
+//
+// dv.setVisible(true);
+// dv.setAlignment(dct.getDisplayAlignment());
+// dv.setDisplayTotal(dct.getDisplayTotal());
+// dv.setDisplayName(dct.getDisplayName());
+//
+// //Add Drilldown URL to dv
+// if (nvls(dct.getDrillDownURL()).length() > 0) {
+//
+// if(dv.getDisplayValue().length() > 0) {
+// dv.setDrillDownURL(dashboardReportRunHandler.parseDrillDownURL(r, /* c, */ds, dct,null,rr));
+// dv.setDrillDowninPoPUp(dct.isDrillinPoPUp()!=null?dct.isDrillinPoPUp():false);
+// }
+//
+// if (dv.getDisplayValue().length() == 0) {
+// //dv.setDisplayValue("[NULL]");
+// dv.setDisplayValue("");
+// }
+// } // if
+//
+// } else {
+// dv.setVisible(false);
+// dv.setHidden(true);
+// }
+// //System.out.println("in Linear report b4" + dr.getFormatId() + dr.getBgColorHtml() + dv.getDisplayValue());
+//
+// /* if(dr.getFormatId()!=null)
+// ((FormatProcessor) formatProcessors.get(formatCount)).setHtmlFormatters(dv, dr, true);
+// else
+// ((FormatProcessor) formatProcessors.get(formatCount)).setHtmlFormatters(dv, dr, false);*/
+//
+// //System.out.println("in Linear report After" + dr.getFormatId() + dr.getBgColorHtml() + dv.getDisplayValue());
+//
+// if(topDown) {
+// if(!dv.getColId().endsWith("_calc") && dv.isVisible())
+// rowList.add(dv);
+// for (int cInner = 0; cInner < reportCols.size(); cInner++) {
+// if(reportCols.get(cInner)!=null) {
+// DataColumnType dctInner = (DataColumnType) reportCols.get(cInner);
+// if((dv.getColId()+"_calc").equals(dctInner.getColId())) {
+// /* DataValue dvInner = new DataValue();
+// dvInner.setDisplayValue(ds.getString(r, c));
+// dvInner.setColName(dct.getColName());
+// dvInner.setColId(dct.getColId());
+// rowList.add(dvInner);
+// */ dv.setDisplayCalculatedValue(ds.getString(r, dctInner.getColId()));
+// }
+// }
+// }
+// }
+// } else { //dv value check
+// DataValue dv = new DataValue();
+// dr.addDataValue(dv);
+// dv.setDisplayValue(nvls(value));
+// dv.setColName(dct.getColName());
+// dv.setColId(dct.getColId());
+// if(dct.isVisible())
+// dv.setVisible(true);
+// else
+// dv.setVisible(false);
+// /*if(dr.getFormatId()!=null)
+// ((FormatProcessor) formatProcessors.get(formatCount)).setHtmlFormatters(dv, dr, true);
+// else
+// ((FormatProcessor) formatProcessors.get(formatCount)).setHtmlFormatters(dv, dr, false);*/
+//
+// if(topDown) {
+// if(!dv.getColId().endsWith("_calc") && dv.isVisible())
+// rowList.add(dv);
+// for (int cInner = 0; cInner < reportCols.size(); cInner++) {
+// if(reportCols.get(cInner)!=null) {
+// DataColumnType dctInner = (DataColumnType) reportCols.get(cInner);
+// if((dv.getColId()+"_calc").equals(dctInner.getColId())) {
+// dv.setDisplayCalculatedValue(ds.getString(r, dctInner.getColId()));
+// }
+// }
+// }
+// }
+// }
+// }
+// } // if reportCols
+//
+//
+// } // for
+// for (int c = 0; c < reportCols.size(); c++) {
+// if(reportCols.get(c)!=null) {
+// DataColumnType dct = (DataColumnType) reportCols.get(c);
+// //Modified since ds is null.
+// DataValue dv = new DataValue();
+// dv = dr.getDataValue(c);
+// if(dr.getFormatId()!=null)
+// ((FormatProcessor) formatProcessors.get(c)).setHtmlFormatters(dv, dr, true);
+// else
+// ((FormatProcessor) formatProcessors.get(c)).setHtmlFormatters(dv, dr, false);
+// }
+// }
+// //add dr to rowList after all column is done.
+// if(!topDown) {
+// rowList.add(dr);
+// }
+// } // for
+//
+// //String totalSql = raptorRunHandler.getTotalSql();
+// if(nvls(totalSql).length()>0) {
+// ds = ConnectionUtils.getDataSet(totalSql,rr.getDbInfo());
+// DataRow dr = new DataRow();
+// DataValue dv = new DataValue();
+//
+// //dv.setColName("#");
+// int count = 0;
+// for (int c = 0; c < reportCols.size(); c++) {
+// DataColumnType dct = (DataColumnType) reportCols.get(c);
+// if(dct.getLevel()!=null && dct.getLevel() > 0) continue;
+// if ( dct != null && dct.isVisible()) {
+// count++;
+//
+// dv = new DataValue();
+// dv.setVisible(dct.isVisible());
+//
+// if(count==1) {
+// dr.addDataValue(dv);
+// dv.setDisplayValue("Total (for all Records)");
+// dv.setColName(dct.getColName());
+// dv.setDisplayName(dct.getDisplayName());
+// dv.setColId(dct.getColId());
+// dv.setBold(true);
+// } else {
+// if(dv.isVisible())
+// dr.addDataValue(dv);
+//
+// String totalValue = "";
+// if (ds != null)
+// totalValue = ds.getString(0, "TOTAL_"+dct.getColId());
+// if (nvls(dct.getDisplayTotal()).length() > 0
+// && (!dct.getDisplayTotal().equals(AppConstants.TOTAL_SUM_ID)))
+// totalValue = nvls(AppConstants.TOTAL_FUNCTIONS.getNameById(dct
+// .getDisplayTotal()))
+// + ": " + totalValue;
+// dv.setDisplayValue(Utils.truncateTotalDecimals(totalValue));
+//
+// dv.setAlignment(dct.getDisplayAlignment());
+// dv.setColName(dct.getColName());
+// dv.setDisplayName(dct.getDisplayName());
+// dv.setColId(dct.getColId());
+// dv.setNowrap(nvl(dct.getNowrap(),"null").equals("false")?"null":nvl(dct.getNowrap(),"null"));
+// /*StringBuffer indentation = new StringBuffer("");
+// if(dct.getIndentation()!=null && dct.getIndentation()>0) {
+// for (int indent=0; indent< dct.getIndentation(); indent++) {
+// indentation.append("\t");
+// }
+// dv.setNowrap("true");
+// }
+// dv.setIndentation(indentation.toString());*/
+// dv.setIndentation(new Integer((dct.getIndentation()==null)?new Integer("0"):dct.getIndentation()).toString());
+// dv.setDisplayTotal(dct.getDisplayTotal());
+// dv.setBold(true) ;
+// }
+// } // dct check
+// } // for
+// if(!topDown) {
+// rowList.add(dr);
+// }
+//
+// }
+//
+//
+// } catch (ReportSQLException ex) {
+// ex.printStackTrace();
+// }catch(Exception ex1) {
+// ex1.printStackTrace();
+// } finally {
+// try {
+// clearConnection(con);
+// } catch (ReportSQLException ex2) {
+// ex2.printStackTrace();
+// }
+// }
+// return rowList;
+// }
+
+ public String nvl(String s) {
+ return (s == null) ? "" : s;
+ }
+
+ public static String nvls(String s) {
+ return (s == null) ? "" : s;
+ }
+
+ public static String nvl(String s, String sDefault) {
+ return nvls(s).equals("") ? sDefault : s;
+ }
+
+
+
+ public static DataSource getDataSource() {
+ return dataSource;
+ }
+
+ @Autowired
+ public void setDataSource(DataSource dataSource) {
+ dataSource = dataSource;
+ }
+
+
+// public static List executeQuery(ReportRuntime rr, String filterClause, int itemStartNumber, int itemEndNumber, boolean topDown, String _orderBy, boolean asc, RaptorHiveRunHandler raptorHiveRunHandler) {
+// Connection con = null;
+// List rowList = new ArrayList();
+// ReportData rd = null;
+//
+// try {
+//
+//
+//
+// con = ConnectionUtils.getConnection(rr.getDBInfo());
+// //if client side sorting is needed we could disable the comment line below for quicker development
+// // until we do it in "client" end.
+// //StringBuffer sql = new StringBuffer(rr.getReportSQLWithRowNum());
+// StringBuffer sql = new StringBuffer("");
+// sql.append(rr.getWholeSQL());
+// int count = rr.getReportDataSize();
+// System.out.println("Count "+ count+ " " + itemEndNumber);
+// if(count < itemEndNumber)
+// sql.append(" " + "limit "+ count);
+// else
+// sql.append(" " + "limit "+ itemEndNumber);
+// //sql = new StringBuffer(raptorHiveRunHandler.getReportSQLWithRowNum(_orderBy, asc));
+// //if( /*itemEndNumber > 1 &&*/ itemEndNumber > itemStartNumber)
+// //sql.append(" WHERE ROWNUM <= " + (topDown?itemEndNumber:(itemEndNumber+1)));
+// //sql.append(" ) y WHERE rnum >= " + (topDown?itemStartNumber:(itemStartNumber+1)));
+// //if(nvls(_orderBy).length()>0)
+// //sql.append(" ORDER BY "+ _orderBy + " "+ (asc ? "ASC" : "DESC"));
+// //else
+// //sql.append(" ORDER BY rnum");
+// // sql = String.format(sql, _orderBy, asc ? "ASC" : "DESC");
+//
+// System.out.println("ZK RAPTOR RUN " + sql);
+//
+// String dbInfo = rr.getDBInfo();
+// DataSet ds = null;
+// ds = ConnectionUtils.getDataSet(sql.toString(), dbInfo);
+// List reportCols = rr.getAllColumns();
+// Vector formatProcessors = new Vector(reportCols.size());
+//
+// for (int r = itemStartNumber; r < ds.getRowCount(); r++) {
+// DataRow dr = new DataRow();
+// //rd.reportDataRows.addDataRow(dr);
+// //rd = raptorRunHandler.getReportData();
+// //RowHeaderCol rhc = new RowHeaderCol();
+// //reportRowHeaderCols.addRowHeaderCol(0, rhc);
+// //rhc.setColumnWidth("5%");
+//
+// int formatCount = -1; //added for auxillary head check
+// for (int c = 0; c < reportCols.size(); c++) {
+// if(reportCols.get(c)!=null) {
+// DataColumnType dct = (DataColumnType) reportCols.get(c);
+// if(dct.getLevel()!=null && dct.getLevel() > 0) continue;
+// else formatCount++;
+// //
+// formatProcessors.add(formatCount,new FormatProcessor(
+// rr.getSemaphoreById(dct.getSemaphoreId()), dct.getColType(), dct
+// .getColFormat(), rr.getReportDefType().equals(
+// AppConstants.RD_SQL_BASED)));
+// //
+// if(!(dct.getColName().startsWith("[") && dct.getDisplayName() == null)) {
+// String value = "";
+// if(ds.getColumnIndex(dct.getColId())!= -1) {
+// value = ds.getString(r, dct.getColId());
+// }
+// if(nvls(value).length()>0 && !nvls(value).equals("'")) {
+// DataValue dv = new DataValue();
+// dr.addDataValue(dv);
+// dv.setDisplayValue(nvls(value));
+// dv.setColName(dct.getColName());
+// dv.setColId(dct.getColId());
+// if(dct.getColType().equals(AppConstants.CT_HYPERLINK)) {
+// dv.setHyperlinkURL(dct.getHyperlinkURL());
+// dv.setDisplayType(dct.getHyperlinkType());
+// if(dct.getHyperlinkType().equals("IMAGE"))
+// dv.setActionImg(dct.getActionImg());
+// }
+// dv.setIndentation(new Integer((dct.getIndentation()==null)?new Integer("0"):dct.getIndentation()).toString());
+// //dv.setNowrap(nvl(dct.getNowrap(),"null").equals("false")?"null":nvl(dct.getNowrap(),"null"));
+// if(dct.isVisible()) {
+//
+// dv.setVisible(true);
+// dv.setAlignment(dct.getDisplayAlignment());
+// dv.setDisplayTotal(dct.getDisplayTotal());
+// dv.setDisplayName(dct.getDisplayName());
+//
+// //Add Drilldown URL to dv
+// if (nvls(dct.getDrillDownURL()).length() > 0) {
+//
+// if(dv.getDisplayValue().length() > 0) {
+// dv.setDrillDownURL(raptorHiveRunHandler.parseDrillDownURL(r, /* c, */ds, dct,null));
+// dv.setDrillDowninPoPUp(dct.isDrillinPoPUp()!=null?dct.isDrillinPoPUp():false);
+// }
+//
+// if (dv.getDisplayValue().length() == 0) {
+// //dv.setDisplayValue("[NULL]");
+// dv.setDisplayValue("");
+// }
+// } // if
+//
+// } else {
+// dv.setVisible(false);
+// dv.setHidden(true);
+// }
+// //System.out.println("in Linear report b4" + dr.getFormatId() + dr.getBgColorHtml() + dv.getDisplayValue());
+//
+// if(dr.getFormatId()!=null)
+// ((FormatProcessor) formatProcessors.get(formatCount)).setHtmlFormatters(dv, dr, true);
+// else
+// ((FormatProcessor) formatProcessors.get(formatCount)).setHtmlFormatters(dv, dr, false);
+//
+// //System.out.println("in Linear report After" + dr.getFormatId() + dr.getBgColorHtml() + dv.getDisplayValue());
+//
+// if(topDown) {
+// if(!dv.getColId().endsWith("_calc") && dv.isVisible())
+// rowList.add(dv);
+// for (int cInner = 0; cInner < reportCols.size(); cInner++) {
+// if(reportCols.get(cInner)!=null) {
+// DataColumnType dctInner = (DataColumnType) reportCols.get(cInner);
+// if((dv.getColId()+"_calc").equals(dctInner.getColId())) {
+// /* DataValue dvInner = new DataValue();
+// dvInner.setDisplayValue(ds.getString(r, c));
+// dvInner.setColName(dct.getColName());
+// dvInner.setColId(dct.getColId());
+// rowList.add(dvInner);
+// */ dv.setDisplayCalculatedValue(ds.getString(r, dctInner.getColId()));
+// }
+// }
+// }
+// }
+// } else { //dv value check
+// DataValue dv = new DataValue();
+// dr.addDataValue(dv);
+// dv.setDisplayValue(nvls(value));
+// dv.setColName(dct.getColName());
+// dv.setColId(dct.getColId());
+// if(dct.isVisible())
+// dv.setVisible(true);
+// else
+// dv.setVisible(false);
+// if(dr.getFormatId()!=null)
+// ((FormatProcessor) formatProcessors.get(formatCount)).setHtmlFormatters(dv, dr, true);
+// else
+// ((FormatProcessor) formatProcessors.get(formatCount)).setHtmlFormatters(dv, dr, false);
+//
+// if(topDown) {
+// if(!dv.getColId().endsWith("_calc") && dv.isVisible())
+// rowList.add(dv);
+// for (int cInner = 0; cInner < reportCols.size(); cInner++) {
+// if(reportCols.get(cInner)!=null) {
+// DataColumnType dctInner = (DataColumnType) reportCols.get(cInner);
+// if((dv.getColId()+"_calc").equals(dctInner.getColId())) {
+// dv.setDisplayCalculatedValue(ds.getString(r, cInner));
+// }
+// }
+// }
+// }
+// }
+// }
+// } // if reportCols
+//
+//
+// } // for
+// //add dr to rowList after all column is done.
+// if(!topDown) {
+// rowList.add(dr);
+// }
+// } // for
+// } catch (ReportSQLException ex) {
+// ex.printStackTrace();
+// }catch(Exception ex1) {
+// ex1.printStackTrace();
+// } finally {
+// try {
+// clearConnection(con);
+// } catch (ReportSQLException ex2) {
+// ex2.printStackTrace();
+// }
+// }
+// return rowList;
+// }
+
+
+} // DbUtils
+
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/ExecuteQuery.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/ExecuteQuery.java
new file mode 100644
index 00000000..8d769d4f
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/ExecuteQuery.java
@@ -0,0 +1,60 @@
+/*-
+ * ================================================================================
+ * 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.system;
+
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.concurrent.Callable;
+
+public class ExecuteQuery implements Callable<ResultSet>{
+
+ private Statement stmt;
+ private String sql = "";
+ private int maxRowLimit;
+ private ResultSet resultSet;
+
+ public ResultSet getResultSet() {
+ return resultSet;
+ }
+ public void setResultSet(ResultSet resultSet) {
+ this.resultSet = resultSet;
+ }
+
+ public ExecuteQuery(Statement stmt, String sql, int maxRowLimit) {
+ super();
+ this.stmt = stmt;
+ this.sql = sql;
+ this.maxRowLimit = maxRowLimit;
+ }
+
+ public ResultSet call() throws SQLException {
+ try {
+ System.out.println("Query Started" + new java.util.Date());
+ resultSet = stmt.executeQuery(sql);
+ System.out.println("Query End" + new java.util.Date());
+ } catch (SQLException ex) {
+ System.out.println("Query Exception" + new java.util.Date());
+ ex.printStackTrace();
+ throw ex;
+ }
+ return resultSet;
+ }
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/Globals.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/Globals.java
new file mode 100644
index 00000000..f02600eb
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/Globals.java
@@ -0,0 +1,2282 @@
+/*-
+ * ================================================================================
+ * 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.
+ * ================================================================================
+ */
+
+/* ===========================================================================================
+ * This class is part of <I>RAPTOR (Rapid Application Programming Tool for OLAP Reporting)</I>
+ * Raptor : This tool is used to generate different kinds of reports with lot of utilities
+ * ===========================================================================================
+ *
+ * -------------------------------------------------------------------------------------------
+ * Globals.java - This class is used to read properties file and call the common methods
+ * existing among all the frameworks.
+
+ * -------------------------------------------------------------------------------------------
+ *
+ *
+ * Changes
+ * -------
+ * 31-Jul-2009 : Version 8.4 (Sundar); <UL><LI> getRequestparametersMap method iterates form field collections. </LI>
+ * </UL>
+ * 27-Jul-2009 : Version 8.4 (Sundar); <UL><LI> Added property "admin_role_equiv_to_super_role" to specify Admin User equivalent to Super User.</LI>
+ * </UL>
+ * 14-Jul-2009 : Version 8.4 (Sundar); <UL><LI> Added property to showing/hiding params displayed in dashboard reports.</LI>
+ * </UL>
+ *
+ */
+package org.openecomp.portalsdk.analytics.system;
+
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+import java.util.StringTokenizer;
+
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpServletRequest;
+
+import org.openecomp.portalsdk.analytics.config.ConfigLoader;
+import org.openecomp.portalsdk.analytics.controller.ActionMapping;
+import org.openecomp.portalsdk.analytics.model.runtime.FormField;
+import org.openecomp.portalsdk.analytics.model.runtime.ReportFormFields;
+import org.openecomp.portalsdk.analytics.model.runtime.ReportRuntime;
+import org.openecomp.portalsdk.analytics.util.AppConstants;
+import org.openecomp.portalsdk.analytics.util.ExcelColorDef;
+import org.openecomp.portalsdk.analytics.util.Scheduler;
+import org.openecomp.portalsdk.analytics.util.Utils;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+
+public class Globals extends org.openecomp.portalsdk.analytics.RaptorObject {
+
+ static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(Globals.class);
+
+
+ private static boolean systemInitialized = false;
+
+ private static ActionMapping raptorActionMapping = null;
+
+ private static Scheduler scheduler = null;
+
+ // System type constants
+ public final static String ST_FUSION = "fusion";
+
+ public final static String ST_GENERIC = "generic";
+
+ public final static String ST_PRISMS = "prisms";
+
+ private static String systemType = ST_PRISMS; // default
+
+ private static IAppUtils appUtils = null;
+
+ private static IDbUtils dbUtils = null;
+
+ private static RDbUtils rdbUtils = null;
+
+ private static int debugLevel = 5;
+
+ private static int downloadLimit = 65000; // max number rows for download
+ // csv file
+
+ private static int defaultPageSize = 50;
+
+ private static int formFieldsListSize = 50;
+
+ private static int schedulerInterval = 0;
+
+ private static String systemName = "MSA Databank";
+
+ private static String baseTitle = "ANALYSIS";
+
+ private static String sheet_name = "Raptor Reports";
+
+ private static boolean allowSQLBasedReports = true; // whether to allow
+ // SQL-based report
+ // definition (security
+ // risk); super users
+ // are always allowed to
+ // create SQL-based
+ // reports
+
+ private static boolean showDisclaimer = true; // whether to include
+ // disclaimer page at the
+ // bottom of each screen
+
+ private static boolean displayFormBeforeRun = true; // whether to display
+ // the form page as a
+ // separate page before
+ // running the report
+
+ private static boolean includeFormWithData = true; // whether to include
+ // the form page on the
+ // report data page
+
+ private static boolean cacheChartData = true; // whether to cache chart
+ // data in the session =>
+ // faster re-display if the
+ // data volume does not get
+ // too large
+
+ private static boolean cacheCurPageData = true; // whether to cache report
+ // data for the currently
+ // displayed page in the
+ // session => faster
+ // re-display if the data
+ // volume does not get too
+ // large
+
+ private static boolean deleteOnlyByOwner = true; // whether to permit
+ // report deletion only
+ // by report owner or by
+ // everyone with "write"
+ // access
+
+ private static boolean enableReportLog = true; // whether to log each
+ // report execution and
+ // update time and user ID
+
+ private static boolean cacheUserRoles = true; // whether to cache user
+ // roles info in memory
+ // (saves many DB reads, but
+ // does not account for
+ // roles assigned after the
+ // cache was loaded)
+
+ private static boolean monthFormatUseLastDay = true; // whether to
+ // convert month
+ // formats (e.g.
+ // MM/YYYY) to the
+ // last day of the
+ // month (true) or
+ // first day (false)
+ // - like 12/2003 is
+ // converted to
+ // either 12/31/2003
+ // or 12/01/2003
+
+ private static boolean printTitleInDownload = false; // whether to print
+ // the report title
+ // in the download
+ // files
+
+ private static boolean showDescrAtRuntime = false; // whether to show
+ // report description
+ // when the report is
+ // run and in the quick
+ // links
+
+ // private static boolean skipChartLabelsToFit = false; // whether to skip
+ // labels on the Line chart axis when they overlap
+ private static boolean showNonstandardCharts = false; // whether to show
+ // chart types that
+ // are purpose
+ // and/or data
+ // specific
+
+ private static boolean allowRuntimeChartSel = true; // whether to allow the
+ // user to change the
+ // chart type at runtime
+
+ private static boolean displayChartTitle = false; // whether to display
+ // the report title as
+ // chart title as well
+
+ private static boolean mergeCrosstabRowHeadings = true; // whether to
+ // merge/blank
+ // multi-level row
+ // headings in
+ // cross-tab report
+
+ private static boolean displayChartByDefault = true; // whether to
+ // display chart
+ // when displaying
+ // the report at
+ // first or just a
+ // "Show Chart"
+ // button
+
+ private static boolean printParamsInDownload = false; // whether to print
+ // the form field
+ // values in the
+ // download files
+
+ // private static boolean chartLinesAlwaysSolid = true; // whether
+ // multi-lines chart uses solid line for all series or dashed/dotted/etc for
+ // each
+ // private static boolean chartLinesAlwaysSmooth = true; // whether line
+ // charts display smooth lines or with marked points on them for each value
+ private static int maxDecimalsOnTotals = 2; // Maximum number of decimals
+ // displayed in totals; decimal
+ // digits beyond that number
+ // will be truncated; if
+ // negative => display all
+ // decimal digits
+
+ private static int defaultChartWidth = 700;
+
+ private static int defaultChartHeight = 420;
+
+ private static int skipChartLabelsLimit = 30;
+
+ private static boolean canCopyOnReadOnly = true; // whether to users with
+ // read-only rights for
+ // a report can copy it
+
+ // Currently not loaded from a property file
+ private static boolean restrictTablesByRole = true; // whether to restrict
+ // DB tables
+ // accessibility by user
+ // role; defaults to
+ // false if table
+ // CR_TABLE_ROLE is
+ // empty, otherwise true
+
+ private static String javaTimeFormat = "MM/dd/yyyy h:m:s a";
+
+ private static String oracleTimeFormat = "%m/%d/%Y %h:%i:%s %p"; // must
+ // correspond
+ // to
+ // the
+ // java
+ // format
+ // modifier
+
+ private static String raptorVersion = "10.5.1";
+
+ private static int flatFileLowerLimit = 0;
+
+ private static int flatFileUpperLimit = 0;
+
+ private static String shellScriptDir = "";
+
+ private static String queryFolder = "";
+
+ private static String requestParams = "";
+
+ private static String sessionParams = "";
+
+ private static boolean displayAllUsers = true;
+
+ private static boolean user_col_def = true;
+
+ private static boolean printFooterInDownload = true;
+
+ private static String footerFirstLine = "";
+
+ private static String footerSecondLine = "";
+
+ private static boolean reportsInPoPUpWindow = false;
+
+ private static boolean poPUpInNewWindow = false;
+
+ private static boolean passRequestParamInDrilldown = false;
+
+ private static Properties raptorPdfProperties;
+
+ private static Properties raptorProperties;
+
+ private static Properties sqlProperty;
+
+ private static boolean showPDFDownloadIcon = false;
+
+
+
+ private Globals() {
+ }
+
+ public static synchronized void initializeSystem(ServletContext servletContext) {
+ if (systemInitialized)
+ return;
+ AppConstants.initializeAppConstants();
+ ExcelColorDef.initializeExcelColorDef();
+
+ //DB Agnostic Addition
+ try{
+ Properties sqlProperty = ConfigLoader.getProperties(servletContext, ConfigLoader.SQL_PROPERTIES);
+ Globals.sqlProperty = sqlProperty;
+ }
+
+ catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ try {
+ Properties raptorProperties = ConfigLoader.getProperties(servletContext,
+ ConfigLoader.RAPTOR_PROPERTIES);
+ initializeRaptorProperties(raptorProperties);
+
+
+ } catch (Exception e) {
+ logger.error(EELFLoggerDelegate.debugLogger, ("[EXCEPTION ENCOUNTERED IN RAPTOR] Globals: Unable to load properties ["
+ + ConfigLoader.RAPTOR_PROPERTIES + "]. Exception: " + e.getMessage()));
+ // throw new RuntimeException(e.getMessage());
+ }
+
+ systemInitialized = true;
+
+ try {
+ appUtils = (IAppUtils) Class.forName(
+ "org.openecomp.portalsdk.analytics.system." + systemType.toLowerCase() + ".AppUtils")
+ .newInstance();
+ appUtils.initializeAppUtils(servletContext);
+
+ dbUtils = (IDbUtils) Class.forName(
+ "org.openecomp.portalsdk.analytics.system." + systemType.toLowerCase() + ".DbUtils")
+ .newInstance();
+ dbUtils.initializeDbUtils(servletContext);
+
+ if(!Globals.getSystemType().equals(Globals.ST_GENERIC)) {
+ rdbUtils = (RDbUtils) Class.forName(
+ "org.openecomp.portalsdk.analytics.system." + systemType.toLowerCase() + ".RemoteDbUtils")
+ .newInstance();
+ rdbUtils.initializeDbUtils(servletContext);
+ }
+ } catch (Exception e) {
+ String eMsg = "[SYSTEM ERROR] Globals: Unable to instantiate system classes. Exception: "
+ + e.getMessage();
+ logger.error(EELFLoggerDelegate.debugLogger, ("[EXCEPTION ENCOUNTERED IN RAPTOR] " + eMsg));
+ systemInitialized = false;
+ throw new RuntimeException(eMsg);
+ }
+
+ try {
+ raptorActionMapping = ConfigLoader.loadRaptorActionMapping(servletContext);
+ } catch (Exception e) {
+ String eMsg = "[SYSTEM ERROR] Globals: Unable to load Raptor action mapping. Exception: "
+ + e.getMessage();
+ logger.error(EELFLoggerDelegate.debugLogger, ("[EXCEPTION ENCOUNTERED IN RAPTOR] " + eMsg));
+ systemInitialized = false;
+ throw new RuntimeException(eMsg);
+ } // catch
+
+ /*try {
+ //DataSet ds = DbUtils
+ // .executeQuery("SELECT 1 FROM dual WHERE EXISTS (SELECT 1 FROM cr_table_role)");
+
+ String p_sql = Globals.getInitializeRoles();
+ DataSet ds = DbUtils.executeQuery(p_sql);
+
+ restrictTablesByRole = (ds.getRowCount() > 0);
+ } catch (Exception e) {
+ String eMsg = "[SYSTEM ERROR] Globals: Unable to load Raptor version. Exception: "
+ + e.getMessage();
+ debugLogger.error("[EXCEPTION ENCOUNTERED IN RAPTOR] " + eMsg, e);
+ } // catch
+ */
+ /*try {
+ //DataSet ds = DbUtils.executeQuery("SELECT cr_raptor.get_version FROM dual");
+
+ //String n_sql = Globals.getInitializeVersion();
+ //DataSet ds = DbUtils.executeQuery(n_sql);
+ //raptorVersion = Globals.get
+ // if(ds.getRowCount()>0)
+ // raptorVersion = " v"+ds.getString(0, 0);
+ } catch (Exception e) {
+ String eMsg = "[SYSTEM ERROR] Globals: Unable to load Raptor version. Exception: "
+ + e.getMessage();
+ debugLogger.error("[EXCEPTION ENCOUNTERED IN RAPTOR] " + eMsg, e);
+ } // catch*/
+
+
+ //initiate pdf global config
+ try {
+ raptorPdfProperties = ConfigLoader.getProperties(servletContext, ConfigLoader.RAPTOR_PDF_PROPERTIES);
+ }
+ catch (Exception e) {
+ logger.error(EELFLoggerDelegate.debugLogger, ("[EXCEPTION ENCOUNTERED IN RAPTOR] Globals: Unable to load properties ["
+ + ConfigLoader.RAPTOR_PDF_PROPERTIES + "]. Exception: " + e.getMessage()));
+
+ }
+
+ scheduler = new Scheduler(schedulerInterval);
+
+ } // initializeSystem
+
+ public static void initializeRaptorProperties(Properties raptorProperties) {
+ Globals.raptorProperties = raptorProperties;
+ systemType = raptorProperties.getProperty("system");
+
+ try {
+ debugLevel = Integer.parseInt(nvls(raptorProperties
+ .getProperty("debug_level")).trim());
+ } catch (NumberFormatException nfe) {
+ }
+
+ try {
+ downloadLimit = Integer.parseInt(nvls(raptorProperties
+ .getProperty("download_limit")).trim());
+ } catch (NumberFormatException nfe) {
+ }
+
+ try {
+ defaultPageSize = Integer.parseInt(nvls(raptorProperties
+ .getProperty("default_page_size")).trim());
+ } catch (NumberFormatException nfe) {
+ }
+
+ try {
+ formFieldsListSize = Integer.parseInt(nvls(raptorProperties
+ .getProperty("form_fields_list_size")).trim());
+ } catch (NumberFormatException nfe) {
+ }
+
+ try {
+ schedulerInterval = Integer.parseInt(nvls(raptorProperties
+ .getProperty("scheduler_interval")).trim());
+ } catch (NumberFormatException nfe) {
+ System.out.println("NUMBERFORMATEXCEPTION Schedular " + raptorProperties
+ .getProperty("scheduler_interval"));
+ schedulerInterval = 0;
+ }
+
+ try {
+ maxDecimalsOnTotals = Integer.parseInt(nvls(raptorProperties
+ .getProperty("max_decimals_on_totals")).trim());
+ } catch (NumberFormatException nfe) {
+ }
+
+ try {
+ defaultChartWidth = Integer.parseInt(nvls(raptorProperties
+ .getProperty("default_chart_width")).trim());
+ } catch (NumberFormatException nfe) {
+ }
+
+ try {
+ defaultChartHeight = Integer.parseInt(nvls(raptorProperties
+ .getProperty("default_chart_height")).trim());
+ } catch (NumberFormatException nfe) {
+ }
+
+ try {
+ skipChartLabelsLimit = Integer.parseInt(nvls(raptorProperties
+ .getProperty("skip_chart_labels_limit")).trim());
+ } catch (NumberFormatException nfe) {
+ }
+
+ systemName = nvls(raptorProperties.getProperty("system_name"), "MSA Databank");
+ baseTitle = nvls(raptorProperties.getProperty("base_title"), "ANALYSIS");
+
+
+ allowSQLBasedReports = nvls(
+ raptorProperties.getProperty("allow_sql_based_reports"), "yes")
+ .toUpperCase().startsWith("Y");
+ showDisclaimer = nvls(raptorProperties.getProperty("show_disclaimer"), "yes")
+ .toUpperCase().startsWith("Y");
+ displayFormBeforeRun = nvls(
+ raptorProperties.getProperty("display_form_before_run"), "yes")
+ .toUpperCase().startsWith("Y");
+ includeFormWithData = nvls(raptorProperties.getProperty("include_form_with_data"),
+ "yes").toUpperCase().startsWith("Y");
+ cacheChartData = nvls(raptorProperties.getProperty("cache_chart_data"), "yes")
+ .toUpperCase().startsWith("Y");
+ cacheCurPageData = nvls(raptorProperties.getProperty("cache_cur_page_data"), "yes")
+ .toUpperCase().startsWith("Y");
+ deleteOnlyByOwner = nvls(raptorProperties.getProperty("delete_only_by_owner"),
+ "yes").toUpperCase().startsWith("Y");
+ enableReportLog = nvls(raptorProperties.getProperty("enable_report_log"), "yes")
+ .toUpperCase().startsWith("Y");
+ cacheUserRoles = nvls(raptorProperties.getProperty("cache_user_roles"), "yes")
+ .toUpperCase().startsWith("Y");
+ monthFormatUseLastDay = nvls(
+ raptorProperties.getProperty("month_format_use_last_day"), "yes")
+ .toUpperCase().startsWith("Y");
+ printTitleInDownload = nvls(
+ raptorProperties.getProperty("print_title_in_download"), "no")
+ .toUpperCase().startsWith("Y");
+ showDescrAtRuntime = nvls(raptorProperties.getProperty("show_descr_at_runtime"),
+ "no").toUpperCase().startsWith("Y");
+ // skipChartLabelsToFit =
+ // nvls(raptorProperties.getProperty("skip_chart_labels_to_fit"),
+ // "no" ).toUpperCase().startsWith("Y");
+ showNonstandardCharts = nvls(
+ raptorProperties.getProperty("show_nonstandard_charts"), "no")
+ .toUpperCase().startsWith("Y");
+ allowRuntimeChartSel = nvls(
+ raptorProperties.getProperty("allow_runtime_chart_sel"), "yes")
+ .toUpperCase().startsWith("Y");
+ displayChartTitle = nvls(raptorProperties.getProperty("display_chart_title"), "no")
+ .toUpperCase().startsWith("Y");
+ mergeCrosstabRowHeadings = nvls(
+ raptorProperties.getProperty("merge_crosstab_row_headings"), "yes")
+ .toUpperCase().startsWith("Y");
+ displayChartByDefault = nvls(
+ raptorProperties.getProperty("display_chart_by_default"), "yes")
+ .toUpperCase().startsWith("Y");
+ //System.out.println("Params Globals " + raptorProperties.getProperty("print_params_in_download"));
+
+ printParamsInDownload = nvls(
+ raptorProperties.getProperty("print_params_in_download"), "no")
+ .toUpperCase().startsWith("Y");
+ //System.out.println("printParamsInDownload " + printParamsInDownload);
+
+ canCopyOnReadOnly = nvls(raptorProperties.getProperty("can_copy_on_read_only"),
+ "yes").toUpperCase().startsWith("Y");
+ // chartLinesAlwaysSolid =
+ // nvls(raptorProperties.getProperty("chart_lines_always_solid"),
+ // "yes").toUpperCase().startsWith("Y");
+ // chartLinesAlwaysSmooth =
+ // nvls(raptorProperties.getProperty("chart_lines_always_smooth"),
+ // "yes").toUpperCase().startsWith("Y");
+ displayAllUsers = nvls(
+ raptorProperties.getProperty("display_all_users"), "yes")
+ .toUpperCase().startsWith("Y");
+ requestParams = nvls(
+ raptorProperties.getProperty("request_get_params"), "");
+ sessionParams = nvls(
+ raptorProperties.getProperty("session_params"), "");
+ user_col_def = nvls(
+ raptorProperties.getProperty("user_col_def"), "no")
+ .toUpperCase().startsWith("Y");
+ sheet_name = nvls(raptorProperties.getProperty("sheet_name"), "Raptor Reports");
+ try {
+ flatFileLowerLimit = Integer.parseInt(raptorProperties
+ .getProperty("flat_file_lower_limit"));
+ } catch (NumberFormatException nfe) {
+ }
+ try {
+ flatFileUpperLimit = Integer.parseInt(raptorProperties
+ .getProperty("flat_file_upper_limit"));
+ } catch (NumberFormatException nfe) {
+ }
+ shellScriptDir = nvls(raptorProperties.getProperty("shell_script_dir"), "");
+ //queryFolder = nvls(raptorProperties.getProperty("download_query_folder"), AppUtils.getTempFolderPath()+"../raptor/dwnld/query/");
+ queryFolder = nvls(raptorProperties.getProperty("download_query_folder"),"../raptor/dwnld/query/");
+
+
+ printFooterInDownload = nvls(
+ raptorProperties.getProperty("print_footer_in_download"), "no")
+ .toUpperCase().startsWith("Y");
+ footerFirstLine = nvls(raptorProperties.getProperty("footer_first_line"), "");
+ footerSecondLine = nvls(raptorProperties.getProperty("footer_second_line"), "Use Pursuant to Company Instructions");
+ reportsInPoPUpWindow = nvls(
+ raptorProperties.getProperty("report_in_popup_window"), "no")
+ .toUpperCase().startsWith("Y");
+ poPUpInNewWindow = nvls(
+ raptorProperties.getProperty("popup_in_new_window"), "no")
+ .toUpperCase().startsWith("Y") && reportsInPoPUpWindow;
+
+ passRequestParamInDrilldown = nvls(
+ raptorProperties.getProperty("pass_request_param_in_drilldown"), "yes")
+ .toUpperCase().startsWith("Y");
+ showPDFDownloadIcon = nvls(
+ raptorProperties.getProperty("show_pdf_download"), "no")
+ .toUpperCase().startsWith("Y");
+ }
+
+ /** *********************************************************************** */
+
+ public static ActionMapping getRaptorActionMapping() {
+ if (!systemInitialized)
+ throw new RuntimeException("[SYSTEM ERROR] Globals not initialized");
+
+ return raptorActionMapping;
+ } // getRaptorActionMapping
+
+ public static String getSystemType() {
+ if (!systemInitialized)
+ throw new RuntimeException("[SYSTEM ERROR] Globals not initialized");
+
+ return systemType;
+ } // getSystemType
+
+ public static IAppUtils getAppUtils() {
+ if (!systemInitialized)
+ throw new RuntimeException("[SYSTEM ERROR] Globals not initialized");
+
+ return appUtils;
+ } // getAppUtils
+
+ public static IDbUtils getDbUtils() {
+ if (!systemInitialized)
+ throw new RuntimeException("[SYSTEM ERROR] Globals not initialized");
+
+ return dbUtils;
+ } // getDbUtils
+
+ public static RDbUtils getRDbUtils() {
+ if (!systemInitialized)
+ throw new RuntimeException("[SYSTEM ERROR] Globals not initialized");
+ return rdbUtils;
+ } // getDbUtils
+
+ /** *********************************************************************** */
+
+ public static int getDebugLevel() {
+ return debugLevel;
+ }
+
+ public static int getDownloadLimit() {
+ return downloadLimit;
+ }
+
+ public static int getCSVDownloadLimit() {
+ return Integer.parseInt(nvls(raptorProperties.getProperty("csv_download_limit"), new Integer(getDownloadLimit()).toString()).trim());
+ }
+
+ public static String getDownloadLimitAsText() {
+ return java.text.NumberFormat.getNumberInstance(java.util.Locale.US).format(
+ downloadLimit);
+ }
+
+ public static int getDefaultPageSize() {
+ return defaultPageSize;
+ }
+
+ public static int getFormFieldsListSize() {
+ return formFieldsListSize;
+ }
+
+ public static int getSchedulerInterval() {
+ return schedulerInterval;
+ }
+
+ public static String getBaseTitle() {
+ return baseTitle;
+ }
+
+ public static String getSystemName() {
+ return systemName;
+ }
+
+ public static boolean getAllowSQLBasedReports() {
+ return allowSQLBasedReports;
+ }
+
+ public static boolean getShowDisclaimer() {
+ return showDisclaimer;
+ }
+
+ public static boolean getDisplayFormBeforeRun() {
+ return displayFormBeforeRun;
+ }
+
+ public static boolean getIncludeFormWithData() {
+ return includeFormWithData;
+ }
+
+ public static boolean getCacheChartData() {
+ return cacheChartData;
+ }
+
+ public static boolean getCacheCurPageData() {
+ return cacheCurPageData;
+ }
+
+ public static boolean getDeleteOnlyByOwner() {
+ return deleteOnlyByOwner;
+ }
+
+ public static boolean getEnableReportLog() {
+ return enableReportLog;
+ }
+
+ public static boolean getCacheUserRoles() {
+ return cacheUserRoles;
+ }
+
+ public static boolean getMonthFormatUseLastDay() {
+ return monthFormatUseLastDay;
+ }
+
+ public static boolean getPrintTitleInDownload() {
+ return printTitleInDownload;
+ }
+
+ public static boolean getShowDescrAtRuntime() {
+ return showDescrAtRuntime;
+ }
+
+ // public static boolean getSkipChartLabelsToFit() { return
+ // skipChartLabelsToFit; }
+ public static boolean getShowNonstandardCharts() {
+ return showNonstandardCharts;
+ }
+
+ public static boolean getAllowRuntimeChartSel() {
+ return allowRuntimeChartSel;
+ }
+
+ public static boolean getDisplayChartTitle() {
+ return displayChartTitle;
+ }
+
+ public static boolean getMergeCrosstabRowHeadings() {
+ return mergeCrosstabRowHeadings;
+ }
+
+ public static boolean getDisplayChartByDefault() {
+ return displayChartByDefault;
+ }
+
+ public static boolean getPrintParamsInDownload() {
+ return printParamsInDownload;
+ }
+
+ public static boolean getCanCopyOnReadOnly() {
+ return canCopyOnReadOnly;
+ }
+
+ // public static boolean getChartLinesAlwaysSolid() { return
+ // chartLinesAlwaysSolid; }
+ // public static boolean getChartLinesAlwaysSmooth() { return
+ // chartLinesAlwaysSmooth; }
+ public static int getMaxDecimalsOnTotals() {
+ return maxDecimalsOnTotals;
+ }
+
+ public static int getDefaultChartWidth() {
+ return defaultChartWidth;
+ }
+
+ public static int getDefaultChartHeight() {
+ return defaultChartHeight;
+ }
+
+ public static int getSkipChartLabelsLimit() {
+ return skipChartLabelsLimit;
+ }
+
+ public static boolean getRestrictTablesByRole() {
+ return restrictTablesByRole;
+ }
+
+ public static String getJavaTimeFormat() {
+ return javaTimeFormat;
+ }
+
+ public static String getOracleTimeFormat() {
+ return oracleTimeFormat;
+ }
+
+ public static String getRaptorVersion() {
+ return raptorVersion;
+ }
+
+ public static boolean getDisplayAllUsers() {
+ return displayAllUsers;
+ }
+
+ public static boolean getUserColDef() {
+ return user_col_def;
+ }
+
+ public static String getSheetName() {
+ return sheet_name;
+ }
+
+ public static int getFlatFileLowerLimit() {
+ return flatFileLowerLimit;
+ }
+
+ public static int getFlatFileUpperLimit() {
+ return flatFileUpperLimit;
+ }
+
+
+ public static String getShellScriptDir() {
+ return shellScriptDir;
+ }
+
+ public static String getQueryFolder() {
+ return AppUtils.getTempFolderPath()+queryFolder;
+ }
+
+ public static String getRequestParams() {
+ return requestParams;
+ }
+
+ public static String getSessionParams() {
+ return sessionParams;
+ }
+
+ public static boolean getPrintFooterInDownload() {
+ return printFooterInDownload;
+ }
+
+ public static String getFooterFirstLine() {
+ return footerFirstLine;
+ }
+
+ public static String getFooterSecondLine() {
+ return footerSecondLine;
+ }
+
+ public static boolean getReportsInPoPUpWindow() {
+ return reportsInPoPUpWindow;
+ }
+
+ public static boolean getPoPUpInNewWindow() {
+ return poPUpInNewWindow;
+ }
+
+ public static boolean getPassRequestParamInDrilldown() {
+ return passRequestParamInDrilldown;
+ }
+
+
+ //pdf specific properties
+ public static float getDataFontSize() {
+ float size = 10f;
+
+ try {
+ size = Float.parseFloat(nvls(raptorPdfProperties.getProperty("pdf_data_font_size")).trim());
+ } catch (Exception ex) {
+
+ }
+ return size;
+ }
+
+ public static float getDataFontSizeOffset() {
+ float size = 9f;
+
+ try {
+ size = Float.parseFloat(nvls(raptorPdfProperties.getProperty("pdf_data_font_size_offset")).trim());
+ } catch (Exception ex) {
+
+ }
+ return size;
+ }
+
+ public static float getFooterFontSize() {
+ float size = 9f;
+
+ try {
+ size = Float.parseFloat(nvls(raptorPdfProperties.getProperty("pdf_footer_font_size")).trim());
+ } catch (Exception ex) {
+
+ }
+ return size;
+ }
+
+ public static int getPageNumberPosition() {
+ int size = 1;
+
+ try {
+ size = Integer.parseInt(nvls(raptorPdfProperties.getProperty("pdf_page_number_position")).trim());
+ } catch (Exception ex) {
+
+ }
+ return size;
+ }
+
+ public static String getDataFontFamily() {
+
+ return nvls(raptorPdfProperties.getProperty("pdf_data_font_family"),"Arial").trim();
+ }
+
+ public static String getFooterFontFamily() {
+
+ return nvls(raptorPdfProperties.getProperty("pdf_footer_font_family"),"Arial").trim();
+ }
+
+ public static boolean isCoverPageNeeded() {
+
+ return nvls(raptorPdfProperties.getProperty("display_cover_page"),"true").trim().equalsIgnoreCase("true");
+ }
+
+ public static boolean isDataAlternateColor() {
+
+ return nvls(raptorPdfProperties.getProperty("pdf_data_alternate_color"),"true").trim().equalsIgnoreCase("true");
+ }
+
+ public static String getAttProprietary() {
+
+ return nvls(raptorPdfProperties.getProperty("pdf_att_proprietary"));
+ }
+
+ public static boolean isCreatedOwnerInfoNeeded() {
+ return nvls(raptorPdfProperties.getProperty("display_create_owner_info"),"true").trim().equalsIgnoreCase("true");
+ }
+
+ // Selected Form field section in the run page
+ public static boolean displayFormFieldInfo() {
+ return nvls(raptorProperties.getProperty("display_formfield_info"),"no").trim().toUpperCase().startsWith("Y");
+ }
+
+ // Customize Form field section in the run page
+ public static boolean customizeFormFieldInfo() {
+ return nvls(raptorProperties.getProperty("customize_formfield_info"),"no").trim().toUpperCase().startsWith("Y");
+ }
+
+ public static boolean displayLoginIdForDownloadedBy() {
+ return nvls(raptorPdfProperties.getProperty("display_loginid_for_downloaded_by"),"false").trim().equalsIgnoreCase("true");
+ }
+
+ public static boolean isDefaultOrientationPortrait() {
+ return nvls(raptorPdfProperties.getProperty("is_default_orientation_portrait"),"true").trim().equalsIgnoreCase("true");
+ }
+
+ public static String getSessionInfoForTheCoverPage() {
+ return nvls(raptorPdfProperties.getProperty("session_info"));
+ }
+
+ public static String getDatePattern() {
+
+ return nvls(raptorPdfProperties.getProperty("pdf_date_pattern"),"MM/dd/yyyy hh:mm:ss a");
+ }
+
+ public static String getTimeZone() {
+
+ return nvls(raptorPdfProperties.getProperty("pdf_date_timezone"),"EST");
+ }
+
+ public static String getWordBeforePageNumber() {
+
+ return nvls(raptorPdfProperties.getProperty("pdf_word_before_page_number"));
+ }
+
+ public static String getWordAfterPageNumber() {
+
+ return nvls(raptorPdfProperties.getProperty("pdf_word_after_page_number"));
+ }
+
+ public static float getAttProprieraryFontSize() {
+ float size = 7f;
+
+ try {
+ size = Float.parseFloat(nvls(raptorPdfProperties.getProperty("pdf_att_proprierary_font_size")).trim());
+ } catch (Exception ex) {
+
+ }
+ return size;
+ }
+
+ public static String getDataBackgroundAlternateHexCode() {
+
+ return nvls(raptorPdfProperties.getProperty("pdf_data_background_alternate_hex_code"),"#FFFFFF");
+ }
+
+ public static String getDataDefaultBackgroundHexCode() {
+
+ return nvls(raptorPdfProperties.getProperty("pdf_data_default_background_hex_code"),"#FFFFFF");
+ }
+
+ public static String getDataTableHeaderFontColor() {
+
+ return nvls(raptorPdfProperties.getProperty("pdf_data_table_header_font_hex_code"),"#FFFFFF");
+ }
+
+ public static String getDataTableHeaderBackgroundFontColor() {
+
+ return nvls(raptorPdfProperties.getProperty("pdf_data_table_header_background_hex_code"),"#8A9BB3");
+ }
+
+ public static boolean isFolderTreeAllowed() {
+ return nvls(raptorProperties.getProperty("show_folder_tree"),"yes").trim().toUpperCase().startsWith("Y");
+ }
+
+ public static boolean isFolderDefaultMinimized() {
+ return nvls(raptorProperties.getProperty("folder_tree_minimized"),"no").trim().toUpperCase().startsWith("Y");
+ }
+
+ public static boolean isFolderTreeAllowedOnlyForAdminUsers() {
+ return nvls(raptorProperties.getProperty("show_folder_tree_only_to_admin_users"),"yes").trim().toUpperCase().startsWith("Y");
+ }
+
+ public static float getCoverPageFirstColumnSize() {
+ float size = 0.3f;
+
+ try {
+ size = Float.parseFloat(nvls(raptorPdfProperties.getProperty("pdf_coverpage_firstcolumn_size")).trim());
+ } catch (Exception ex) {
+
+ }
+ return size;
+ }
+
+ public static boolean isImageAutoRotate() {
+ return nvls(raptorPdfProperties.getProperty("pdf_image_auto_rotate"),"false").trim().equalsIgnoreCase("true");
+ }
+
+
+ public static boolean isShowPDFDownloadIcon() {
+ return showPDFDownloadIcon;
+ }
+
+
+ public static void setShowPDFDownloadIcon(boolean showPDFDownloadIcon) {
+ Globals.showPDFDownloadIcon = showPDFDownloadIcon;
+ }
+
+ public static int getScheduleLimit() {
+ int limit = 1000;
+ try {
+ limit = Integer.parseInt(nvls(raptorProperties.getProperty("schedule_limit")).trim());
+ } catch (Exception ex) {
+
+ }
+ return limit;
+ }
+
+// public static String getWhereConditionForUserRole() {
+// return nvls(raptorProperties.getProperty("schedule_where_condition"),"").trim();
+// }
+ public static String getCustomizedScheduleQueryForUsers() {
+ return nvls(raptorProperties.getProperty("schedule_custom_query_for_users"),"").trim();
+ }
+
+ public static String getCustomizedScheduleQueryForRoles() {
+ return nvls(raptorProperties.getProperty("schedule_custom_query_for_roles"),"").trim();
+ }
+
+ public static String getScheduleDatePattern() {
+ return nvls(raptorProperties.getProperty("schedule_date_pattern"),"MM/dd/yyyy hh:mm:ss a");
+ }
+
+ public static String getChartYearlyPattern() {
+ return nvls(raptorProperties.getProperty("chart_yearly_format"),"yyyy");
+ }
+
+ public static String getChartMonthlyPattern() {
+ return nvls(raptorProperties.getProperty("chart_monthly_format"),"MMM-yyyy");
+ }
+
+ public static String getChartDailyPattern() {
+ return nvls(raptorProperties.getProperty("chart_daily_format"),"MM-dd-yyyy");
+ }
+
+ public static String getChartWeeklyPattern() {
+ return nvls(raptorProperties.getProperty("chart_weekly_format"),"MM-dd-yyyy");
+ }
+
+ public static String getChartHourlyPattern() {
+ return nvls(raptorProperties.getProperty("chart_hourly_format"),"HH");
+ }
+
+ public static String getChartMinutePattern() {
+ return nvls(raptorProperties.getProperty("chart_minute_format"),"HH:mm");
+ }
+
+ public static String getChartSecPattern() {
+ return nvls(raptorProperties.getProperty("chart_second_format"),"HH:mm:ss");
+ }
+
+ public static String getChartMilliSecPattern() {
+ return nvls(raptorProperties.getProperty("chart_millisecond_format"),"HH:mm:ss.S");
+ }
+
+ public static String getSessionParamsForScheduling() {
+ return nvls(raptorProperties.getProperty("session_params_for_scheduling"),"");
+ }
+
+ public static String getDisplaySessionParamInPDFEXCEL() {
+ return nvls(raptorProperties.getProperty("display_session_param_pdfexcel"),"");
+ }
+
+ public static String getDisplayScheduleSessionParamInPDFEXCEL() {
+ return nvls(raptorProperties.getProperty("session_params_for_displaying_in_scheduling"),"");
+ }
+
+ public static boolean isScheduleDateParamAutoIncr() {
+ return nvls(raptorProperties.getProperty("session_date_formfield_auto_incr"),"yes").trim().toUpperCase().startsWith("Y");
+ }
+
+ public static int getMaxCellWidthInExcel() {
+ int cellWidth = 40;
+ try {
+ cellWidth = Integer.parseInt(nvls(raptorProperties.getProperty("max_cell_width_in_excel")).trim());
+ } catch (Exception ex) {
+
+ }
+ return cellWidth;
+ }
+
+ public static synchronized int getFormFieldsCount(HttpServletRequest request)
+ {
+ if(request.getSession().getAttribute(
+ AppConstants.SI_REPORT_RUNTIME) == null )
+ {
+ return 0;
+ }
+
+ ReportRuntime rr = (ReportRuntime) request.getSession().getAttribute(
+ AppConstants.SI_REPORT_RUNTIME);
+
+ ReportFormFields rff = rr.getReportFormFields();
+
+ int idx = 0;
+ FormField ff = null;
+ Map fieldNameMap = new HashMap();
+ int countOfFields = 0 ;
+ for(rff.resetNext(); rff.hasNext(); idx++) {
+ ff = rff.getNext();
+ fieldNameMap.put(ff.getFieldName(), ff.getFieldDisplayName());
+ countOfFields++;
+ }
+ return countOfFields;
+
+ }
+
+ public static synchronized java.util.HashMap getRequestParametersMap(HttpServletRequest request, HashMap paramsMap) {
+ HashMap valuesMap = new HashMap();
+ if(paramsMap.size() <= 0) {
+ return valuesMap;
+ }
+
+ ReportRuntime rr = (ReportRuntime) request.getSession().getAttribute(
+ AppConstants.SI_REPORT_RUNTIME);
+ if(rr.getReportType().equals(AppConstants.RT_DASHBOARD)) {
+ rr = (ReportRuntime) request.getSession().getAttribute("FirstDashReport");
+ }
+ ReportFormFields rff = rr.getReportFormFields();
+
+ int idx = 0;
+ FormField ff = null;
+
+ Map fieldNameMap = new HashMap();
+ int countOfFields = 0 ;
+
+
+ for(rff.resetNext(); rff.hasNext(); idx++) {
+ ff = rff.getNext();
+ fieldNameMap.put(ff.getFieldName(), ff.getFieldDisplayName());
+ countOfFields++;
+ }
+
+ List formParameter = new ArrayList();
+ String formField = "";
+
+ for(int i = 0 ; i < rff.size(); i++) {
+ ff = ((FormField)rff.getFormField(i));
+ formField = ff.getFieldName();
+
+ if(paramsMap.containsKey(formField) ) {
+ String vals = (String) paramsMap.get(formField);
+ StringBuffer value = new StringBuffer("");
+ boolean isMultiValue = false;
+ isMultiValue = ff.getFieldType().equals(FormField.FFT_CHECK_BOX)
+ || ff.getFieldType().equals(FormField.FFT_LIST_MULTI);
+ boolean isTextArea = (ff.getFieldType().equals(FormField.FFT_TEXTAREA) && rr.getReportDefType()
+ .equals(AppConstants.RD_SQL_BASED));
+
+ if(isMultiValue) {
+ value.append("(");
+ }
+ StringTokenizer st = new StringTokenizer(vals, "|");
+ if(st.countTokens()>0) {
+ while(st.hasMoreTokens()) {
+ if(isMultiValue) value.append("'");
+ String token = st.nextToken();
+ try {
+ if(token !=null && token.length() > 0)
+ token = java.net.URLDecoder.decode(token, "UTF-8");
+ } catch (UnsupportedEncodingException ex) {}
+ catch (IllegalArgumentException ex1){}
+ catch (Exception ex2){}
+ value.append(token);
+ if(isMultiValue) value.append("'");
+ if(st.hasMoreTokens()) {
+ value.append(",");
+ }
+ }
+ } else {
+ String valueStr = "";
+ valueStr = request.getParameter(formField);
+ valueStr = Utils.oracleSafe(valueStr);
+ valueStr = "('" + Utils.replaceInString(valueStr, ",", "'|'") + "')";
+ valueStr = Utils.replaceInString(valueStr, "|", ",");
+ valuesMap.put(fieldNameMap.get(formField), valueStr);
+ valueStr = "";
+ }
+ if(isMultiValue) value.append(")");
+
+ valuesMap.put(fieldNameMap.get(formField), value.toString());
+ if(ff.getValidationType().equals(FormField.VT_TIMESTAMP_HR) || ff.getValidationType().equals(FormField.VT_TIMESTAMP_MIN) || ff.getValidationType().equals(FormField.VT_TIMESTAMP_SEC)) {
+ String valueStr = "";
+ if(ff.getValidationType().equals(FormField.VT_TIMESTAMP_HR)) {
+ valueStr = (String) paramsMap.get(formField +"_Hr");
+ valuesMap.put(formField+"_Hr", valueStr);
+ valueStr = "";
+ } else if (ff.getValidationType().equals(FormField.VT_TIMESTAMP_MIN)) {
+ valueStr =(String) paramsMap.get(formField +"_Hr");
+ valuesMap.put(formField+"_Hr", valueStr);
+ valueStr = "";
+ valueStr = (String) paramsMap.get(formField +"_Min");
+ valuesMap.put(formField+"_Min", valueStr);
+ valueStr = "";
+ } else if (ff.getValidationType().equals(FormField.VT_TIMESTAMP_SEC)) {
+ valueStr = (String) paramsMap.get(formField +"_Hr");
+ valuesMap.put(formField+"_Hr", valueStr);
+ valueStr = "";
+ valueStr =(String) paramsMap.get(formField +"_Min");
+ valuesMap.put(formField+"_Min", valueStr);
+ valueStr = "";
+ valueStr = (String) paramsMap.get(formField +"_Sec");
+ valuesMap.put(formField+"_Sec", valueStr);
+ valueStr = "";
+ }
+ }
+
+ value = new StringBuffer("");
+
+ } else if (paramsMap.containsKey(formField +"_auto")) {
+ String vals = (String) paramsMap.get(formField +"_auto");
+ StringBuffer value = new StringBuffer("");
+ boolean isMultiValue = false;
+ isMultiValue = ff.getFieldType().equals(FormField.FFT_CHECK_BOX)
+ || ff.getFieldType().equals(FormField.FFT_LIST_MULTI);
+ boolean isTextArea = (ff.getFieldType().equals(FormField.FFT_TEXTAREA) && rr.getReportDefType()
+ .equals(AppConstants.RD_SQL_BASED));
+
+ if(isMultiValue) {
+ value.append("(");
+ }
+ StringTokenizer st = new StringTokenizer(vals, "|");
+ if(st.countTokens()>0) {
+ while(st.hasMoreTokens()) {
+ if(isMultiValue) value.append("'");
+ String token = st.nextToken();
+ try {
+ if(token !=null && token.length() > 0)
+ token = java.net.URLDecoder.decode(Utils.oracleSafe(token), "UTF-8");
+ } catch (UnsupportedEncodingException ex) {}
+ catch (IllegalArgumentException ex1){}
+ catch (Exception ex2){}
+ value.append(token);
+ if(isMultiValue) value.append("'");
+ if(st.hasMoreTokens()) {
+ value.append(",");
+ }
+ }
+ } else {
+ String valueStr = "";
+ valueStr = request.getParameter(formField +"_auto");
+ valueStr = "('" + Utils.replaceInString(valueStr, ",", "'|'") + "')";
+ valueStr = Utils.replaceInString(valueStr, "|", ",");
+ valuesMap.put(fieldNameMap.get(formField), valueStr);
+ valueStr = "";
+ }
+ if(isMultiValue) value.append(")");
+
+ valuesMap.put(fieldNameMap.get(formField), value.toString());
+
+ if(ff.getValidationType().equals(FormField.VT_TIMESTAMP_HR) || ff.getValidationType().equals(FormField.VT_TIMESTAMP_MIN) || ff.getValidationType().equals(FormField.VT_TIMESTAMP_SEC)) {
+ String valueStr = "";
+ if(ff.getValidationType().equals(FormField.VT_TIMESTAMP_HR)) {
+ valueStr = (String) paramsMap.get(formField +"_Hr");
+ valuesMap.put(formField+"_Hr", valueStr);
+ valueStr = "";
+ } else if (ff.getValidationType().equals(FormField.VT_TIMESTAMP_MIN)) {
+ valueStr = (String) paramsMap.get(formField +"_Hr");
+ valuesMap.put(formField+"_Hr", valueStr);
+ valueStr = "";
+ valueStr = (String) paramsMap.get(formField +"_Min");
+ valuesMap.put(formField+"_Min", valueStr);
+ valueStr = "";
+ } else if (ff.getValidationType().equals(FormField.VT_TIMESTAMP_SEC)) {
+ valueStr = (String) paramsMap.get(formField +"_Hr");
+ valuesMap.put(formField+"_Hr", valueStr);
+ valueStr = "";
+ valueStr = (String) paramsMap.get(formField +"_Min");
+ valuesMap.put(formField+"_Min", valueStr);
+ valueStr = "";
+ valueStr = (String) paramsMap.get(formField +"_Sec");
+ valuesMap.put(formField+"_Sec", valueStr);
+ valueStr = "";
+ }
+ }
+ value = new StringBuffer("");
+
+
+ } else
+ valuesMap.put(fieldNameMap.get(formField), "" );
+ }
+ return valuesMap;
+ }
+
+ public static synchronized java.util.HashMap getRequestParamtersMap(HttpServletRequest request) {
+ return getRequestParamtersMap(request, false);
+ }
+
+ public static synchronized java.util.HashMap getRequestParamtersMap(HttpServletRequest request, boolean isFromChild)
+ {
+ HashMap valuesMap = new HashMap();
+ ReportRuntime rr = null;
+ if(request.getSession().getAttribute(
+ AppConstants.SI_REPORT_RUNTIME) == null )
+ {
+ rr = (ReportRuntime) request.getSession().getAttribute("FirstDashReport");
+ if(rr==null)
+ return valuesMap;
+ }
+
+ rr = (ReportRuntime) request.getSession().getAttribute(
+ AppConstants.SI_REPORT_RUNTIME);
+ if(rr!=null && rr.getReportType().equals(AppConstants.RT_DASHBOARD)) {
+ rr = (ReportRuntime) request.getSession().getAttribute("FirstDashReport");
+ }
+
+ ReportFormFields rff = rr.getReportFormFields();
+
+ int idx = 0;
+ FormField ff = null;
+
+ Map fieldNameMap = new HashMap();
+ int countOfFields = 0 ;
+
+
+ for(rff.resetNext(); rff.hasNext(); idx++) {
+ ff = rff.getNext();
+ fieldNameMap.put(ff.getFieldName(), ff.getFieldDisplayName());
+ countOfFields++;
+ }
+ if(isFromChild) {
+ Hashtable ht = rr.getReportParamValues();
+ Set set = ht.entrySet();
+ HashMap hashMap = new HashMap();
+ Iterator itr = set.iterator();
+ while(itr.hasNext()){
+ Map.Entry entry = (Map.Entry)itr.next();
+ Object key = entry.getKey();
+ Object val = entry.getValue();
+ if(key==null){
+ key = ""; // Or whatever you want
+ }
+ if(val==null){
+ val = ""; // Or whatever you want
+ }
+ hashMap.put(fieldNameMap.get((String)key),val);
+ }
+ return hashMap;
+
+ } else {
+ List formParameter = new ArrayList();
+ String formField = "";
+
+// for(int i = 1 ; i < (countOfFields+1); i++)
+// {
+// formField ="ff"+i;
+//
+// if(request.getParameterValues(formField) != null && request.getParameterValues(formField).length > 1 )
+// {
+// String[] vals = request.getParameterValues(formField);
+// boolean isMultiValue = false;
+// StringBuffer value = new StringBuffer("");
+// if(vals.length > 1) {
+// isMultiValue = true;
+// value.append("(");
+// }
+// for(int j = 0 ; j < vals.length; j++)
+// {
+// if(isMultiValue) value.append("'");
+// try {
+// if(vals[j] !=null && vals[j].length() > 0)
+// value.append(java.net.URLDecoder.decode(vals[j], "UTF-8"));// + ",";
+// else
+// value.append(vals[j]);
+// } catch (UnsupportedEncodingException ex) {value.append(vals[j]);}
+// catch (IllegalArgumentException ex1){value.append(vals[j]);}
+// catch (Exception ex2){value.append(vals[j]);}
+//
+//
+// if(isMultiValue) value.append("'");
+//
+// if(j != vals.length -1) {
+// value.append(",");
+// }
+// }
+// if(vals.length > 1) {
+// value.append(")");
+// }
+//
+// //value = value.substring(0 , value.length());
+//
+// valuesMap.put(fieldNameMap.get(formField), value.toString());
+// value = new StringBuffer("");
+//
+// }
+// else if(request.getParameter(formField) != null)
+// {
+// String value = "";
+// value = request.getParameter(formField);
+// try {
+// if(value !=null && value.length() > 0)
+// value = java.net.URLDecoder.decode(request.getParameter(formField), "UTF-8");
+// } catch (UnsupportedEncodingException ex) {}
+// catch (IllegalArgumentException ex1){}
+// catch (Exception ex2){}
+// valuesMap.put(fieldNameMap.get(formField), value);
+//
+// }else
+// {
+// valuesMap.put(fieldNameMap.get(formField), "NULL" );
+// }
+// }
+ for(int i = 0 ; i < rff.size(); i++) {
+ ff = ((FormField)rff.getFormField(i));
+ formField = ff.getFieldName();
+ boolean isMultiValue = false;
+ isMultiValue = ff.getFieldType().equals(FormField.FFT_CHECK_BOX)
+ || ff.getFieldType().equals(FormField.FFT_LIST_MULTI);
+ boolean isTextArea = (ff.getFieldType().equals(FormField.FFT_TEXTAREA) && rr.getReportDefType()
+ .equals(AppConstants.RD_SQL_BASED));
+
+ if(request.getParameterValues(formField) != null && isMultiValue ) {
+ String[] vals = request.getParameterValues(formField);
+ StringBuffer value = new StringBuffer("");
+ if(!AppUtils.getRequestFlag(request, AppConstants.RI_RESET_ACTION)) {
+
+ if ( isMultiValue ) {
+ value.append("(");
+ }
+ for(int j = 0 ; j < vals.length; j++) {
+ if(isMultiValue) value.append("'");
+ try {
+ if(vals[j] !=null && vals[j].length() > 0) {
+ vals[j] = Utils.oracleSafe(vals[j]);
+ value.append(java.net.URLDecoder.decode(vals[j], "UTF-8"));// + ",";
+ }
+ else
+ value.append(vals[j]);
+ } catch (UnsupportedEncodingException ex) {value.append(vals[j]);}
+ catch (IllegalArgumentException ex1){value.append(vals[j]);}
+ catch (Exception ex2){
+ value.append(vals[j]);
+ }
+
+
+ if(isMultiValue) value.append("'");
+
+ if(j != vals.length -1) {
+ value.append(",");
+ }
+ }
+ if(vals.length > 0) {
+ value.append(")");
+ }
+ }
+
+ //value = value.substring(0 , value.length());
+
+ valuesMap.put(fieldNameMap.get(formField), value.toString());
+ value = new StringBuffer("");
+ } else if(request.getParameter(formField) != null) {
+ if(isTextArea) {
+ String value = "";
+ value = request.getParameter(formField);
+/* try {
+ value = java.net.URLDecoder.decode(value, "UTF-8");
+ } catch (UnsupportedEncodingException ex) {}
+ catch (IllegalArgumentException ex1){}
+ catch (Exception ex2){}
+*/
+ value = Utils.oracleSafe(value);
+ value = "('" + Utils.replaceInString(value, ",", "'|'") + "')";
+ value = Utils.replaceInString(value, "|", ",");
+ valuesMap.put(fieldNameMap.get(formField), value);
+ value = "";
+ } else {
+ String value = "";
+ if(!AppUtils.getRequestFlag(request, AppConstants.RI_RESET_ACTION))
+ value = request.getParameter(formField);
+ /*try {
+ value = java.net.URLDecoder.decode(value, "UTF-8");
+ } catch (UnsupportedEncodingException ex) {}
+ catch (IllegalArgumentException ex1){}
+ catch (Exception ex2){}
+*/
+ valuesMap.put(fieldNameMap.get(formField), Utils.oracleSafe(value));
+ }
+
+ } else {
+ valuesMap.put(fieldNameMap.get(formField), "" );
+ }
+
+ }
+
+ return valuesMap;
+ }
+ }
+
+ //new method added to get the help message for schedule tab
+ public static String getScheduleHelpMessage() {
+ return nvls(raptorProperties.getProperty("schedule_help_text"),"").trim();
+ }
+
+ //new method added to get the help message for schedule tab
+ public static String getUseLoginIdInSchedYN() {
+ return nvls(raptorProperties.getProperty("use_loginid_in_schedYN"),"N").trim();
+ }
+
+ //new method to check if map is allowed or not
+ public static String getMapAllowedYN() {
+ return nvls(raptorProperties.getProperty("map_allowed"),"").trim();
+ }
+
+ //new method added to get gmap key
+ public static String getGmapKey() {
+ return nvls(raptorProperties.getProperty("gmap_key"),"").trim();
+ }
+
+// new method added to get gmap
+ public static String getProjectFolder() {
+ return nvls(raptorProperties.getProperty("PROJECT-FOLDER"),"").trim();
+ }
+
+
+ //new method added to get gmap
+ public static String getMarketShapefileFolder() {
+ return nvls(raptorProperties.getProperty("MARKET-SHAPEFILE-FOLDER"),"").trim();
+ }
+
+ //new method added to get gmap
+ public static String getTileSize() {
+ return nvls(raptorProperties.getProperty("TILE-SIZE"),"").trim();
+ }
+
+ // new method added to get gmap
+ public static String getOutputFolder() {
+ return nvls(raptorProperties.getProperty("OUTPUT-FOLDER"),"").trim();
+ }
+
+ //getting server details
+ public static boolean isWeblogicServer() {
+ return nvls(raptorProperties.getProperty("application_server"),"tomcat").trim().toUpperCase().startsWith("WEBLOGIC");
+ }
+
+ public static String getTempFolderURL() {
+ return nvls(AppUtils.getTempFolderURL(),"").trim();
+ }
+
+ public static int getMaxDrillDownLevel() {
+ int drillDownLevel = 1;
+ try {
+ drillDownLevel = Integer.parseInt(nvls(raptorProperties.getProperty("max_drilldown_level")).trim());
+ } catch (Exception ex) {
+
+ }
+ return drillDownLevel;
+ }
+
+ public static int getMemoryThreshold() {
+ int threshold = Integer.parseInt(nvls(raptorProperties.getProperty("memory_threshold_percentage"),"0").trim());
+ if(threshold <= 0) threshold = 0;
+ return threshold;
+ }
+
+ public static boolean showParamsInAllDashboardReports() {
+ return nvls(raptorProperties.getProperty("show_params_in_all_dashboard_reports"),"N").trim().toUpperCase().startsWith("Y");
+ }
+
+ public static boolean isAdminRoleEquivalenttoSuperRole() {
+ return nvls(raptorProperties.getProperty("admin_role_equiv_to_super_role"),"N").trim().toUpperCase().startsWith("Y");
+ }
+
+ public static boolean showLoadingMsgDuringFormFieldChain() {
+ return nvls(raptorProperties.getProperty("show_loading_during_formfield_chain"),"Y").trim().toUpperCase().startsWith("Y");
+ }
+
+ public static boolean showPrintIcon() {
+ return nvls(raptorProperties.getProperty("show_print_icon"),"Y").trim().toUpperCase().startsWith("Y");
+ }
+
+ public static boolean IsGlobalNoWrap() {
+ return nvls(raptorProperties.getProperty("globally_nowrap"),"N").trim().toUpperCase().startsWith("Y");
+ }
+
+ public static String getCalendarOutputDateFormat() {
+ return nvls(raptorProperties.getProperty("calendar_output_date_format"),"MM/dd/yyyy");
+ }
+
+ public static String getUserDefinedMessageForMemoryLimitReached() {
+ return nvls(raptorProperties.getProperty("user_defined_message_memory_limit"),"Please note: Due to limited computing resource at this time,");
+ }
+
+ public static String getAdhocUserRoldId() {
+ return nvls(raptorProperties.getProperty("adhoc_user_roleId"),"");
+ }
+
+ public static String getAdhocReportSequence() {
+ return nvls(raptorProperties.getProperty("adhoc_report_sequence"),"");
+ }
+
+ public static boolean hideToolTipsGlobally() {
+ return nvls(raptorProperties.getProperty("hide_tooltips_in_chart"),"N").trim().toUpperCase().startsWith("Y");
+ }
+
+ public static boolean showScheduleIconBeforeRun() {
+ return nvls(raptorProperties.getProperty("show_schedule_icon_before_run"),"Y").trim().toUpperCase().startsWith("Y");
+ }
+
+ public static boolean hideRaptorFooter() {
+ return nvls(raptorProperties.getProperty("hide_raptor_footer"),"N").trim().toUpperCase().startsWith("Y");
+ }
+
+ public static boolean getPrintParamsInCSVDownload() {
+ return nvls(raptorProperties.getProperty("print_params_in_csv_download"),"N").trim().toUpperCase().startsWith("Y");
+ }
+
+ public static String getLogVariablesInSession() {
+ return nvls(raptorProperties.getProperty("log_variable_in_session"), "");
+ }
+
+ public static boolean hideTitleInDashboard() {
+ return nvls(raptorProperties.getProperty("notitle_in_dashboard"), "N").trim().toUpperCase().startsWith("Y");
+ }
+
+ public static String getEncryptedSMTPServer() {
+ return nvls(raptorProperties.getProperty("secure_smtp_server"), "");
+ }
+
+ public static boolean generateSchedReportsInFileSystem() {
+ return nvls(raptorProperties.getProperty("generate_store_sched_reports"), "N").trim().toUpperCase().startsWith("Y");
+ }
+
+ public static boolean showExcel2007DownloadIcon() {
+ return nvls(raptorProperties.getProperty("show_excel_2007_download"), "N").trim().toUpperCase().startsWith("Y");
+ }
+
+ public static boolean printExcelInLandscapeMode() {
+ return nvls(raptorProperties.getProperty("print_excel_in_landscape"), "").trim().toUpperCase().startsWith("Y");
+ }
+
+ public static String getAppDefinedMessageForSendingSchedAsAttachment() {
+ return nvls(raptorProperties.getProperty("app_defined_message_schedule_attachment"),"Send as Attachment");
+ }
+
+ public static String getReportEmptyMessage() {
+ return nvls(raptorProperties.getProperty("no_rows_found"),"Your Search didn't yield any results.");
+ }
+
+ public static boolean showAnimatedChartOption() {
+ return nvls(raptorProperties.getProperty("show_animated_chart_option"),"N").trim().toUpperCase().startsWith("Y");
+ }
+
+ public static boolean showAnimatedChartOnly() {
+ return nvls(raptorProperties.getProperty("show_animated_chart_only"),"N").trim().toUpperCase().startsWith("Y");
+ }
+
+ public static boolean adjustContentBasedOnHeight() {
+ return nvls(raptorProperties.getProperty("adjust_content_based_on_height"),"N").trim().toUpperCase().startsWith("Y");
+ }
+
+ public static boolean disclaimerPositionedTopInCSVExcel() {
+ return nvls(raptorProperties.getProperty("disclaimer_positioned_top_in_csvexcel"),"N").trim().toUpperCase().startsWith("Y");
+ }
+
+ public static String customizedSubmitButtonText() {
+ return nvls(raptorProperties.getProperty("custom_submit_button_text"),"submit");
+ }
+
+ public static String customizedResetButtonText() {
+ return nvls(raptorProperties.getProperty("custom_reset_button_text"),"reset");
+ }
+ public static boolean customizeFormFieldLayout() {
+ return nvls(raptorProperties.getProperty("customize_formfield_layout"),"N").trim().toUpperCase().startsWith("Y");
+ }
+ public static String getRaptorTheme() {
+ return nvls(raptorProperties.getProperty("raptor_theme"),"default");
+ }
+
+ public static String getFormfieldAlignment() {
+ return nvls(raptorProperties.getProperty("formfield_alignment"),"left");
+ }
+
+ public static boolean displayExcelOptionInDashboard() {
+ return nvls(raptorProperties.getProperty("display_excel_option_in_dashboard"),"N").trim().toUpperCase().startsWith("Y");
+ }
+
+ public static boolean displayRuntimeOptionsAsDefault() {
+ return nvls(raptorProperties.getProperty("display_runtime_options_as_default"),"Y").trim().toUpperCase().startsWith("Y");
+ }
+
+ public static boolean displayHiddenFormfieldinExcel() {
+ return nvls(raptorProperties.getProperty("display_hidden_field_in_excel"),"N").trim().toUpperCase().startsWith("Y");
+ }
+
+ //ReportLoader.java
+ public static String getLoadCustomReportXml(){
+ return nvls(sqlProperty.getProperty("load.custom.report.xml"));
+ }
+
+ public static String getDBUpdateReportXml(){
+ return nvls(sqlProperty.getProperty("db.update.report.xml"));
+ }
+
+ public static String getUpdateCustomReportRec(){
+ return nvls(sqlProperty.getProperty("update.custom.report.rec"));
+ }
+
+ public static String getIsReportAlreadyScheduled(){
+ return nvls(sqlProperty.getProperty("is.report.already.scheduled"));
+ }
+
+ public static String getCreateCustomReportRec(){
+ return nvls(sqlProperty.getProperty("create.custom.report.rec"));
+ }
+
+ public static String getTheUserReportNames(){
+ return nvls(sqlProperty.getProperty("get.user.report.names"));
+ }
+
+ public static String getTheReportOwnerId(){
+ return nvls(sqlProperty.getProperty("get.report.owner.id"));
+ }
+
+ public static String getReportSecurity(){
+ return nvls(sqlProperty.getProperty("report.security.create"));
+ }
+
+ public static String getDeleteReportRecordLog(){
+ return nvls(sqlProperty.getProperty("delete.report.record.log"));
+ }
+
+ public static String getDeleteReportRecordUsers(){
+ return nvls(sqlProperty.getProperty("delete.report.record.users"));
+ }
+
+ public static String getDeleteReportRecordSchedule(){
+ return nvls(sqlProperty.getProperty("delete.report.record.schedule"));
+ }
+
+ public static String getDeleteReportRecordAccess(){
+ return nvls(sqlProperty.getProperty("delete.report.record.access"));
+ }
+
+ public static String getDeleteReportRecordEmail(){
+ return nvls(sqlProperty.getProperty("delete.report.record.email"));
+ }
+
+ public static String getDeleteReportRecordFavorite(){
+ return nvls(sqlProperty.getProperty("delete.report.record.favorite"));
+ }
+
+ public static String getDeleteReportRecordReport(){
+ return nvls(sqlProperty.getProperty("delete.report.record.report"));
+ }
+
+ public static String getLoadQuickLinks(){
+ return nvls(sqlProperty.getProperty("load.quick.links"));
+ }
+
+ public static String getLoadFolderReports(){
+ return nvls(sqlProperty.getProperty("load.folder.reports"));
+ }
+
+ public static String getLoadFolderReportsUser(){
+ return nvls(sqlProperty.getProperty("load.folder.reports.user"));
+ }
+
+ public static String getLoadFolderReportsPublicSql(){
+ return nvls(sqlProperty.getProperty("load.folder.reports.publicsql"));
+ }
+
+ public static String getLoadQuickDownloadLinks(){
+ return nvls(sqlProperty.getProperty("load.quick.download.links"));
+ }
+
+ public static String getLoadReportsToSchedule(){
+ return nvls(sqlProperty.getProperty("load.reports.to.schedule"));
+ }
+
+ public static String getLoadReportsToAddInDashboard(){
+ return nvls(sqlProperty.getProperty("load.reports.to.add.in.dashboard"));
+ }
+
+ public static String getLoadMyRecentLinks(){
+ return nvls(sqlProperty.getProperty("load.my.recent.links"));
+ }
+
+ public static String getCreateReportLogEntry(){
+ return nvls(sqlProperty.getProperty("create.report.log.entry"));
+ }
+
+ public static String getCreateReportLogEntryExecTime(){
+ return nvls(sqlProperty.getProperty("create.report.log.entry.exec.time"));
+ }
+
+ public static String getClearReportLogEntries(){
+ return nvls(sqlProperty.getProperty("clear.report.log.entries"));
+ }
+
+ public static String getLoadReportLogEntries(){
+ return nvls(sqlProperty.getProperty("load.report.log.entries"));
+ }
+
+ public static String getDoesUserCanScheduleReport(){
+ return nvls(sqlProperty.getProperty("does.user.can.schedule.report"));
+ }
+
+ public static String getDoesUserCanSchedule(){
+ return nvls(sqlProperty.getProperty("does.user.can.schedule"));
+ }
+
+ public static String getTheSystemDateTime(){
+ return nvls(sqlProperty.getProperty("get.system.date.time"));
+ }
+
+ public static String getTheNextDayDateTime(){
+ return nvls(sqlProperty.getProperty("get.next.day.date.time"));
+ }
+
+ public static String getTheNextFifteenMinDateTime(){
+ return nvls(sqlProperty.getProperty("get.next.fifteen.minutes.date.time"));
+ }
+
+ public static String getTheNextThirtyMinDateTime(){
+ return nvls(sqlProperty.getProperty("get.next.thirty.minutes.date.time"));
+ }
+
+ public static String getTheTemplateFile(){
+ return nvls(sqlProperty.getProperty("get.template.file"));
+ }
+
+ public static String getLoadPdfImgLookup(){
+ return nvls(sqlProperty.getProperty("load.pdf.img.lookup"));
+ }
+
+ public static String getLoadActionImgLookup(){
+ return nvls(sqlProperty.getProperty("load.action.img.lookup"));
+ }
+
+ //ActionHandler.java
+
+ public static String getReportValuesMapDefA(){
+ return nvls(sqlProperty.getProperty("report.values.map.def.a"));
+ }
+ public static String getReportValuesMapDefB(){
+ return nvls(sqlProperty.getProperty("report.values.map.def.b"));
+ }
+ public static String getReportValuesMapDefC(){
+ return nvls(sqlProperty.getProperty("report.values.map.def.c"));
+ }
+ public static String getReportValuesMapDefD(){
+ return nvls(sqlProperty.getProperty("report.values.map.def.d"));
+ }
+
+ public static String getTestSchedCondPopup(){
+ return nvls(sqlProperty.getProperty("test.sched.cond.popup"));
+ }
+
+ public static String getDownloadAllEmailSent(){
+ return nvls(sqlProperty.getProperty("download.all.email.sent"));
+ }
+
+ public static String getDownloadAllGenKey(){
+ return nvls(sqlProperty.getProperty("download.all.gen.key"));
+ }
+
+ public static String getDownloadAllRetrieve(){
+ return nvls(sqlProperty.getProperty("download.all.retrieve"));
+ }
+
+ public static String getDownloadAllInsert(){
+ return nvls(sqlProperty.getProperty("download.all.insert"));
+ }
+
+ //ReportWrapper.java
+
+ public static String getReportWrapperFormat(){
+ return nvls(sqlProperty.getProperty("report.wrapper.format"));
+ }
+
+ public static String getGenerateSubsetSql(){
+ return nvls(sqlProperty.getProperty("generate.subset.sql"));
+ }
+
+ public static String getReportSqlForFormfield(){
+ return nvls(sqlProperty.getProperty("formfield.id.name.sql"));
+ }
+
+ public static String getReportSqlForFormfieldPrefix(){
+ return nvls(sqlProperty.getProperty("formfield.id.name.sql.prefix"));
+ }
+
+ public static String getReportSqlForFormfieldSuffix(){
+ return nvls(sqlProperty.getProperty("formfield.id.name.sql.suffix"));
+ }
+
+ public static String getReportSqlOnlyFirstPart(){
+ return nvls(sqlProperty.getProperty("report.sql.only.first.part"));
+ }
+
+ public static String getReportSqlOnlySecondPartA(){
+ return nvls(sqlProperty.getProperty("report.sql.only.second.part.a"));
+ }
+
+ public static String getReportSqlOnlySecondPartB(){
+ return nvls(sqlProperty.getProperty("report.sql.only.second.part.b"));
+ }
+
+ public static String getReportSqlOnlySecondPartBNoOrderBy(){
+ return nvls(sqlProperty.getProperty("report.sql.only.second.part.b.noorderby"));
+ }
+
+ public static String getGenerateSqlVisualSelect(){
+ return nvls(sqlProperty.getProperty("generate.sql.visual.select"));
+ }
+
+ public static String getGenerateSqlVisualCount(){
+ return nvls(sqlProperty.getProperty("generate.sql.visual.count"));
+ }
+
+ public static String getGenerateSqlVisualDual(){
+ return nvls(sqlProperty.getProperty("generate.sql.visual.select"));
+ }
+
+ //ReportRuntime.java
+
+ public static String getLoadCrosstabReportData(){
+ return nvls(sqlProperty.getProperty("load.crosstab.report.data"));
+ }
+
+ //ReportRunHandler.java
+
+ public static String getGenerateSqlHandler(){
+ return nvls(sqlProperty.getProperty("generate.sql.handler"));
+ }
+
+ public static String getGenerateSqlSelect(){
+ return nvls(sqlProperty.getProperty("generate.sql.select"));
+ }
+
+ public static String getRemoteDbSchemaSql() {
+ return nvls(sqlProperty.getProperty("load.remoteDB.schema"));
+ }
+
+ public static String getRemoteDbSchemaSqlWithWhereClause() {
+ return nvls(sqlProperty.getProperty("load.remoteDB.schema.where"));
+ }
+
+ //ReportSchedule.java
+
+ public static String getLoadScheduleData(){
+ return nvls(sqlProperty.getProperty("load.schedule.data"));
+ }
+
+ public static String getLoadScheduleGetId(){
+ return nvls(sqlProperty.getProperty("load.schedule.getid"));
+ }
+
+ public static String getLoadScheduleUsers(){
+ return nvls(sqlProperty.getProperty("load.schedule.users"));
+ }
+
+ public static String getNewScheduleData(){
+ return nvls(sqlProperty.getProperty("new.schedule.data"));
+ }
+
+ public static String getNewReportData(){
+ return nvls(sqlProperty.getProperty("new.report.data"));
+ }
+
+ public static String getExecuteUpdate(){
+ return nvls(sqlProperty.getProperty("execute.update"));
+ }
+
+ public static String getExecuteUpdateUsers(){
+ return nvls(sqlProperty.getProperty("execute.update.users"));
+ }
+
+ public static String getExecuteUpdateRoles(){
+ return nvls(sqlProperty.getProperty("execute.update.roles"));
+ }
+
+ public static String getExecuteUpdateActivity(){
+ return nvls(sqlProperty.getProperty("execute.update.activity"));
+ }
+
+ public static String getDeleteScheduleData(){
+ return nvls(sqlProperty.getProperty("delete.schedule.data"));
+ }
+
+ public static String getDeleteScheduleDataUsers(){
+ return nvls(sqlProperty.getProperty("delete.schedule.data.users"));
+ }
+
+ public static String getDeleteScheduleDataId(){
+ return nvls(sqlProperty.getProperty("delete.schedule.data.id"));
+ }
+
+ public static String getLoadCondSql(){
+ return nvls(sqlProperty.getProperty("load.cond.sql"));
+ }
+
+ public static String getLoadCondSqlSelect(){
+ return nvls(sqlProperty.getProperty("load.cond.sql.select"));
+ }
+
+ public static String getPersistCondSqlUpdate(){
+ return nvls(sqlProperty.getProperty("persist.cond.sql.update"));
+ }
+
+ public static String getPersistCondSqlLarge(){
+ return nvls(sqlProperty.getProperty("persist.cond.sql.large"));
+ }
+
+ public static String getPersistCondSqlSet(){
+ return nvls(sqlProperty.getProperty("persist.cond.sql.set"));
+ }
+
+ //DataCache.java
+
+ public static String getTheDataViewActions(){
+ return nvls(sqlProperty.getProperty("get.data.view.actions"));
+ }
+
+ public static String getThePublicReportIdNames(){
+ return nvls(sqlProperty.getProperty("get.public.report.id.names"));
+ }
+
+ public static String getThePrivateAccessibleNamesA(){
+ return nvls(sqlProperty.getProperty("get.private.accessible.names.a"));
+ }
+ public static String getThePrivateAccessibleNamesIf(){
+ return nvls(sqlProperty.getProperty("get.private.accessible.names.if"));
+ }
+ public static String getThePrivateAccessibleNamesB(){
+ return nvls(sqlProperty.getProperty("get.private.accessible.names.b"));
+ }
+
+ public static String getTheGroupAccessibleNamesA(){
+ return nvls(sqlProperty.getProperty("get.group.accessible.names.a"));
+ }
+
+ public static String getTheGroupAccessibleNamesB(){
+ return nvls(sqlProperty.getProperty("get.group.accessible.names.b"));
+ }
+
+ public static String getTheReportTableSourcesA(){
+ return nvls(sqlProperty.getProperty("get.report.table.sources.a"));
+ }
+
+ public static String getTheReportTableSourcesWhere(){
+ return nvls(sqlProperty.getProperty("get.report.table.sources.where"));
+ }
+
+ public static String getTheReportTableSourcesIf(){
+ return nvls(sqlProperty.getProperty("get.report.table.sources.if"));
+ }
+
+ public static String getTheReportTableSourcesElse(){
+ return nvls(sqlProperty.getProperty("get.report.table.sources.else"));
+ }
+
+ public static String grabTheReportTableA(){
+ return nvls(sqlProperty.getProperty("grab.report.table.a"));
+ }
+
+ public static String grabTheReportTableIf(){
+ return nvls(sqlProperty.getProperty("grab.report.table.if"));
+ }
+
+ public static String grabTheReportTableElse(){
+ return nvls(sqlProperty.getProperty("grab.report.table.else"));
+ }
+
+ public static String grabTheReportTableB(){
+ return nvls(sqlProperty.getProperty("grab.report.table.b"));
+ }
+
+ public static String grabTheReportTableC(){
+ return nvls(sqlProperty.getProperty("grab.report.table.c"));
+ }
+
+ public static String getTheReportTableCrJoin(){
+ return nvls(sqlProperty.getProperty("get.report.table.crjoin"));
+ }
+
+ public static String getTheReportTableJoins(){
+ return nvls(sqlProperty.getProperty("get.report.table.joins"));
+ }
+
+ public static String getGenerateReportTableCol(){
+ return nvls(sqlProperty.getProperty("generate.report.table.col"));
+ }
+
+
+ public static String getGenerateDbUserSqlA(){
+ return nvls(sqlProperty.getProperty("generate.db.user.sql.a"));
+ }
+
+ public static String getGenerateDbUserSqlIf(){
+ return nvls(sqlProperty.getProperty("generate.db.user.sql.if"));
+ }
+
+ public static String getGenerateDbUserSqlElse(){
+ return nvls(sqlProperty.getProperty("generate.db.user.sql.else"));
+ }
+
+ public static String getGenerateDbUserSqlB(){
+ return nvls(sqlProperty.getProperty("generate.db.user.sql.b"));
+ }
+
+ public static String getGenerateDbUserSqlC(){
+ return nvls(sqlProperty.getProperty("generate.db.user.sql.c"));
+ }
+
+ public static String getGenerateDbUserSqlD(){
+ return nvls(sqlProperty.getProperty("generate.db.user.sql.d"));
+ }
+
+ //SearchHandler.java
+
+ public static String getLoadReportSearchResult(){
+ return nvls(sqlProperty.getProperty("load.report.search.result"));
+ }
+
+ public static String getLoadReportSearchInstr(){
+ return nvls(sqlProperty.getProperty("load.report.search.instr"));
+ }
+
+ public static String getLoadReportSearchResultUser(){
+ return nvls(sqlProperty.getProperty("load.report.search.result.user"));
+ }
+
+ public static String getLoadReportSearchResultPublic(){
+ return nvls(sqlProperty.getProperty("load.report.search.result.public"));
+ }
+
+ public static String getLoadReportSearchResultFav(){
+ return nvls(sqlProperty.getProperty("load.report.search.result.fav"));
+ }
+
+ public static String getLoadReportSearchResultSort(){
+ return nvls(sqlProperty.getProperty("load.report.search.result.sort"));
+ }
+
+ public static String getLoadFolderReportResult(){
+ return nvls(sqlProperty.getProperty("load.folder.report.result"));
+ }
+
+ public static String getLoadFolderReportResultSort(){
+ return nvls(sqlProperty.getProperty("load.folder.report..result.sort"));
+ }
+
+ //WizardProcessor.java
+
+ public static String getProcessFilterAddEdit(){
+ return nvls(sqlProperty.getProperty("process.filter.add.edit"));
+ }
+
+ //ReportDefinition.java
+
+ public static String getPersistReportAdhoc(){
+ return nvls(sqlProperty.getProperty("persist.report.adhoc"));
+ }
+
+ //Globals.java
+ public static String getInitializeRoles(){
+ return nvls(sqlProperty.getProperty("initialize.roles"));
+ }
+
+ public static String getInitializeVersion(){
+ return nvls(sqlProperty.getProperty("initialize.version"));
+ }
+
+ public static String getDBType(){
+ return nvls(raptorProperties.getProperty("db_type"), "oracle");
+ }
+
+ public static boolean isPostgreSQL(){
+ return getDBType().equals("postgresql");
+ }
+ public static boolean isMySQL(){
+ return getDBType().equals("mysql");
+ }
+ public static boolean isOracle(){
+ return getDBType().equals("oracle");
+ }
+
+ //scheduler
+ public static String getAvailableSchedules(){
+ return nvls(sqlProperty.getProperty("scheduler.available.schedules"));
+ }
+
+ public static String getCurrentDateString(){
+ return nvls(sqlProperty.getProperty("current.date.string"));
+ }
+
+ public static String getSchedulerUserEmails(){
+ return nvls(sqlProperty.getProperty("scheduler.user.emails"));
+ }
+
+ public static String getSqlConvertToRaw(){
+ return nvls(sqlProperty.getProperty("convert.to.raw"));
+ }
+
+ public static Properties getRaptorPdfProperties() {
+ return raptorPdfProperties;
+ }
+
+ public static void setRaptorPdfProperties(Properties raptorPdfProperties) {
+ Globals.raptorPdfProperties = raptorPdfProperties;
+ }
+
+ public static Properties getRaptorProperties() {
+ return raptorProperties;
+ }
+
+ public static void setRaptorProperties(Properties raptorProperties) {
+ Globals.raptorProperties = raptorProperties;
+ }
+
+ public static Properties getSqlProperty() {
+ return sqlProperty;
+ }
+
+ public static void setSqlProperty(Properties sqlProperty) {
+ Globals.sqlProperty = sqlProperty;
+ }
+
+ public static String getSequenceNextVal() {
+ return nvls(sqlProperty.getProperty("seq.next.val"));
+ }
+
+ public static String getRandomString() {
+ return nvls(sqlProperty.getProperty("seq.next.val"));
+ }
+
+ public static String getReportUserAccess(){
+ return nvls(sqlProperty.getProperty("report.user.access"));
+ }
+
+ public static String getAddUserAccess(){
+ return nvls(sqlProperty.getProperty("add.user.access"));
+ }
+
+ public static String getUpdateUserAccess(){
+ return nvls(sqlProperty.getProperty("update.user.access"));
+ }
+
+ public static String getRemoveUserAccess(){
+ return nvls(sqlProperty.getProperty("remove.user.access"));
+ }
+
+ public static String getAddRoleAccess(){
+ return nvls(sqlProperty.getProperty("add.role.access"));
+ }
+
+ public static String getUpdateRoleAccess(){
+ return nvls(sqlProperty.getProperty("update.role.access"));
+ }
+
+ public static String getRemoveRoleAccess(){
+ return nvls(sqlProperty.getProperty("remove.role.access"));
+ }
+
+ public static boolean isSystemInitialized() {
+ return systemInitialized;
+ }
+} // Globals
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/IAppUtils.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/IAppUtils.java
new file mode 100644
index 00000000..e239a3f9
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/IAppUtils.java
@@ -0,0 +1,175 @@
+/*-
+ * ================================================================================
+ * 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.system;
+
+import java.util.Vector;
+
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpServletRequest;
+
+import org.openecomp.portalsdk.analytics.error.RaptorException;
+
+public interface IAppUtils {
+ void initializeAppUtils(ServletContext servletContext);
+
+ /** Returns ID of the user currently logged in */
+ String getUserID(HttpServletRequest request);
+
+ /** Obtains user name by ID */
+ String getUserName(HttpServletRequest request);
+ String getUserName(String userId);
+
+ /** Obtains user email by ID */
+ String getUserEmail(HttpServletRequest request);
+ String getUserEmail(String userId);
+
+ /** Obtains user login ID */
+ String getUserLoginId(HttpServletRequest request);
+ String getUserLoginId(String userId);
+
+ /** Obtains user back door log id */
+ String getUserBackdoorLoginId(HttpServletRequest request);
+
+ /** Obtains list of all users (in IdNameValue objects) */
+ Vector getAllUsers(String customizedQuery, String param, boolean isAdmin);
+
+ /** Obtains role name by ID */
+ String getRoleName(String roleId);
+
+ /** Obtains list of all roles (in IdNameValue objects) */
+ Vector getAllRoles(String customizedQuery, String param, boolean isAdmin);
+
+ /** Checks whether the user currently logged in has the specified role */
+ // boolean isUserInRole(HttpServletRequest request, String roleId);
+ /** Checks whether the specified user has the specified role */
+ boolean isUserInRole(HttpServletRequest request, String roleId) throws RaptorException ;
+
+ /**
+ * Returns Vector containing the IDs of all the roles to which the user
+ * currently logged in belongs
+ */
+ // Vector getUserRoles(HttpServletRequest request);
+ /**
+ * Returns Vector containing the IDs of all the roles to which the specified
+ * user belongs
+ */
+ Vector getUserRoles(HttpServletRequest request)throws RaptorException;
+
+ Vector getUserRoles(String userID)throws RaptorException;
+ /** Empties cached lists of app users and roles */
+ void resetUserCache();
+
+ /** Returns the ID of the super role (all powerful) */
+ String getSuperRoleID();
+
+ /** Returns Vector containing the IDs of all Admin roles */
+ Vector getAdminRoleIDs();
+
+ /** Returns Temp folder file path */
+ String getTempFolderPath();
+
+ /** Returns Upload folder file path */
+ String getUploadFolderPath();
+
+ /** Returns Temp folder web URL */
+ String getTempFolderURL();
+
+ /** Returns Upload folder web URL */
+ String getUploadFolderURL();
+
+ /** Returns SMTP server to be used for notifications */
+ String getSMTPServer()throws RaptorException ;
+
+ /** Returns Encrypted SMTP server to be used for notifications */
+ String getEncryptedSMTPServer()throws RaptorException ;
+
+ /**
+ * Returns email address used for the "From" field in the system
+ * notifications
+ */
+ String getDefaultEmailSender() throws RaptorException;
+
+ /** Returns the application error page */
+ String getErrorPage();
+
+ /** Returns the application error page with menu for fusion*/
+ String getErrorPageWMenu();
+
+ /** Returns path to the folder containing JSP pages */
+ String getJspContextPath();
+
+ /** Returns web URL of the folder containing the images */
+ String getImgFolderURL();
+
+ /** Returns web URL to the base raptor folder */
+ String getBaseFolderURL();
+
+ /** Returns the URL used for executing a report - system specific */
+ // String getReportExecuteActionURL();
+ /** Returns the URL used for displaying data record - system specific */
+ // String getDataViewActionURL();
+ /**
+ * Returns the parameter name of the ID value used for displaying data
+ * record - system specific
+ */
+ // String getDataViewActionParam();
+ /** Returns full web URL for direct access to execute a report */
+ String getDirectAccessURL();
+
+ /** Returns the URL of the controller servlet - system specific */
+ String getBaseActionURL();
+
+ /** Returns the base URL of the NG report - system specific */
+ String getBaseActionURLNG();
+
+ /** Returns the URL of the Report Run specifc to AngularJS */
+ String getDrillActionURL();
+
+ /** Returns the primary parameter name - system specific */
+ String getBaseActionParam();
+
+ /** Returns Vector containing menu IDs for quick links */
+ Vector getQuickLinksMenuIDs();
+
+ /** Obtains menu label by ID */
+ String getMenuLabel(String menuId);
+
+ /**
+ * SQL for loading the screen labels and restricting to active cols only for
+ * report columns; can return null => use straight data dictionary For
+ * PRISMS - based on "useFieldTable" config parameter
+ */
+ String getReportDbColsMaskSQL();
+
+ /**
+ * SQL for replacing lookup tables with id and name values; can return null =>
+ * do NOT replace lookups Returns SQL with columns - Table_name, Field_name,
+ * New_Lookup_Table_name, New_Lookup_Id_Field_name,
+ * New_Lookup_Name_Field_name For PRISMS - based on "useFieldTable" config
+ * parameter
+ */
+ String getReportDbLookupsSQL();
+
+ /** Obtains menu label by ID */
+ void processErrorNotification(HttpServletRequest request, RaptorException e);
+
+ /** Returns Excel template PATH web URL */
+ String getExcelTemplatePath();
+} // IAppUtils
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/IDbUtils.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/IDbUtils.java
new file mode 100644
index 00000000..5ee42719
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/IDbUtils.java
@@ -0,0 +1,35 @@
+/*-
+ * ================================================================================
+ * 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.system;
+
+import java.sql.Connection;
+
+import javax.servlet.ServletContext;
+
+import org.openecomp.portalsdk.analytics.error.ReportSQLException;
+
+public interface IDbUtils {
+ void initializeDbUtils(ServletContext servletContext);
+
+ Connection getConnection() throws ReportSQLException ;
+
+ void clearConnection(Connection con) throws ReportSQLException ;
+
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/RDbUtils.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/RDbUtils.java
new file mode 100644
index 00000000..b9753a51
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/RDbUtils.java
@@ -0,0 +1,36 @@
+/*-
+ * ================================================================================
+ * 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.system;
+
+import java.sql.Connection;
+
+import javax.servlet.ServletContext;
+
+import org.openecomp.portalsdk.analytics.error.ReportSQLException;
+
+public interface RDbUtils {
+
+ void initializeDbUtils(ServletContext servletContext);
+
+ Connection getRemoteConnection(String dbKey)throws ReportSQLException;
+
+ void clearConnection(Connection con)throws ReportSQLException;
+
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/RemDbUtils.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/RemDbUtils.java
new file mode 100644
index 00000000..733a0a38
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/RemDbUtils.java
@@ -0,0 +1,200 @@
+/*-
+ * ================================================================================
+ * 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.system;
+
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+
+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.util.DataSet;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+
+public class RemDbUtils /* implements IDbUtils */{
+
+ static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(RemDbUtils.class);
+
+
+
+ public RemDbUtils() {
+ }
+
+ public static Connection getConnection(String dbKey) throws ReportSQLException {
+ return Globals.getRDbUtils().getRemoteConnection(dbKey);
+ } // getConnection
+
+ public static void clearConnection(Connection con) throws ReportSQLException {
+ try {
+ if ((con != null) && !con.isClosed())
+ Globals.getRDbUtils().clearConnection(con);
+ } catch (SQLException ex) { throw new ReportSQLException(ex.getMessage()); }
+
+ } // clearConnection
+
+ public static Connection startTransaction(String dbKey) throws RaptorException {
+ Connection con = null;
+ try {
+ con = getConnection(dbKey);
+ con.setAutoCommit(false);
+ } catch (SQLException ex) {
+ throw new RaptorRuntimeException (ex.getMessage(), ex.getCause());
+ } catch (Exception ex2 ) {
+ throw new RaptorException (ex2.getMessage(), ex2.getCause());
+ }
+ return con;
+ } // startTransaction
+
+ public static void commitTransaction(Connection con) throws RaptorException {
+ try {
+ con.commit();
+ } catch (SQLException ex) {
+ throw new RaptorRuntimeException (ex.getMessage(), ex.getCause());
+ } catch (Exception ex2 ) {
+ throw new RaptorException (ex2.getMessage(), ex2.getCause());
+ }
+ //clearConnection(con);
+ } // commitTransaction
+
+ public static void rollbackTransaction(Connection con) throws RaptorException {
+ try {
+ con.rollback();
+ clearConnection(con);
+ } catch (SQLException ex) {
+ throw new RaptorRuntimeException (ex.getMessage(), ex.getCause());
+ } catch (Exception ex2 ) {
+ throw new RaptorException (ex2.getMessage(), ex2.getCause());
+ }
+ } // rollbackTransaction
+
+// public static String executeCall(Connection con, String sql, boolean expectResult)
+// throws ReportSQLException, Exception {
+// String result = null;
+//
+// try {
+// if(con.isClosed()) con = getConnection();
+// Log.write("[SQL Call] " + sql, 4);
+// CallableStatement stmt = con.prepareCall(sql);
+// if (expectResult)
+// stmt.registerOutParameter(1, Types.CHAR);
+// stmt.executeUpdate();
+// if (expectResult)
+// result = stmt.getString(1);
+// stmt.close();
+// con.commit();
+// } catch (SQLException e) {
+// throw new ReportSQLException(e.getMessage(), sql);
+// } finally {
+// clearConnection(con);
+// }
+//
+// return result;
+// } // executeCall
+//
+// public static String executeCall(String sql, boolean expectResult)
+// throws ReportSQLException, Exception {
+// Connection con = null;
+// try {
+// con = getConnection();
+// String result = executeCall(con, sql, expectResult);
+// return result;
+// } catch (SQLException e) {
+// throw new ReportSQLException(e.getMessage(), sql);
+// }
+// } // executeCall
+//
+// public static int executeUpdate(Connection con, String sql) throws ReportSQLException, Exception {
+// try {
+// if(con.isClosed()) con = getConnection();
+// Statement stmt = con.createStatement();
+//
+// int rcode = -1;
+// try {
+// Log.write("[SQL Update] " + sql, 4);
+// rcode = stmt.executeUpdate(sql);
+// stmt.close();
+// con.commit();
+// } finally {
+// clearConnection(con);
+// }
+//
+// return rcode;
+// } catch (SQLException e) {
+// throw new ReportSQLException(e.getMessage(), sql);
+// } finally {
+// clearConnection(con);
+// }
+// } // executeUpdate
+//
+// public static int executeUpdate(String sql) throws ReportSQLException, Exception {
+// Connection con = null;
+// try {
+// con = getConnection();
+// int rcode = executeUpdate(con, sql);
+// return rcode;
+// } catch (SQLException e) {
+// throw new ReportSQLException(e.getMessage(), sql);
+// }
+// } // executeUpdate
+
+ public static DataSet executeQuery(Connection con, String sql, String dbKey) throws ReportSQLException, Exception {
+ return executeQuery(con, sql, Integer.MAX_VALUE,dbKey);
+ } // executeQuery
+
+ public static DataSet executeQuery(Connection con, String sql, int maxRowLimit, String dbKey)
+ throws ReportSQLException {
+ try {
+ if (con==null || con.isClosed()) con = getConnection(dbKey);
+ if(con==null) throw new ReportSQLException("Remote Connection not configured for "+ dbKey);
+ Statement stmt = con.createStatement();
+ logger.debug(EELFLoggerDelegate.debugLogger, ("[SQL CALL FROM RAPTOR] [SQL] " + sql));
+ ResultSet rs = stmt.executeQuery(sql);
+ DataSet ds = new DataSet(rs, maxRowLimit);
+ if(rs!=null)
+ rs.close();
+ if(stmt!=null)
+ stmt.close();
+
+ return ds;
+ } catch (SQLException e) {
+ throw new ReportSQLException(e.getMessage(), sql, e.getCause());
+ }
+ } // executeQuery
+
+ public static DataSet executeQuery(String sql,String dbKey) throws ReportSQLException {
+ return executeQuery(sql, Integer.MAX_VALUE, dbKey);
+ } // executeQuery
+
+ public static DataSet executeQuery(String sql, int maxRowLimit, String dbKey) throws ReportSQLException{
+ Connection con = null;
+ try {
+ con = getConnection(dbKey);
+ return executeQuery(con, sql, maxRowLimit,dbKey);
+ } catch (ReportSQLException e) {
+ throw new ReportSQLException(e.getMessage(), sql, e.getCause());
+ } finally {
+ clearConnection(con);
+ }
+ } // executeQuery
+
+} // DbUtils
+
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/AntBuild.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/AntBuild.java
new file mode 100644
index 00000000..724a07d3
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/AntBuild.java
@@ -0,0 +1,66 @@
+/*-
+ * ================================================================================
+ * 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.system.fusion;
+
+import java.io.IOException;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.jar.Attributes;
+import java.util.jar.JarFile;
+import java.util.jar.Manifest;
+
+/**
+ * This class is used to get version and Build information when
+ * user run "java -jar raptor_fusion.jar" command.
+ */
+public class AntBuild {
+
+ public static void main(String[] args) {
+ System.out.println("Jar (raptor_fusion.jar) Information: ");
+ readManifest();
+ }
+
+ public static void readManifest() {
+ try {
+ JarFile jar = new JarFile("./raptor_fusion.jar");
+ Manifest manifest = jar.getManifest();
+
+ Attributes attribs = manifest.getMainAttributes();
+ Iterator it = attribs.entrySet().iterator();
+ while(it.hasNext()) {
+ Map.Entry entry = (Map.Entry) it.next();
+ Attributes.Name attributeName = (Attributes.Name) entry.getKey();
+ String attributeValue = (String) entry.getValue();
+ if (attributeName.toString().equals("Created-By"))
+ System.out.println("JDK Version " + " : " + attributeValue);
+ else if (attributeName.toString().equals("Ant-Version"))
+ System.out.println(attributeName.toString() + " : " + attributeValue);
+ else {
+ if(attributeName.toString().startsWith("Raptor"))
+ System.out.println(attributeName.toString() + " : " + attributeValue);
+ }
+ }
+
+ } catch (IOException e) {
+ System.err.println("Cannot read jar-file manifest: "
+ + e.getMessage());
+ }
+ }
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/AppUtils.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/AppUtils.java
new file mode 100644
index 00000000..008a1d8c
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/AppUtils.java
@@ -0,0 +1,363 @@
+/*-
+ * ================================================================================
+ * 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.system.fusion;
+
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+import java.util.StringTokenizer;
+import java.util.Vector;
+
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpServletRequest;
+
+import org.openecomp.portalsdk.analytics.config.ConfigLoader;
+import org.openecomp.portalsdk.analytics.error.RaptorException;
+import org.openecomp.portalsdk.analytics.model.base.IdNameValue;
+import org.openecomp.portalsdk.analytics.system.Globals;
+import org.openecomp.portalsdk.analytics.system.IAppUtils;
+import org.openecomp.portalsdk.analytics.system.fusion.adapter.RaptorAdapter;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;;
+
+public class AppUtils extends org.openecomp.portalsdk.analytics.RaptorObject implements IAppUtils {
+
+ EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(AppUtils.class);
+
+
+ private static String tempFolderPath = "/artemis/PROJECT1/MSA/databank/WEB-INF/temp/";
+ private static String uploadFolderPath = "/artemis/PROJECT1/MSA/databank/WEB-INF/upload/";
+ private static String tempFolderURL = "temp/";
+ private static String uploadFolderURL = "upload/";
+ private static String SMTPServer = "todo.smtp.server.com";
+ private static String defaultEmailSender = "todo.email.sender.com";
+ private static String errorPage = "error_page";
+ private static String errorPageWMenu = "error_page_wmenu";
+ private static String jspContextPath = "raptor/";
+ private static String imgFolderURL = "raptor/images/";
+ private static String baseFolderURL = "raptor/";
+ //private static String reportExecuteActionURL = "dispatcher?action=raptor&r_action=report.run&c_master=";
+ //private static String dataViewActionURL = "dispatcher?action="; // dispatcher?action=ACTION_ID&c_master=REC_ID
+ //private static String dataViewActionParam = "c_master=";
+ private static String directAccessURL = "http://localhost:8082/databank/dispatcher?direct.access=raptor&r_action=report.run&show=";
+ private static String baseActionURL = "dispatcher?action="; // dispatcher?action=ACTION_ID&c_master=REC_ID or dispatcher?action=raptor&r_action=RAPTOR_ACTION_ID&c_master=REC_ID
+ private static String baseActionURLNG = "report#/"; // dispatcher?action=ACTION_ID&c_master=REC_ID or dispatcher?action=raptor&r_action=RAPTOR_ACTION_ID&c_master=REC_ID
+ private static String drillActionURL = "dispatcher?action="; // dispatcher?action=ACTION_ID&c_master=REC_ID or dispatcher?action=raptor&r_action=RAPTOR_ACTION_ID&c_master=REC_ID
+ private static String baseActionParam = "c_master=";
+ private static String superRoleID = "1";
+ private static Vector adminRoleIDs = new Vector();
+ private static Vector quickLinksMenuIDs = new Vector();
+
+ private static Properties raptorAppProperties;
+
+ private static String encryptedSMTPServer = "";
+ public AppUtils() {}
+
+ public void initializeAppUtils(ServletContext servletContext) {
+ try {
+ Properties appProperties = ConfigLoader.getProperties(servletContext, ConfigLoader.APP_PROPERTIES, Globals.getSystemType());
+ raptorAppProperties = appProperties;
+ tempFolderPath = appProperties.getProperty("temp_folder_path");
+ uploadFolderPath = appProperties.getProperty("upload_folder_path");
+ tempFolderURL = appProperties.getProperty("temp_folder_url");
+ uploadFolderURL = appProperties.getProperty("upload_folder_url");
+ SMTPServer = appProperties.getProperty("smtp_server");
+ encryptedSMTPServer = appProperties.getProperty("encrypted_smtp_server");
+ defaultEmailSender = appProperties.getProperty("default_email_sender");
+ errorPage = appProperties.getProperty("error_page");
+ jspContextPath = appProperties.getProperty("jsp_context_path");
+ imgFolderURL = appProperties.getProperty("img_folder_url");
+ baseFolderURL = appProperties.getProperty("base_folder_url");
+/* reportExecuteActionURL = appProperties.getProperty("report_execute_action_url");
+ dataViewActionURL = appProperties.getProperty("data_view_action_url");
+ dataViewActionParam = appProperties.getProperty("data_view_action_param");*/
+ directAccessURL = appProperties.getProperty("direct_access_url");
+ baseActionURL = appProperties.getProperty("base_action_url");
+ baseActionURLNG = appProperties.getProperty("base_action_url_ng");
+ drillActionURL = appProperties.getProperty("drill_action_url");
+ baseActionParam = appProperties.getProperty("base_action_param");
+ superRoleID = appProperties.getProperty("super_role_id");
+
+ adminRoleIDs.removeAllElements();
+ StringTokenizer st = new StringTokenizer(appProperties.getProperty("admin_role_ids"), ",");
+ while(st.hasMoreTokens())
+ adminRoleIDs.add(st.nextToken());
+
+ quickLinksMenuIDs.removeAllElements();
+ st = new StringTokenizer(appProperties.getProperty("quick_links_menu_ids"), ",");
+ while(st.hasMoreTokens())
+ quickLinksMenuIDs.add(st.nextToken());
+ } catch(Exception e) {
+ logger.error(EELFLoggerDelegate.debugLogger, ("[EXCEPTION ENCOUNTERED IN RAPTOR] AppUtils.initializeAppUtils: Unable to load properties ["+Globals.getSystemType()+"_"+ConfigLoader.APP_PROPERTIES+"]. Exception: "+e.getMessage()));
+ //throw new RuntimeException(e.getMessage());
+ }
+ } // initializeAppUtils
+
+ public static void getFullURL(HttpServletRequest req) {
+ String applicationBase = "";
+ if (applicationBase == null) {
+ applicationBase = req.getScheme() + "://" + req.getServerName() +
+ getPort(req) + req.getContextPath();
+ }
+ }
+
+ private static String getPort(HttpServletRequest req) {
+ if ("http".equalsIgnoreCase(req.getScheme()) && req.getServerPort() != 80 ||
+ "https".equalsIgnoreCase(req.getScheme()) && req.getServerPort() != 443 ) {
+ return (":" + req.getServerPort());
+ } else {
+ return "";
+ }
+ }
+ public String getUserID(HttpServletRequest request) {
+ String pdfAttachmentKey = org.openecomp.portalsdk.analytics.system.AppUtils.getRequestValue(request, "pdfAttachmentKey");
+ String report_email_sent_log_id = org.openecomp.portalsdk.analytics.system.AppUtils.getRequestValue(request, "log_id");
+ boolean isEmailAttachment = false;
+ if(pdfAttachmentKey != null && report_email_sent_log_id !=null)
+ isEmailAttachment = true;
+ if(isEmailAttachment) {
+ return RaptorAdapter.getUserID(org.openecomp.portalsdk.analytics.system.AppUtils.getRequestValue(request, "user_id"));
+ } else
+ return RaptorAdapter.getUserID(request);
+ } // getUserID
+
+ public Vector getAllUsers(String customizedQuery, String param, boolean isAdmin) {
+ Map map = RaptorAdapter.getAllUsers(customizedQuery, param, isAdmin);
+
+ Vector vector = new Vector(map.size());
+ for(Iterator iter=map.keySet().iterator(); iter.hasNext(); ) {
+ Long key = (Long) iter.next();
+ vector.add(new IdNameValue(""+key, (String) map.get(key)));
+ } // for
+
+ return vector;
+ } // getAllUsers
+
+ public String getRoleName(String roleId) {
+ return RaptorAdapter.getRoleName(roleId);
+ } // getRoleName
+
+ public Vector getAllRoles(String customizedQuery, String param, boolean isAdmin) {
+ Map map = RaptorAdapter.getAllRolesUsingCustomizedQuery(customizedQuery, param, isAdmin);
+
+ Vector vector = new Vector(map.size());
+ for(Iterator iter=map.keySet().iterator(); iter.hasNext(); ) {
+ Long key = (Long) iter.next();
+ vector.add(new IdNameValue(""+key, (String) map.get(key)));
+ } // for
+
+ return vector;
+ } // getAllRoles
+
+ public String getUserName(HttpServletRequest request) {
+ return RaptorAdapter.getUserName(request);
+ } // getUserName
+
+ public String getUserName(String userId) {
+ return RaptorAdapter.getUserName(userId);
+ } // getUserName
+
+ public String getUserEmail(String userId) {
+ return RaptorAdapter.getUserEmail(userId);
+ } // getUserEmail
+
+ public String getUserEmail(HttpServletRequest request) {
+ return RaptorAdapter.getUserEmail(request);
+ } // getUserEmail
+
+ public String getUserLoginId(HttpServletRequest request) {
+ return RaptorAdapter.getUserLoginId(request);
+ } // getUserLoginId
+
+ public String getUserLoginId(String userId) {
+ return RaptorAdapter.getUserLoginId(userId);
+ } // getUserLoginId
+
+ public String getUserBackdoorLoginId(HttpServletRequest request) {
+ String pdfAttachmentKey = org.openecomp.portalsdk.analytics.system.AppUtils.getRequestValue(request, "pdfAttachmentKey");
+ String report_email_sent_log_id = org.openecomp.portalsdk.analytics.system.AppUtils.getRequestValue(request, "log_id");
+ boolean isEmailAttachment = false;
+ if(pdfAttachmentKey != null && report_email_sent_log_id !=null)
+ isEmailAttachment = true;
+ if(isEmailAttachment) {
+ return RaptorAdapter.getUserBackdoorLoginId(org.openecomp.portalsdk.analytics.system.AppUtils.getRequestValue(request, "user_id"));
+ } else
+ return RaptorAdapter.getUserBackdoorLoginId(request);
+ } // getUserBackdoorLoginId
+
+ public boolean isUserInRole(HttpServletRequest request, String roleId) {
+ return RaptorAdapter.isCurrentUserInRole(request, roleId);
+ } // isUserInRole
+
+ public Vector getUserRoles(HttpServletRequest request) {
+// Map map = RaptorAdapter.getAllRoles(userId);
+ Set set = RaptorAdapter.getUserRoles(request);
+
+ Vector vector = new Vector(set.size());
+ for(Iterator iter=set.iterator(); iter.hasNext(); ) {
+ Long key = (Long) iter.next();
+ vector.add(""+key);
+ //vector.add(new IdNameValue(""+key, (String) map.get(key)));
+ } // for
+
+ return vector;
+ } // getUserRoles
+
+ public Vector getUserRoles(String userId) {
+ Set set = RaptorAdapter.getUserRoles(userId);
+
+ Vector vector = new Vector(set.size());
+ for(Iterator iter=set.iterator(); iter.hasNext(); ) {
+ Long key = (Long) iter.next();
+ vector.add(""+key);
+ //vector.add(new IdNameValue(""+key, (String) map.get(key)));
+ } // for
+
+ return vector;
+ //return null;
+ } // getUserRoles
+
+ public void resetUserCache() {
+ //org.openecomp.portalsdk.core.web.support.AppUtils.removeObjectFromCache(RaptorAdapter.KEY_USER_ROLES_CACHE);
+ } // resetUserCache
+
+ public String getSuperRoleID(){
+ return superRoleID;
+ } // getSuperRoleID
+
+ public Vector getAdminRoleIDs(){
+ return adminRoleIDs;
+ } // getAdminRoleIDs
+
+
+ public String getTempFolderPath() {
+ return tempFolderPath;
+ } // getTempFolderPath
+
+ public String getUploadFolderPath() {
+ return uploadFolderPath;
+ } // getUploadFolderPath
+
+ public String getTempFolderURL() {
+ return tempFolderURL;
+ } // getTempFolderURL
+
+ public String getUploadFolderURL() {
+ return uploadFolderURL;
+ } // getUploadFolderURL
+
+ public String getSMTPServer() {
+ return SMTPServer;
+ } // getSMTPServer
+
+ public String getDefaultEmailSender() {
+ return defaultEmailSender;
+ } // getDefaultEmailSender
+
+ public String getErrorPage() {
+ return errorPage;
+ } // getErrorPage
+
+ public String getJspContextPath() {
+ return jspContextPath;
+ } // getJspContextPath
+
+ public String getImgFolderURL() {
+ return imgFolderURL;
+ } // getImgFolderURL
+
+ public String getBaseFolderURL() {
+ return baseFolderURL;
+ } // getBaseFolderURL
+
+/* public String getReportExecuteActionURL() {
+ return reportExecuteActionURL;
+ } // getReportExecuteActionURL
+
+ public String getDataViewActionURL() {
+ return dataViewActionURL;
+ } // getDataViewActionURL
+
+ public String getDataViewActionParam() {
+ return dataViewActionParam;
+ } // getDataViewActionParam
+*/
+ public String getDirectAccessURL() {
+ return directAccessURL.trim();
+ } // getDirectAccessURL
+
+ public String getBaseActionURL() {
+ return baseActionURL;
+ } // getBaseActionURL
+
+ public String getBaseActionURLNG() {
+ return baseActionURLNG;
+ } // getBaseActionURLNG
+
+ public String getDrillActionURL() {
+ return drillActionURL;
+ } // getBaseActionURL
+
+ public String getBaseActionParam() {
+ return baseActionParam;
+ } // getBaseActionParam
+
+ public Vector getQuickLinksMenuIDs(){
+ return quickLinksMenuIDs;
+ } // getQuickLinksMenuIDs
+
+ public String getMenuLabel(String menuId) {
+ //return menuId.substring(0, 1).toUpperCase()+menuId.substring(1).toLowerCase();
+ return menuId;
+ } // getMenuLabel
+
+ public String getReportDbColsMaskSQL() {
+ return null;
+/* Example:
+ return "SELECT f.table_name, UPPER(f.column_name) column_name, f.label "+
+ "FROM fields f WHERE f.active_yn = 'Y'"; */
+ } // getReportDbColsMaskSQL
+
+ public String getReportDbLookupsSQL() {
+ return null;
+/* Example:
+ return "SELECT DISTINCT f.table_name, UPPER(f.column_name) column_name, f.lookup_table, f.lookup_id_field, f.lookup_name_field "+
+ "FROM fields f WHERE f.active_yn = 'Y'"; */
+ } // getReportDbLookupsSQL
+
+ public void processErrorNotification(HttpServletRequest request, RaptorException e) {
+ //RaptorAdapter.processErrorNotification(request, e);
+} // processErrorNotification
+
+ public String getErrorPageWMenu() {
+ return errorPageWMenu;
+ }
+
+ public String getExcelTemplatePath() {
+ return nvls(raptorAppProperties.getProperty("excel_template_path"), "");
+ }
+ /**
+ * @return the encryptedSMTPServer
+ */
+ public String getEncryptedSMTPServer() {
+ return encryptedSMTPServer;
+ }
+
+} // AppUtils
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/DbUtils.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/DbUtils.java
new file mode 100644
index 00000000..4638f3e3
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/DbUtils.java
@@ -0,0 +1,75 @@
+/*-
+ * ================================================================================
+ * 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.system.fusion;
+
+import java.sql.Connection;
+
+import javax.servlet.ServletContext;
+
+import org.openecomp.portalsdk.analytics.system.IDbUtils;
+import org.openecomp.portalsdk.analytics.system.fusion.adapter.FusionAdapter;
+import org.openecomp.portalsdk.analytics.system.fusion.adapter.RaptorAdapter;
+import org.openecomp.portalsdk.analytics.system.fusion.adapter.SpringContext;
+import org.springframework.beans.factory.annotation.Autowired;
+
+
+
+public class DbUtils implements IDbUtils {
+
+ @Autowired
+ public RaptorAdapter raptorAdapter;
+ @Autowired
+ public FusionAdapter fusionAdapter;
+
+ public DbUtils() {}
+
+ public void initializeDbUtils(ServletContext servletContext) {
+ raptorAdapter = (RaptorAdapter)SpringContext.getApplicationContext().getBean("raptorAdapter");
+ } // initializeDbUtils
+
+ public Connection getConnection() {
+ return raptorAdapter.getConnection();
+ } // getConnection
+
+ public void clearConnection(Connection con) {
+ raptorAdapter.releaseConnection(con);
+ } // clearConnection
+
+ public RaptorAdapter getRaptorAdapter() {
+ return raptorAdapter;
+ }
+
+ public void setRaptorAdapter(RaptorAdapter raptorAdapter) {
+ this.raptorAdapter = raptorAdapter;
+ }
+
+ public FusionAdapter getFusionAdapter() {
+ return fusionAdapter;
+ }
+
+ public void setFusionAdapter(FusionAdapter fusionAdapter) {
+ this.fusionAdapter = fusionAdapter;
+ }
+
+
+
+
+
+} // DbUtils
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/RemoteDbUtils.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/RemoteDbUtils.java
new file mode 100644
index 00000000..4f8f7427
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/RemoteDbUtils.java
@@ -0,0 +1,50 @@
+/*-
+ * ================================================================================
+ * 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.system.fusion;
+
+import java.sql.Connection;
+
+import javax.servlet.ServletContext;
+
+import org.openecomp.portalsdk.analytics.system.RDbUtils;
+import org.openecomp.portalsdk.analytics.system.fusion.adapter.RaptorAdapter;
+import org.openecomp.portalsdk.analytics.system.fusion.adapter.SpringContext;
+
+
+
+public class RemoteDbUtils implements RDbUtils{
+
+ private RaptorAdapter raptorAdapter;
+
+
+ public void initializeDbUtils(ServletContext servletContext) {
+ raptorAdapter = (RaptorAdapter)SpringContext.getApplicationContext().getBean("raptorAdapter");
+ } // initializeDbUtils
+
+
+ public Connection getRemoteConnection(String dbKey) {
+ return raptorAdapter.getConnection(dbKey);
+ }
+
+ public void clearConnection(Connection conn) {
+ raptorAdapter.releaseConnection(conn);
+ }
+
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/adapter/AdapterSessionFactoryContainer.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/adapter/AdapterSessionFactoryContainer.java
new file mode 100644
index 00000000..1e2de464
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/adapter/AdapterSessionFactoryContainer.java
@@ -0,0 +1,39 @@
+/*-
+ * ================================================================================
+ * 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.system.fusion.adapter;
+
+import java.util.LinkedHashMap;
+
+public class AdapterSessionFactoryContainer {
+
+ private LinkedHashMap sessionFactories;
+
+ public AdapterSessionFactoryContainer() {
+ }
+
+ public LinkedHashMap getSessionFactories() {
+ return sessionFactories;
+ }
+
+ public void setSessionFactories(LinkedHashMap sessionFactories) {
+ this.sessionFactories = sessionFactories;
+ }
+
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/adapter/DateUtils.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/adapter/DateUtils.java
new file mode 100644
index 00000000..a9ea0979
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/adapter/DateUtils.java
@@ -0,0 +1,287 @@
+/*-
+ * ================================================================================
+ * 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.system.fusion.adapter;
+
+
+import java.io.Serializable;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.List;
+import java.util.TimeZone;
+
+import org.openecomp.portalsdk.core.FusionObject;
+import org.openecomp.portalsdk.core.domain.User;
+import org.openecomp.portalsdk.core.service.DataAccessService;
+import org.openecomp.portalsdk.core.util.SystemProperties;
+import org.openecomp.portalsdk.core.web.support.AppUtils;
+
+
+public class DateUtils implements Serializable, FusionObject{
+
+ public static final String US_PACIFIC = "US/Pacific";
+ public static final String US_MOUNTAIN = "US/Mountain";
+ public static final String US_CENTRAL = "US/Central";
+ public static final String US_EASTERN = "US/Eastern";
+ public static final String US_HAWAII = "US/Hawaii";
+ public static final String US_ALASKA = "US/Alaska";
+
+ //Arizona State has Mountain Time with no Daylight Savings
+ public static final String US_ARIZONA = "America/Phoenix";
+
+ private static final String DB_DATE_FORMAT = "yyyy-MM-dd HH:mm:ss";
+ private static final String GET_CURRENT_DATE = "getCurrentDate";
+
+ private static DataAccessService dataAccessService;
+
+ public static DataAccessService getDataAccessService() {
+ return dataAccessService;
+ }
+
+ public void setDataAccessService(DataAccessService dataAccessService) {
+ this.dataAccessService = dataAccessService;
+ }
+
+ /**
+ * Parses a date value with given pattern,
+ * to return a Date Object
+ *
+ * @param dateValue
+ * @param inPattern
+ * @return Date Object
+ * @throws Exception
+ *
+ */
+ public static Date parseDate(String dateValue,String inPattern) throws Exception{
+ return parseDate(dateValue,inPattern,null);
+ }
+
+ /**
+ * Parses a date value with the given pattern for the specific TimeZone,
+ * to return a Date Object
+ *
+ * @param dateValue
+ * @param inPattern
+ * @param currentTimeZone
+ * @return Date Object
+ * @throws Exception
+ *
+ */
+ public static Date parseDate(String dateValue,String inPattern,
+ String currentTimeZone) throws Exception{
+ DateFormat df = new SimpleDateFormat(inPattern);
+ if(currentTimeZone !=null && !(currentTimeZone.trim().equals(""))){
+ df.setTimeZone(TimeZone.getTimeZone(currentTimeZone));
+ }
+ Date date = df.parse(dateValue);
+ return date;
+ }
+
+ /**
+ * Parses a date value with the given pattern for the specific User(in User TimeZone),
+ * to return a Date Object
+ *
+ * @param dateValue
+ * @param inPattern
+ * @param userId
+ * @return Date Object
+ * @throws Exception
+ *
+ */
+ public static Date parseUserDate(String dateValue, String inPattern, Long userId) throws Exception{
+ User user = (User)getDataAccessService().getDomainObject(User.class, userId, null);
+
+ String userTimeZone = null;
+ Long timezoneId = user.getTimeZoneId();
+
+ if (timezoneId != null) {
+ userTimeZone = AppUtils.getLookupValueByLabel(timezoneId.toString(), "fn_lu_timezone", "timezone_id", "timezone_value");
+ }
+
+ return parseDate(dateValue,inPattern,userTimeZone);
+ }
+
+ /**
+ * Formats a given date object to the desired pattern
+ *
+ * @param date
+ * @param outPattern
+ * @return Formatted date value
+ * @throws Exception
+ */
+ public static String formatDate(Date date,String outPattern)throws Exception{
+ return formatDate(date,outPattern,null);
+ }
+
+ /**
+ * Formats a date value with the given pattern into a date value with the desired pattern
+ *
+ * @param dateValue
+ * @param inPattern
+ * @param outPattern
+ * @return Formatted date value
+ * @throws Exception
+ *
+ */
+ public static String formatDate(String dateValue,String inPattern,
+ String outPattern) throws Exception{
+ return formatDate(dateValue,inPattern,null,outPattern,null);
+ }
+
+ /**
+ * Formats a given date object to the desired pattern for the TimeZone provided
+ * @param date
+ * @param outPattern
+ * @param requiredTimeZone
+ * @return Formatted date value
+ * @throws Exception
+ */
+ public static String formatDate(Date date,String outPattern,
+ String requiredTimeZone) throws Exception{
+ DateFormat df = new SimpleDateFormat(outPattern);
+ if(requiredTimeZone != null && !requiredTimeZone.trim().equals("")){
+ df.setTimeZone(TimeZone.getTimeZone(requiredTimeZone));
+ }
+ return df.format(date);
+ }
+
+ /**
+ * Formats a date value with the given pattern
+ * into a date value with the desired pattern for the TimeZone provided
+ *
+ * @param dateValue
+ * @param inPattern
+ * @param outPattern
+ * @param requiredTimeZone
+ * @return Formatted date value
+ * @throws Exception
+ *
+ */
+ public static String formatDate(String dateValue,String inPattern,
+ String outPattern,String requiredTimeZone) throws Exception{
+ return formatDate(dateValue,inPattern,null,outPattern,requiredTimeZone);
+ }
+
+ /**
+ * Formats a date value with the given pattern for a specific TimeZone,
+ * into a date value with the desired pattern for the TimeZone provided
+ *
+ * @param dateValue
+ * @param inPattern
+ * @param currentTimeZone
+ * @param outPattern
+ * @param requiredTimeZone
+ * @return Formatted date value
+ * @throws Exception
+ *
+ */
+ public static String formatDate(String dateValue,String inPattern,String currentTimeZone,
+ String outPattern,String requiredTimeZone) throws Exception{
+ Date date = parseDate(dateValue,inPattern,currentTimeZone);
+ return formatDate(date,outPattern,requiredTimeZone);
+ }
+
+ /**
+ * Formats a date value with the given pattern, for a specific User(in User TimeZone),
+ * into a date value with the desired pattern for the TimeZone provided
+ *
+ * @param dateValue
+ * @param inPattern
+ * @param userId
+ * @param outPattern
+ * @param requiredTimeZone
+ * @return Formatted date value
+ * @throws Exception
+ *
+ */
+ public static String formatUserDate(String dateValue,String inPattern, Long userId,String outPattern,String requiredTimeZone) throws Exception{
+ User user = (User)getDataAccessService().getDomainObject(User.class, userId, null);
+
+ String userTimeZone = null;
+ Long timezoneId = user.getTimeZoneId();
+
+ if (timezoneId != null) {
+ userTimeZone = AppUtils.getLookupValueByLabel(timezoneId.toString(), "fn_lu_timezone", "timezone_id", "timezone_value");
+ }
+
+ return formatDate(dateValue,inPattern,userTimeZone,outPattern,requiredTimeZone);
+ }
+
+ /**
+ * Formats a date value with a given pattern for a specific User(User TimeZone),
+ * into a date value with the desired pattern for Database TimeZone
+ *
+ * @param dateValue
+ * @param inPattern
+ * @param userId
+ * @param outPattern
+ * @return Formatted date value
+ * @throws Exception
+ *
+ */
+ public static String formatUserDateForDBTimeZone(String dateValue,String inPattern, Long userId,String outPattern) throws Exception{
+ User user = (User)getDataAccessService().getDomainObject(User.class, userId, null);
+
+ String userTimeZone = null;
+ Long timezoneId = user.getTimeZoneId();
+
+ /*if (timezoneId != null) {
+ userTimeZone = AppUtils.getLookupValueByLabel(timezoneId.toString(), "fn_lu_timezone", "timezone_id", "timezone_value");
+ }*/
+
+ String dbTimeZone = SystemProperties.getProperty(SystemProperties.DATABASE_TIME_ZONE);
+
+ return formatDate(dateValue,inPattern,userTimeZone,outPattern,dbTimeZone);
+ }
+
+ /**
+ * Get the current database Date/Time
+ * @return Date object
+ */
+ public static Date getCurrentDBDate()throws Exception{
+ String dbTimeZone = SystemProperties.getProperty(SystemProperties.DATABASE_TIME_ZONE);
+ List results = (List)getDataAccessService().executeNamedQuery(GET_CURRENT_DATE, null, null);
+ return parseDate(((Object[])results.get(0))[0]+" "+((Object[])results.get(0))[1],DB_DATE_FORMAT,dbTimeZone);
+ }
+
+ /**
+ * Get the current date value formatted for the User's TimeZone in the desired pattern
+ *
+ * @param outPattern
+ * @param userId
+ * @return Date value
+ * @throws Exception
+ */
+ public static String getCurrentDBDateForUser(String outPattern,Long userId)throws Exception{
+ User user = (User)getDataAccessService().getDomainObject(User.class, userId, null);
+
+ String userTimeZone = null;
+ Long timezoneId = user.getTimeZoneId();
+
+ /*if (timezoneId != null) {
+ userTimeZone = AppUtils.getLookupValueByLabel(timezoneId.toString(), "fn_lu_timezone", "timezone_id", "timezone_value");
+ }*/
+
+ Date dbDate = getCurrentDBDate();
+
+ return formatDate(dbDate,outPattern,userTimeZone);
+ }
+
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/adapter/FusionAdapter.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/adapter/FusionAdapter.java
new file mode 100644
index 00000000..33b6ec2d
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/adapter/FusionAdapter.java
@@ -0,0 +1,135 @@
+/*-
+ * ================================================================================
+ * 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.system.fusion.adapter;
+
+import java.sql.Connection;
+import java.util.Map;
+
+import javax.servlet.ServletContext;
+
+import org.openecomp.portalsdk.core.FusionObject;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import com.mchange.v2.c3p0.ComboPooledDataSource;
+
+public class FusionAdapter implements FusionObject {
+
+ public static final String LOCAL_SESSION_FACTORY_KEY = "local";
+
+
+ private ComboPooledDataSource dataSource;
+ private Map<String,ComboPooledDataSource> dataSourceMap;
+
+ //private SessionFactory sessionFactory;
+ private ServletContext servletContext;
+
+ // private static Connection connection = null;
+
+ //private static AdapterSessionFactoryContainer sessionFactoryContainer;
+
+
+ public FusionAdapter() {
+ }
+
+
+ public ServletContext getServletContext() {
+ return servletContext;
+ }
+
+ public void setServletContext(ServletContext servletContext) {
+ this.servletContext = servletContext;
+ }
+
+ // public static AdapterSessionFactoryContainer getSessionFactoryContainer() {
+ // return sessionFactoryContainer;
+ // }
+
+ //public static LinkedHashMap getSessionFactories() {
+ // return getSessionFactoryContainer().getSessionFactories();
+ //}
+
+
+ //public void setSessionFactoryContainer(AdapterSessionFactoryContainer sessionFactoryContainer) {
+ // this.sessionFactoryContainer = sessionFactoryContainer;
+ //}
+
+
+ /** Gets connection to the database **/
+ public Connection getConnection() {
+ //Session session = sessionFactory.getCurrentSession();
+ Connection connection = null;
+ try {
+ connection = getDataSource().getConnection();
+ } catch(Exception ex) {
+ ex.printStackTrace();
+ }
+
+ return connection;
+ }
+
+
+ /** Gets connection to the database indicated via the session factory key **/
+ public synchronized Connection getConnection(String schemaId) {
+ Connection connection = null;
+ try {
+ connection = getDataSourceMap().get(schemaId).getConnection();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ return connection;
+ }
+
+
+ /** Releases connection to the database **/
+ public void releaseConnection(Connection conn) {
+ try {
+ conn.close();
+ //logger.debug("releasing connection from adapter...");
+ }
+ catch (Exception e) {
+ //logger.error("Error while closing the connection.");
+ e.printStackTrace();
+ }
+ }
+
+
+ public ComboPooledDataSource getDataSource() {
+ return dataSource;
+ }
+
+
+ @Autowired
+ public void setDataSource(ComboPooledDataSource dataSource) {
+ this.dataSource = dataSource;
+ }
+
+ public Map<String,ComboPooledDataSource> getDataSourceMap() {
+ if(dataSourceMap==null)
+ dataSourceMap = (Map<String,ComboPooledDataSource>)SpringContext.getApplicationContext().getBean("dataSourceMap");
+
+ return dataSourceMap;
+ }
+
+ public void setdataSourceMap(Map<String,ComboPooledDataSource> dataSourceMap) {
+ this.dataSourceMap = dataSourceMap;
+ }
+
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/adapter/IdName.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/adapter/IdName.java
new file mode 100644
index 00000000..5b4af3f9
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/adapter/IdName.java
@@ -0,0 +1,59 @@
+/*-
+ * ================================================================================
+ * 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.system.fusion.adapter;
+
+import org.openecomp.portalsdk.core.domain.support.DomainVo;
+
+/**
+ * <p>IdName.java</p>
+ * <p>Represents a id/name data object.</p>
+*/
+public class IdName extends DomainVo {
+
+ private String name;
+ private Long id;
+
+ public IdName() {}
+
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public int compareTo(Object obj){
+ String c1 = getName();
+ String c2 = ((IdName)obj).getName();
+
+ return (c1 == null || c2 == null) ? 1 : c1.compareTo(c2);
+ }
+
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/adapter/Item.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/adapter/Item.java
new file mode 100644
index 00000000..71663bc2
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/adapter/Item.java
@@ -0,0 +1,55 @@
+/*-
+ * ================================================================================
+ * 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.system.fusion.adapter;
+
+
+public class Item {
+ private String _id;
+ private String _name;
+
+ public Item() {
+ }
+
+ public Item(String id, String name) {
+ this._id = id;
+ this._name = name;
+ }
+
+ public String getId() {
+ return _id;
+ }
+
+ public void setId(String id) {
+ this._id = id;
+ }
+
+ public String getName() {
+ return _name;
+ }
+
+ public void setName(String name) {
+ this._name = name;
+ }
+
+ public String toString() {
+ return _name;
+ }
+}
+
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/adapter/Lookup.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/adapter/Lookup.java
new file mode 100644
index 00000000..ac6cd16c
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/adapter/Lookup.java
@@ -0,0 +1,85 @@
+/*-
+ * ================================================================================
+ * 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.system.fusion.adapter;
+
+
+import java.io.Serializable;
+
+import org.openecomp.portalsdk.core.domain.FusionVo;
+import org.openecomp.portalsdk.core.domain.support.NameValueId;
+
+
+
+public class Lookup extends FusionVo implements Serializable {
+
+ private NameValueId nameValueId = new NameValueId();
+
+ public Lookup() {}
+
+ public Lookup(String label, String value) {
+ this();
+ setLabel(label);
+ setValue(value);
+ }
+
+ public String getValue() {
+ return getNameValueId().getVal();
+ }
+
+ public String getLabel() {
+ return getNameValueId().getLab();
+ }
+
+ public void setValue(String value) {
+ getNameValueId().setVal(value);
+ }
+
+ public void setLabel(String label) {
+ getNameValueId().setLab(label);
+ }
+
+ public NameValueId getNameValueId() {
+ return nameValueId;
+ }
+
+ public void setNameValueId(NameValueId nameValueId) {
+ this.nameValueId = nameValueId;
+ }
+
+ // required by ZK for to set the selectedItems of Listboxes (used heavily for <select>-style drop-downs)
+ public int hashCode() {
+ int hash = getValue().hashCode();
+ hash = hash + getLabel().hashCode();
+
+ return hash;
+ }
+
+ public boolean equals( Object obj ) {
+ boolean equivalent = false;
+
+ Lookup lookup = (Lookup)obj;
+ if( lookup.getValue().equals(getValue()) && lookup.getLabel().equals(getLabel())) {
+ equivalent = true;
+ }
+
+ return equivalent;
+ }
+
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/adapter/RaptorAdapter.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/adapter/RaptorAdapter.java
new file mode 100644
index 00000000..99cc0272
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/adapter/RaptorAdapter.java
@@ -0,0 +1,368 @@
+/*-
+ * ================================================================================
+ * 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.system.fusion.adapter;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeSet;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+
+import org.openecomp.portalsdk.analytics.system.AppUtils;
+import org.openecomp.portalsdk.core.domain.Menu;
+import org.openecomp.portalsdk.core.domain.MenuData;
+import org.openecomp.portalsdk.core.domain.Role;
+import org.openecomp.portalsdk.core.domain.RoleFunction;
+import org.openecomp.portalsdk.core.domain.User;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.openecomp.portalsdk.core.service.DataAccessService;
+import org.openecomp.portalsdk.core.util.SystemProperties;
+import org.openecomp.portalsdk.core.web.support.UserUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+
+@Service("raptorAdapter")
+public class RaptorAdapter extends FusionAdapter {
+
+ @Autowired
+ private static DataAccessService dataAccessService;
+
+ static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(RaptorAdapter.class);
+
+
+ public static final int RAPTOR_USER_ID = 20000; // RAPTOR system user id (for auditing purposes)
+ public static final String RAPTOR_CONTROLLER_CLASSNAME = "org.openecomp.portalsdk.analytics.controller.Controller";
+ public static final String KEY_USER_ROLES_CACHE = "userRoles";
+
+ public void initializeRaptor() {
+ org.openecomp.portalsdk.analytics.config.ConfigLoader.setConfigFilesPath(SystemProperties.getProperty(SystemProperties.RAPTOR_CONFIG_FILE_PATH));
+ org.openecomp.portalsdk.analytics.system.Globals.initializeSystem(getServletContext());
+ }
+
+
+ /** Returns ID of the user currently logged in */
+ public static String getUserID(HttpServletRequest request) {
+ return String.valueOf(UserUtils.getUserId(request));
+ //return null;
+ }
+
+ public static String getUserID(String user_id) {
+ return user_id;
+ }
+
+
+ public static String getUserBackdoorLoginId(HttpServletRequest request) {
+ if(AppUtils.getRequestNvlValue(request, "login_id").length()>0) return AppUtils.getRequestNvlValue(request, "login_id");
+ return String.valueOf(UserUtils.getUserSession(request).getLoginId());
+ }
+
+ public static String getUserBackdoorLoginId(String user_id) {
+ return getUserLoginId(user_id);
+ }
+
+ /** Obtains user name by ID */
+ public static String getUserName(String userId) {
+ Map<String, Long> params = new HashMap<String, Long>();
+ params.put("user_id", new Long(userId));
+
+ List list = getDataAccessService().executeNamedQuery("getUserNameById", params, null);
+
+ String firstName = "";
+ String lastName = "";
+
+ if (list != null) {
+ if (!list.isEmpty()) {
+ Object[] user = (Object[]) list.get(0);
+ firstName = (String) user[0]; // firstName scalar
+ lastName = (String) user[1]; // lastName scalar
+ }
+ }
+
+ return lastName + ", " + firstName;
+ }
+
+ public static String getUserName(HttpServletRequest request) {
+ User user = UserUtils.getUserSession(request);
+ return user.getLastName() + ", " + user.getFirstName();
+ }
+
+ public static String getUserEmail(String userId) {
+ Map<String, Long> params = new HashMap<String, Long>();
+ params.put("user_id", new Long(userId));
+ List list = getDataAccessService().executeNamedQuery("getUserEmail", params, null);
+ String email = "";
+ if (list != null && !list.isEmpty())
+ email = (String) list.get(0);
+ return email;
+ }
+
+ public static String getUserEmail(HttpServletRequest request) {
+ User user = UserUtils.getUserSession(request);
+ return user.getEmail();
+ }
+
+ public static String getUserLoginId(String userId) {
+
+ String loginId = "";
+ try{
+ List list = getDataAccessService().getList(User.class, " where user_id = " + userId, null, null);
+ if (list != null) {
+ if (!list.isEmpty()) {
+ User user = (User)list.get(0);
+ loginId = user.getLoginId(); // firstName scalar
+ }
+ }
+ }catch(Exception e){
+ logger.error(EELFLoggerDelegate.debugLogger, ("error while getting login id : Exception" + e.getMessage()));
+ }
+ return loginId;
+ }
+
+
+ public static String getUserLoginId(HttpServletRequest request) {
+ User user = UserUtils.getUserSession(request);
+ return user.getLoginId();
+ }
+
+ /** Obtains list of all users (in IdNameValue objects) */
+ public static Map<Long, String> getAllUsers(String customizedQuery, String param, boolean isAdmin) {
+ List users = null;
+ Map<Long, String> map = new LinkedHashMap<Long, String>();
+
+ if(customizedQuery.length()>0 && !isAdmin) {
+
+ users = getDataAccessService().executeSQLQuery(customizedQuery, IdName.class, null);
+
+ if (users != null) {
+ Iterator i = users.iterator();
+ while (i.hasNext()) {
+ IdName item = (IdName)i.next();
+ map.put(item.getId(), item.getName());
+ }
+ }
+
+ } else {
+ users = getDataAccessService().executeNamedQuery("getAllUsers", null, null);
+ if (users != null) {
+ Iterator i = users.iterator();
+ while (i.hasNext()) {
+ Object[] user = (Object[])i.next();
+ Long id = (Long)user[0]; // id scalar
+ String firstName = (String)user[1]; // firstName scalar
+ String lastName = (String)user[2]; // lastName scalar
+ map.put(id, lastName + ", " + firstName);
+ }
+ }
+ }
+ return map;
+ }
+
+ /** Obtains role name by ID */
+ public static String getRoleName(String roleId) {
+ Map<String, Long> params = new HashMap<String, Long>();
+ params.put("role_id", new Long(roleId));
+
+ List list = getDataAccessService().executeNamedQuery("getRoleNameById", params, null);
+
+ String roleName = "";
+
+ if (list != null) {
+ if (!list.isEmpty()) {
+ roleName = (String) list.get(0); // name scalar
+ }
+ }
+
+ return roleName;
+ }
+
+ /** Obtains list of all roles (in IdNameValue objects) */
+ public static Map<Long, String> getAllRolesUsingCustomizedQuery(String customizedQuery, String param, boolean isAdmin) {
+ List roles = null;
+
+ Map<Long, String> map = new LinkedHashMap<Long, String>();
+
+ if(customizedQuery.length()>0 && !isAdmin) {
+
+ roles = getDataAccessService().executeSQLQuery(customizedQuery, IdName.class, null);
+
+ if (roles != null) {
+ Iterator i = roles.iterator();
+ while (i.hasNext()) {
+ IdName item = (IdName)i.next();
+ map.put(item.getId(), item.getName());
+ }
+ }
+ } else {
+
+ roles = getDataAccessService().executeNamedQuery("getAllRoles", null, null);
+
+ if (roles != null) {
+ Iterator i = roles.iterator();
+ while (i.hasNext()) {
+ Object[] role = (Object[])i.next();
+ Long id = (Long)role[0]; // id scalar
+ String name = (String)role[1]; // firstName scalar
+ map.put(id, name);
+ }
+ }
+ }
+
+ return map;
+ }
+
+ public static Set getUserRoles(HttpServletRequest request) {
+ return UserUtils.getRoles(request).keySet();
+ }
+
+ public static Set getUserRoles(String userId) {
+ Set userRoles = new HashSet<Long>();
+// Map usersRolesMap = new LinkedHashMap<Long, Set>();
+// Map<String, Long> params = new HashMap<String, Long>();
+//
+// params.put("user_id", new Long(userId));
+//
+// List usersRolesList = getDataAccessService().executeNamedQuery("getAllUsersRoles", params, null);
+// Iterator i = usersRolesList.iterator();
+// while (i.hasNext()) {
+// Object[] userRole = (Object[]) i.next();
+//
+// Long roleId = (Long) userRole[1]; // role id scalar
+// userRoles.add(roleId);
+//
+// }
+ userRoles = getActiveUsersRoleIds(new Long(userId));
+
+
+ return userRoles;
+ }
+
+ /** this is used to get role for the current user. **/
+ public static synchronized boolean isCurrentUserInRole(HttpServletRequest request, String roleId) {
+ HttpSession session = request.getSession(false);
+ if(session!=null && session.getAttribute(SystemProperties.getProperty(SystemProperties.USER_ATTRIBUTE_NAME))!=null)
+ return UserUtils.hasRole(request, roleId);
+ else
+ return false;
+ }
+
+ // public static void processErrorNotification(HttpServletRequest request, Exception e) {
+ //org.openecomp.portalsdk.core.web.support.AppUtils.processError(e, logger, request);
+ //}
+
+ /** Obtains menu label by ID */
+ public static String getMenuLabel(String menuId) {
+ return ((Menu) getDataAccessService().getDomainObject(MenuData.class, new Long(menuId), null)).getLabel();
+ }
+
+ public static String formatUserDateForDBTimeZone(String dateValue,String inPattern,
+ Long userId, String outPattern)throws Exception{
+ return DateUtils.formatUserDateForDBTimeZone(dateValue,inPattern,userId,outPattern);
+ }
+
+ public static String getCurrentDBDateForUser(String inPattern,Long userId)throws Exception{
+ return DateUtils.getCurrentDBDateForUser(inPattern, userId);
+ }
+
+ public static Set<Long> getActiveUsersRoleIds(Long userId) {
+ Set<Role> allActiveUserRoles = getActiveUserRoles(userId);
+ Iterator<Role> allActiveUserRolesIterator = allActiveUserRoles.iterator();
+ Set<Long> allActiveUserRoleIds = new TreeSet<Long>();
+ while(allActiveUserRolesIterator.hasNext()){
+ Role role = allActiveUserRolesIterator.next();
+ allActiveUserRoleIds.add(role.getId());
+ }
+
+ return allActiveUserRoleIds;
+ }
+
+ public static Set<Long> getActiveUserRoleIds(Long userId) {
+ Set<Role> allActiveUserRoles = getActiveUserRoles(userId);
+ Iterator<Role> allActiveUserRolesIterator = allActiveUserRoles.iterator();
+ Set<Long> allActiveUserRoleIds = new TreeSet<Long>();
+ while(allActiveUserRolesIterator.hasNext()){
+ Role role = allActiveUserRolesIterator.next();
+ allActiveUserRoleIds.add(role.getId());
+ }
+
+ return allActiveUserRoleIds;
+ }
+
+ public static Set<RoleFunction> getActiveRoleFunctions(Long userId) {
+ Set<Role> allActiveUserRoles = getActiveUserRoles(userId);
+ Iterator<Role> allActiveUserRolesIterator = allActiveUserRoles.iterator();
+ Set<RoleFunction> allActiveRoleFunctions = new TreeSet<RoleFunction>();
+ while(allActiveUserRolesIterator.hasNext()){
+ Role role = allActiveUserRolesIterator.next();
+ allActiveRoleFunctions.addAll(role.getRoleFunctions());
+ }
+
+ return allActiveRoleFunctions;
+ }
+
+ public static Set<Role> getActiveUserRoles(Long userId) {
+ User user = (User)getDataAccessService().getDomainObject(User.class,userId,null);
+ Set<Role> allActiveUserRoles = new TreeSet<Role>();
+ allActiveUserRoles.addAll(user.getRoles());
+ Iterator<Role> userRolesIterator = user.getRoles().iterator();
+ while(userRolesIterator.hasNext()){
+ getAllChildRoles( userRolesIterator.next(),allActiveUserRoles);
+ }
+
+ Iterator<Role> allActiveUserRolesIterator = allActiveUserRoles.iterator();
+ while(allActiveUserRolesIterator.hasNext()){
+ Role role = allActiveUserRolesIterator.next();
+ if(!role.getActive()){
+ allActiveUserRolesIterator.remove();
+ }
+ }
+
+ return allActiveUserRoles;
+ }
+
+ public static Set<Role> getAllChildRoles(Role role, Set<Role> allchildRoles) {
+ Set<Role> childRoles = role.getChildRoles();
+ allchildRoles.addAll(childRoles);
+ Iterator<Role> childRolesIterator = childRoles.iterator();
+ while (childRolesIterator.hasNext()) {
+ getAllChildRoles(childRolesIterator.next(),allchildRoles);
+ }
+ return allchildRoles;
+ }
+
+
+ public static DataAccessService getDataAccessService() {
+ return org.openecomp.portalsdk.core.web.support.AppUtils.getDataAccessService();
+ }
+
+
+ public static void setDataAccessService(DataAccessService dataAccessService) {
+ dataAccessService = dataAccessService;
+ }
+
+
+
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/adapter/SpringContext.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/adapter/SpringContext.java
new file mode 100644
index 00000000..1d46290a
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/adapter/SpringContext.java
@@ -0,0 +1,37 @@
+/*-
+ * ================================================================================
+ * 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.system.fusion.adapter;
+
+import org.springframework.beans.BeansException;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.ApplicationContextAware;
+import org.springframework.stereotype.Component;
+
+@Component("springContext")
+public class SpringContext implements ApplicationContextAware {
+ private static ApplicationContext context;
+
+ public void setApplicationContext(ApplicationContext context) throws BeansException {
+ this.context = context;
+ }
+ public static ApplicationContext getApplicationContext() {
+ return context;
+ }
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/controller/FileServletController.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/controller/FileServletController.java
new file mode 100644
index 00000000..203ee9cc
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/controller/FileServletController.java
@@ -0,0 +1,206 @@
+/*-
+ * ================================================================================
+ * 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.system.fusion.controller;
+/**
+ * Raptor Blob Extract Servlet
+ *
+ */
+
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.sql.Blob;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.openecomp.portalsdk.core.service.DataAccessService;
+import org.springframework.web.servlet.ModelAndView;;
+
+
+public class FileServletController {
+
+ private DataAccessService dataAccessService;
+
+ EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(FileServletController.class);
+
+
+ public ModelAndView handleRequestInternal(HttpServletRequest request,
+ HttpServletResponse response) throws Exception {
+ logger.debug(EELFLoggerDelegate.debugLogger, ("FileServletController:: f=" + request.getParameter("f")));
+
+ String fname = request.getParameter("f");
+
+ try {
+ Map params = new HashMap();
+ params.put("fname", fname);
+
+ logger.debug(EELFLoggerDelegate.debugLogger, ("executing query: select file_blob from cr_report_file_history where file_name = :"
+ + fname));
+
+ List<Object> fileFromDB = (List<Object>) getDataAccessService().executeNamedQuery("getFileWithName", params, null);
+
+ byte[] allBytesInBlob = null;
+
+ if (fileFromDB != null && fileFromDB.size() > 0) {
+
+ logger.debug(EELFLoggerDelegate.debugLogger, ("reading file blob from DB..."));
+ try {
+
+ /*for weblogic setup
+ * if(Globals.isWeblogicServer()) {
+ weblogic.jdbc.vendor.oracle.OracleThinBlob aBlob = (weblogic.jdbc.vendor.oracle.OracleThinBlob) ((org.hibernate.lob.SerializableBlob) fileFromDB
+ .get(0)).getWrappedBlob();
+ InputStream inBlob = ((java.sql.Blob) aBlob).getBinaryStream();
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ byte[] buf = new byte[1024];
+ int n = 0;
+ while ((n=inBlob.read(buf))>=0) {
+ baos.write(buf, 0, n);
+ }
+ inBlob.close();
+ allBytesInBlob = baos.toByteArray();
+ } else { */
+ /* works in Hinernate3 [ oracle.sql.BLOB aBlob = (oracle.sql.BLOB) ((org.hibernate.lob.SerializableBlob) fileFromDB
+ .get(0)).getWrappedBlob();
+ allBytesInBlob = aBlob.getBytes(1, (int) aBlob.length()); ] */
+ // }
+
+ Object fileFromDBType = fileFromDB.get(0);
+ if(fileFromDBType instanceof byte[] ) // postgres
+ allBytesInBlob = (byte[]) fileFromDB.get(0);
+ else if (fileFromDBType instanceof Blob ) // oracle
+ allBytesInBlob = ((Blob) fileFromDB.get(0)).getBytes(1, (int) ((Blob) fileFromDB.get(0)).length());
+
+
+
+ } catch (Exception e) {
+ logger.error(EELFLoggerDelegate.debugLogger, ("An exception has occurred: " + e.getMessage()));
+ throw (e);
+ }
+
+ } else {
+ logger.error(EELFLoggerDelegate.debugLogger, ("ERROR: No BLOB returned from DB..."));
+ throw (new Exception("ERROR: No BLOB returned from DB..."));
+ }
+
+ serveFile(response, allBytesInBlob, fname);
+ return null;
+ } catch (Exception e) {
+ logger.error(EELFLoggerDelegate.debugLogger, ("Exception occurred..." + e.getMessage()));
+ Map<String, Object> errView = new HashMap<String, Object>();
+ errView.put("error", "The requested resource was not found.");
+ //return new ModelAndView(getExceptionView(), "model", errView);
+ return null;
+ }
+
+ }
+
+ private void serveFile(HttpServletResponse response, File inFile)
+ throws Exception {
+ OutputStream os = null;
+ InputStream is = null;
+ try {
+ response.reset();
+ is = new BufferedInputStream(new FileInputStream(inFile));
+ os = new BufferedOutputStream(response.getOutputStream());
+ response.setContentLength((int) inFile.length());
+ response.setContentType("application/octet-stream");
+ response.setHeader("Content-disposition", "attachment; filename=\""
+ + inFile.getName() + "\"");
+ copyStream(is, os);
+ os.flush();
+ } catch (Exception ex) {
+ if (os == null)
+ throw new Exception("Could not open output stream for file ");
+ if (is == null)
+ throw new Exception("Could not open input stream for file ");
+ } finally {
+ if (os != null) {
+ os.close();
+ }
+ if (is != null)
+ is.close();
+ }
+ }
+
+ private void serveFile(HttpServletResponse response, byte[] outStream,
+ String name) throws Exception {
+ OutputStream os = null;
+ InputStream is = null;
+ try {
+ response.reset();
+ response.setContentLength((int) outStream.length);
+ response.setContentType("application/octet-stream");
+ response.setHeader("Content-disposition", "attachment; filename=\""
+ + name + "\"");
+ copyStream(response, outStream);
+ } catch (Exception ex) {
+ if (os == null)
+ throw new Exception("Could not open output stream for file ");
+ if (is == null)
+ throw new Exception("Could not open input stream for file ");
+ } finally {
+ if (os != null) {
+ os.close();
+ }
+ if (is != null)
+ is.close();
+ }
+ }
+
+ private int copyStream(InputStream in, OutputStream out) throws IOException {
+ int bytes, totalBytes = 0;
+
+ byte[] b = new byte[4096];
+
+ while ((bytes = in.read(b, 0, b.length)) != -1) {
+ totalBytes += bytes;
+ out.write(b, 0, bytes);
+ }
+ return totalBytes;
+ }
+
+ private int copyStream(HttpServletResponse response, byte[] outStream)
+ throws IOException {
+
+ OutputStream os = new BufferedOutputStream(response.getOutputStream());
+ os.write(outStream);
+ os.flush();
+ return outStream.length;
+ }
+
+ public DataAccessService getDataAccessService() {
+ return dataAccessService;
+ }
+
+ public void setDataAccessService(DataAccessService dataAccessService) {
+ this.dataAccessService = dataAccessService;
+ }
+
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/domain/CR_Report.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/domain/CR_Report.java
new file mode 100644
index 00000000..9f6ed7d6
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/domain/CR_Report.java
@@ -0,0 +1,306 @@
+/*-
+ * ================================================================================
+ * 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.system.fusion.domain;
+
+
+import java.util.Date;
+
+import org.openecomp.portalsdk.core.domain.User;
+import org.openecomp.portalsdk.core.domain.support.DomainVo;;
+
+/**
+ * <p>CR_Report.java</p>
+ * <p>Represents a RAPTOR report data object.</p>
+ *
+ * @version 1.0
+ */
+public class CR_Report extends DomainVo {
+
+ private String title;
+ private String descr;
+ private String public_yn;
+ //private String report_xml;
+ private Date createDate;
+ private Date maintDate;
+ private String menuId;
+ private String menuApproved_YN;
+ private User ownerId;
+ private Long folderId;
+ private String dashboard_type_YN;
+ private String dashboard_yn;
+ private User createId;
+ private User maintId;
+
+/*
+ //New Buttons
+ private String copyImagePath = "/static/fusion/raptor/img/cross-small.png" ;
+ private String editImagePath = "/static/fusion/raptor/img/pencil-small.png" ;
+ private String deleteImagePath = "/static/fusion/raptor/img/DeleteCross-16x16.png" ;
+ private String scheduleImagePath = "/static/fusion/raptor/img/Calendar-16x16.png" ;
+ private String runImagePath = "/static/fusion/raptor/img/tick-small.png" ;
+
+*/
+ //private Set reportAccess = new TreeSet();
+
+ public CR_Report() {}
+
+
+
+ /**
+ * @return the title
+ */
+ public String getTitle() {
+ return title;
+ }
+
+
+
+ /**
+ * @param title the title to set
+ */
+ public void setTitle(String title) {
+ this.title = title;
+ }
+
+
+
+ /**
+ * @return the descr
+ */
+ public String getDescr() {
+ return descr;
+ }
+
+
+
+ /**
+ * @param descr the descr to set
+ */
+ public void setDescr(String descr) {
+ this.descr = descr;
+ }
+
+
+
+ /**
+ * @return the public_yn
+ */
+ public String getPublic_yn() {
+ return public_yn;
+ }
+
+
+
+ /**
+ * @param public_yn the public_yn to set
+ */
+ public void setPublic_yn(String public_yn) {
+ this.public_yn = public_yn;
+ }
+
+
+ /**
+ * @return the createDate
+ */
+ public Date getCreateDate() {
+ return createDate;
+ }
+
+
+
+ /**
+ * @param createDate the createDate to set
+ */
+ public void setCreateDate(Date createDate) {
+ this.createDate = createDate;
+ }
+
+
+ /**
+ * @return the maintDate
+ */
+ public Date getMaintDate() {
+ return maintDate;
+ }
+
+
+
+ /**
+ * @param maintDate the maintDate to set
+ */
+ public void setMaintDate(Date maintDate) {
+ this.maintDate = maintDate;
+ }
+
+
+
+ /**
+ * @return the menuId
+ */
+ public String getMenuId() {
+ return menuId;
+ }
+
+
+
+ /**
+ * @param menuId the menuId to set
+ */
+ public void setMenuId(String menuId) {
+ this.menuId = menuId;
+ }
+
+
+
+ /**
+ * @return the menuApproved_YN
+ */
+ public String getMenuApproved_YN() {
+ return menuApproved_YN;
+ }
+
+
+
+ /**
+ * @param menuApproved_YN the menuApproved_YN to set
+ */
+ public void setMenuApproved_YN(String menuApproved_YN) {
+ this.menuApproved_YN = menuApproved_YN;
+ }
+
+
+
+
+ /**
+ * @return the folderId
+ */
+ public Long getFolderId() {
+ return folderId;
+ }
+
+
+
+ /**
+ * @param folderId the folderId to set
+ */
+ public void setFolderId(Long folderId) {
+ this.folderId = folderId;
+ }
+
+
+
+ /**
+ * @return the dashboard_type_YN
+ */
+ public String getDashboard_type_YN() {
+ return dashboard_type_YN;
+ }
+
+
+
+ /**
+ * @param dashboard_type_YN the dashboard_type_YN to set
+ */
+ public void setDashboard_type_YN(String dashboard_type_YN) {
+ this.dashboard_type_YN = dashboard_type_YN;
+ }
+
+
+
+ /**
+ * @return the dashboard_yn
+ */
+ public String getDashboard_yn() {
+ return dashboard_yn;
+ }
+
+
+
+ /**
+ * @param dashboard_yn the dashboard_yn to set
+ */
+ public void setDashboard_yn(String dashboard_yn) {
+ this.dashboard_yn = dashboard_yn;
+ }
+
+
+
+ /**
+ * @return the ownerId
+ */
+ public User getOwnerId() {
+ return ownerId;
+ }
+
+
+
+ /**
+ * @param ownerId the ownerId to set
+ */
+ public void setOwnerId(User ownerId) {
+ this.ownerId = ownerId;
+ }
+
+
+
+ /**
+ * @return the createId
+ */
+ public User getCreateId() {
+ return createId;
+ }
+
+
+
+ /**
+ * @param createId the createId to set
+ */
+ public void setCreateId(User createId) {
+ this.createId = createId;
+ }
+
+
+
+ /**
+ * @return the maintId
+ */
+ public User getMaintId() {
+ return maintId;
+ }
+
+
+
+ /**
+ * @param maintId the maintId to set
+ */
+ public void setMaintId(User maintId) {
+ this.maintId = maintId;
+ }
+
+
+
+ public int compareTo(Object obj){
+ String c1 = getTitle();
+ String c2 = ((CR_Report)obj).getTitle();
+
+ return (c1 == null || c2 == null) ? 1 : c1.compareTo(c2);
+ }
+
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/domain/QuickLink.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/domain/QuickLink.java
new file mode 100644
index 00000000..75b2d119
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/domain/QuickLink.java
@@ -0,0 +1,61 @@
+/*-
+ * ================================================================================
+ * 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.system.fusion.domain;
+
+public class QuickLink {
+
+ private String reportURL;
+ private String reportName;
+ private String reportDescr;
+ private Boolean showDescr;
+
+ public String getReportURL() {
+ return reportURL;
+ }
+
+ public void setReportURL(String reportURL) {
+ this.reportURL = reportURL;
+ }
+
+ public String getReportName() {
+ return reportName;
+ }
+
+ public void setReportName(String reportName) {
+ this.reportName = reportName;
+ }
+
+ public String getReportDescr() {
+ return reportDescr;
+ }
+
+ public void setReportDescr(String reportDescr) {
+ this.reportDescr = reportDescr;
+ }
+
+ public Boolean getShowDescr() {
+ return showDescr;
+ }
+
+ public void setShowDescr(Boolean showDescr) {
+ this.showDescr = showDescr;
+ }
+
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/domain/RaptorSearch.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/domain/RaptorSearch.java
new file mode 100644
index 00000000..cb85f368
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/domain/RaptorSearch.java
@@ -0,0 +1,188 @@
+/*-
+ * ================================================================================
+ * 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.system.fusion.domain;
+
+import java.util.Date;
+
+import org.openecomp.portalsdk.analytics.system.Globals;
+import org.openecomp.portalsdk.core.domain.support.DomainVo;;
+
+public class RaptorSearch extends DomainVo {
+
+ private Long repId;
+ private String title;
+ private String descr;
+ private String ownerName;
+ private Date createDate;
+ private String canEdit;
+ private String readOnly;
+ private String schedule;
+ // private Long countRows;
+
+ /**
+ * @return the repId
+ */
+ public Long getRepId() {
+ return repId;
+ }
+
+ /**
+ * @param repId
+ * the repId to set
+ */
+ public void setRepId(Long repId) {
+ this.repId = repId;
+ }
+
+ /**
+ * @return the title
+ */
+ public String getTitle() {
+ return title;
+ }
+
+ /**
+ * @param title
+ * the title to set
+ */
+ public void setTitle(String title) {
+ this.title = title;
+ }
+
+ /**
+ * @return the descr
+ */
+ public String getDescr() {
+ return descr;
+ }
+
+ /**
+ * @param descr
+ * the descr to set
+ */
+ public void setDescr(String descr) {
+ this.descr = descr;
+ }
+
+ /**
+ * @return the createDate
+ */
+ public Date getCreateDate() {
+ return createDate;
+ }
+
+ /**
+ * @param createDate
+ * the createDate to set
+ */
+ public void setCreateDate(Date createDate) {
+ this.createDate = createDate;
+ }
+
+ /**
+ * @return the ownerName
+ */
+ public String getOwnerName() {
+ return ownerName;
+ }
+
+ /**
+ * @param ownerName
+ * the ownerName to set
+ */
+ public void setOwnerName(String ownerName) {
+ this.ownerName = ownerName;
+ }
+
+ /**
+ * @return the schedule
+ */
+ public String getSchedule() {
+ return schedule;
+ }
+
+ /**
+ * @param schedule
+ * the schedule to set
+ */
+ public void setSchedule(String schedule) {
+ this.schedule = schedule;
+ }
+
+ /**
+ * @return the canEdit
+ */
+ public String getCanEdit() {
+ return canEdit;
+ }
+
+ /**
+ * @param canEdit
+ * the canEdit to set
+ */
+ public void setCanEdit(String canEdit) {
+ this.canEdit = canEdit;
+ }
+
+ /**
+ * @return the canDelete
+ */
+ public boolean canDelete() {
+ String s = getCanEdit();
+ if (s != null && s.length() > 0 && s.equals("Y")) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @return the canCopy
+ */
+ public boolean canCopy() {
+ String s = getReadOnly();
+ if (returnTrueOrFalse(s)) {
+ return Globals.getCanCopyOnReadOnly() ? true : returnTrueOrFalse(getCanEdit());
+ }
+ return true;
+ }
+
+ /**
+ * @return the readOnly
+ */
+ public String getReadOnly() {
+ return readOnly;
+ }
+
+ /**
+ * @param readOnly
+ * the readOnly to set
+ */
+ public void setReadOnly(String readOnly) {
+ this.readOnly = readOnly;
+ }
+
+ private boolean returnTrueOrFalse(String s) {
+ if (s != null && s.length() > 0 && s.equals("Y")) {
+ return true;
+ }
+ return false;
+ }
+
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/domain/ReportInfo.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/domain/ReportInfo.java
new file mode 100644
index 00000000..e11f3bcb
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/domain/ReportInfo.java
@@ -0,0 +1,159 @@
+/*-
+ * ================================================================================
+ * 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.system.fusion.domain;
+
+import java.util.Date;
+
+public class ReportInfo {
+
+ private Long repId;
+ private String title;
+ private String createUser;
+ private String ownerName;
+ private Date createDate;
+ private Long lastAccessed = -1L;
+ private Long lastWeekAccess;
+ private Long lastMonthAccess;
+ private Long lastYearAccess;
+ private Long userAccessCount;
+ /**
+ * @return the repId
+ */
+ public Long getRepId() {
+ return repId;
+ }
+ /**
+ * @param repId the repId to set
+ */
+ public void setRepId(Long repId) {
+ this.repId = repId;
+ }
+ /**
+ * @return the title
+ */
+ public String getTitle() {
+ return title;
+ }
+ /**
+ * @param title the title to set
+ */
+ public void setTitle(String title) {
+ this.title = title;
+ }
+ /**
+ * @return the createUser
+ */
+ public String getCreateUser() {
+ return createUser;
+ }
+ /**
+ * @param createUser the createUser to set
+ */
+ public void setCreateUser(String createUser) {
+ this.createUser = createUser;
+ }
+ /**
+ * @return the ownerName
+ */
+ public String getOwnerName() {
+ return ownerName;
+ }
+ /**
+ * @param ownerName the ownerName to set
+ */
+ public void setOwnerName(String ownerName) {
+ this.ownerName = ownerName;
+ }
+ /**
+ * @return the createDate
+ */
+ public Date getCreateDate() {
+ return createDate;
+ }
+ /**
+ * @param createDate the createDate to set
+ */
+ public void setCreateDate(Date createDate) {
+ this.createDate = createDate;
+ }
+ /**
+ * @return the lastAccessed
+ */
+ public Long getLastAccessed() {
+ return lastAccessed;
+ }
+ /**
+ * @param lastAccessed the lastAccessed to set
+ */
+ public void setLastAccessed(Long lastAccessed) {
+ this.lastAccessed = lastAccessed;
+ }
+ /**
+ * @return the lastWeekAccess
+ */
+ public Long getLastWeekAccess() {
+ return lastWeekAccess;
+ }
+ /**
+ * @param lastWeekAccess the lastWeekAccess to set
+ */
+ public void setLastWeekAccess(Long lastWeekAccess) {
+ this.lastWeekAccess = lastWeekAccess;
+ }
+ /**
+ * @return the lastMonthAccess
+ */
+ public Long getLastMonthAccess() {
+ return lastMonthAccess;
+ }
+ /**
+ * @param lastMonthAccess the lastMonthAccess to set
+ */
+ public void setLastMonthAccess(Long lastMonthAccess) {
+ this.lastMonthAccess = lastMonthAccess;
+ }
+ /**
+ * @return the lastYearAccess
+ */
+ public Long getLastYearAccess() {
+ return lastYearAccess;
+ }
+ /**
+ * @param lastYearAccess the lastYearAccess to set
+ */
+ public void setLastYearAccess(Long lastYearAccess) {
+ this.lastYearAccess = lastYearAccess;
+ }
+ /**
+ * @return the userAccessCount
+ */
+ public Long getUserAccessCount() {
+ return userAccessCount;
+ }
+ /**
+ * @param userAccessCount the userAccessCount to set
+ */
+ public void setUserAccessCount(Long userAccessCount) {
+ this.userAccessCount = userAccessCount;
+ }
+
+
+
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/service/RaptorService.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/service/RaptorService.java
new file mode 100644
index 00000000..26276579
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/service/RaptorService.java
@@ -0,0 +1,36 @@
+/*-
+ * ================================================================================
+ * 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.system.fusion.service;
+
+import java.util.List;
+import java.util.Map;
+
+
+
+public interface RaptorService {
+ public void deleteReport(Long reportId);
+ public List getReportInfo(Map params);
+ public int getTotalSize();
+ public int executeCountQuery(Class entity, String query, Map params, String whereClause);
+ public List executeGridQuery(String query, Map params, Integer fromIndex, Integer toIndex);
+ public List executeGridQueryOrderByWithLimit(Class entity, String query, Map params, String _orderBy, boolean _asc, Integer fromIndex, Integer toIndex);
+ public List executeGridQuery(Class entity, String query, String whereClause, Map params, Integer fromIndex, Integer toIndex);
+ public List executeGridQueryOrderByWithLimit(Class entity, String query, String whereClause, Map params, String _orderBy, boolean _asc, Integer fromIndex, Integer toIndex);
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/service/RaptorServiceImpl.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/service/RaptorServiceImpl.java
new file mode 100644
index 00000000..e8e0cf31
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/service/RaptorServiceImpl.java
@@ -0,0 +1,163 @@
+/*-
+ * ================================================================================
+ * 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.system.fusion.service;
+
+import java.util.List;
+import java.util.Map;
+
+import org.openecomp.portalsdk.analytics.system.fusion.domain.CR_Report;
+import org.openecomp.portalsdk.core.service.DataAccessService;
+import org.openecomp.portalsdk.core.service.support.FusionService;
+import org.springframework.context.ApplicationContext;
+
+public class RaptorServiceImpl extends FusionService implements RaptorService {
+
+ private DataAccessService dataAccessService;
+
+ private int totalSize;
+
+ public DataAccessService getDataAccessService() {
+ return dataAccessService;
+ }
+
+ public void setDataAccessService(DataAccessService dataAccessService) {
+ this.dataAccessService = dataAccessService;
+ }
+
+ private ApplicationContext applicationContext;
+
+ //raptorSearchAllReportsCount
+
+ public int executeCountQuery(Class entity, String query, Map params, String whereClause) {
+ List l = getDataAccessService().executeNamedCountQuery(entity, query, whereClause, params);
+ //List l = getDataAccessService().executeNamedQuery(query, params, null);
+ int searchCount = 0;
+ if(l != null) {
+ if (!l.isEmpty()) {
+ searchCount = (((Long) l.get(0))).intValue();
+ }
+ }
+ totalSize = searchCount;
+ return totalSize;
+ }
+
+ //raptorSearchAllReports
+ public List executeGridQuery(String query, Map params, Integer fromIndex, Integer toIndex) {
+ return getDataAccessService().executeNamedQuery(query, params, fromIndex, toIndex, null);
+ }
+
+ public List executeGridQueryOrderByWithLimit(Class entity, String query, Map params, String _orderBy, boolean asc, Integer fromIndex, Integer toIndex) {
+ return getDataAccessService().executeNamedQueryWithOrderBy(entity, query, params, _orderBy, asc, fromIndex, toIndex, null);
+ }
+
+ //with where clause
+ public List executeGridQuery(Class entity, String query, String whereClause, Map params, Integer fromIndex, Integer toIndex) {
+ return getDataAccessService().executeNamedQuery(entity, query, whereClause, params, fromIndex, toIndex, null);
+ }
+
+ public List executeGridQueryOrderByWithLimit(Class entity, String query, String whereClause, Map params, String _orderBy, boolean asc, Integer fromIndex, Integer toIndex) {
+ return getDataAccessService().executeNamedQueryWithOrderBy(entity, query, whereClause, params, _orderBy, asc, fromIndex, toIndex, null);
+ }
+
+ /*
+ public int getUserReportsCount(Map params) {
+ List l = getDataAccessService().executeNamedQuery("raptorSearchUserReportsCount", params, null);
+ int count = 0;
+ if(l != null) {
+ if (!l.isEmpty()) {
+ Object[] result = (Object[]) l.get(0);
+ count = ((Long)result[0]).intValue();
+ }
+ }
+ totalSize = count;
+ return totalSize;
+ }
+
+ public List getUserReports(Map params, Integer fromIndex, Integer toIndex) {
+ return getDataAccessService().executeNamedQuery("raptorSearchUserReports", params, fromIndex, toIndex, null);
+ }
+
+ public int getPublicReportsCount(Map params) {
+ List l = getDataAccessService().executeNamedQuery("raptorPublicUserReportsCount", params, null);
+ int count = 0;
+ if(l != null) {
+ if (!l.isEmpty()) {
+ Object[] result = (Object[]) l.get(0);
+ count = ((Long)result[0]).intValue();
+ }
+ }
+ totalSize = count;
+ return totalSize;
+ }
+
+ public List getPublicReports(Map params, Integer fromIndex, Integer toIndex) {
+ return getDataAccessService().executeNamedQuery("raptorPublicUserReports", params, fromIndex, toIndex, null);
+ }
+
+ public int getFavReportsCount(Map params) {
+ List l = getDataAccessService().executeNamedQuery("raptorSearchFavReportsCount", params, null);
+ int count = 0;
+ if(l != null) {
+ if (!l.isEmpty()) {
+ Object[] result = (Object[]) l.get(0);
+ count = ((Long)result[0]).intValue();
+ }
+ }
+ totalSize = count;
+ return totalSize;
+ }
+
+ public List getFavReports(Map params, Integer fromIndex, Integer toIndex) {
+ return getDataAccessService().executeNamedQuery("raptorSearchFavReports", params, fromIndex, toIndex, null);
+ }
+ */
+ public int getTotalSize() {
+ return totalSize;
+ }
+
+ public void deleteReport(Long reportId) {
+ getDataAccessService().deleteDomainObject(getDataAccessService().getDomainObject(CR_Report.class, reportId, null), null);
+ }
+
+ public List getReportInfo(Map params) {
+ return getDataAccessService().executeNamedQuery("raptorInfoQuery", params, null);
+ }
+
+/* public List executeGridQueryWithOrderBy(String query, Map params, String _orderBy, boolean asc, Integer fromIndex, Integer toIndex) {
+ query = String.format(query, _orderBy, asc ? "ASC" : "DESC", fromIndex, toIndex);
+ DataSource ds = (DataSource)getApplicationContext().getBean(searchBean.getDatasourceName());
+ NamedParameterJdbcTemplate jdbcTemplate = new NamedParameterJdbcTemplate(ds);
+ }*/
+
+ /**
+ * @return the applicationContext
+ */
+ public ApplicationContext getApplicationContext() {
+ return applicationContext;
+ }
+
+ /**
+ * @param applicationContext the applicationContext to set
+ */
+ public void setApplicationContext(ApplicationContext applicationContext) {
+ this.applicationContext = applicationContext;
+ }
+
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/web/RaptorController.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/web/RaptorController.java
new file mode 100644
index 00000000..417a8e19
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/web/RaptorController.java
@@ -0,0 +1,191 @@
+/*-
+ * ================================================================================
+ * 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.system.fusion.web;
+
+
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.openecomp.portalsdk.analytics.controller.Action;
+import org.openecomp.portalsdk.analytics.controller.ErrorHandler;
+import org.openecomp.portalsdk.analytics.error.RaptorException;
+import org.openecomp.portalsdk.analytics.error.RaptorRuntimeException;
+import org.openecomp.portalsdk.analytics.system.Globals;
+import org.openecomp.portalsdk.analytics.util.AppConstants;
+import org.openecomp.portalsdk.core.controller.RestrictedBaseController;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.servlet.ModelAndView;
+
+@Controller
+@RequestMapping("/")
+public class RaptorController extends RestrictedBaseController{
+ String viewName;
+ //static org.apache.log4j.Logger s_logger = org.apache.log4j.Logger.getLogger(RaptorController.class.getName());
+
+ @RequestMapping(value = {"/report" }, method = RequestMethod.GET)
+ public ModelAndView report(HttpServletRequest request) {
+ request.getSession().setAttribute("isEmbedded", false);
+ viewName = "report";
+ return new ModelAndView(getViewName());
+ }
+
+ @RequestMapping(value = {"/report_embedded" }, method = RequestMethod.GET)
+ public ModelAndView embededReport(HttpServletRequest request) {
+ request.getSession().setAttribute("isEmbedded", true);
+ viewName = "report_embedded";
+ return new ModelAndView(getViewName());
+ }
+
+ @RequestMapping(value = {"/report_sample" }, method = RequestMethod.GET)
+ public ModelAndView reportSample(HttpServletRequest request) {
+ viewName = "report_sample";
+ return new ModelAndView(getViewName());
+ }
+
+ @RequestMapping(value = {"/report_import.htm" }, method = RequestMethod.GET)
+
+ public ModelAndView RaptorWizard1(HttpServletRequest request, HttpServletResponse response) throws IOException {
+ viewName = "report_import";
+ Action action = null;
+ String actionKey = "report.import";
+ ServletContext servletContext = request.getSession().getServletContext();
+ if( !Globals.isSystemInitialized()) {
+ Globals.initializeSystem(servletContext);
+ }
+ try {
+ action = Globals.getRaptorActionMapping().getAction(actionKey);
+ if (action == null)
+ throw new RaptorRuntimeException("Action not found");
+ } catch (RaptorException e) {
+ logger.debug(EELFLoggerDelegate.debugLogger, ("[Controller.processRequest]Invalid raptor action [" + actionKey
+ + "]. RaptorException: " + e.getMessage()));
+ viewName = (new ErrorHandler()).processFatalError(request, new RaptorRuntimeException(
+ "[Controller.processRequest]Invalid raptor action [" + actionKey
+ + "]. Exception: " + e.getMessage()));
+ }
+ return new ModelAndView(getViewName(), "model", null);
+ }
+
+
+ @RequestMapping(value = {"/report_wizard.htm" }, method = {RequestMethod.POST, RequestMethod.GET})
+ public ModelAndView RaptorWizard(HttpServletRequest request, HttpServletResponse response) throws IOException {
+
+
+ viewName = "";
+ String actionKey = nvl(request.getParameter(AppConstants.RI_ACTION), request.getParameter("action"));
+ actionKey = nvl(actionKey, "report.run");
+ Action action = null;
+ ServletContext servletContext = request.getSession().getServletContext();
+ if( !Globals.isSystemInitialized()) {
+ Globals.initializeSystem(servletContext);
+ }
+ try {
+ action = Globals.getRaptorActionMapping().getAction(actionKey);
+ if (action == null)
+ throw new RaptorRuntimeException("Action not found");
+ } catch (RaptorException e) {
+ logger.debug(EELFLoggerDelegate.debugLogger, ("[Controller.processRequest]Invalid raptor action [" + actionKey
+ + "]. RaptorException: " + e.getMessage()));
+ viewName = (new ErrorHandler()).processFatalError(request, new RaptorRuntimeException(
+ "[Controller.processRequest]Invalid raptor action [" + actionKey
+ + "]. Exception: " + e.getMessage()));
+ }
+
+ try {
+ Class[] paramTypes = new Class[2];
+ paramTypes[0] = Class.forName("javax.servlet.http.HttpServletRequest");
+ paramTypes[1] = Class.forName("java.lang.String");
+
+ Class handlerClass = Class.forName(action.getControllerClass());
+ Object handler = handlerClass.newInstance();
+ Method handlerMethod = handlerClass.getMethod(action.getControllerMethod(),
+ paramTypes);
+
+ Object[] paramValues = new Object[2];
+ paramValues[0] = request;
+ paramValues[1] = action.getJspName();;
+
+ viewName = (String) handlerMethod.invoke(handler, paramValues);
+ //ObjectMapper mapper = new ObjectMapper();
+ //response.setContentType("application/json");
+ //PrintWriter out = response.getWriter();
+ //out.write(viewName);
+
+ } catch (ClassNotFoundException e) {
+ logger.debug(EELFLoggerDelegate.debugLogger, ("[Controller.processRequest]Invalid raptor action [" + actionKey
+ + "]. ClassNotFoundException: " + e.getMessage()));
+ viewName = (new ErrorHandler()).processFatalError(request, new RaptorRuntimeException(
+ "[Controller.processRequest] Unable to instantiate and invoke action handler. Exception: "
+ + e.getMessage()));
+ } catch (IllegalAccessException e) {
+ logger.debug(EELFLoggerDelegate.debugLogger, ("[Controller.processRequest]Invalid raptor action [" + actionKey
+ + "]. IllegalAccessException: " + e.getMessage()));
+ viewName = (new ErrorHandler()).processFatalError(request, new RaptorRuntimeException(
+ "[Controller.processRequest] Unable to instantiate and invoke action handler. Exception: "
+ + e.getMessage()));
+ }catch (InstantiationException e) {
+ logger.debug(EELFLoggerDelegate.debugLogger, ("Ocurring during Schedule "));
+ viewName = (new ErrorHandler()).processFatalError(request, new RaptorRuntimeException(
+ "[Controller.processRequest] Unable to instantiate and invoke action handler. Exception: "
+ + e.getMessage()));
+ }catch (NoSuchMethodException e) {
+ logger.debug(EELFLoggerDelegate.debugLogger, ("[Controller.processRequest]Invalid raptor action [" + actionKey
+ + "]. NoSuchMethodException: " + e.getMessage()));
+ viewName = (new ErrorHandler()).processFatalError(request, new RaptorRuntimeException(
+ "[Controller.processRequest] Unable to instantiate and invoke action handler. Exception: "
+ + e.getMessage()));
+ }catch (InvocationTargetException e) {
+ logger.debug(EELFLoggerDelegate.debugLogger, ("[Controller.processRequest]Invalid raptor action [" + actionKey
+ + "]. InvocationTargetException: " + e.getMessage()));
+ viewName = (new ErrorHandler()).processFatalError(request, new RaptorRuntimeException(
+ "[Controller.processRequest] Unable to instantiate and invoke action handler. Exception: "
+ + e.getMessage()));
+ }
+ return new ModelAndView(getViewName(), "model", null);
+ }
+
+ public String getViewName() {
+ return viewName;
+ }
+ public void setViewName(String viewName) {
+ this.viewName = viewName;
+ }
+
+ public String nvl(String s) {
+ return (s == null) ? "" : s;
+ }
+
+ public String nvl(String s, String sDefault) {
+ return nvl(s).equals("") ? sDefault : s;
+ }
+
+ EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(RaptorController.class);
+
+
+
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/web/RaptorControllerAsync.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/web/RaptorControllerAsync.java
new file mode 100644
index 00000000..bd3fdce3
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/web/RaptorControllerAsync.java
@@ -0,0 +1,410 @@
+/*-
+ * ================================================================================
+ * 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.system.fusion.web;
+
+
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+
+import org.openecomp.portalsdk.analytics.controller.Action;
+import org.openecomp.portalsdk.analytics.controller.ErrorHandler;
+import org.openecomp.portalsdk.analytics.error.RaptorException;
+import org.openecomp.portalsdk.analytics.error.RaptorRuntimeException;
+import org.openecomp.portalsdk.analytics.model.ReportHandler;
+import org.openecomp.portalsdk.analytics.model.pdf.PdfReportHandler;
+import org.openecomp.portalsdk.analytics.model.runtime.CategoryAxisJSON;
+import org.openecomp.portalsdk.analytics.model.runtime.ChartJSON;
+import org.openecomp.portalsdk.analytics.model.runtime.RangeAxisJSON;
+import org.openecomp.portalsdk.analytics.model.runtime.ReportRuntime;
+import org.openecomp.portalsdk.analytics.system.AppUtils;
+import org.openecomp.portalsdk.analytics.system.Globals;
+import org.openecomp.portalsdk.analytics.util.AppConstants;
+import org.openecomp.portalsdk.analytics.view.ReportData;
+import org.openecomp.portalsdk.analytics.xmlobj.DataColumnType;
+import org.openecomp.portalsdk.core.controller.UnRestrictedBaseController;
+import org.openecomp.portalsdk.core.domain.User;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.openecomp.portalsdk.core.web.support.UserUtils;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+
+@Controller
+@RequestMapping("/")
+public class RaptorControllerAsync extends UnRestrictedBaseController{
+ String viewName;
+
+ @RequestMapping(value = {"/raptor.htm" }, method = RequestMethod.GET)
+ public void RaptorSearch(HttpServletRequest request, HttpServletResponse response) throws IOException {
+
+ /* List items = null;
+ int reportId = ServletRequestUtils.getIntParameter(request, "report_id", 0);
+ //String task = ServletRequestUtils.getStringParameter(request, "task", TASK_GET);
+
+ HashMap additionalParams = new HashMap();
+ additionalParams.put(Parameters.PARAM_HTTP_REQUEST, request);
+
+ return new ModelAndView(getViewName(), "model", null);
+
+ //return new ModelAndView(getViewName(), "model", null);
+ //System.out.println("Fill with proper code");
+ //return null;*/
+ viewName = "";
+ String actionKey = nvl(request.getParameter(AppConstants.RI_ACTION), request.getParameter("action"));
+ actionKey = nvl(actionKey, "report.run");
+
+ HttpSession session = request.getSession();
+ User user = UserUtils.getUserSession(request);
+
+ if(actionKey.equals("report.download.excel2007.session") || actionKey.equals("report.download.csv.session") || actionKey.equals("report.download.excel.session") || actionKey.equals("report.download.pdf.session") ) {
+ if(session!=null && user!=null){
+ ServletContext servletContext = request.getSession().getServletContext();
+ if( !Globals.isSystemInitialized()) {
+ Globals.initializeSystem(servletContext);
+ }
+ ReportRuntime rr = null;
+ ReportData rd = null;
+ String parent = "";
+ int parentFlag = 0;
+ if(!nvl(request.getParameter("parent"), "").equals("N")) parent = nvl(request.getParameter("parent"), "");
+ if(parent.startsWith("parent_")) parentFlag = 1;
+ if(parentFlag == 1) {
+ rr = (ReportRuntime) request.getSession().getAttribute(parent+"_rr");
+ rd = (ReportData) request.getSession().getAttribute(parent+"_rd");
+ }
+
+ boolean isEmbedded = false;
+ Object temp = request.getSession().getAttribute("isEmbedded");
+ if(temp!=null){
+ isEmbedded = (boolean)temp;
+ }
+ if(isEmbedded){
+ String reportID = AppUtils.getRequestValue(request, AppConstants.RI_REPORT_ID);
+ if(rr==null) rr = (ReportRuntime) ((HashMap)request.getSession().getAttribute(AppConstants.EMBEDDED_REPORTRUNTIME_MAP)).get(reportID);
+ if(rd==null) rd = (ReportData) ((HashMap)request.getSession().getAttribute(AppConstants.EMBEDDED_REPORTDATA_MAP)).get(reportID);
+ } else {
+ if(rr==null) rr = (ReportRuntime) request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME);
+ if(rd==null) rd = (ReportData) request.getSession().getAttribute(AppConstants.RI_REPORT_DATA);
+ }
+ String user_id = AppUtils.getUserID(request);
+ try {
+ OutputStreamWriter out = new OutputStreamWriter(response.getOutputStream());
+
+ if(actionKey.equals("report.download.pdf.session")) {
+ new PdfReportHandler().createPdfFileContent(request,response, 3);
+ } else if (actionKey.equals("report.download.csv.session")) {
+ (new ReportHandler()).createCSVFileContent(out, rd, rr, request, response);
+ } else if (actionKey.equals("report.download.excel.session")) {
+ new ReportHandler().createExcelFileContent(out, rd, rr, request, response, user_id, 3); //3 whole
+ } else {
+
+ new ReportHandler().createExcel2007FileContent(out, rd, rr, request, response, user_id, 3); //3 whole
+ }
+ } catch(Exception e) {
+ e.printStackTrace();
+ //Log.write("Fatal error [report_download_xlsx.jsp]: "+e.getMessage());
+ }
+ } else {
+ response.sendRedirect("login.htm");
+ }
+ } else {
+ if(session!=null && user!=null){
+ Action action = null;
+ ServletContext servletContext = request.getSession().getServletContext();
+ if( !Globals.isSystemInitialized()) {
+ Globals.initializeSystem(servletContext);
+ }
+ try {
+ action = Globals.getRaptorActionMapping().getAction(actionKey);
+ if (action == null)
+ throw new RaptorRuntimeException("Action not found");
+ } catch (RaptorException e) {
+ logger.debug(EELFLoggerDelegate.debugLogger, ("[Controller.processRequest]Invalid raptor action [" + actionKey
+ + "]. RaptorException: " + e.getMessage()));
+
+ viewName = (new ErrorHandler()).processFatalError(request, new RaptorRuntimeException(
+ "[Controller.processRequest]Invalid raptor action [" + actionKey
+ + "]. Exception: " + e.getMessage()));
+ }
+
+ try {
+ Class[] paramTypes = new Class[2];
+ paramTypes[0] = Class.forName("javax.servlet.http.HttpServletRequest");
+ paramTypes[1] = Class.forName("java.lang.String");
+
+ Class handlerClass = Class.forName(action.getControllerClass());
+ Object handler = handlerClass.newInstance();
+ Method handlerMethod = handlerClass.getMethod(action.getControllerMethod(),
+ paramTypes);
+
+ Object[] paramValues = new Object[2];
+ paramValues[0] = request;
+ paramValues[1] = action.getJspName();;
+
+ viewName = (String) handlerMethod.invoke(handler, paramValues);
+ //ObjectMapper mapper = new ObjectMapper();
+ if(!actionKey.equals("chart.run"))
+ response.setContentType("application/json");
+ else
+ response.setContentType("text/html");
+ PrintWriter out = response.getWriter();
+ out.write(viewName);
+
+ } catch (ClassNotFoundException e) {
+ logger.debug(EELFLoggerDelegate.debugLogger, ("[Controller.processRequest]Invalid raptor action [" + actionKey
+ + "]. ClassNotFoundException: " + e.getMessage()));
+ viewName = (new ErrorHandler()).processFatalError(request, new RaptorRuntimeException(
+ "[Controller.processRequest] Unable to instantiate and invoke action handler. Exception: "
+ + e.getMessage()));
+ } catch (IllegalAccessException e) {
+ logger.debug(EELFLoggerDelegate.debugLogger, ("[Controller.processRequest]Invalid raptor action [" + actionKey
+ + "]. IllegalAccessException: " + e.getMessage()));
+ viewName = (new ErrorHandler()).processFatalError(request, new RaptorRuntimeException(
+ "[Controller.processRequest] Unable to instantiate and invoke action handler. Exception: "
+ + e.getMessage()));
+ }catch (InstantiationException e) {
+ logger.debug(EELFLoggerDelegate.debugLogger, ("[Controller.processRequest]Invalid raptor action [" + actionKey
+ + "]. InstantiationException: " + e.getMessage()));
+ viewName = (new ErrorHandler()).processFatalError(request, new RaptorRuntimeException(
+ "[Controller.processRequest] Unable to instantiate and invoke action handler. Exception: "
+ + e.getMessage()));
+ }catch (NoSuchMethodException e) {
+ logger.debug(EELFLoggerDelegate.debugLogger, ("[Controller.processRequest]Invalid raptor action [" + actionKey
+ + "]. NoSuchMethodException: " + e.getMessage()));
+ viewName = (new ErrorHandler()).processFatalError(request, new RaptorRuntimeException(
+ "[Controller.processRequest] Unable to instantiate and invoke action handler. Exception: "
+ + e.getMessage()));
+ }catch (InvocationTargetException e) {
+ e.printStackTrace();
+ logger.debug(EELFLoggerDelegate.debugLogger, ("[Controller.processRequest]Invalid raptor action [" + actionKey
+ + "]. InvocationTargetException: " + e.getMessage()));
+ viewName = (new ErrorHandler()).processFatalError(request, new RaptorRuntimeException(
+ "[Controller.processRequest] Unable to instantiate and invoke action handler. Exception: "
+ + e.getMessage()));
+ }
+ //return new ModelAndView(getViewName(), "model", null);
+ } else {
+ PrintWriter out = response.getWriter();
+ out.write("session has timed out for user");
+ }
+
+ }
+ }
+
+ @RequestMapping(value = "save_chart", method = RequestMethod.POST)
+ public void reportChartReceive(@RequestBody ChartJSON chartJSON, HttpServletRequest request, HttpServletResponse response) throws IOException {
+ ReportRuntime reportRuntime;
+ System.out.println("*****Hit RaptorChart******");
+ reportRuntime = (ReportRuntime) request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME); //changing session to request
+ String reportID = request.getParameter("c_master");
+ if (reportRuntime == null && AppUtils.nvl(reportID).length() > 0) {
+ try {
+ ReportHandler rh = new ReportHandler();
+ reportRuntime = rh.loadReportRuntime(request, reportID);
+ } catch (RaptorException ex) {
+ ex.printStackTrace();
+
+ }
+ }
+
+ if (reportRuntime != null) {
+ String chartType = chartJSON.getChartType();
+ reportRuntime.setChartType(chartJSON.getChartType());
+ reportRuntime.setChartAnimate(chartJSON.isAnimation());
+ reportRuntime.setChartWidth(chartJSON.getWidth());
+ reportRuntime.setChartHeight(chartJSON.getHeight());
+ reportRuntime.setShowChartTitle(chartJSON.isShowTitle());
+
+
+ String domainAxis = null;
+ domainAxis = chartJSON.getDomainAxis();
+
+ List < DataColumnType > reportCols = reportRuntime.getAllColumns();
+
+ for (Iterator < DataColumnType > iter = reportCols.iterator(); iter
+ .hasNext();) {
+ DataColumnType dct = (DataColumnType) iter.next();
+ if (dct.getColId().equals(domainAxis)) {
+ dct.setColOnChart(AppConstants.GC_LEGEND);
+ } else {
+ dct.setColOnChart(null);
+ }
+ }
+
+ CategoryAxisJSON categoryAxisJSON = chartJSON.getCategoryAxisJSON();
+ String categoryAxis = null;
+
+ categoryAxis = (categoryAxisJSON!=null?categoryAxisJSON.getValue():"");
+
+ reportCols = reportRuntime.getAllColumns();
+
+ for (Iterator < DataColumnType > iter = reportCols.iterator(); iter
+ .hasNext();) {
+ DataColumnType dct = (DataColumnType) iter.next();
+ if (dct.getColId().equals(categoryAxis)) {
+ dct.setChartSeries(true);
+ } else {
+ dct.setChartSeries(false);
+ }
+ }
+
+
+ ArrayList < RangeAxisJSON > rangeAxisList = chartJSON.getRangeAxisList();
+ int r = 0;
+ for (int i = 0; i < rangeAxisList.size(); i++) {
+ RangeAxisJSON rangeAxisJSON = rangeAxisList.get(i);
+ String rangeAxis = rangeAxisJSON.getRangeAxis();
+ String rangeYAxis = AppUtils.nvl(rangeAxisJSON.getRangeYAxis());
+ String rangeChartGroup = AppUtils.nvl(rangeAxisJSON.getRangeChartGroup());
+ String rangeColor = AppUtils.nvl(rangeAxisJSON.getRangeColor());
+ String rangeLineType = AppUtils.nvl(rangeAxisJSON.getRangeLineType());
+
+ rangefor:
+ for (Iterator < DataColumnType > iterator = reportCols.iterator(); iterator.hasNext();) {
+ DataColumnType dct = (DataColumnType) iterator.next();
+ if (dct.getColId().equals(rangeAxis)) {
+ dct.setChartSeq(++r);
+ dct.setColOnChart("0");
+ dct.setYAxis(rangeYAxis); //+"|"+dct.getColId());
+ dct.setChartGroup(rangeChartGroup); //+"|"+dct.getColId());
+ dct.setChartColor(rangeColor);
+ dct.setChartLineType(rangeLineType);
+
+ if (chartType.equals(AppConstants.GT_ANNOTATION_CHART) || chartType.equals(AppConstants.GT_FLEX_TIME_CHARTS)) {
+ if (rangeAxisJSON.isShowAsArea()) {
+ dct.setIsRangeAxisFilled(true);
+ } else {
+ dct.setIsRangeAxisFilled(false);
+ }
+ }
+ break rangefor;
+ }
+ }
+
+ }
+
+
+ reportRuntime.setChartLeftAxisLabel(chartJSON.getPrimaryAxisLabel());
+ reportRuntime.setChartRightAxisLabel(chartJSON.getSecondaryAxisLabel());
+
+ reportRuntime.setRangeAxisLowerLimit(chartJSON.getMinRange());
+ reportRuntime.setRangeAxisUpperLimit(chartJSON.getMaxRange());
+
+
+
+ if (chartType.equals(AppConstants.GT_ANNOTATION_CHART) || chartType.equals(AppConstants.GT_FLEX_TIME_CHARTS)) {
+ if (chartJSON.getFlexTimeSeriesChartOptions() != null) {
+ reportRuntime.setZoomIn(chartJSON.getFlexTimeSeriesChartOptions().getZoomIn());
+ reportRuntime.setTimeAxisType(chartJSON.getFlexTimeSeriesChartOptions().getTimeAxisType());
+ }
+
+ }
+
+ if (chartType.equals(AppConstants.GT_TIME_SERIES)) {
+ if (chartJSON.getTimeSeriesChartOptions() != null) {
+ reportRuntime.setTimeSeriesRender(chartJSON.getTimeSeriesChartOptions().getLineChartRenderer());
+ reportRuntime.setShowXAxisLabel(chartJSON.getTimeSeriesChartOptions().isShowXAxisLabel());
+ reportRuntime.setAddXAxisTickers(chartJSON.getTimeSeriesChartOptions().isAddXAxisTicker());
+ reportRuntime.setTimeAxis(chartJSON.getTimeSeriesChartOptions().isNonTimeAxis());
+ reportRuntime.setMultiSeries(chartJSON.getTimeSeriesChartOptions().isMultiSeries());
+ }
+
+ }
+
+ if (chartType.equals(AppConstants.GT_BAR_3D)) {
+ if (chartJSON.getBarChartOptions() != null) {
+ reportRuntime.setChartOrientation(chartJSON.getBarChartOptions().isVerticalOrientation() ? "vertical" : "horizontal");
+ reportRuntime.setChartStacked(chartJSON.getBarChartOptions().isStackedChart());
+ reportRuntime.setBarControls(chartJSON.getBarChartOptions().isDisplayBarControls());
+ reportRuntime.setXAxisDateType(chartJSON.getBarChartOptions().isxAxisDateType());
+ reportRuntime.setLessXaxisTickers(chartJSON.getBarChartOptions().isMinimizeXAxisTickers());
+ reportRuntime.setTimeAxis(chartJSON.getBarChartOptions().isTimeAxis());
+ reportRuntime.setLogScale(chartJSON.getBarChartOptions().isyAxisLogScale());
+ }
+ }
+
+
+ reportRuntime.setLegendLabelAngle(chartJSON.getCommonChartOptions().getLegendLabelAngle());
+ reportRuntime.setChartLegendDisplay(chartJSON.getCommonChartOptions().isHideLegend() ? "Y" : "N");
+ reportRuntime.setAnimateAnimatedChart(chartJSON.getCommonChartOptions().isAnimateAnimatedChart());
+
+ reportRuntime.setTopMargin(chartJSON.getCommonChartOptions().getTopMargin());
+ reportRuntime.setBottomMargin(chartJSON.getCommonChartOptions().getBottomMargin());
+ reportRuntime.setLeftMargin(chartJSON.getCommonChartOptions().getLeftMargin());
+ reportRuntime.setRightMargin(chartJSON.getCommonChartOptions().getRightMargin());
+
+
+
+ for (Iterator < DataColumnType > iterator = reportCols.iterator(); iterator.hasNext();) {
+ DataColumnType dct = (DataColumnType) iterator.next();
+ if (!(AppUtils.nvl(dct.getColOnChart()).equals(AppConstants.GC_LEGEND) || (dct.getChartSeq()!=null && dct.getChartSeq()>0) || dct.isChartSeries()) ) {
+ dct.setChartSeq(-1);
+ dct.setChartColor(null);
+ dct.setColOnChart(null);
+ dct.setCreateInNewChart(false);
+ dct.setChartGroup(null);
+ dct.setYAxis(null);
+ }
+ }
+
+
+ try {
+ reportRuntime.persistLinearReport(request);
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ logger.error("While SAVING CHART", ex);
+ }
+ }
+
+ }
+
+ public String getViewName() {
+ return viewName;
+ }
+ public void setViewName(String viewName) {
+ this.viewName = viewName;
+ }
+
+ public String nvl(String s) {
+ return (s == null) ? "" : s;
+ }
+
+ public String nvl(String s, String sDefault) {
+ return nvl(s).equals("") ? sDefault : s;
+ }
+
+ EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(RaptorControllerAsync.class);
+
+
+
+}
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/web/ReportsSearchListController.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/web/ReportsSearchListController.java
new file mode 100644
index 00000000..b5df482b
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/web/ReportsSearchListController.java
@@ -0,0 +1,74 @@
+/*-
+ * ================================================================================
+ * 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.system.fusion.web;
+
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.openecomp.portalsdk.analytics.system.fusion.service.RaptorService;
+import org.springframework.web.servlet.ModelAndView;
+
+
+public class ReportsSearchListController {
+
+ private RaptorService raptorService = null;
+
+ /**
+ * @return the raptorService
+ */
+ public RaptorService getRaptorService() {
+ return raptorService;
+ }
+
+ /**
+ * @param raptorService the raptorService to set
+ */
+ public void setRaptorService(RaptorService raptorService) {
+ this.raptorService = raptorService;
+ }
+
+ public ModelAndView handleRequestInternal(HttpServletRequest request,
+ HttpServletResponse response) {
+
+ /*List items = null;
+ int reportId = ServletRequestUtils.getIntParameter(request, "report_id", 0);
+ String task = ServletRequestUtils.getStringParameter(request, "task", TASK_GET);
+
+ HashMap additionalParams = new HashMap();
+ additionalParams.put(Parameters.PARAM_HTTP_REQUEST, request);
+
+ if (reportId != 0 && task.equals(TASK_DELETE)) { // delete the selected record
+ getRaptorService().deleteReport(new Long(reportId));
+ }
+
+ items = getRaptorService().getReports();
+
+ Map model = new HashMap();
+ model.put("items", items);
+
+ return new ModelAndView(getViewName(), "model", model);
+ */
+ //return new ModelAndView(getViewName(), "model", null);
+ System.out.println("Fill with proper code");
+ return null;
+ }
+
+}