From 8cd208ebaa33627daf05d8ffff7b28e53a7067d0 Mon Sep 17 00:00:00 2001 From: "Christopher Lott (cl778h)" Date: Thu, 7 Sep 2017 08:52:41 -0400 Subject: Adjust code for Sonar issues Made non-functional updates to address static code analysis issues. Update license header with simple double-quote characters. Issue: PORTAL-72, PORTAL-90 Change-Id: Ic2c330daea07d721f0e6b350ebf03da97073f7ce Signed-off-by: Christopher Lott (cl778h) --- .../portalsdk/core/logging/aspect/AuditLog.java | 9 +- .../core/logging/aspect/EELFLoggerAdvice.java | 22 +- .../core/logging/aspect/EELFLoggerAspect.java | 49 +-- .../portalsdk/core/logging/aspect/MetricsLog.java | 9 +- .../core/logging/format/AlarmSeverityEnum.java | 10 +- .../core/logging/format/AppMessagesEnum.java | 391 ++++++++++++--------- .../core/logging/format/AuditLogFormatter.java | 81 ++--- .../core/logging/format/ErrorCodesEnum.java | 96 ++--- .../core/logging/format/ErrorSeverityEnum.java | 9 +- .../core/logging/format/ErrorTypeEnum.java | 11 +- .../core/logging/logic/EELFLoggerDelegate.java | 71 ++-- 11 files changed, 375 insertions(+), 383 deletions(-) (limited to 'ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/logging') diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/logging/aspect/AuditLog.java b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/logging/aspect/AuditLog.java index 93075937..6a5ce910 100644 --- a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/logging/aspect/AuditLog.java +++ b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/logging/aspect/AuditLog.java @@ -6,7 +6,7 @@ * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * under the Apache License, Version 2.0 (the "License"); * you may not use this software except in compliance with the License. * You may obtain a copy of the License at * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); * you may not use this documentation except in compliance with the License. * You may obtain a copy of the License at * @@ -42,9 +42,8 @@ import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; - -@Target({ElementType.METHOD, ElementType.TYPE}) +@Target({ ElementType.METHOD, ElementType.TYPE }) @Retention(RetentionPolicy.RUNTIME) public @interface AuditLog { - String value() default ""; + String value() default ""; } \ No newline at end of file diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/logging/aspect/EELFLoggerAdvice.java b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/logging/aspect/EELFLoggerAdvice.java index 269d4b9c..779a24fc 100644 --- a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/logging/aspect/EELFLoggerAdvice.java +++ b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/logging/aspect/EELFLoggerAdvice.java @@ -6,7 +6,7 @@ * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * under the Apache License, Version 2.0 (the "License"); * you may not use this software except in compliance with the License. * You may obtain a copy of the License at * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); * you may not use this documentation except in compliance with the License. * You may obtain a copy of the License at * @@ -105,16 +105,14 @@ public class EELFLoggerAdvice { MDC.put(SystemProperties.TARGET_SERVICE_NAME, methodName); if (securityEventType != null) { MDC.put(className + methodName + SystemProperties.AUDITLOG_BEGIN_TIMESTAMP, getCurrentDateTimeUTC()); - HttpServletRequest req = null; if (args[0] != null && args[0] instanceof HttpServletRequest) { - req = (HttpServletRequest) args[0]; + HttpServletRequest req = (HttpServletRequest) args[0]; logger.setRequestBasedDefaultsIntoGlobalLoggingContext(req, appName); } } - logger.debug(EELFLoggerDelegate.debugLogger, (methodName + " was invoked.")); + logger.debug(EELFLoggerDelegate.debugLogger, "{} was invoked.", methodName); } catch (Exception e) { - adviceLogger.error(EELFLoggerDelegate.errorLogger, - "Exception occurred in EELFLoggerAdvice.before() method. Details: " + e.getMessage()); + adviceLogger.error(EELFLoggerDelegate.errorLogger, "before failed", e); } return new Object[] { "" }; @@ -197,8 +195,7 @@ public class EELFLoggerAdvice { MDC.remove(SystemProperties.TARGET_ENTITY); MDC.remove(SystemProperties.TARGET_SERVICE_NAME); } catch (Exception e) { - adviceLogger.error(EELFLoggerDelegate.errorLogger, - "Exception occurred in EELFLoggerAdvice.after() method. Details: " + e.getMessage()); + adviceLogger.error(EELFLoggerDelegate.errorLogger, "after failed", e); } } @@ -212,7 +209,6 @@ public class EELFLoggerAdvice { private void logSecurityMessage(EELFLoggerDelegate logger, SecurityEventTypeEnum securityEventType, String result, String restMethod) { StringBuilder additionalInfoAppender = new StringBuilder(); - String auditMessage = ""; additionalInfoAppender.append(String.format("%s request was received.", restMethod)); @@ -224,7 +220,7 @@ public class EELFLoggerAdvice { additionalInfoAppender.append(" Request-URL:" + MDC.get(SystemProperties.FULL_URL)); } - auditMessage = AuditLogFormatter.getInstance().createMessage(MDC.get(SystemProperties.PROTOCOL), + String auditMessage = AuditLogFormatter.getInstance().createMessage(MDC.get(SystemProperties.PROTOCOL), securityEventType.name(), MDC.get(SystemProperties.MDC_LOGIN_ID), additionalInfoAppender.toString()); logger.info(EELFLoggerDelegate.auditLogger, auditMessage); @@ -243,9 +239,7 @@ public class EELFLoggerAdvice { String timeDifference = String.format("%d ms", endDate.getTime() - beginDate.getTime()); MDC.put(SystemProperties.MDC_TIMER, timeDifference); } catch (Exception e) { - adviceLogger.error(EELFLoggerDelegate.errorLogger, - "Exception occurred in EELFLoggerAdvice.calculateDateTimeDifference() method. Details: " - + e.getMessage()); + adviceLogger.error(EELFLoggerDelegate.errorLogger, "calculateDateTimeDifference failed", e); } } } diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/logging/aspect/EELFLoggerAspect.java b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/logging/aspect/EELFLoggerAspect.java index 8c958924..3ffd0894 100644 --- a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/logging/aspect/EELFLoggerAspect.java +++ b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/logging/aspect/EELFLoggerAspect.java @@ -6,7 +6,7 @@ * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * under the Apache License, Version 2.0 (the "License"); * you may not use this software except in compliance with the License. * You may obtain a copy of the License at * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); * you may not use this documentation except in compliance with the License. * You may obtain a copy of the License at * @@ -44,20 +44,21 @@ import org.aspectj.lang.annotation.Pointcut; import org.onap.portalsdk.core.util.SystemProperties.SecurityEventTypeEnum; import org.springframework.beans.factory.annotation.Autowired; - @Aspect @org.springframework.context.annotation.Configuration public class EELFLoggerAspect { - + @Autowired - EELFLoggerAdvice advice; - + private EELFLoggerAdvice advice; + /* * Point-cut expression to handle all INCOMING_REST_MESSAGES */ @Pointcut("execution(public * org.onap.portalsdk.core.controller.*.*(..))") - public void incomingAuditMessages() {} - + public void incomingAuditMessages() { + // Nothing is logged on incoming message + } + @Around("incomingAuditMessages() && @annotation(auditLog)") public Object logAuditMethodAround(ProceedingJoinPoint joinPoint, AuditLog auditLog) throws Throwable { return this.logAroundMethod(joinPoint, SecurityEventTypeEnum.INCOMING_REST_MESSAGE); @@ -67,40 +68,44 @@ public class EELFLoggerAspect { public Object logAuditMethodClassAround(ProceedingJoinPoint joinPoint, AuditLog auditLog) throws Throwable { return this.logAroundMethod(joinPoint, SecurityEventTypeEnum.INCOMING_REST_MESSAGE); } - + /* * Point cut expression to capture metrics logging */ @Pointcut("execution(public * *(..))") - public void publicMethod() {} - + public void publicMethod() { + // By default do nothing + } + @Around("publicMethod() && @within(metricsLog)") public Object logMetricsClassAround(ProceedingJoinPoint joinPoint, MetricsLog metricsLog) throws Throwable { return this.logAroundMethod(joinPoint, null); } - + @Around("publicMethod() && @annotation(metricsLog)") public Object logMetricsMethodAround(ProceedingJoinPoint joinPoint, MetricsLog metricsLog) throws Throwable { return this.logAroundMethod(joinPoint, null); } - - private Object logAroundMethod(ProceedingJoinPoint joinPoint, SecurityEventTypeEnum securityEventType) throws Throwable { - //Before - Object[] passOnArgs = new Object[] {joinPoint.getSignature().getDeclaringType().getName(),joinPoint.getSignature().getName()}; + + private Object logAroundMethod(ProceedingJoinPoint joinPoint, SecurityEventTypeEnum securityEventType) + throws Throwable { + // Before + Object[] passOnArgs = new Object[] { joinPoint.getSignature().getDeclaringType().getName(), + joinPoint.getSignature().getName() }; Object[] returnArgs = advice.before(securityEventType, joinPoint.getArgs(), passOnArgs); - - //Execute the actual method + + // Execute the actual method Object result = null; String restStatus = "COMPLETE"; try { result = joinPoint.proceed(); - } catch(Exception e) { + } catch (Exception e) { restStatus = "ERROR"; } - - //After + + // After advice.after(securityEventType, restStatus, joinPoint.getArgs(), returnArgs, passOnArgs); - + return result; } } diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/logging/aspect/MetricsLog.java b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/logging/aspect/MetricsLog.java index 7d552774..3e089aeb 100644 --- a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/logging/aspect/MetricsLog.java +++ b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/logging/aspect/MetricsLog.java @@ -6,7 +6,7 @@ * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * under the Apache License, Version 2.0 (the "License"); * you may not use this software except in compliance with the License. * You may obtain a copy of the License at * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); * you may not use this documentation except in compliance with the License. * You may obtain a copy of the License at * @@ -42,9 +42,8 @@ import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; - -@Target({ElementType.METHOD, ElementType.TYPE}) +@Target({ ElementType.METHOD, ElementType.TYPE }) @Retention(RetentionPolicy.RUNTIME) public @interface MetricsLog { - String value() default ""; + String value() default ""; } diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/logging/format/AlarmSeverityEnum.java b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/logging/format/AlarmSeverityEnum.java index f2481e34..5e202475 100644 --- a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/logging/format/AlarmSeverityEnum.java +++ b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/logging/format/AlarmSeverityEnum.java @@ -6,7 +6,7 @@ * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * under the Apache License, Version 2.0 (the "License"); * you may not use this software except in compliance with the License. * You may obtain a copy of the License at * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); * you may not use this documentation except in compliance with the License. * You may obtain a copy of the License at * @@ -38,9 +38,5 @@ package org.onap.portalsdk.core.logging.format; public enum AlarmSeverityEnum { - CRITICAL, - MAJOR, - MINOR, - INFORMATIONAL, - NONE, + CRITICAL, MAJOR, MINOR, INFORMATIONAL, NONE, } diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/logging/format/AppMessagesEnum.java b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/logging/format/AppMessagesEnum.java index 84790f6b..569f9392 100644 --- a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/logging/format/AppMessagesEnum.java +++ b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/logging/format/AppMessagesEnum.java @@ -6,7 +6,7 @@ * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * under the Apache License, Version 2.0 (the "License"); * you may not use this software except in compliance with the License. * You may obtain a copy of the License at * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); * you may not use this documentation except in compliance with the License. * You may obtain a copy of the License at * @@ -39,164 +39,213 @@ package org.onap.portalsdk.core.logging.format; public enum AppMessagesEnum { /* - 100-199 Security/Permission Related - - Authentication problems (from external client, to external server) - - Certification errors - - - - 200-299 Availability/Timeout Related - - connectivity error - - connection timeout - - 300-399 Data Access/Integrity Related - - Data in graph in invalid(E.g. no creator is found for service) - - Artifact is missing in ES, but exists in graph. - - 400-499 Schema Interface Type/Validation - - received Pay-load checksum is invalid - - received JSON is not valid - - 500-599 Business/Flow Processing Related - - check out to service is not allowed - - Roll-back is done - - failed to generate heat file - - - 600-899 Reserved - do not use - - 900-999 Unknown Errors - - Unexpected exception - */ - - BeUebAuthenticationError(ErrorCodesEnum.BEUEBAUTHENTICATIONERROR_ONE_ARGUMENT, ErrorTypeEnum.AUTHENTICATION_PROBLEM, AlarmSeverityEnum.MAJOR, ErrorSeverityEnum.ERROR, - "ERR100E", "An Authentication failure occurred during access to UEB server", "Details: {0}.", "Please check UEB server list and keys configured under Portal.Properties file."), - - BeRestApiAuthenticationError(ErrorCodesEnum.BERESTAPIAUTHENTICATIONERROR, ErrorTypeEnum.AUTHENTICATION_PROBLEM, AlarmSeverityEnum.MAJOR, ErrorSeverityEnum.ERROR, - "ERR101E", "Rejected an incoming REST API request due to invalid credentials", "", "Please check application credentials defined in Database or properties files."), - - InternalAuthenticationInfo(ErrorCodesEnum.INTERNALAUTHENTICATIONINFO_ONE_ARGUMENT, ErrorTypeEnum.AUTHENTICATION_PROBLEM, AlarmSeverityEnum.INFORMATIONAL, ErrorSeverityEnum.INFO, - "ERR199I", "Internal authentication problem", "Details: {0}.", "Please check the logs for more information."), - - InternalAuthenticationWarning(ErrorCodesEnum.INTERNALAUTHENTICATIONWARNING_ONE_ARGUMENT, ErrorTypeEnum.AUTHENTICATION_PROBLEM, AlarmSeverityEnum.MINOR, ErrorSeverityEnum.WARN, - "ERR199W", "Internal authentication problem", "Details: {0}.", "Please check the logs for more information."), - - InternalAuthenticationError(ErrorCodesEnum.INTERNALAUTHENTICATIONERROR_ONE_ARGUMENT, ErrorTypeEnum.AUTHENTICATION_PROBLEM, AlarmSeverityEnum.MAJOR, ErrorSeverityEnum.ERROR, - "ERR199E", "Internal authentication problem", "Details: {0}.", "Please check the logs for more information."), - - InternalAuthenticationFatal(ErrorCodesEnum.INTERNALAUTHENTICATIONFATAL_ONE_ARGUMENT, ErrorTypeEnum.AUTHENTICATION_PROBLEM, AlarmSeverityEnum.CRITICAL, ErrorSeverityEnum.FATAL, - "ERR199F", "Internal authentication problem", "Details: {0}.", "Please check the logs for more information."), - - BeHealthCheckError(ErrorCodesEnum.BeHEALTHCHECKERROR, ErrorTypeEnum.SYSTEM_ERROR, AlarmSeverityEnum.CRITICAL, ErrorSeverityEnum.ERROR, - "ERR200E", "ECOMP-PORTAL Back-end probably lost connectivity to either one of the following components: MySQL DB, UEB Cluster", "", "Please check the logs for more information."), - - BeHealthCheckMySqlError(ErrorCodesEnum.BEHEALTHCHECKMYSQLERROR, ErrorTypeEnum.SYSTEM_ERROR, AlarmSeverityEnum.CRITICAL, ErrorSeverityEnum.ERROR, - "ERR201E", "ECOMP-PORTAL Back-end probably lost connectivity to MySQL DB", "", "Check connectivity to MYSQL is configured correctly under system.properties file."), - - BeHealthCheckUebClusterError(ErrorCodesEnum.BEHEALTHCHECKUEBCLUSTERERROR, ErrorTypeEnum.SYSTEM_ERROR, AlarmSeverityEnum.CRITICAL, ErrorSeverityEnum.ERROR, - "ERR203E", "ECOMP-PORTAL Back-end probably lost connectivity to UEB Cluster", "", "Check connectivity to UEB cluster which is configured under portal.properties file."), - - FeHealthCheckError(ErrorCodesEnum.FEHEALTHCHECKERROR, ErrorTypeEnum.SYSTEM_ERROR, AlarmSeverityEnum.CRITICAL, ErrorSeverityEnum.ERROR, - "ERR204E", "Unable to connect to a valid ECOMP-PORTAL Back-end Server.", "", "Please check connectivity from this FE instance towards BE or BE Load Balancer."), - - BeHealthCheckRecovery(ErrorCodesEnum.BEHEALTHCHECKRECOVERY, ErrorTypeEnum.RECOVERY, AlarmSeverityEnum.INFORMATIONAL, ErrorSeverityEnum.INFO, - "ERR205I", "ECOMP-PORTAL Back-end Recovery to either one of the following components: MySQL DB, UEB Cluster", "", "Please check logs for more specific information about the problem."), - - BeHealthCheckMySqlRecovery(ErrorCodesEnum.BEHEALTHCHECKMYSQLRECOVERY, ErrorTypeEnum.RECOVERY, AlarmSeverityEnum.INFORMATIONAL, ErrorSeverityEnum.INFO, - "ERR206I", "ECOMP-PORTAL Back-end connection recovery to MySQL DB", "", "Please check logs for more specific information about the problem."), - - BeHealthCheckUebClusterRecovery(ErrorCodesEnum.BEHEALTHCHECKUEBCLUSTERRECOVERY, ErrorTypeEnum.RECOVERY, AlarmSeverityEnum.INFORMATIONAL, ErrorSeverityEnum.INFO, - "ERR208I", "ECOMP-PORTAL Back-end connection recovery to UEB Cluster", "", "Please check logs for more specific information about the problem."), - - FeHealthCheckRecovery(ErrorCodesEnum.FEHEALTHCHECKRECOVERY, ErrorTypeEnum.RECOVERY, AlarmSeverityEnum.INFORMATIONAL, ErrorSeverityEnum.INFO, - "ERR209I", "Connectivity to ECOMP-PORTAL Front-end Server is recovered", "", "Please check logs for more specific information about the problem."), - - BeUebConnectionError(ErrorCodesEnum.BEUEBCONNECTIONERROR_ONE_ARGUMENT, ErrorTypeEnum.CONNECTION_PROBLEM, AlarmSeverityEnum.MAJOR, ErrorSeverityEnum.ERROR, - "ERR210E", "ECOMP-PORTAL Back-end probably lost connectivity to UEB Cluster", "Details: {0}.", "Please check UEB server list and keys configured under Portal.Properties file."), - - BeUebUnkownHostError(ErrorCodesEnum.BEUEBUNKOWNHOSTERROR_ONE_ARGUMENT, ErrorTypeEnum.CONNECTION_PROBLEM, AlarmSeverityEnum.MAJOR, ErrorSeverityEnum.ERROR, - "ERR211E", "ECOMP-PORTAL Back-end probably lost connectivity to UEB Cluster", "Cannot reach host: {0}.", "Please check UEB server list and keys configured under Portal.Properties file."), - - BeUebRegisterOnboardingAppError(ErrorCodesEnum.BEUEBREGISTERONBOARDINGAPPERROR, ErrorTypeEnum.CONNECTION_PROBLEM, AlarmSeverityEnum.MAJOR, ErrorSeverityEnum.ERROR, - "ERR212E", "Failed to register the On-boarding application with UEB Communication server", "Details: {0}.", "Please check UEB server list and keys configured under Portal.Properties file."), - - BeHttpConnectionError(ErrorCodesEnum.BEHTTPCONNECTIONERROR_ONE_ARGUMENT, ErrorTypeEnum.CONNECTION_PROBLEM, AlarmSeverityEnum.MAJOR, ErrorSeverityEnum.ERROR, - "ERR213E", "It could be that communication to an external application might resulted an exception or failed to reach the external application", - "Details: {0}.", "Please check logs for more information."), - - InternalConnectionInfo(ErrorCodesEnum.INTERNALCONNECTIONINFO_ONE_ARGUMENT, ErrorTypeEnum.CONNECTION_PROBLEM, AlarmSeverityEnum.INFORMATIONAL, ErrorSeverityEnum.INFO, - "ERR299I", "Internal Connection problem", "Details: {0}.", "Please check logs for more information."), - - InternalConnectionWarning(ErrorCodesEnum.INTERNALCONNECTIONWARNING_ONE_ARGUMENT, ErrorTypeEnum.CONNECTION_PROBLEM, AlarmSeverityEnum.MINOR, ErrorSeverityEnum.WARN, - "ERR299W", "Internal Connection problem", "Details: {0}.", "Please check logs for more information."), - - InternalConnectionError(ErrorCodesEnum.INTERNALCONNECTIONERROR_ONE_ARGUMENT, ErrorTypeEnum.CONNECTION_PROBLEM, AlarmSeverityEnum.MAJOR, ErrorSeverityEnum.ERROR, - "ERR299E", "Internal Connection problem", "Details: {0}.", "Please check logs for more information."), - - InternalConnectionFatal(ErrorCodesEnum.INTERNALCONNECTIONFATAL_ONE_ARGUMENT, ErrorTypeEnum.CONNECTION_PROBLEM, AlarmSeverityEnum.CRITICAL, ErrorSeverityEnum.FATAL, - "ERR299F", "Internal Connection problem", "Details: {0}.", "Please check logs for more information."), - - BeUebObjectNotFoundError(ErrorCodesEnum.BEUEBOBJECTNOTFOUNDERROR_ONE_ARGUMENT, ErrorTypeEnum.DATA_ERROR, AlarmSeverityEnum.MAJOR, ErrorSeverityEnum.ERROR, - "ERR303E", "Error occurred during access to U-EB Server.", "Data not found: {0}.", "An error occurred during access to UEB Server, {1} failed to either register or unregister to/from UEB topic."), - - BeUserMissingError(ErrorCodesEnum.BEUSERMISSINGERROR_ONE_ARGUMENT, ErrorTypeEnum.DATA_ERROR, AlarmSeverityEnum.MAJOR, ErrorSeverityEnum.ERROR, - "ERR310E", "User is not found", "", "User {0} must be added to the corresponding application with proper user roles."), - - BeUserInactiveWarning(ErrorCodesEnum.BEUSERINACTIVEWARNING_ONE_ARGUMENT, ErrorTypeEnum.DATA_ERROR, AlarmSeverityEnum.MINOR, ErrorSeverityEnum.WARN, - "ERR313W", "User is found but in-active", "", "User {0} must be added to the corresponding application with proper user roles."), - - BeUserAdminPrivilegesInfo(ErrorCodesEnum.BEUSERADMINPRIVILEGESINFO_ONE_ARGUMENT, ErrorTypeEnum.DATA_ERROR, AlarmSeverityEnum.MINOR, ErrorSeverityEnum.WARN, - "ERR314W", "User is found but don't have administrative privileges", "", "User {0} should be given administrator role for the corresponding application to perform the necessary actions."), - - BeInvalidJsonInput(ErrorCodesEnum.BEINVALIDJSONINPUT, ErrorTypeEnum.SYSTEM_ERROR, AlarmSeverityEnum.MAJOR, ErrorSeverityEnum.ERROR, - "ERR405E", "Failed to convert JSON input to object", "", "Please check logs for more information."), - - BeIncorrectHttpStatusError(ErrorCodesEnum.BEINCORRECTHTTPSTATUSERROR, ErrorTypeEnum.SYSTEM_ERROR, AlarmSeverityEnum.MAJOR, ErrorSeverityEnum.ERROR, - "ERR407E", "Communication to an external application is resulted in with Incorrect Http response code", "", "Please check logs for more information."), - - BeInitializationError(ErrorCodesEnum.BEINITIALIZATIONERROR, ErrorTypeEnum.SYSTEM_ERROR, AlarmSeverityEnum.CRITICAL, ErrorSeverityEnum.ERROR, - "ERR500E", "ECOMP-PORTAL Back-end was not initialized properly", "", "Please check logs for more information."), - - BeUebSystemError(ErrorCodesEnum.BEUEBSYSTEMERROR, ErrorTypeEnum.SYSTEM_ERROR, AlarmSeverityEnum.MAJOR, ErrorSeverityEnum.ERROR, - "ERR502E", "Error occurred during access to U-EB Server", "Details: {0}.", "An error occurred in {1} distribution mechanism. Please check the logs for more information."), - - BeDaoSystemError(ErrorCodesEnum.BEDAOSYSTEMERROR, ErrorTypeEnum.SYSTEM_ERROR, AlarmSeverityEnum.CRITICAL, ErrorSeverityEnum.ERROR, - "ERR505E", "Performing DDL or DML operations on database might have failed", "", "Please check MySQL DB health or look at the logs for more details."), - - BeSystemError(ErrorCodesEnum.BESYSTEMERROR, ErrorTypeEnum.SYSTEM_ERROR, AlarmSeverityEnum.CRITICAL, ErrorSeverityEnum.ERROR, - "ERR506E", "Unexpected error during operation", "", "Please check logs for more information."), - - BeExecuteRollbackError(ErrorCodesEnum.BEEXECUTEROLLBACKERROR, ErrorTypeEnum.DATA_ERROR, AlarmSeverityEnum.MAJOR, ErrorSeverityEnum.ERROR, - "ERR507E", "Roll-back operation towards database has failed", "", "Please check MYSQL DB health or look at the logs for more details."), - - FeHttpLoggingError(ErrorCodesEnum.FEHTTPLOGGINGERROR, ErrorTypeEnum.SYSTEM_ERROR, AlarmSeverityEnum.MINOR, ErrorSeverityEnum.ERROR, - "ERR517E", "Error when logging FE HTTP request/response", "", "Please check MYSQL DB health or look at the logs for more details."), - - FePortalServletError(ErrorCodesEnum.FEPORTALSERVLETERROR, ErrorTypeEnum.SYSTEM_ERROR, AlarmSeverityEnum.MAJOR, ErrorSeverityEnum.ERROR, - "ERR518E", "Error when trying to access FE Portal page.", "", "Please check logs for more information."), - - BeDaoCloseSessionError(ErrorCodesEnum.BEDAOCLOSESESSIONERROR, ErrorTypeEnum.SYSTEM_ERROR, AlarmSeverityEnum.MAJOR, ErrorSeverityEnum.ERROR, - "ERR519E", "Close local session operation with database failed", "", "Please check MYSQL DB health or look at the logs form more details."), - - BeRestApiGeneralError(ErrorCodesEnum.BERESTAPIGENERALERROR, ErrorTypeEnum.SYSTEM_ERROR, AlarmSeverityEnum.CRITICAL, ErrorSeverityEnum.ERROR, - "ERR900E", "Unexpected error during ECOMP-PORTAL Back-end REST API execution", "", "Please check error log for more information."), - - FeHealthCheckGeneralError(ErrorCodesEnum.FEHEALTHCHECKGENERALERROR, ErrorTypeEnum.SYSTEM_ERROR, AlarmSeverityEnum.CRITICAL, ErrorSeverityEnum.ERROR, - "ERR901E", "General error during FE Health Check", "", "Please check error log for more information."), - - InternalUnexpectedInfo(ErrorCodesEnum.INTERNALUNEXPECTEDINFO_ONE_ARGUMENT, ErrorTypeEnum.SYSTEM_ERROR, AlarmSeverityEnum.INFORMATIONAL, ErrorSeverityEnum.INFO, - "ERR999I", "Unexpected error", "Details: {0}.", "Please check logs for more information."), - - InternalUnexpectedWarning(ErrorCodesEnum.INTERNALUNEXPECTEDWARNING_ONE_ARGUMENT, ErrorTypeEnum.SYSTEM_ERROR, AlarmSeverityEnum.MINOR, ErrorSeverityEnum.WARN, - "ERR999W", "Unexpected error", "Details: {0}.", "Please check logs for more information."), - - InternalUnexpectedError(ErrorCodesEnum.INTERNALUNEXPECTEDERROR_ONE_ARGUMENT, ErrorTypeEnum.SYSTEM_ERROR, AlarmSeverityEnum.MAJOR, ErrorSeverityEnum.ERROR, - "ERR999E", "Unexpected error", "Details: {0}.", "Please check logs for more information."), - - InternalUnexpectedFatal(ErrorCodesEnum.INTERNALUNEXPECTEDFATAL_ONE_ARGUMENT, ErrorTypeEnum.SYSTEM_ERROR, AlarmSeverityEnum.CRITICAL, ErrorSeverityEnum.FATAL, - "ERR999F", "Unexpected error", "Details: {0}.", "Please check logs for more information."), - + * 100-199 Security/Permission Related - Authentication problems (from external + * client, to external server) - Certification errors - + * + * 200-299 Availability/Timeout Related - connectivity error - connection + * timeout + * + * 300-399 Data Access/Integrity Related - Data in graph in invalid(E.g. no + * creator is found for service) - Artifact is missing in ES, but exists in + * graph. + * + * 400-499 Schema Interface Type/Validation - received Pay-load checksum is + * invalid - received JSON is not valid + * + * 500-599 Business/Flow Processing Related - check out to service is not + * allowed - Roll-back is done - failed to generate heat file + * + * + * 600-899 Reserved - do not use + * + * 900-999 Unknown Errors - Unexpected exception + */ + + BeUebAuthenticationError(ErrorCodesEnum.BEUEBAUTHENTICATIONERROR_ONE_ARGUMENT, ErrorTypeEnum.AUTHENTICATION_PROBLEM, + AlarmSeverityEnum.MAJOR, ErrorSeverityEnum.ERROR, "ERR100E", + "An Authentication failure occurred during access to UEB server", "Details: {0}.", + "Please check UEB server list and keys configured under Portal.Properties file."), + + BeRestApiAuthenticationError(ErrorCodesEnum.BERESTAPIAUTHENTICATIONERROR, ErrorTypeEnum.AUTHENTICATION_PROBLEM, + AlarmSeverityEnum.MAJOR, ErrorSeverityEnum.ERROR, "ERR101E", + "Rejected an incoming REST API request due to invalid credentials", "", + "Please check application credentials defined in Database or properties files."), + + InternalAuthenticationInfo(ErrorCodesEnum.INTERNALAUTHENTICATIONINFO_ONE_ARGUMENT, + ErrorTypeEnum.AUTHENTICATION_PROBLEM, AlarmSeverityEnum.INFORMATIONAL, ErrorSeverityEnum.INFO, "ERR199I", + "Internal authentication problem", "Details: {0}.", "Please check the logs for more information."), + + InternalAuthenticationWarning(ErrorCodesEnum.INTERNALAUTHENTICATIONWARNING_ONE_ARGUMENT, + ErrorTypeEnum.AUTHENTICATION_PROBLEM, AlarmSeverityEnum.MINOR, ErrorSeverityEnum.WARN, "ERR199W", + "Internal authentication problem", "Details: {0}.", "Please check the logs for more information."), + + InternalAuthenticationError(ErrorCodesEnum.INTERNALAUTHENTICATIONERROR_ONE_ARGUMENT, + ErrorTypeEnum.AUTHENTICATION_PROBLEM, AlarmSeverityEnum.MAJOR, ErrorSeverityEnum.ERROR, "ERR199E", + "Internal authentication problem", "Details: {0}.", "Please check the logs for more information."), + + InternalAuthenticationFatal(ErrorCodesEnum.INTERNALAUTHENTICATIONFATAL_ONE_ARGUMENT, + ErrorTypeEnum.AUTHENTICATION_PROBLEM, AlarmSeverityEnum.CRITICAL, ErrorSeverityEnum.FATAL, "ERR199F", + "Internal authentication problem", "Details: {0}.", "Please check the logs for more information."), + + BeHealthCheckError(ErrorCodesEnum.BeHEALTHCHECKERROR, ErrorTypeEnum.SYSTEM_ERROR, AlarmSeverityEnum.CRITICAL, + ErrorSeverityEnum.ERROR, "ERR200E", + "ECOMP-PORTAL Back-end probably lost connectivity to either one of the following components: MySQL DB, UEB Cluster", + "", "Please check the logs for more information."), + + BeHealthCheckMySqlError(ErrorCodesEnum.BEHEALTHCHECKMYSQLERROR, ErrorTypeEnum.SYSTEM_ERROR, + AlarmSeverityEnum.CRITICAL, ErrorSeverityEnum.ERROR, "ERR201E", + "ECOMP-PORTAL Back-end probably lost connectivity to MySQL DB", "", + "Check connectivity to MYSQL is configured correctly under system.properties file."), + + BeHealthCheckUebClusterError(ErrorCodesEnum.BEHEALTHCHECKUEBCLUSTERERROR, ErrorTypeEnum.SYSTEM_ERROR, + AlarmSeverityEnum.CRITICAL, ErrorSeverityEnum.ERROR, "ERR203E", + "ECOMP-PORTAL Back-end probably lost connectivity to UEB Cluster", "", + "Check connectivity to UEB cluster which is configured under portal.properties file."), + + FeHealthCheckError(ErrorCodesEnum.FEHEALTHCHECKERROR, ErrorTypeEnum.SYSTEM_ERROR, AlarmSeverityEnum.CRITICAL, + ErrorSeverityEnum.ERROR, "ERR204E", "Unable to connect to a valid ECOMP-PORTAL Back-end Server.", "", + "Please check connectivity from this FE instance towards BE or BE Load Balancer."), + + BeHealthCheckRecovery(ErrorCodesEnum.BEHEALTHCHECKRECOVERY, ErrorTypeEnum.RECOVERY, AlarmSeverityEnum.INFORMATIONAL, + ErrorSeverityEnum.INFO, "ERR205I", + "ECOMP-PORTAL Back-end Recovery to either one of the following components: MySQL DB, UEB Cluster", "", + "Please check logs for more specific information about the problem."), + + BeHealthCheckMySqlRecovery(ErrorCodesEnum.BEHEALTHCHECKMYSQLRECOVERY, ErrorTypeEnum.RECOVERY, + AlarmSeverityEnum.INFORMATIONAL, ErrorSeverityEnum.INFO, "ERR206I", + "ECOMP-PORTAL Back-end connection recovery to MySQL DB", "", + "Please check logs for more specific information about the problem."), + + BeHealthCheckUebClusterRecovery(ErrorCodesEnum.BEHEALTHCHECKUEBCLUSTERRECOVERY, ErrorTypeEnum.RECOVERY, + AlarmSeverityEnum.INFORMATIONAL, ErrorSeverityEnum.INFO, "ERR208I", + "ECOMP-PORTAL Back-end connection recovery to UEB Cluster", "", + "Please check logs for more specific information about the problem."), + + FeHealthCheckRecovery(ErrorCodesEnum.FEHEALTHCHECKRECOVERY, ErrorTypeEnum.RECOVERY, AlarmSeverityEnum.INFORMATIONAL, + ErrorSeverityEnum.INFO, "ERR209I", "Connectivity to ECOMP-PORTAL Front-end Server is recovered", "", + "Please check logs for more specific information about the problem."), + + BeUebConnectionError(ErrorCodesEnum.BEUEBCONNECTIONERROR_ONE_ARGUMENT, ErrorTypeEnum.CONNECTION_PROBLEM, + AlarmSeverityEnum.MAJOR, ErrorSeverityEnum.ERROR, "ERR210E", + "ECOMP-PORTAL Back-end probably lost connectivity to UEB Cluster", "Details: {0}.", + "Please check UEB server list and keys configured under Portal.Properties file."), + + BeUebUnkownHostError(ErrorCodesEnum.BEUEBUNKOWNHOSTERROR_ONE_ARGUMENT, ErrorTypeEnum.CONNECTION_PROBLEM, + AlarmSeverityEnum.MAJOR, ErrorSeverityEnum.ERROR, "ERR211E", + "ECOMP-PORTAL Back-end probably lost connectivity to UEB Cluster", "Cannot reach host: {0}.", + "Please check UEB server list and keys configured under Portal.Properties file."), + + BeUebRegisterOnboardingAppError(ErrorCodesEnum.BEUEBREGISTERONBOARDINGAPPERROR, ErrorTypeEnum.CONNECTION_PROBLEM, + AlarmSeverityEnum.MAJOR, ErrorSeverityEnum.ERROR, "ERR212E", + "Failed to register the On-boarding application with UEB Communication server", "Details: {0}.", + "Please check UEB server list and keys configured under Portal.Properties file."), + + BeHttpConnectionError(ErrorCodesEnum.BEHTTPCONNECTIONERROR_ONE_ARGUMENT, ErrorTypeEnum.CONNECTION_PROBLEM, + AlarmSeverityEnum.MAJOR, ErrorSeverityEnum.ERROR, "ERR213E", + "It could be that communication to an external application might resulted an exception or failed to reach the external application", + "Details: {0}.", "Please check logs for more information."), + + InternalConnectionInfo(ErrorCodesEnum.INTERNALCONNECTIONINFO_ONE_ARGUMENT, ErrorTypeEnum.CONNECTION_PROBLEM, + AlarmSeverityEnum.INFORMATIONAL, ErrorSeverityEnum.INFO, "ERR299I", "Internal Connection problem", + "Details: {0}.", "Please check logs for more information."), + + InternalConnectionWarning(ErrorCodesEnum.INTERNALCONNECTIONWARNING_ONE_ARGUMENT, ErrorTypeEnum.CONNECTION_PROBLEM, + AlarmSeverityEnum.MINOR, ErrorSeverityEnum.WARN, "ERR299W", "Internal Connection problem", "Details: {0}.", + "Please check logs for more information."), + + InternalConnectionError(ErrorCodesEnum.INTERNALCONNECTIONERROR_ONE_ARGUMENT, ErrorTypeEnum.CONNECTION_PROBLEM, + AlarmSeverityEnum.MAJOR, ErrorSeverityEnum.ERROR, "ERR299E", "Internal Connection problem", "Details: {0}.", + "Please check logs for more information."), + + InternalConnectionFatal(ErrorCodesEnum.INTERNALCONNECTIONFATAL_ONE_ARGUMENT, ErrorTypeEnum.CONNECTION_PROBLEM, + AlarmSeverityEnum.CRITICAL, ErrorSeverityEnum.FATAL, "ERR299F", "Internal Connection problem", + "Details: {0}.", "Please check logs for more information."), + + BeUebObjectNotFoundError(ErrorCodesEnum.BEUEBOBJECTNOTFOUNDERROR_ONE_ARGUMENT, ErrorTypeEnum.DATA_ERROR, + AlarmSeverityEnum.MAJOR, ErrorSeverityEnum.ERROR, "ERR303E", "Error occurred during access to U-EB Server.", + "Data not found: {0}.", + "An error occurred during access to UEB Server, {1} failed to either register or unregister to/from UEB topic."), + + BeUserMissingError(ErrorCodesEnum.BEUSERMISSINGERROR_ONE_ARGUMENT, ErrorTypeEnum.DATA_ERROR, + AlarmSeverityEnum.MAJOR, ErrorSeverityEnum.ERROR, "ERR310E", "User is not found", "", + "User {0} must be added to the corresponding application with proper user roles."), + + BeUserInactiveWarning(ErrorCodesEnum.BEUSERINACTIVEWARNING_ONE_ARGUMENT, ErrorTypeEnum.DATA_ERROR, + AlarmSeverityEnum.MINOR, ErrorSeverityEnum.WARN, "ERR313W", "User is found but in-active", "", + "User {0} must be added to the corresponding application with proper user roles."), + + BeUserAdminPrivilegesInfo(ErrorCodesEnum.BEUSERADMINPRIVILEGESINFO_ONE_ARGUMENT, ErrorTypeEnum.DATA_ERROR, + AlarmSeverityEnum.MINOR, ErrorSeverityEnum.WARN, "ERR314W", + "User is found but don't have administrative privileges", "", + "User {0} should be given administrator role for the corresponding application to perform the necessary actions."), + + BeInvalidJsonInput(ErrorCodesEnum.BEINVALIDJSONINPUT, ErrorTypeEnum.SYSTEM_ERROR, AlarmSeverityEnum.MAJOR, + ErrorSeverityEnum.ERROR, "ERR405E", "Failed to convert JSON input to object", "", + "Please check logs for more information."), + + BeIncorrectHttpStatusError(ErrorCodesEnum.BEINCORRECTHTTPSTATUSERROR, ErrorTypeEnum.SYSTEM_ERROR, + AlarmSeverityEnum.MAJOR, ErrorSeverityEnum.ERROR, "ERR407E", + "Communication to an external application is resulted in with Incorrect Http response code", "", + "Please check logs for more information."), + + BeInitializationError(ErrorCodesEnum.BEINITIALIZATIONERROR, ErrorTypeEnum.SYSTEM_ERROR, AlarmSeverityEnum.CRITICAL, + ErrorSeverityEnum.ERROR, "ERR500E", "ECOMP-PORTAL Back-end was not initialized properly", "", + "Please check logs for more information."), + + BeUebSystemError(ErrorCodesEnum.BEUEBSYSTEMERROR, ErrorTypeEnum.SYSTEM_ERROR, AlarmSeverityEnum.MAJOR, + ErrorSeverityEnum.ERROR, "ERR502E", "Error occurred during access to U-EB Server", "Details: {0}.", + "An error occurred in {1} distribution mechanism. Please check the logs for more information."), + + BeDaoSystemError(ErrorCodesEnum.BEDAOSYSTEMERROR, ErrorTypeEnum.SYSTEM_ERROR, AlarmSeverityEnum.CRITICAL, + ErrorSeverityEnum.ERROR, "ERR505E", "Performing DDL or DML operations on database might have failed", "", + "Please check MySQL DB health or look at the logs for more details."), + + BeSystemError(ErrorCodesEnum.BESYSTEMERROR, ErrorTypeEnum.SYSTEM_ERROR, AlarmSeverityEnum.CRITICAL, + ErrorSeverityEnum.ERROR, "ERR506E", "Unexpected error during operation", "", + "Please check logs for more information."), + + BeExecuteRollbackError(ErrorCodesEnum.BEEXECUTEROLLBACKERROR, ErrorTypeEnum.DATA_ERROR, AlarmSeverityEnum.MAJOR, + ErrorSeverityEnum.ERROR, "ERR507E", "Roll-back operation towards database has failed", "", + "Please check MYSQL DB health or look at the logs for more details."), + + FeHttpLoggingError(ErrorCodesEnum.FEHTTPLOGGINGERROR, ErrorTypeEnum.SYSTEM_ERROR, AlarmSeverityEnum.MINOR, + ErrorSeverityEnum.ERROR, "ERR517E", "Error when logging FE HTTP request/response", "", + "Please check MYSQL DB health or look at the logs for more details."), + + FePortalServletError(ErrorCodesEnum.FEPORTALSERVLETERROR, ErrorTypeEnum.SYSTEM_ERROR, AlarmSeverityEnum.MAJOR, + ErrorSeverityEnum.ERROR, "ERR518E", "Error when trying to access FE Portal page.", "", + "Please check logs for more information."), + + BeDaoCloseSessionError(ErrorCodesEnum.BEDAOCLOSESESSIONERROR, ErrorTypeEnum.SYSTEM_ERROR, AlarmSeverityEnum.MAJOR, + ErrorSeverityEnum.ERROR, "ERR519E", "Close local session operation with database failed", "", + "Please check MYSQL DB health or look at the logs form more details."), + + BeRestApiGeneralError(ErrorCodesEnum.BERESTAPIGENERALERROR, ErrorTypeEnum.SYSTEM_ERROR, AlarmSeverityEnum.CRITICAL, + ErrorSeverityEnum.ERROR, "ERR900E", "Unexpected error during ECOMP-PORTAL Back-end REST API execution", "", + "Please check error log for more information."), + + FeHealthCheckGeneralError(ErrorCodesEnum.FEHEALTHCHECKGENERALERROR, ErrorTypeEnum.SYSTEM_ERROR, + AlarmSeverityEnum.CRITICAL, ErrorSeverityEnum.ERROR, "ERR901E", "General error during FE Health Check", "", + "Please check error log for more information."), + + InternalUnexpectedInfo(ErrorCodesEnum.INTERNALUNEXPECTEDINFO_ONE_ARGUMENT, ErrorTypeEnum.SYSTEM_ERROR, + AlarmSeverityEnum.INFORMATIONAL, ErrorSeverityEnum.INFO, "ERR999I", "Unexpected error", "Details: {0}.", + "Please check logs for more information."), + + InternalUnexpectedWarning(ErrorCodesEnum.INTERNALUNEXPECTEDWARNING_ONE_ARGUMENT, ErrorTypeEnum.SYSTEM_ERROR, + AlarmSeverityEnum.MINOR, ErrorSeverityEnum.WARN, "ERR999W", "Unexpected error", "Details: {0}.", + "Please check logs for more information."), + + InternalUnexpectedError(ErrorCodesEnum.INTERNALUNEXPECTEDERROR_ONE_ARGUMENT, ErrorTypeEnum.SYSTEM_ERROR, + AlarmSeverityEnum.MAJOR, ErrorSeverityEnum.ERROR, "ERR999E", "Unexpected error", "Details: {0}.", + "Please check logs for more information."), + + InternalUnexpectedFatal(ErrorCodesEnum.INTERNALUNEXPECTEDFATAL_ONE_ARGUMENT, ErrorTypeEnum.SYSTEM_ERROR, + AlarmSeverityEnum.CRITICAL, ErrorSeverityEnum.FATAL, "ERR999F", "Unexpected error", "Details: {0}.", + "Please check logs for more information."), + ; - + ErrorTypeEnum eType; AlarmSeverityEnum alarmSeverity; ErrorCodesEnum messageCode; @@ -205,9 +254,10 @@ public enum AppMessagesEnum { String errorDescription; String details; String resolution; - - AppMessagesEnum(ErrorCodesEnum messageCode, ErrorTypeEnum eType, AlarmSeverityEnum alarmSeverity, ErrorSeverityEnum errorSeverity, String errorCode, String errorDescription, - String details, String resolution) { + + AppMessagesEnum(ErrorCodesEnum messageCode, ErrorTypeEnum eType, AlarmSeverityEnum alarmSeverity, + ErrorSeverityEnum errorSeverity, String errorCode, String errorDescription, String details, + String resolution) { this.messageCode = messageCode; this.eType = eType; this.alarmSeverity = alarmSeverity; @@ -217,30 +267,31 @@ public enum AppMessagesEnum { this.details = details; this.resolution = resolution; } - + public String getDetails() { return this.details; } - + public String getResolution() { return this.resolution; } + public String getErrorCode() { return this.errorCode; } - + public String getErrorDescription() { return this.errorDescription; } - + public ErrorSeverityEnum getErrorSeverity() { return this.errorSeverity; } - + public void setErrorSeverity(ErrorSeverityEnum errorSeverity) { this.errorSeverity = errorSeverity; } - + public ErrorCodesEnum getMessageCode() { return messageCode; } @@ -248,7 +299,7 @@ public enum AppMessagesEnum { public void setMessageCode(ErrorCodesEnum messageCode) { this.messageCode = messageCode; } - + public AlarmSeverityEnum getAlarmSeverity() { return alarmSeverity; } @@ -256,7 +307,7 @@ public enum AppMessagesEnum { public void setAlarmSeverity(AlarmSeverityEnum alarmSeverity) { this.alarmSeverity = alarmSeverity; } - + public ErrorTypeEnum getErrorType() { return eType; } diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/logging/format/AuditLogFormatter.java b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/logging/format/AuditLogFormatter.java index 4ea932a3..d7a80ee5 100644 --- a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/logging/format/AuditLogFormatter.java +++ b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/logging/format/AuditLogFormatter.java @@ -6,7 +6,7 @@ * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * under the Apache License, Version 2.0 (the "License"); * you may not use this software except in compliance with the License. * You may obtain a copy of the License at * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); * you may not use this documentation except in compliance with the License. * You may obtain a copy of the License at * @@ -43,51 +43,47 @@ import java.util.Map; import org.onap.portalsdk.core.util.SystemProperties; public class AuditLogFormatter { - //Singleton + // Singleton private static AuditLogFormatter instance = new AuditLogFormatter(); - + public static AuditLogFormatter getInstance() { - + return instance; } - - public String createMessage(String protocol,String set, - String loginId, String message) { - - Object[] securityMessageArgs = prepareFormatArgs( - protocol, - set, - loginId, - message ); - + + public String createMessage(String protocol, String set, String loginId, String message) { + + Object[] securityMessageArgs = prepareFormatArgs(protocol, set, loginId, message); + return MessageFormat.format(SystemProperties.SECURITY_LOG_TEMPLATE, securityMessageArgs); } - + /** - * A method for normalizing the security log field - returns - * the @Param defaultValue in case the entry is null or empty. - * If the @param entry is not empty, a single quotation is added to it. + * A method for normalizing the security log field - returns the @Param + * defaultValue in case the entry is null or empty. If the @param entry is not + * empty, a single quotation is added to it. * - * @param entry the entry - * @param defaultValue The default value in case the entry is empty + * @param entry + * the entry + * @param defaultValue + * The default value in case the entry is empty * @return String (formatted) */ private String formatEntry(Object entry, String defaultValue) { - return (entry!=null && !entry.toString().isEmpty()) ? addSingleQuotes(entry.toString()): defaultValue; + return (entry != null && !entry.toString().isEmpty()) ? addSingleQuotes(entry.toString()) : defaultValue; } - + private String addSingleQuotes(String s) { - if (null!=s && !s.isEmpty()) { - s = SystemProperties.SINGLE_QUOTE+s+SystemProperties.SINGLE_QUOTE; + if (null != s && !s.isEmpty()) { + s = SystemProperties.SINGLE_QUOTE + s + SystemProperties.SINGLE_QUOTE; } return s; } - - + /** - * This method prepares an Object array of arguments that would be passed - * to the MessageFormat.format() method, to format the security log. + * This method prepares an Object array of arguments that would be passed to the + * MessageFormat.format() method, to format the security log. * * @param protocol * @param set @@ -97,28 +93,19 @@ public class AuditLogFormatter { * @param message * @return */ - private Object[] prepareFormatArgs(String protocol,String set, - String loginId, String message) { - - Object[] messageFormatArgs = { - formatEntry(protocol, SystemProperties.NA), - formatEntry(set, SystemProperties.NA), - formatEntry(loginId, SystemProperties.UNKNOWN), - message - }; + private Object[] prepareFormatArgs(String protocol, String set, String loginId, String message) { + + Object[] messageFormatArgs = { formatEntry(protocol, SystemProperties.NA), + formatEntry(set, SystemProperties.NA), formatEntry(loginId, SystemProperties.UNKNOWN), message }; return messageFormatArgs; } - public String createMessage(Map logArgsMap) { - - Object[] securityMessageArgs = prepareFormatArgs( - logArgsMap.get(SystemProperties.PROTOCOL), - logArgsMap.get(SystemProperties.SECURIRY_EVENT_TYPE), - logArgsMap.get(SystemProperties.LOGIN_ID), - logArgsMap.get(SystemProperties.ADDITIONAL_INFO) - ); - + + Object[] securityMessageArgs = prepareFormatArgs(logArgsMap.get(SystemProperties.PROTOCOL), + logArgsMap.get(SystemProperties.SECURIRY_EVENT_TYPE), logArgsMap.get(SystemProperties.LOGIN_ID), + logArgsMap.get(SystemProperties.ADDITIONAL_INFO)); + return MessageFormat.format(SystemProperties.SECURITY_LOG_TEMPLATE, securityMessageArgs); } } diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/logging/format/ErrorCodesEnum.java b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/logging/format/ErrorCodesEnum.java index 6dc7e99d..9ae1fbf0 100644 --- a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/logging/format/ErrorCodesEnum.java +++ b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/logging/format/ErrorCodesEnum.java @@ -6,7 +6,7 @@ * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * under the Apache License, Version 2.0 (the "License"); * you may not use this software except in compliance with the License. * You may obtain a copy of the License at * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); * you may not use this documentation except in compliance with the License. * You may obtain a copy of the License at * @@ -41,67 +41,37 @@ import com.att.eelf.i18n.EELFResolvableErrorEnum; //import com.att.eelf.i18n.EELFResourceManager; public enum ErrorCodesEnum implements EELFResolvableErrorEnum { - BERESTAPIAUTHENTICATIONERROR, - BEHTTPCONNECTIONERROR_ONE_ARGUMENT, - BEUEBAUTHENTICATIONERROR_ONE_ARGUMENT, - - INTERNALAUTHENTICATIONINFO_ONE_ARGUMENT, - INTERNALAUTHENTICATIONWARNING_ONE_ARGUMENT, - INTERNALAUTHENTICATIONERROR_ONE_ARGUMENT, - INTERNALAUTHENTICATIONFATAL_ONE_ARGUMENT, - - BEHEALTHCHECKRECOVERY, - BEHEALTHCHECKMYSQLRECOVERY, - BEHEALTHCHECKUEBCLUSTERRECOVERY, - FEHEALTHCHECKRECOVERY, - BeHEALTHCHECKERROR, - - BEHEALTHCHECKMYSQLERROR, - BEHEALTHCHECKUEBCLUSTERERROR, - FEHEALTHCHECKERROR, - BEUEBCONNECTIONERROR_ONE_ARGUMENT, - BEUEBUNKOWNHOSTERROR_ONE_ARGUMENT, - BEUEBREGISTERONBOARDINGAPPERROR, - - INTERNALCONNECTIONINFO_ONE_ARGUMENT, - INTERNALCONNECTIONWARNING_ONE_ARGUMENT, - INTERNALCONNECTIONERROR_ONE_ARGUMENT, - INTERNALCONNECTIONFATAL_ONE_ARGUMENT, - - BEUEBOBJECTNOTFOUNDERROR_ONE_ARGUMENT, - BEUSERMISSINGERROR_ONE_ARGUMENT, - - BEUSERINACTIVEWARNING_ONE_ARGUMENT, - BEUSERADMINPRIVILEGESINFO_ONE_ARGUMENT, - - BEINVALIDJSONINPUT, - BEINCORRECTHTTPSTATUSERROR, - - BEINITIALIZATIONERROR, - BEUEBSYSTEMERROR, - BEDAOSYSTEMERROR, - BESYSTEMERROR, - BEEXECUTEROLLBACKERROR, - - FEHTTPLOGGINGERROR, - FEPORTALSERVLETERROR, - BEDAOCLOSESESSIONERROR, - - BERESTAPIGENERALERROR, - FEHEALTHCHECKGENERALERROR, - - INTERNALUNEXPECTEDINFO_ONE_ARGUMENT, - INTERNALUNEXPECTEDWARNING_ONE_ARGUMENT, - INTERNALUNEXPECTEDERROR_ONE_ARGUMENT, - INTERNALUNEXPECTEDFATAL_ONE_ARGUMENT, - + BERESTAPIAUTHENTICATIONERROR, BEHTTPCONNECTIONERROR_ONE_ARGUMENT, BEUEBAUTHENTICATIONERROR_ONE_ARGUMENT, + + INTERNALAUTHENTICATIONINFO_ONE_ARGUMENT, INTERNALAUTHENTICATIONWARNING_ONE_ARGUMENT, INTERNALAUTHENTICATIONERROR_ONE_ARGUMENT, INTERNALAUTHENTICATIONFATAL_ONE_ARGUMENT, + + BEHEALTHCHECKRECOVERY, BEHEALTHCHECKMYSQLRECOVERY, BEHEALTHCHECKUEBCLUSTERRECOVERY, FEHEALTHCHECKRECOVERY, BeHEALTHCHECKERROR, + + BEHEALTHCHECKMYSQLERROR, BEHEALTHCHECKUEBCLUSTERERROR, FEHEALTHCHECKERROR, BEUEBCONNECTIONERROR_ONE_ARGUMENT, BEUEBUNKOWNHOSTERROR_ONE_ARGUMENT, BEUEBREGISTERONBOARDINGAPPERROR, + + INTERNALCONNECTIONINFO_ONE_ARGUMENT, INTERNALCONNECTIONWARNING_ONE_ARGUMENT, INTERNALCONNECTIONERROR_ONE_ARGUMENT, INTERNALCONNECTIONFATAL_ONE_ARGUMENT, + + BEUEBOBJECTNOTFOUNDERROR_ONE_ARGUMENT, BEUSERMISSINGERROR_ONE_ARGUMENT, + + BEUSERINACTIVEWARNING_ONE_ARGUMENT, BEUSERADMINPRIVILEGESINFO_ONE_ARGUMENT, + + BEINVALIDJSONINPUT, BEINCORRECTHTTPSTATUSERROR, + + BEINITIALIZATIONERROR, BEUEBSYSTEMERROR, BEDAOSYSTEMERROR, BESYSTEMERROR, BEEXECUTEROLLBACKERROR, + + FEHTTPLOGGINGERROR, FEPORTALSERVLETERROR, BEDAOCLOSESESSIONERROR, + + BERESTAPIGENERALERROR, FEHEALTHCHECKGENERALERROR, + + INTERNALUNEXPECTEDINFO_ONE_ARGUMENT, INTERNALUNEXPECTEDWARNING_ONE_ARGUMENT, INTERNALUNEXPECTEDERROR_ONE_ARGUMENT, INTERNALUNEXPECTEDFATAL_ONE_ARGUMENT, + ; - + /** - * Static initializer to ensure the resource bundles for this class are loaded... - * Here this application loads messages from three bundles - */ - //static { - // EELFResourceManager.loadMessageBundle("com/att/fusion/core/logging/format/ApplicationCodes"); - //} + * Static initializer to ensure the resource bundles for this class are + * loaded... Here this application loads messages from three bundles + */ + // static { + // EELFResourceManager.loadMessageBundle("com/att/fusion/core/logging/format/ApplicationCodes"); + // } } diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/logging/format/ErrorSeverityEnum.java b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/logging/format/ErrorSeverityEnum.java index 468a2b9a..83f4c1a5 100644 --- a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/logging/format/ErrorSeverityEnum.java +++ b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/logging/format/ErrorSeverityEnum.java @@ -6,7 +6,7 @@ * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * under the Apache License, Version 2.0 (the "License"); * you may not use this software except in compliance with the License. * You may obtain a copy of the License at * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); * you may not use this documentation except in compliance with the License. * You may obtain a copy of the License at * @@ -38,8 +38,5 @@ package org.onap.portalsdk.core.logging.format; public enum ErrorSeverityEnum { - INFO, - WARN, - ERROR, - FATAL, + INFO, WARN, ERROR, FATAL, } diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/logging/format/ErrorTypeEnum.java b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/logging/format/ErrorTypeEnum.java index 77477ca1..4f9962b4 100644 --- a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/logging/format/ErrorTypeEnum.java +++ b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/logging/format/ErrorTypeEnum.java @@ -6,7 +6,7 @@ * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * under the Apache License, Version 2.0 (the "License"); * you may not use this software except in compliance with the License. * You may obtain a copy of the License at * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); * you may not use this documentation except in compliance with the License. * You may obtain a copy of the License at * @@ -38,10 +38,5 @@ package org.onap.portalsdk.core.logging.format; public enum ErrorTypeEnum { - RECOVERY, - CONFIG_ERROR, - SYSTEM_ERROR, - DATA_ERROR, - CONNECTION_PROBLEM, - AUTHENTICATION_PROBLEM + RECOVERY, CONFIG_ERROR, SYSTEM_ERROR, DATA_ERROR, CONNECTION_PROBLEM, AUTHENTICATION_PROBLEM } diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/logging/logic/EELFLoggerDelegate.java b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/logging/logic/EELFLoggerDelegate.java index 2eef3793..1d3ac743 100644 --- a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/logging/logic/EELFLoggerDelegate.java +++ b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/logging/logic/EELFLoggerDelegate.java @@ -6,7 +6,7 @@ * =================================================================== * * Unless otherwise specified, all software contained herein is licensed - * under the Apache License, Version 2.0 (the “License”); + * under the Apache License, Version 2.0 (the "License"); * you may not use this software except in compliance with the License. * You may obtain a copy of the License at * @@ -19,7 +19,7 @@ * limitations under the License. * * Unless otherwise specified, all documentation contained herein is licensed - * under the Creative Commons License, Attribution 4.0 Intl. (the “License”); + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); * you may not use this documentation except in compliance with the License. * You may obtain a copy of the License at * @@ -67,17 +67,18 @@ import com.att.eelf.configuration.SLF4jWrapper; public class EELFLoggerDelegate extends SLF4jWrapper implements EELFLogger { - public static EELFLogger errorLogger = EELFManager.getInstance().getErrorLogger(); - public static EELFLogger applicationLogger = EELFManager.getInstance().getApplicationLogger(); - public static EELFLogger auditLogger = EELFManager.getInstance().getAuditLogger(); - public static EELFLogger metricsLogger = EELFManager.getInstance().getMetricsLogger(); - public static EELFLogger debugLogger = EELFManager.getInstance().getDebugLogger(); + public static final EELFLogger errorLogger = EELFManager.getInstance().getErrorLogger(); + public static final EELFLogger applicationLogger = EELFManager.getInstance().getApplicationLogger(); + public static final EELFLogger auditLogger = EELFManager.getInstance().getAuditLogger(); + public static final EELFLogger metricsLogger = EELFManager.getInstance().getMetricsLogger(); + public static final EELFLogger debugLogger = EELFManager.getInstance().getDebugLogger(); + private String className; - private static ConcurrentMap classMap = new ConcurrentHashMap(); + private static ConcurrentMap classMap = new ConcurrentHashMap<>(); - public EELFLoggerDelegate(String _className) { - super(_className); - className = _className; + public EELFLoggerDelegate(final String className) { + super(className); + this.className = className; } /** @@ -93,17 +94,17 @@ public class EELFLoggerDelegate extends SLF4jWrapper implements EELFLogger { } /** - * Gets a logger for the specified class name. If the logger does not - * already exist in the map, this creates a new logger. + * Gets a logger for the specified class name. If the logger does not already + * exist in the map, this creates a new logger. * * @param className * If null or empty, uses EELFLoggerDelegate as the class name. * @return Instance of EELFLoggerDelegate */ - public static EELFLoggerDelegate getLogger(String className) { - if (className == null || className == "") - className = EELFLoggerDelegate.class.getName(); - EELFLoggerDelegate delegate = classMap.get(className); + public static EELFLoggerDelegate getLogger(final String className) { + String classNameNeverNull = className == null || "".equals(className) ? EELFLoggerDelegate.class.getName() + : className; + EELFLoggerDelegate delegate = classMap.get(classNameNeverNull); if (delegate == null) { delegate = new EELFLoggerDelegate(className); classMap.put(className, delegate); @@ -355,9 +356,9 @@ public class EELFLoggerDelegate extends SLF4jWrapper implements EELFLogger { } /** - * Logs a standard message identified by the specified enum, using the - * specified parameters, at error level. Alarm and error severity are taken - * from the specified enum argument. + * Logs a standard message identified by the specified enum, using the specified + * parameters, at error level. Alarm and error severity are taken from the + * specified enum argument. * * @param epMessageEnum * @param param @@ -381,7 +382,7 @@ public class EELFLoggerDelegate extends SLF4jWrapper implements EELFLogger { errorLogger.error(resolution); } } catch (Exception e) { - errorLogger.error("Failed to log the error code. Details: " + UserUtils.getStackTrace(e)); + errorLogger.error("logEcompError failed", e); } finally { MDC.remove("ErrorCode"); MDC.remove("ErrorDescription"); @@ -419,6 +420,7 @@ public class EELFLoggerDelegate extends SLF4jWrapper implements EELFLogger { MDC.put(MDC_SERVER_IP_ADDRESS, InetAddress.getLocalHost().getHostAddress()); MDC.put(MDC_INSTANCE_UUID, SystemProperties.getProperty(SystemProperties.INSTANCE_UUID)); } catch (Exception e) { + errorLogger.error("setGlobalLoggingContext failed", e); } } @@ -435,9 +437,9 @@ public class EELFLoggerDelegate extends SLF4jWrapper implements EELFLogger { } /** - * Loads the RequestId/TransactionId into the MDC which it should be - * receiving with an each incoming REST API request. Also, configures few - * other request based logging fields into the MDC context. + * Loads the RequestId/TransactionId into the MDC which it should be receiving + * with an each incoming REST API request. Also, configures few other request + * based logging fields into the MDC context. * * @param req * @param appName @@ -453,19 +455,17 @@ public class EELFLoggerDelegate extends SLF4jWrapper implements EELFLogger { MDC.put(MDC_KEY_REQUEST_ID, requestId); // Load user agent into MDC context, if available. - String accessingClient = "Unknown"; - accessingClient = req.getHeader(SystemProperties.USERAGENT_NAME); - if (accessingClient != null && accessingClient != "" && (accessingClient.contains("Mozilla") + String accessingClient = req.getHeader(SystemProperties.USERAGENT_NAME); + if (accessingClient != null && !"".equals(accessingClient) && (accessingClient.contains("Mozilla") || accessingClient.contains("Chrome") || accessingClient.contains("Safari"))) { accessingClient = appName + "_FE"; } MDC.put(SystemProperties.PARTNER_NAME, accessingClient); // Protocol, Rest URL & Rest Path - String restURL = ""; MDC.put(SystemProperties.FULL_URL, SystemProperties.UNKNOWN); MDC.put(SystemProperties.PROTOCOL, SystemProperties.HTTP); - restURL = UserUtils.getFullURL(req); + String restURL = UserUtils.getFullURL(req); if (restURL != null && restURL != "") { MDC.put(SystemProperties.FULL_URL, restURL); if (restURL.toLowerCase().contains("https")) { @@ -478,8 +478,7 @@ public class EELFLoggerDelegate extends SLF4jWrapper implements EELFLogger { // Client IPAddress i.e. IPAddress of the remote host who is making // this request. - String clientIPAddress = ""; - clientIPAddress = req.getHeader("X-FORWARDED-FOR"); + String clientIPAddress = req.getHeader("X-FORWARDED-FOR"); if (clientIPAddress == null) { clientIPAddress = req.getRemoteAddr(); } @@ -487,12 +486,12 @@ public class EELFLoggerDelegate extends SLF4jWrapper implements EELFLogger { // Load loginId into MDC context. MDC.put(SystemProperties.MDC_LOGIN_ID, "Unknown"); - + String loginId = ""; - User user = UserUtils.getUserSession(req); - if (user != null) { - loginId = user.getLoginId(); - } + User user = UserUtils.getUserSession(req); + if (user != null) { + loginId = user.getLoginId(); + } if (loginId != null && loginId != "") { MDC.put(SystemProperties.MDC_LOGIN_ID, loginId); -- cgit 1.2.3-korg