diff options
author | PawelSzalapski <pawel.szalapski@nokia.com> | 2018-07-31 08:18:03 +0200 |
---|---|---|
committer | PawelSzalapski <pawel.szalapski@nokia.com> | 2018-08-01 09:56:00 +0200 |
commit | fc073344d4c0eb8a28bf34c07a8439176cf846ca (patch) | |
tree | 01f5b4789c3d9369eaebb54a9f910a9fa400af1f /src/main/java/org/onap/dcae/restapi/ApiException.java | |
parent | d12cd3525284cc41414d8fdae09e2ffbc03a1fbb (diff) |
Replace nsaCore library with Spring
Change-Id: I2227939a67a2cbba2d392136d49ef4419600d186
Issue-ID: DCAEGEN2-602
Signed-off-by: PawelSzalapski <pawel.szalapski@nokia.com>
Diffstat (limited to 'src/main/java/org/onap/dcae/restapi/ApiException.java')
-rw-r--r-- | src/main/java/org/onap/dcae/restapi/ApiException.java | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/main/java/org/onap/dcae/restapi/ApiException.java b/src/main/java/org/onap/dcae/restapi/ApiException.java index 0f922678..53895ffe 100644 --- a/src/main/java/org/onap/dcae/restapi/ApiException.java +++ b/src/main/java/org/onap/dcae/restapi/ApiException.java @@ -33,10 +33,10 @@ public enum ApiException { UNAUTHORIZED_USER(ExceptionType.POLICY_EXCEPTION, "POL2000", "Unauthorized user", 401), NO_SERVER_RESOURCES(ExceptionType.SERVICE_EXCEPTION, "SVC1000", "No server resources (internal processing queue full)", 503); + public final int httpStatusCode; private final ExceptionType type; private final String code; private final String details; - public final int httpStatusCode; ApiException(ExceptionType type, String code, String details, int httpStatusCode) { this.type = type; @@ -45,18 +45,9 @@ public enum ApiException { this.httpStatusCode = httpStatusCode; } - public enum ExceptionType { - SERVICE_EXCEPTION, POLICY_EXCEPTION; - - @Override - public String toString() { - return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, this.name()); - } - } - public JSONObject toJSON() { JSONObject exceptionTypeNode = new JSONObject(); - exceptionTypeNode.put("messageId", code ); + exceptionTypeNode.put("messageId", code); exceptionTypeNode.put("text", details); JSONObject requestErrorNode = new JSONObject(); @@ -67,4 +58,13 @@ public enum ApiException { return rootNode; } + public enum ExceptionType { + SERVICE_EXCEPTION, POLICY_EXCEPTION; + + @Override + public String toString() { + return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, this.name()); + } + } + } |