aboutsummaryrefslogtreecommitdiffstats
path: root/PolicyEngineAPI/src/main/java/org/onap/policy/api
diff options
context:
space:
mode:
authorwaqas.ikram <waqas.ikram@ericsson.com>2018-02-20 15:44:50 +0000
committerwaqas.ikram <waqas.ikram@ericsson.com>2018-02-20 16:40:08 +0000
commit5450bdbfb94fb5217617da6c41971fd26f7e81b5 (patch)
treece2229464356c633588edcb8a1988f46a6bf5757 /PolicyEngineAPI/src/main/java/org/onap/policy/api
parenta9710cb3b80c73c98d257c676ba6ecf9e30ef758 (diff)
JUnit test for policy/engine PolicyEngineAPI
Change-Id: I31991245bb5cc877722f7ce14530222a102d6472 Issue-ID: POLICY-606 Signed-off-by: waqas.ikram <waqas.ikram@ericsson.com>
Diffstat (limited to 'PolicyEngineAPI/src/main/java/org/onap/policy/api')
-rw-r--r--PolicyEngineAPI/src/main/java/org/onap/policy/api/DeletePolicyCondition.java57
-rw-r--r--PolicyEngineAPI/src/main/java/org/onap/policy/api/DictionaryType.java144
-rw-r--r--PolicyEngineAPI/src/main/java/org/onap/policy/api/PolicyClass.java68
-rw-r--r--PolicyEngineAPI/src/main/java/org/onap/policy/api/PolicyConfigStatus.java97
-rw-r--r--PolicyEngineAPI/src/main/java/org/onap/policy/api/PolicyDecision.java69
-rw-r--r--PolicyEngineAPI/src/main/java/org/onap/policy/api/PolicyResponseStatus.java108
-rw-r--r--PolicyEngineAPI/src/main/java/org/onap/policy/api/PolicyType.java79
-rw-r--r--PolicyEngineAPI/src/main/java/org/onap/policy/api/RuleProvider.java86
8 files changed, 367 insertions, 341 deletions
diff --git a/PolicyEngineAPI/src/main/java/org/onap/policy/api/DeletePolicyCondition.java b/PolicyEngineAPI/src/main/java/org/onap/policy/api/DeletePolicyCondition.java
index 117ac716e..34b481719 100644
--- a/PolicyEngineAPI/src/main/java/org/onap/policy/api/DeletePolicyCondition.java
+++ b/PolicyEngineAPI/src/main/java/org/onap/policy/api/DeletePolicyCondition.java
@@ -29,38 +29,41 @@ import com.fasterxml.jackson.annotation.JsonCreator;
* @version 0.1
*/
public enum DeletePolicyCondition {
-
- /**
- * Indicates a condition to only delete the current version of the policy.
- */
- ONE("Current Version"),
-
- /**
- * Indicates a condition to delete all versions of the policy.
- */
- ALL("All Versions");
- private String name;
- private DeletePolicyCondition(String name){
- this.name = name;
- }
+ /**
+ * Indicates a condition to only delete the current version of the policy.
+ */
+ ONE("Current Version"),
- /**
- * Returns the <code>String</code> format of delete condition for this Policy
- * @return the <code>String</code> of the delete condition for this Policy
- */
- @Override
- public String toString(){
- return this.name;
- }
+ /**
+ * Indicates a condition to delete all versions of the policy.
+ */
+ ALL("All Versions");
- @JsonCreator
- public static DeletePolicyCondition create (String value) {
- for(DeletePolicyCondition type: values()){
- if(type.toString().equals(value) || type.equals(DeletePolicyCondition.valueOf(value))){
+ private final String name;
+
+ private DeletePolicyCondition(final String name) {
+ this.name = name;
+ }
+
+ /**
+ * Returns the <code>String</code> format of delete condition for this
+ * Policy
+ *
+ * @return the <code>String</code> of the delete condition for this Policy
+ */
+ @Override
+ public String toString() {
+ return this.name;
+ }
+
+ @JsonCreator
+ public static DeletePolicyCondition create(final String value) {
+ for (final DeletePolicyCondition type : values()) {
+ if (type.toString().equalsIgnoreCase(value) || type.name().equalsIgnoreCase(value)) {
return type;
}
}
- throw new IllegalArgumentException();
+ throw new IllegalArgumentException("Invalid value: " + value);
}
}
diff --git a/PolicyEngineAPI/src/main/java/org/onap/policy/api/DictionaryType.java b/PolicyEngineAPI/src/main/java/org/onap/policy/api/DictionaryType.java
index 499295d65..56b73221f 100644
--- a/PolicyEngineAPI/src/main/java/org/onap/policy/api/DictionaryType.java
+++ b/PolicyEngineAPI/src/main/java/org/onap/policy/api/DictionaryType.java
@@ -22,80 +22,82 @@ package org.onap.policy.api;
import com.fasterxml.jackson.annotation.JsonCreator;
-public enum DictionaryType{
- /**
- * Indicates Common Dictionaries.
- */
- Common("Common"),
- /**
- * Indicates Action Policy Dictionaries
- */
- Action("Action"),
- /**
- * Indicates ClosedLoop Policy Dictionaries.
- */
- ClosedLoop("ClosedLoop"),
- /**
- * Indicates Firewall Config Policy Dictionaries.
- */
- Firewall("Firewall"),
- /**
- * Indicates Decision Policy Dictionaries.
- */
- Decision("Decision"),
- /**
- * Indicates BRMS Policy Dictionaries.
- */
- BRMS("BRMS"),
- /**
- * Indicates DCAE Micro Service Policy Dictionaries.
- */
- MicroService("MicroService"),
- /**
- * Indicates Descriptive Scope Dictionaries
- */
- DescriptiveScope("DescriptiveScope"),
- /**
- * Indicates Policy Scope Dictionaries
- */
- PolicyScope("PolicyScope"),
- /**
- * Indicates Enforcer Dictionaries
- */
- Enforcer("Enforcer"),
- /**
- * Indicates SafePolicy Dictionaries
- */
- SafePolicy("SafePolicy"),
- /**
- * Enum support entry to extend dictionary
- */
- Extended("Extended"),
- ;
-
- private String name;
-
- private DictionaryType(String typeName){
- this.name = typeName;
- }
-
- /**
- * Returns the <code>String</code> format of Type for this <code>PolicyClass</code>
- * @return the <code>String</code> of the Type for this <code>PolicyClass</code>
- */
- @Override
- public String toString() {
- return this.name;
- }
-
- @JsonCreator
- public static DictionaryType create (String value) {
- for(DictionaryType type: values()){
- if(type.toString().equals(value) || type.equals(DictionaryType.valueOf(value))){
+public enum DictionaryType {
+ /**
+ * Indicates Common Dictionaries.
+ */
+ Common("Common"),
+ /**
+ * Indicates Action Policy Dictionaries
+ */
+ Action("Action"),
+ /**
+ * Indicates ClosedLoop Policy Dictionaries.
+ */
+ ClosedLoop("ClosedLoop"),
+ /**
+ * Indicates Firewall Config Policy Dictionaries.
+ */
+ Firewall("Firewall"),
+ /**
+ * Indicates Decision Policy Dictionaries.
+ */
+ Decision("Decision"),
+ /**
+ * Indicates BRMS Policy Dictionaries.
+ */
+ BRMS("BRMS"),
+ /**
+ * Indicates DCAE Micro Service Policy Dictionaries.
+ */
+ MicroService("MicroService"),
+ /**
+ * Indicates Descriptive Scope Dictionaries
+ */
+ DescriptiveScope("DescriptiveScope"),
+ /**
+ * Indicates Policy Scope Dictionaries
+ */
+ PolicyScope("PolicyScope"),
+ /**
+ * Indicates Enforcer Dictionaries
+ */
+ Enforcer("Enforcer"),
+ /**
+ * Indicates SafePolicy Dictionaries
+ */
+ SafePolicy("SafePolicy"),
+ /**
+ * Enum support entry to extend dictionary
+ */
+ Extended("Extended");
+
+ private final String name;
+
+ private DictionaryType(final String typeName) {
+ this.name = typeName;
+ }
+
+ /**
+ * Returns the <code>String</code> format of Type for this
+ * <code>PolicyClass</code>
+ *
+ * @return the <code>String</code> of the Type for this
+ * <code>PolicyClass</code>
+ */
+ @Override
+ public String toString() {
+ return this.name;
+ }
+
+ @JsonCreator
+ public static DictionaryType create(final String value) {
+ for (final DictionaryType type : values()) {
+ if (type.toString().equalsIgnoreCase(value) || type.name().equalsIgnoreCase(value)) {
return type;
}
}
- throw new IllegalArgumentException();
+ throw new IllegalArgumentException("Invalid value: " + value);
}
}
diff --git a/PolicyEngineAPI/src/main/java/org/onap/policy/api/PolicyClass.java b/PolicyEngineAPI/src/main/java/org/onap/policy/api/PolicyClass.java
index 6a648e8e6..fb389bb03 100644
--- a/PolicyEngineAPI/src/main/java/org/onap/policy/api/PolicyClass.java
+++ b/PolicyEngineAPI/src/main/java/org/onap/policy/api/PolicyClass.java
@@ -29,40 +29,44 @@ import com.fasterxml.jackson.annotation.JsonCreator;
* @version 0.1
*/
public enum PolicyClass {
- /**
- * Indicates Config based Policy.
- */
- Config("Config"),
- /**
- * Indicates Action based Policy.
- */
- Action("Action"),
- /**
- * Indicates Decision based Policy.
- */
- Decision("Decision")
- ;
- private String name;
-
- private PolicyClass(String typeName){
- this.name = typeName;
- }
-
- /**
- * Returns the <code>String</code> format of Type for this <code>PolicyClass</code>
- * @return the <code>String</code> of the Type for this <code>PolicyClass</code>
- */
- @Override
- public String toString() {
- return this.name;
- }
- @JsonCreator
- public static PolicyClass create (String value) {
- for(PolicyClass type: values()){
- if(type.toString().equals(value) || type.equals(PolicyClass.valueOf(value))){
+ /**
+ * Indicates Config based Policy.
+ */
+ Config("Config"),
+ /**
+ * Indicates Action based Policy.
+ */
+ Action("Action"),
+ /**
+ * Indicates Decision based Policy.
+ */
+ Decision("Decision");
+
+ private final String name;
+
+ private PolicyClass(final String typeName) {
+ this.name = typeName;
+ }
+
+ /**
+ * Returns the <code>String</code> format of Type for this
+ * <code>PolicyClass</code>
+ *
+ * @return the <code>String</code> of the Type for this
+ * <code>PolicyClass</code>
+ */
+ @Override
+ public String toString() {
+ return this.name;
+ }
+
+ @JsonCreator
+ public static PolicyClass create(final String value) {
+ for (final PolicyClass type : values()) {
+ if (type.toString().equalsIgnoreCase(value) || type.name().equalsIgnoreCase(value)) {
return type;
}
}
- throw new IllegalArgumentException();
+ throw new IllegalArgumentException("Invalid value: " + value);
}
}
diff --git a/PolicyEngineAPI/src/main/java/org/onap/policy/api/PolicyConfigStatus.java b/PolicyEngineAPI/src/main/java/org/onap/policy/api/PolicyConfigStatus.java
index cee156786..f1bbea167 100644
--- a/PolicyEngineAPI/src/main/java/org/onap/policy/api/PolicyConfigStatus.java
+++ b/PolicyEngineAPI/src/main/java/org/onap/policy/api/PolicyConfigStatus.java
@@ -23,58 +23,63 @@ package org.onap.policy.api;
import com.fasterxml.jackson.annotation.JsonCreator;
/**
- * Enumeration of PolicyConfigStatus that can be returned as a part of
+ * Enumeration of PolicyConfigStatus that can be returned as a part of
* {@link org.onap.policy.api.PolicyConfig}.
*
* @version 0.1
*/
-public enum PolicyConfigStatus {
- /**
- * Indicates that the Configuration has been successfully retrieved.
- */
- CONFIG_RETRIEVED("retrieved"),
- /**
- * Indicates that there is no Configuration Retrieved from PolicyConfig.
- */
- CONFIG_NOT_FOUND("not_found"),
- ;
-
- private String name;
- private PolicyConfigStatus(String name){
- this.name = name;
- }
-
- /**
- * Get the <code>PolicyConfigStatus</code> based on <code>String</code> representation of <code>PolicyConfig</code>
- *
- * @param configStatus the <code>String</code> Configuration Status
- * @return the <code>PolicyConfigResponse</code> with the name matching <code>CONFIG_RETRIEVED</code> or <code>CONFIG_NOT_FOUND</code>
- * if no match is found
- */
- public static PolicyConfigStatus getStatus(String configStatus) {
- if("retrieved".equalsIgnoreCase(configStatus)) {
- return CONFIG_RETRIEVED;
- }else {
- return CONFIG_NOT_FOUND;
- }
- }
-
- /**
- * Returns the <code>String</code> name for this <code>PolicyConfigStatus</code>
- *
- * @return the <code>String</code> name for this <code>PolicyConfigStatus</code>
- */
- @Override
- public String toString(){
- return this.name;
- }
- @JsonCreator
- public static PolicyConfigStatus create (String value) {
- for(PolicyConfigStatus type: values()){
- if(type.toString().equals(value) || type.equals(PolicyConfigStatus.valueOf(value))){
+public enum PolicyConfigStatus {
+ /**
+ * Indicates that the Configuration has been successfully retrieved.
+ */
+ CONFIG_RETRIEVED("retrieved"),
+ /**
+ * Indicates that there is no Configuration Retrieved from PolicyConfig.
+ */
+ CONFIG_NOT_FOUND("not_found");
+
+ private final String name;
+
+ private PolicyConfigStatus(final String name) {
+ this.name = name;
+ }
+
+ /**
+ * Get the <code>PolicyConfigStatus</code> based on <code>String</code>
+ * representation of <code>PolicyConfig</code>
+ *
+ * @param configStatus
+ * the <code>String</code> Configuration Status
+ * @return the <code>PolicyConfigResponse</code> with the name matching
+ * <code>CONFIG_RETRIEVED</code> or <code>CONFIG_NOT_FOUND</code> if
+ * no match is found
+ */
+ public static PolicyConfigStatus getStatus(final String configStatus) {
+ if (CONFIG_RETRIEVED.name.equalsIgnoreCase(configStatus)) {
+ return CONFIG_RETRIEVED;
+ }
+ return CONFIG_NOT_FOUND;
+ }
+
+ /**
+ * Returns the <code>String</code> name for this
+ * <code>PolicyConfigStatus</code>
+ *
+ * @return the <code>String</code> name for this
+ * <code>PolicyConfigStatus</code>
+ */
+ @Override
+ public String toString() {
+ return this.name;
+ }
+
+ @JsonCreator
+ public static PolicyConfigStatus create(final String value) {
+ for (final PolicyConfigStatus type : values()) {
+ if (type.toString().equalsIgnoreCase(value) || type.name().equalsIgnoreCase(value)) {
return type;
}
}
- throw new IllegalArgumentException();
+ throw new IllegalArgumentException("Invalid value: " + value);
}
}
diff --git a/PolicyEngineAPI/src/main/java/org/onap/policy/api/PolicyDecision.java b/PolicyEngineAPI/src/main/java/org/onap/policy/api/PolicyDecision.java
index 6bae84cc7..782d44459 100644
--- a/PolicyEngineAPI/src/main/java/org/onap/policy/api/PolicyDecision.java
+++ b/PolicyEngineAPI/src/main/java/org/onap/policy/api/PolicyDecision.java
@@ -23,47 +23,48 @@ package org.onap.policy.api;
import com.fasterxml.jackson.annotation.JsonCreator;
/**
- * Enumeration of PolicyDecision that can be returned as a part of
+ * Enumeration of PolicyDecision that can be returned as a part of
* {@link org.onap.policy.api.DecisionResponse} getDecision().
*
* @version 0.1
*/
public enum PolicyDecision {
- /**
- * Indicates that the Decision is to Permit.
- */
- PERMIT("permit"),
- /**
- * Indicates that the Decision is to Deny.
- */
- DENY("deny"),
- /**
- * Indicates that the Decision process has some issues.
- */
- ERROR("error")
- ;
-
- private String name;
- private PolicyDecision(String name){
- this.name = name;
- }
-
- /**
- * Returns the <code>String</code> name for this <code>PolicyDecision</code>
- *
- * @return the <code>String</code> name for this <code>PolicyDecision</code>
- */
- @Override
- public String toString(){
- return this.name;
- }
- @JsonCreator
- public static PolicyDecision create (String value) {
- for(PolicyDecision type: values()){
- if(type.toString().equals(value) || type.equals(PolicyDecision.valueOf(value))){
+ /**
+ * Indicates that the Decision is to Permit.
+ */
+ PERMIT("permit"),
+ /**
+ * Indicates that the Decision is to Deny.
+ */
+ DENY("deny"),
+ /**
+ * Indicates that the Decision process has some issues.
+ */
+ ERROR("error");
+
+ private final String name;
+
+ private PolicyDecision(final String name) {
+ this.name = name;
+ }
+
+ /**
+ * Returns the <code>String</code> name for this <code>PolicyDecision</code>
+ *
+ * @return the <code>String</code> name for this <code>PolicyDecision</code>
+ */
+ @Override
+ public String toString() {
+ return this.name;
+ }
+
+ @JsonCreator
+ public static PolicyDecision create(final String value) {
+ for (final PolicyDecision type : values()) {
+ if (type.toString().equalsIgnoreCase(value) || type.name().equalsIgnoreCase(value)) {
return type;
}
}
- throw new IllegalArgumentException();
+ throw new IllegalArgumentException("Invalid value: " + value);
}
}
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 <code>PolicyResponseStatus</code> based on <code>String</code> representation of <code>PolicyResponse</code>
- *
- * @param responseStatus the <code>String</code> Response Status
- * @return the <code>PolicyResponseStatus</code> with the name matching <code>ACTION_ADVISED</code> or <code>ACTION_TAKEN</code> or <code>NO_ACTION_REQUIRED</code>
- */
- 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 <code>String</code> name for this <code>PolicyResponseStatus</code>
- *
- * @return the <code>String</code> name for this <code>PolicyResponseStatus</code>
- */
- @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 <code>PolicyResponseStatus</code> based on <code>String</code>
+ * representation of <code>PolicyResponse</code>
+ *
+ * @param responseStatus
+ * the <code>String</code> Response Status
+ * @return the <code>PolicyResponseStatus</code> with the name matching
+ * <code>ACTION_ADVISED</code> or <code>ACTION_TAKEN</code> or
+ * <code>NO_ACTION_REQUIRED</code>
+ */
+ 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 <code>String</code> name for this
+ * <code>PolicyResponseStatus</code>
+ *
+ * @return the <code>String</code> name for this
+ * <code>PolicyResponseStatus</code>
+ */
+ @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);
}
}
diff --git a/PolicyEngineAPI/src/main/java/org/onap/policy/api/PolicyType.java b/PolicyEngineAPI/src/main/java/org/onap/policy/api/PolicyType.java
index a29a6c440..0ff5480bf 100644
--- a/PolicyEngineAPI/src/main/java/org/onap/policy/api/PolicyType.java
+++ b/PolicyEngineAPI/src/main/java/org/onap/policy/api/PolicyType.java
@@ -29,45 +29,48 @@ import com.fasterxml.jackson.annotation.JsonCreator;
* @version 0.2
*/
public enum PolicyType {
- /**
- * Indicates the response is Properties type
- */
- PROPERTIES("Properties"),
- /**
- * Indicates the response is JSON type
- */
- JSON("json"),
- /**
- * Indicates the response is XML type
- */
- XML("xml"),
- /**
- * Indicates the response is Other type
- */
- OTHER("other")
- ;
-
- private String name;
-
- private PolicyType(String typeName) {
- this.name = typeName;
- }
-
- /**
- * Returns the <code>String</code> format of Type for this <code>PolicyType</code>
- * @return the <code>String</code> of the Type for this <code>PolicyType</code>
- */
- @Override
- public String toString() {
- return this.name;
- }
- @JsonCreator
- public static PolicyType create (String value) {
- for(PolicyType type: values()){
- if(type.toString().equalsIgnoreCase(value)){
+ /**
+ * Indicates the response is Properties type
+ */
+ PROPERTIES("Properties"),
+ /**
+ * Indicates the response is JSON type
+ */
+ JSON("json"),
+ /**
+ * Indicates the response is XML type
+ */
+ XML("xml"),
+ /**
+ * Indicates the response is Other type
+ */
+ OTHER("other");
+
+ private final String name;
+
+ private PolicyType(final String typeName) {
+ this.name = typeName;
+ }
+
+ /**
+ * Returns the <code>String</code> format of Type for this
+ * <code>PolicyType</code>
+ *
+ * @return the <code>String</code> of the Type for this
+ * <code>PolicyType</code>
+ */
+ @Override
+ public String toString() {
+ return this.name;
+ }
+
+ @JsonCreator
+ public static PolicyType create(final String value) {
+ for (final PolicyType type : values()) {
+ if (type.toString().equalsIgnoreCase(value) || type.name().equalsIgnoreCase(value)) {
return type;
}
}
- throw new IllegalArgumentException();
- }
+ throw new IllegalArgumentException("Invalid value: " + value);
+ }
}
diff --git a/PolicyEngineAPI/src/main/java/org/onap/policy/api/RuleProvider.java b/PolicyEngineAPI/src/main/java/org/onap/policy/api/RuleProvider.java
index 2e45549fc..913f32517 100644
--- a/PolicyEngineAPI/src/main/java/org/onap/policy/api/RuleProvider.java
+++ b/PolicyEngineAPI/src/main/java/org/onap/policy/api/RuleProvider.java
@@ -29,50 +29,52 @@ import com.fasterxml.jackson.annotation.JsonCreator;
* @version 0.1
*/
public enum RuleProvider {
- /**
- * Indicates User will be defining the Rule information.
- */
- CUSTOM("Custom"),
- /**
- * Indicates AAF will be providing the Rule information.
- */
- AAF("AAF"),
- /**
- * Indicates Guard YAML will be providing the Rule information.
- */
- GUARD_YAML("GUARD_YAML"),
- /**
- * Indicates Guard BLACKLIST YAML
- */
- GUARD_BL_YAML("GUARD_BL_YAML"),
- /**
- * Indicates Guard BLACKLIST YAML
- */
- RAINY_DAY("Rainy_Day")
- ;
-
- private String name;
-
- private RuleProvider(String typeName){
- this.name = typeName;
- }
-
- /**
- * Returns the <code>String</code> format of Type for this <code>AttributeType</code>
- * @return the <code>String</code> of the Type for this <code>AttributeType</code>
- */
- @Override
- public String toString() {
- return this.name;
- }
-
- @JsonCreator
- public static RuleProvider create (String value) {
- for(RuleProvider type: values()){
- if(type.toString().equals(value) || type.equals(RuleProvider.valueOf(value))){
+ /**
+ * Indicates User will be defining the Rule information.
+ */
+ CUSTOM("Custom"),
+ /**
+ * Indicates AAF will be providing the Rule information.
+ */
+ AAF("AAF"),
+ /**
+ * Indicates Guard YAML will be providing the Rule information.
+ */
+ GUARD_YAML("GUARD_YAML"),
+ /**
+ * Indicates Guard BLACKLIST YAML
+ */
+ GUARD_BL_YAML("GUARD_BL_YAML"),
+ /**
+ * Indicates Guard BLACKLIST YAML
+ */
+ RAINY_DAY("Rainy_Day");
+
+ private final String name;
+
+ private RuleProvider(final String typeName) {
+ this.name = typeName;
+ }
+
+ /**
+ * Returns the <code>String</code> format of Type for this
+ * <code>AttributeType</code>
+ *
+ * @return the <code>String</code> of the Type for this
+ * <code>AttributeType</code>
+ */
+ @Override
+ public String toString() {
+ return this.name;
+ }
+
+ @JsonCreator
+ public static RuleProvider create(final String value) {
+ for (final RuleProvider type : values()) {
+ if (type.toString().equalsIgnoreCase(value) || type.name().equalsIgnoreCase(value)) {
return type;
}
}
- throw new IllegalArgumentException();
+ throw new IllegalArgumentException("Invalid value: " + value);
}
}