From 7f535078ef80a7b7efa3e3325bfccb994fbd00e8 Mon Sep 17 00:00:00 2001 From: "Christopher Lott (cl778h)" Date: Thu, 31 Aug 2017 15:16:38 -0400 Subject: Rename packages to org.onap in 1.4.0-SNAPSHOT 19 - remove openecomp 72 - remediate Sonar scan issues 79 - removed unwanted left menu under Report 90 - apply approved license text Issue: PORTAL-19, PORTAL-72, PORTAL-79, PORTAL-90 Change-Id: I41a0ef5fba623d2242574bd15f2d9fb8029a496c Signed-off-by: Christopher Lott (cl778h) --- .../portalsdk/core/util/CacheManager.java | 43 --- .../portalsdk/core/util/EncDecUtilTest.java | 112 ------- .../openecomp/portalsdk/core/util/JSONUtil.java | 56 ---- .../portalsdk/core/util/SystemProperties.java | 333 --------------------- .../openecomp/portalsdk/core/util/UsageUtils.java | 92 ------ .../openecomp/portalsdk/core/util/YamlUtils.java | 72 ----- 6 files changed, 708 deletions(-) delete mode 100644 ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/util/CacheManager.java delete mode 100644 ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/util/EncDecUtilTest.java delete mode 100644 ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/util/JSONUtil.java delete mode 100644 ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/util/SystemProperties.java delete mode 100644 ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/util/UsageUtils.java delete mode 100644 ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/util/YamlUtils.java (limited to 'ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/util') diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/util/CacheManager.java b/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/util/CacheManager.java deleted file mode 100644 index e26ac884..00000000 --- a/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/util/CacheManager.java +++ /dev/null @@ -1,43 +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.core.util; - -import org.openecomp.portalsdk.core.objectcache.jcs.JCSCacheManager; -import org.springframework.context.annotation.Configuration; -@Configuration -public class CacheManager extends JCSCacheManager { - public CacheManager() { - - } - - /* The following can be customized for your application to cache the appropriate data upon application startup. The provided - example retrieves a list of sample lookup data and puts the list in the Cache Manager. To retrieve that data, simply call the - Cache Manager's getObject(String key) method which will return an Object instance. To put additional data in the Cache Manager - outside of application startup, call the Cache Manager's putObject(String key, Object objectToCache) method. */ - public void loadLookUpCache() { - /* - List result = (List)getDataAccessService().getList(Role.class,null); - - if (result != null) { - putObject("lookupRoles", result); - }*/ - } - -} diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/util/EncDecUtilTest.java b/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/util/EncDecUtilTest.java deleted file mode 100644 index 23d90cc9..00000000 --- a/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/util/EncDecUtilTest.java +++ /dev/null @@ -1,112 +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.core.util; -import java.security.AlgorithmParameters; -import java.security.SecureRandom; - -import javax.crypto.BadPaddingException; -import javax.crypto.Cipher; -import javax.crypto.IllegalBlockSizeException; -import javax.crypto.SecretKey; -import javax.crypto.SecretKeyFactory; -import javax.crypto.spec.IvParameterSpec; -import javax.crypto.spec.PBEKeySpec; -import javax.crypto.spec.SecretKeySpec; - -import org.apache.commons.codec.binary.Base64; - -public class EncDecUtilTest { - - private static final String password = "test"; - private static final String salt = "r n�HN~��|f��X�" ; - private static int pswdIterations = 65536 ; - private static int keySize = 256; - private byte[] ivBytes; - - public String encrypt(String plainText) throws Exception { - - //get salt - //salt = generateSalt(); - byte[] saltBytes = salt.getBytes("UTF-8"); - - // Derive the key - SecretKeyFactory factory = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA1"); - PBEKeySpec spec = new PBEKeySpec( - password.toCharArray(), - saltBytes, - pswdIterations, - keySize - ); - - SecretKey secretKey = factory.generateSecret(spec); - SecretKeySpec secret = new SecretKeySpec(secretKey.getEncoded(), "AES"); - - //encrypt the message - Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); - cipher.init(Cipher.ENCRYPT_MODE, secret); - AlgorithmParameters params = cipher.getParameters(); - ivBytes = params.getParameterSpec(IvParameterSpec.class).getIV(); - byte[] encryptedTextBytes = cipher.doFinal(plainText.getBytes("UTF-8")); - return new Base64().encodeAsString(encryptedTextBytes); - } - - @SuppressWarnings("static-access") - public String decrypt(String encryptedText) throws Exception { - - byte[] saltBytes = salt.getBytes("UTF-8"); - byte[] encryptedTextBytes = new Base64().decodeBase64(encryptedText); - - // Derive the key - SecretKeyFactory factory = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA1"); - PBEKeySpec spec = new PBEKeySpec( - password.toCharArray(), - saltBytes, - pswdIterations, - keySize - ); - - SecretKey secretKey = factory.generateSecret(spec); - SecretKeySpec secret = new SecretKeySpec(secretKey.getEncoded(), "AES"); - - // Decrypt the message - Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); - cipher.init(Cipher.DECRYPT_MODE, secret, new IvParameterSpec(ivBytes)); - - - byte[] decryptedTextBytes = null; - try { - decryptedTextBytes = cipher.doFinal(encryptedTextBytes); - } catch (IllegalBlockSizeException e) { - e.printStackTrace(); - } catch (BadPaddingException e) { - e.printStackTrace(); - } - - return new String(decryptedTextBytes); - } - - public String generateSalt() { - SecureRandom random = new SecureRandom(); - byte bytes[] = new byte[20]; - random.nextBytes(bytes); - String s = new String(bytes); - return s; - } -} \ No newline at end of file diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/util/JSONUtil.java b/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/util/JSONUtil.java deleted file mode 100644 index 6b849e81..00000000 --- a/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/util/JSONUtil.java +++ /dev/null @@ -1,56 +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.core.util; - -import java.util.HashMap; -import java.util.Map; - -import org.openecomp.portalsdk.core.domain.User; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; - -public class JSONUtil { - public static String convertResponseToJSON(String response) throws JsonProcessingException{ - ObjectMapper mapper = new ObjectMapper(); - Map responseMap = new HashMap(); - responseMap.put("response", response); - response = mapper.writeValueAsString(responseMap); - return response; - } - - public static User mapToDomainUser(User domainUser, User editUser) { - domainUser.setOrgId(editUser.getOrgId()); - domainUser.setManagerId(editUser.getManagerId()); - domainUser.setFirstName(editUser.getFirstName()); - domainUser.setMiddleInitial(editUser.getMiddleInitial()); - domainUser.setLastName(editUser.getLastName()); - domainUser.setPhone(editUser.getPhone()); - domainUser.setEmail(editUser.getEmail()); - domainUser.setHrid(editUser.getHrid()); - domainUser.setOrgUserId(editUser.getOrgUserId()); - domainUser.setOrgCode(editUser.getOrgCode()); - domainUser.setOrgManagerUserId(editUser.getOrgManagerUserId()); - domainUser.setJobTitle(editUser.getJobTitle()); - domainUser.setLoginId(editUser.getLoginId()); - domainUser.setActive(editUser.getActive()); - return domainUser; - } -} diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/util/SystemProperties.java b/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/util/SystemProperties.java deleted file mode 100644 index 20dfec90..00000000 --- a/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/util/SystemProperties.java +++ /dev/null @@ -1,333 +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.core.util; - -import javax.servlet.ServletContext; - -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.PropertySource; -import org.springframework.core.env.Environment; - -/** - * SystemProperties contains a list of constants used throughout portions of the - * application. Populated by Spring from multiple configuration files. - * - * Should be used like this: - * - *
- * 
- * @Autowired
- * SystemProperties systemProperties;
- * 
- */ -@Configuration -@PropertySource(value = { "${container.classpath:}/WEB-INF/conf/system.properties", - "${container.classpath:}/WEB-INF/fusion/conf/fusion.properties", - "${container.classpath:}/WEB-INF/conf/sql.properties" }) -public class SystemProperties { - - private static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(SystemProperties.class); - - private static Environment environment; - - private ServletContext servletContext; - - public SystemProperties() { - } - - protected Environment getEnvironment() { - return environment; - } - - @Autowired - public void setEnvironment(Environment environment) { - SystemProperties.environment = environment; - } - - public ServletContext getServletContext() { - return servletContext; - } - - public void setServletContext(ServletContext servletContext) { - this.servletContext = servletContext; - } - - /** - * Tests whether a property value is available for the specified key. - * - * @param key Property key - * @return True if the key is known, otherwise false. - */ - public static boolean containsProperty(String key) { - return environment.containsProperty(key); - } - - /** - * Returns the property value associated with the given key (never - * {@code null}), after trimming any trailing space. - * - * @param key - * Property key - * @return Property value; the empty string if the environment was not - * autowired, which should never happen. - * @throws IllegalStateException - * if the key cannot be resolved - */ - public static String getProperty(String key) { - String value = ""; - if (environment == null) { - logger.error(EELFLoggerDelegate.errorLogger, "getProperty: environment is null, should never happen!"); - } - else { - value = environment.getRequiredProperty(key); - // java.util.Properties preserves trailing space - if (value != null) - value = value.trim(); - } - return value; - } - - /** - * Gets the property value for the key {@link #APPLICATION_NAME}. - * - * method created to get around JSTL 1.0 limitation of not being able to - * access a static method of a bean - * - * @return Application name - */ - public String getApplicationName() { - return getProperty(APPLICATION_NAME); - } - - /** - * Gets the property value for the key {@link #APP_DISPLAY_NAME}. - * - * @return Application display name - */ - public String getAppDisplayName() { - return getProperty(APP_DISPLAY_NAME); - } - - // keys used to reference values in the system properties file - public static final String DOMAIN_CLASS_LOCATION = "domain_class_location"; - public static final String DEFAULT_ERROR_MESSAGE = "default_error_message"; - - public static final String CSP_COOKIE_NAME = "csp_cookie_name"; - public static final String CSP_GATE_KEEPER_DATA_KEY = "csp_gate_keeper_data_key"; - public static final String CSP_GATE_KEEPER_PROD_KEY = "csp_gate_keeper_prod_key"; - public static final String CSP_LOGIN_URL = "csp_login_url"; - public static final String CSP_LOGOUT_URL = "csp_logout_url"; - - public static final String WEB_JUNCTION_USER_ID_HEADER_NAME = "web_junction_user_id_header_name"; - - public static final String AUTHENTICATION_MECHANISM = "authentication_mechanism"; - - public static final String APPLICATION_NAME = "application_name"; - public static final String HIBERNATE_CONFIG_FILE_PATH = "hibernate_config_file_path"; - public static final String APPLICATION_USER_ID = "application_user_id"; - - public static final String POST_INITIAL_CONTEXT_FACTORY = "post_initial_context_factory"; - public static final String POST_PROVIDER_URL = "post_provider_url"; - public static final String POST_SECURITY_PRINCIPAL = "post_security_principal"; - public static final String POST_MAX_RESULT_SIZE = "post_max_result_size"; - public static final String POST_DEFAULT_ROLE_ID = "post_default_role_id"; - - public static final String FILES_PATH = "files_path"; - public static final String TEMP_PATH = "temp_path"; - - public static final String NUM_UPLOAD_FILES = "num_upload_files"; - - public static final String SYS_ADMIN_ROLE_ID = "sys_admin_role_id"; - - public static final String SYS_ADMIN_ROLE_FUNCTION_DELETE_FROM_UI = "sys_admin_role_function_delete_from_ui"; - public static final String USER_NAME = "user_name"; - public static final String FIRST_NAME = "first_name"; - public static final String LAST_NAME = "last_name"; - public static final String APP_DISPLAY_NAME = "app_display_name"; - // Application base URL is a proper prefix of the on-boarding URL - public static final String APP_BASE_URL = "app_base_url"; - - public static final String MENU_PROPERTIES_FILE_LOCATION = "menu_properties_file_location"; - public static final String MENU_QUERY_NAME = "menu_query_name"; - public static final String APPLICATION_MENU_SET_NAME = "application_menu_set_name"; - public static final String APPLICATION_MENU_ATTRIBUTE_NAME = "application_menu_attribute_name"; - public static final String APPLICATION_MENU_PROPERTIES_NAME = "application_menu_properties_name"; - public static final String BUSINESS_DIRECT_MENU_SET_NAME = "business_direct_menu_set_name"; - public static final String BUSINESS_DIRECT_MENU_ATTRIBUTE_NAME = "business_direct_menu_attribute_name"; - public static final String BUSINESS_DIRECT_MENU_PROPERTIES_NAME = "business_direct_menu_properties_name"; - public static final String RAPTOR_CONFIG_FILE_PATH = "raptor_config_file_path"; - public static final String HOMEPAGE_DATA_CALLBACK_CLASS = "homepage_data_callback_class"; - public static final String ERROR_EMAIL_DISTRIBUTION = "error_email_distribution"; - public static final String ERROR_EMAIL_SOURCE_ADDRESS = "error_email_source_address"; - public static final String ERROR_EMAIL_SUBJECT_LINE = "error_email_subject_line"; - public static final String PROFILE_SEARCH_REPORT_ID = "profile_search_report_id"; - public static final String CALLABLE_PROFILE_SEARCH_REPORT_ID = "callable_profile_search_report_id"; - public static final String CLUSTERED = "clustered"; - - public static final String USER_ATTRIBUTE_NAME = "user_attribute_name"; - public static final String ROLES_ATTRIBUTE_NAME = "roles_attribute_name"; - public static final String ROLE_FUNCTIONS_ATTRIBUTE_NAME = "role_functions_attribute_name"; - public static final String CLIENT_DEVICE_ATTRIBUTE_NAME = "client_device_attribute_name"; - public static final String CLIENT_DEVICE_EMULATION = "client_device_emulation"; - public static final String CLIENT_DEVICE_TYPE_TO_EMULATE = "client_device_type_to_emulate"; - // File generation - Document - public static final String TEMPLATES_PATH = "templates_path"; - public static final String DOCUMENT_XML_ENCODING = "document_xml_encoding"; - - // Transaction - public static final String ROUTING_DATASOURCE_KEY = "routing_datasource_key"; - - // Document Library keys - public static final String DOCLIB_ADMIN_ROLE_ID = "doclib_admin_role_id"; - public static final String DOCLIB_USER_ROLE_ID = "doclib_user_role_id"; - - public static final String SYSTEM_PROPERTIES_FILENAME = "system.properties"; - public static final String FUSION_PROPERTIES_FILENAME = "fusion.properties"; - public static final String SUCCESS_TASKS_PROPERTIES_FILENAME = "success_tasks.properties"; - - // login methods - public static final String LOGIN_METHOD_CSP = "login_method_csp"; - public static final String LOGIN_METHOD_WEB_JUNCTION = "login_method_web_junction"; - public static final String LOGIN_METHOD_BACKDOOR = "login_method_backdoor"; - public static final String LOGIN_METHOD_ATTRIBUTE_NAME = "login_method_attribute_name"; - public static final String ROLE_FUNCTION_LIST = "role_function_list"; - - - // login error message keys - public static final String MESSAGE_KEY_LOGIN_ERROR_COOKIE_EMPTY = "login.error.hrid.empty"; - public static final String MESSAGE_KEY_LOGIN_ERROR_HEADER_EMPTY = "login.error.header.empty"; - public static final String MESSAGE_KEY_LOGIN_ERROR_USER_INACTIVE = "login.error.user.inactive"; - public static final String MESSAGE_KEY_LOGIN_ERROR_USER_NOT_FOUND = "login.error.hrid.not-found"; - public static final String MESSAGE_KEY_LOGIN_ERROR_APPLICATION_LOCKED = "login.error.application.locked"; - public static final String MESSAGE_KEY_AUTOLOGIN_NONE = "webphone.autoimport.nouser"; - public static final String MESSAGE_KEY_AUTOLOGIN_MULTIPLE = "webphone.autoimport.multiple"; - - // Application Mobile capability - public static final String MOBILE_ENABLE = "mobile_enable"; - - public static final String DATABASE_TIME_ZONE = "db.time_zone"; - - public static final String AUTO_USER_IMPORT_ENABLE = "auto_user_import_enable"; - public static final String AUTO_USER_IMPORT_ROLE = "auto_user_import_role"; - - public static final String ITRACKER_EMAIL_SOURCE_ADDRESS = "itracker_email_source_address"; - public static final String ITRACKER_EMAIL_DISTRIBUTION = "itracker_email_distribution"; - public static final String ITRACKER_SYSTEM_USER = "itracker_system_user_id"; - - public static final String MAIL_SERVER_HOST = "mail_server_host"; - public static final String MAIL_SERVER_PORT = "mail_server_port"; - - // Routing Data Source keys - public static final String ROUTING_DATASOURCE_KEY_NON_XA = "NON-XA"; - public static final String ROUTING_DATASOURCE_KEY_XA = "XA"; - public static final String QUARTZ_JOB_ENABLED = "quartz_job_enable"; - public static final String WORKFLOW_EMAIL_SENDER = "workflow_email_sender"; - public static final String DROOLS_GUVNOR_HOME = "drools.guvnor.home"; - - // Hibernate Config - public static final String HB_DIALECT = "hb.dialect"; - public static final String HB_SHOW_SQL = "hb.show_sql"; - public static final String IDLE_CONNECTION_TEST_PERIOD = "hb.idle_connection_test_period"; - - // DataSource - public static final String DB_DRIVER = "db.driver"; - public static final String DB_CONNECTIONURL = "db.connectionURL"; - public static final String DB_USERNAME = "db.userName"; - /** @deprecated this variable is used in many places so don't remove */ - public static final String DB_PASSWOR = "db.password"; - public static final String DB_PASSWORD = "db.password"; - public static final String DB_MIN_POOL_SIZE = "db.min_pool_size"; - public static final String DB_MAX_POOL_SIZE = "db.max_pool_size"; - public static final String TEST_CONNECTION_ON_CHECKOUT = "db.test_connection_on_checkout"; - public static final String PREFERRED_TEST_QUERY = "db.preferred_test_query"; - - public static final String MYLOGINS_FEED_CRON = "mylogins_feed_cron"; - public static final String SESSIONTIMEOUT_FEED_CRON = "sessiontimeout_feed_cron"; - public static final String LOG_CRON = "log_cron"; - - public static final String DB_ENCRYPT_FLAG = "db.encrypt_flag"; - - // Decryption Key - public static final String Decryption_Key = "decryption_key"; - - // Logging/Audit Fields - public static final String MDC_APPNAME = "AppName"; - public static final String MDC_REST_PATH = "RestPath"; - public static final String MDC_REST_METHOD = "RestMethod"; - public static final String INSTANCE_UUID = "instance_uuid"; - public static final String MDC_CLASS_NAME = "ClassName"; - public static final String MDC_LOGIN_ID = "LoginId"; - public static final String MDC_TIMER = "Timer"; - public static final String SDK_NAME = "ECOMP_SDK"; - public static final String ECOMP_REQUEST_ID = "X-ECOMP-RequestID"; - public static final String PARTNER_NAME = "PartnerName"; - public static final String FULL_URL = "Full-URL"; - public static final String AUDITLOG_BEGIN_TIMESTAMP = "AuditLogBeginTimestamp"; - public static final String AUDITLOG_END_TIMESTAMP = "AuditLogEndTimestamp"; - public static final String METRICSLOG_BEGIN_TIMESTAMP = "MetricsLogBeginTimestamp"; - public static final String METRICSLOG_END_TIMESTAMP = "MetricsLogEndTimestamp"; - public static final String CLIENT_IP_ADDRESS = "ClientIPAddress"; - public static final String STATUS_CODE = "StatusCode"; - public static final String RESPONSE_CODE = "ResponseCode"; - // Component or sub component name - public static final String TARGET_ENTITY = "TargetEntity"; - // API or operation name - public static final String TARGET_SERVICE_NAME = "TargetServiceName"; - - // Logging Compliance - public static final String DOUBLE_WHITESPACE_SEPARATOR = " "; - public static final String SINGLE_WHITESPACE_SEPARATOR = " "; - public static final String SINGLE_QUOTE = "'"; - public static final String NA = "N/A"; - public static final String UNKNOWN = "Unknown"; - public static final String SECURITY_LOG_TEMPLATE = "Protocol:{0} Security-Event-Type:{1} Login-ID:{2} {3}"; - public static final String ECOMP_PORTAL_BE = "ECOMP_PORTAL_BE"; - public static final String PROTOCOL = "PROTOCOL"; - public static final String SECURIRY_EVENT_TYPE = "SECURIRY_EVENT_TYPE"; - public static final String LOGIN_ID = "LOGIN_ID"; - public static final String ACCESSING_CLIENT = "ACCESSING_CLIENT"; - public static final String RESULT_STR = "RESULT"; - public static final String ECOMP_PORTAL_FE = "ECOMP_PORTAL_FE"; - public static final String ADDITIONAL_INFO = "ADDITIONAL_INFO"; - public static final String INTERFACE_NAME = "INTERFACE_NAME"; - public static final String USERAGENT_NAME = "user-agent"; - - // Protocols - public static final String HTTP = "HTTP"; - public static final String HTTPS = "HTTPS"; - public static final String SSO_VALUE = "sso"; - - public enum RESULT_ENUM { - SUCCESS, FAILURE - } - - public enum SecurityEventTypeEnum { - FE_LOGIN_ATTEMPT, FE_LOGOUT, SSO_LOGIN_ATTEMPT_PHASE_1, SSO_LOGIN_ATTEMPT_PHASE_2, SSO_LOGOUT, LDAP_PHONEBOOK_USER_SEARCH, INCOMING_REST_MESSAGE, OUTGOING_REST_MESSAGE, REST_AUTHORIZATION_CREDENTIALS_MODIFIED, ECOMP_PORTAL_USER_MODIFIED, ECOMP_PORTAL_USER_ADDED, ECOMP_PORTAL_USER_REMOVED, ECOMP_PORTAL_WIDGET, INCOMING_UEB_MESSAGE, ECOMP_PORTAL_HEALTHCHECK - } - - // Menu - public static final String CONTACT_US_LINK = "contact_us_link"; - - // Left Menu - public static final String LEFT_MENU_PARENT = "parentList"; - public static final String LEFT_MENU_CHILDREND = "childItemList"; -} diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/util/UsageUtils.java b/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/util/UsageUtils.java deleted file mode 100644 index a8cc7fd7..00000000 --- a/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/util/UsageUtils.java +++ /dev/null @@ -1,92 +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.core.util; - -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.Iterator; - -import javax.servlet.http.HttpSession; - -import org.openecomp.portalsdk.core.command.UserRowBean; -import org.openecomp.portalsdk.core.domain.User; - -public class UsageUtils { - @SuppressWarnings("rawtypes") - public static ArrayList getActiveUsers(HashMap activeUsers) { - ArrayList rows = new ArrayList(); - SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss"); - - for(Iterator i = activeUsers.keySet().iterator(); i.hasNext(); ){ - String sessionId = (String)i.next(); - HttpSession session = (HttpSession)activeUsers.get(sessionId); - User userBean = (User)session.getAttribute("user"); - // - // Not all sessions will be valid logins - // Skip those ones - // - if(null == userBean) - continue; - - UserRowBean userRow = new UserRowBean(); - userRow.setFirstName(userBean.getFirstName()); - userRow.setLastName(userBean.getLastName()); - userRow.setEmail(userBean.getEmail()); - userRow.setId(userBean.getId()); - userRow.setSessionId(sessionId); - userRow.setLoginTime(sdf.format(new Date(session.getCreationTime()))); - userRow.setLastLoginTime(sdf.format(userBean.getLastLoginDate())); - - // - // Calculate the last time and time remaining for these sessions. - // - int sessionLength = session.getMaxInactiveInterval(); - long now = new java.util.Date().getTime(); - long lastAccessed = (now - session.getLastAccessedTime()) / 1000; - long lengthInactive = (now - session.getLastAccessedTime()); - long minutesRemaining = sessionLength - (lengthInactive / 1000); - - userRow.setLastAccess((lastAccessed / 60) + ":" + String.format("%02d", (lastAccessed % 60))); - userRow.setRemaining((minutesRemaining / 60) + ":" + String.format("%02d", (minutesRemaining % 60))); - - rows.add(userRow); - } - - return rows; - } - - @SuppressWarnings("rawtypes") - public static ArrayList getActiveUsersAfterDelete(HashMap activeUsers, final java.lang.Object data) { - return getActiveUsers(deleteSession(activeUsers,data)); - - } - - @SuppressWarnings("rawtypes") - private static HashMap deleteSession(HashMap activeUsers, Object data) { - String sessionId = ((UserRowBean)data).getSessionId(); - HttpSession session = (HttpSession)activeUsers.get(sessionId); - session.invalidate(); - activeUsers.remove(sessionId); - - return activeUsers; - } -} diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/util/YamlUtils.java b/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/util/YamlUtils.java deleted file mode 100644 index da69b729..00000000 --- a/ecomp-sdk/epsdk-core/src/main/java/org/openecomp/portalsdk/core/util/YamlUtils.java +++ /dev/null @@ -1,72 +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.core.util; - -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileReader; -import java.io.FileWriter; -import java.io.IOException; -import java.util.Map; - -import org.yaml.snakeyaml.Yaml; -import org.yaml.snakeyaml.representer.Representer; - -public class YamlUtils { - - static Yaml yaml; - - static { - - Representer representer = new Representer(); - //representer.addClassTag(Domain.class, Tag.MAP); - - - yaml = new Yaml(representer); - - } - - public static void writeYamlFile(String filePath, String fileName, - Map model) throws IOException { - FileWriter writer = new FileWriter(filePath + File.separator + fileName); - yaml.dump(model, writer); - writer.close(); - } - - public static String returnYaml( - Map model) throws IOException { - - return yaml.dump(model); - - } - - @SuppressWarnings("unchecked") - public static Map readYamlFile( - String filePath, String fileName) throws FileNotFoundException, - IOException { - FileReader reader = new FileReader(filePath + File.separator + fileName); - - Map callFlowBs = (Map)yaml.load(reader); - reader.close(); - return callFlowBs; - } - - -} -- cgit 1.2.3-korg