aboutsummaryrefslogtreecommitdiffstats
path: root/common-logging/src/main/java/org/onap/policy/common/logging/eelf/ErrorCodeMap.java
diff options
context:
space:
mode:
Diffstat (limited to 'common-logging/src/main/java/org/onap/policy/common/logging/eelf/ErrorCodeMap.java')
-rw-r--r--common-logging/src/main/java/org/onap/policy/common/logging/eelf/ErrorCodeMap.java57
1 files changed, 29 insertions, 28 deletions
diff --git a/common-logging/src/main/java/org/onap/policy/common/logging/eelf/ErrorCodeMap.java b/common-logging/src/main/java/org/onap/policy/common/logging/eelf/ErrorCodeMap.java
index fab0415b..0eaa06b0 100644
--- a/common-logging/src/main/java/org/onap/policy/common/logging/eelf/ErrorCodeMap.java
+++ b/common-logging/src/main/java/org/onap/policy/common/logging/eelf/ErrorCodeMap.java
@@ -2,7 +2,8 @@
* ============LICENSE_START=======================================================
* ONAP-Logging
* ================================================================================
- * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018, 2020-2021 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2024 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,51 +22,63 @@
package org.onap.policy.common.logging.eelf;
import java.util.EnumMap;
+import lombok.AccessLevel;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
/**
* ErrorCodeMap contains a HashMap of ErrorCodeInfo (error code and error description).
+ * Standard error code:
+ * 100 – permission errors
+ * 200 – availability errors
+ * 300 – data errors
+ * 400 – schema errors
+ * 500 – business process errors
+ * 900 – unknown errors
*/
-public class ErrorCodeMap {
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+public final class ErrorCodeMap {
private static final EnumMap<MessageCodes, ErrorCodeInfo> hm = new EnumMap<>(MessageCodes.class);
private static final String CHECK_ERROR_MESSAGE = " Please check the error message for detail information";
- private static final String ERROR_PERMISSIONS = "POLICY-100E";
+ private static final String ERROR_PERMISSIONS = "100";
private static final String ERROR_PERMISSIONS_DESCRIPTION = "This is a Permissions Error." + CHECK_ERROR_MESSAGE;
- private static final String ERROR_SCHEMA_INVALID = "POLICY-400E";
+ private static final String ERROR_SCHEMA_INVALID = "400";
private static final String ERROR_SCHEMA_INVALID_DESCRIPTION = "This is an Invalid Schema Error."
+ CHECK_ERROR_MESSAGE;
- private static final String UPDATE_ERROR = "POLICY-502E";
+
+ private static final String UPDATE_ERROR = "300";
private static final String UPDATE_ERROR_DESCRIPTION = "This is an updating error." + CHECK_ERROR_MESSAGE;
- private static final String EXCEPTION_ERROR_CODE = "POLICY-503E";
+ private static final String EXCEPTION_ERROR_CODE = "500";
private static final String EXCEPTION_ERROR_DESCRIPTION = "This is an exception error message during the process."
+ CHECK_ERROR_MESSAGE;
- private static final String MISS_PROPERTY_ERROR = "POLICY-504E";
+ private static final String MISS_PROPERTY_ERROR = "300";
private static final String MISS_PROPERTY_ERROR_DESCRIPTION = "This is an error of missing properties."
+ CHECK_ERROR_MESSAGE;
- private static final String GENERAL_ERROR_CODE = "POLICY-515E";
+ private static final String GENERAL_ERROR_CODE = "500";
private static final String GENERAL_ERROR_DESCRIPTION = "This is a general error message during the process."
+ CHECK_ERROR_MESSAGE;
- private static final String ERROR_SYSTEM_ERROR = "POLICY-516E";
+ private static final String ERROR_SYSTEM_ERROR = "200";
private static final String ERROR_SYSTEM_ERROR_DESCRIPTION = "This is a System Error." + CHECK_ERROR_MESSAGE;
- private static final String ERROR_DATA_ISSUE = "POLICY-517E";
+ private static final String ERROR_DATA_ISSUE = "300";
private static final String ERROR_DATA_ISSUE_DESCRIPTION = "This is a Data Issue Error." + CHECK_ERROR_MESSAGE;
- private static final String ERROR_PROCESS_FLOW = "POLICY-518E";
+ private static final String ERROR_PROCESS_FLOW = "500";
private static final String ERROR_PROCESS_FLOW_DESCRIPTION = "This is a Process Flow Error." + CHECK_ERROR_MESSAGE;
- private static final String ERROR_UNKNOWN = "POLICY-519E";
+ private static final String ERROR_UNKNOWN = "900";
private static final String ERROR_UNKNOWN_DESCRIPTION = "This is an Unknown Error." + CHECK_ERROR_MESSAGE;
- private static final String ERROR_AUDIT = "POLICY-520E";
+ private static final String ERROR_AUDIT = "300";
private static final String ERROR_AUDIT_DESCRIPTION = "This is an audit Error." + CHECK_ERROR_MESSAGE;
static {
@@ -75,7 +88,6 @@ public class ErrorCodeMap {
new ErrorCodeInfo(MISS_PROPERTY_ERROR, MISS_PROPERTY_ERROR_DESCRIPTION));
hm.put(MessageCodes.UPDATE_ERROR, new ErrorCodeInfo(UPDATE_ERROR, UPDATE_ERROR_DESCRIPTION));
hm.put(MessageCodes.ERROR_SYSTEM_ERROR, new ErrorCodeInfo(ERROR_SYSTEM_ERROR, ERROR_SYSTEM_ERROR_DESCRIPTION));
- hm.put(MessageCodes.ERROR_DATA_ISSUE, new ErrorCodeInfo(ERROR_DATA_ISSUE, ERROR_DATA_ISSUE_DESCRIPTION));
hm.put(MessageCodes.ERROR_PERMISSIONS, new ErrorCodeInfo(ERROR_PERMISSIONS, ERROR_PERMISSIONS_DESCRIPTION));
hm.put(MessageCodes.ERROR_DATA_ISSUE, new ErrorCodeInfo(ERROR_DATA_ISSUE, ERROR_DATA_ISSUE_DESCRIPTION));
hm.put(MessageCodes.ERROR_PROCESS_FLOW, new ErrorCodeInfo(ERROR_PROCESS_FLOW, ERROR_PROCESS_FLOW_DESCRIPTION));
@@ -85,32 +97,21 @@ public class ErrorCodeMap {
hm.put(MessageCodes.ERROR_AUDIT, new ErrorCodeInfo(ERROR_AUDIT, ERROR_AUDIT_DESCRIPTION));
}
- private ErrorCodeMap() {
- // Private constructor to prevent subclassing
- }
-
public static ErrorCodeInfo getErrorCodeInfo(MessageCodes messageCode) {
return hm.get(messageCode);
}
+ @Getter
static class ErrorCodeInfo {
- private String errorCode;
- private String errorDesc;
+ private final String errorCode;
+ private final String errorDesc;
public ErrorCodeInfo(String errorCode, String errorDesc) {
this.errorCode = errorCode;
this.errorDesc = errorDesc;
}
- public String getErrorCode() {
- return errorCode;
- }
-
- public String getErrorDesc() {
- return errorDesc;
- }
-
}
}