From 6beb446925c967aca92f5513adf36c5db77c00d6 Mon Sep 17 00:00:00 2001 From: TATTAVARADA Date: Thu, 27 Apr 2017 07:53:18 -0400 Subject: [PORTAL-7] Rebase This rebasing includes common libraries and common overlays projects abstraction of components Change-Id: Ia1efa4deacdc5701e6205104ac021a6c80ed60ba Signed-off-by: st782s --- .../analytics/system/fusion/AntBuild.java | 66 ---- .../analytics/system/fusion/AppUtils.java | 363 ------------------ .../portalsdk/analytics/system/fusion/DbUtils.java | 75 ---- .../analytics/system/fusion/RemoteDbUtils.java | 50 --- .../adapter/AdapterSessionFactoryContainer.java | 39 -- .../analytics/system/fusion/adapter/DateUtils.java | 287 --------------- .../system/fusion/adapter/FusionAdapter.java | 135 ------- .../analytics/system/fusion/adapter/IdName.java | 59 --- .../analytics/system/fusion/adapter/Item.java | 55 --- .../analytics/system/fusion/adapter/Lookup.java | 85 ----- .../system/fusion/adapter/RaptorAdapter.java | 368 ------------------ .../system/fusion/adapter/SpringContext.java | 37 -- .../fusion/controller/FileServletController.java | 206 ----------- .../analytics/system/fusion/domain/CR_Report.java | 306 --------------- .../analytics/system/fusion/domain/QuickLink.java | 61 --- .../system/fusion/domain/RaptorSearch.java | 188 ---------- .../analytics/system/fusion/domain/ReportInfo.java | 159 -------- .../system/fusion/service/RaptorService.java | 36 -- .../system/fusion/service/RaptorServiceImpl.java | 163 -------- .../system/fusion/web/RaptorController.java | 191 ---------- .../system/fusion/web/RaptorControllerAsync.java | 410 --------------------- .../fusion/web/ReportsSearchListController.java | 74 ---- 22 files changed, 3413 deletions(-) delete mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/AntBuild.java delete mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/AppUtils.java delete mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/DbUtils.java delete mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/RemoteDbUtils.java delete mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/adapter/AdapterSessionFactoryContainer.java delete mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/adapter/DateUtils.java delete mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/adapter/FusionAdapter.java delete mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/adapter/IdName.java delete mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/adapter/Item.java delete mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/adapter/Lookup.java delete mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/adapter/RaptorAdapter.java delete mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/adapter/SpringContext.java delete mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/controller/FileServletController.java delete mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/domain/CR_Report.java delete mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/domain/QuickLink.java delete mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/domain/RaptorSearch.java delete mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/domain/ReportInfo.java delete mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/service/RaptorService.java delete mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/service/RaptorServiceImpl.java delete mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/web/RaptorController.java delete mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/web/RaptorControllerAsync.java delete mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/web/ReportsSearchListController.java (limited to 'ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion') 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 deleted file mode 100644 index 724a07d3..00000000 --- a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/AntBuild.java +++ /dev/null @@ -1,66 +0,0 @@ -/*- - * ================================================================================ - * 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 deleted file mode 100644 index 008a1d8c..00000000 --- a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/AppUtils.java +++ /dev/null @@ -1,363 +0,0 @@ -/*- - * ================================================================================ - * 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 deleted file mode 100644 index 4638f3e3..00000000 --- a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/DbUtils.java +++ /dev/null @@ -1,75 +0,0 @@ -/*- - * ================================================================================ - * 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 deleted file mode 100644 index 4f8f7427..00000000 --- a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/RemoteDbUtils.java +++ /dev/null @@ -1,50 +0,0 @@ -/*- - * ================================================================================ - * 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 deleted file mode 100644 index 1e2de464..00000000 --- a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/adapter/AdapterSessionFactoryContainer.java +++ /dev/null @@ -1,39 +0,0 @@ -/*- - * ================================================================================ - * 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 deleted file mode 100644 index a9ea0979..00000000 --- a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/adapter/DateUtils.java +++ /dev/null @@ -1,287 +0,0 @@ -/*- - * ================================================================================ - * 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 deleted file mode 100644 index 33b6ec2d..00000000 --- a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/adapter/FusionAdapter.java +++ /dev/null @@ -1,135 +0,0 @@ -/*- - * ================================================================================ - * 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 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 getDataSourceMap() { - if(dataSourceMap==null) - dataSourceMap = (Map)SpringContext.getApplicationContext().getBean("dataSourceMap"); - - return dataSourceMap; - } - - public void setdataSourceMap(Map 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 deleted file mode 100644 index 5b4af3f9..00000000 --- a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/adapter/IdName.java +++ /dev/null @@ -1,59 +0,0 @@ -/*- - * ================================================================================ - * 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; - -/** - *

IdName.java

- *

Represents a id/name data object.

-*/ -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 deleted file mode 100644 index 71663bc2..00000000 --- a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/adapter/Item.java +++ /dev/null @@ -1,55 +0,0 @@ -/*- - * ================================================================================ - * 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 deleted file mode 100644 index ac6cd16c..00000000 --- a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/system/fusion/adapter/Lookup.java +++ /dev/null @@ -1,85 +0,0 @@ -/*- - * ================================================================================ - * 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