X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=PolicyEngineAPI%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fpolicy%2Fapi%2FPolicyResponseStatus.java;h=0db373ced5c2f050abf7292ff4c3bb53d7549ff8;hb=5450bdbfb94fb5217617da6c41971fd26f7e81b5;hp=63cb9185c8f1331dd20007d0fad0e82c1737a0b3;hpb=a9710cb3b80c73c98d257c676ba6ecf9e30ef758;p=policy%2Fengine.git
diff --git a/PolicyEngineAPI/src/main/java/org/onap/policy/api/PolicyResponseStatus.java b/PolicyEngineAPI/src/main/java/org/onap/policy/api/PolicyResponseStatus.java
index 63cb9185c..0db373ced 100644
--- a/PolicyEngineAPI/src/main/java/org/onap/policy/api/PolicyResponseStatus.java
+++ b/PolicyEngineAPI/src/main/java/org/onap/policy/api/PolicyResponseStatus.java
@@ -28,59 +28,65 @@ import com.fasterxml.jackson.annotation.JsonCreator;
*
* @version 0.2
*/
-public enum PolicyResponseStatus {
- /**
- * Indicates there is no action required.
- */
- NO_ACTION_REQUIRED("no_action"),
- /**
- * Indicates that an action has been advised.
- */
- ACTION_ADVISED("action_advised"),
- /**
- * Indicates that an action has been taken.
- */
- ACTION_TAKEN("action_taken")
- ;
-
- private String name;
- private PolicyResponseStatus(String name){
- this.name = name;
- }
-
- /**
- * Get the PolicyResponseStatus
based on String
representation of PolicyResponse
- *
- * @param responseStatus the String
Response Status
- * @return the PolicyResponseStatus
with the name matching ACTION_ADVISED
or ACTION_TAKEN
or NO_ACTION_REQUIRED
- */
- public static PolicyResponseStatus getStatus(String responseStatus) {
- if("action_advised".equalsIgnoreCase(responseStatus)) {
- return ACTION_ADVISED;
- }else if("action_taken".equalsIgnoreCase(responseStatus)) {
- return ACTION_TAKEN;
- }else {
- return NO_ACTION_REQUIRED;
- }
- }
-
- /**
- * Returns the String
name for this PolicyResponseStatus
- *
- * @return the String
name for this PolicyResponseStatus
- */
- @Override
- public String toString(){
- return this.name;
- }
-
- @JsonCreator
- public static PolicyResponseStatus create (String value) {
- for(PolicyResponseStatus type: values()){
- if(type.toString().equals(value) || type.equals(PolicyResponseStatus.valueOf(value))){
+public enum PolicyResponseStatus {
+ /**
+ * Indicates there is no action required.
+ */
+ NO_ACTION_REQUIRED("no_action"),
+ /**
+ * Indicates that an action has been advised.
+ */
+ ACTION_ADVISED("action_advised"),
+ /**
+ * Indicates that an action has been taken.
+ */
+ ACTION_TAKEN("action_taken");
+
+ private final String name;
+
+ private PolicyResponseStatus(final String name) {
+ this.name = name;
+ }
+
+ /**
+ * Get the PolicyResponseStatus
based on String
+ * representation of PolicyResponse
+ *
+ * @param responseStatus
+ * the String
Response Status
+ * @return the PolicyResponseStatus
with the name matching
+ * ACTION_ADVISED
or ACTION_TAKEN
or
+ * NO_ACTION_REQUIRED
+ */
+ public static PolicyResponseStatus getStatus(final String responseStatus) {
+ if (ACTION_ADVISED.name.equalsIgnoreCase(responseStatus)) {
+ return ACTION_ADVISED;
+ } else if (ACTION_TAKEN.name.equalsIgnoreCase(responseStatus)) {
+ return ACTION_TAKEN;
+ } else {
+ return NO_ACTION_REQUIRED;
+ }
+ }
+
+ /**
+ * Returns the String
name for this
+ * PolicyResponseStatus
+ *
+ * @return the String
name for this
+ * PolicyResponseStatus
+ */
+ @Override
+ public String toString() {
+ return this.name;
+ }
+
+ @JsonCreator
+ public static PolicyResponseStatus create(final String value) {
+ for (final PolicyResponseStatus type : values()) {
+ if (type.toString().equalsIgnoreCase(value) || type.name().equalsIgnoreCase(value)) {
return type;
}
}
- throw new IllegalArgumentException();
+ throw new IllegalArgumentException("Invalid value: " + value);
}
}