From d0ba41b23a788bc557f451a0c66f0095c10dd390 Mon Sep 17 00:00:00 2001 From: Pamela Dragosh Date: Fri, 21 Feb 2020 14:57:50 -0500 Subject: Add SDNR Actor Actor for SDNR and necessary JUnit tests. Removed the Pair code. Issue-ID: POLICY-2382 Change-Id: I3da1d95f431cc076f12e9ad26280b92058fe51cc Signed-off-by: Pamela Dragosh --- .../org/onap/policy/sdnr/util/StatusCodeEnum.java | 36 ++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'models-interactions/model-impl/sdnr') diff --git a/models-interactions/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/util/StatusCodeEnum.java b/models-interactions/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/util/StatusCodeEnum.java index 483062d6f..09c62c23c 100644 --- a/models-interactions/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/util/StatusCodeEnum.java +++ b/models-interactions/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/util/StatusCodeEnum.java @@ -74,6 +74,42 @@ public enum StatusCodeEnum { return null; } + /** + * Best guess on a value, but since some of these + * codes could be any value this may be difficult to + * use during runtime. + + * @param code input StatusCodeEnum + * @return integer value + */ + public static int toValue(StatusCodeEnum code) { + switch (code) { + case ACCEPTED: + return 100; + + case SUCCESS: + return 200; + + case REJECT: + return 300; + + case ERROR: + return 400; + + case FAILURE: + return 450; + + case PARTIAL_SUCCESS: + return 500; + + case PARTIAL_FAILURE: + return 501; + + default: + return 0; + } + } + private static boolean isRejectStatusCode(final int statusCode) { return statusCode >= 300 && statusCode <= 313; } -- cgit 1.2.3-korg