X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=ONAP-REST%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fpolicy%2Frest%2Futil%2FPolicyValidation.java;h=df4e4726d453bd2a4f641e5eabb35121fa4ba38f;hb=e957a1d9a9fa6bd0f9f8348d1e864c09cfe2cb92;hp=42f94cfa733ba305808c3a261a04ff5f81d5031a;hpb=7a6c4f9214a71101db3354ed06ccd3cfd3cea65b;p=policy%2Fengine.git
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/util/PolicyValidation.java b/ONAP-REST/src/main/java/org/onap/policy/rest/util/PolicyValidation.java
index 42f94cfa7..df4e4726d 100644
--- a/ONAP-REST/src/main/java/org/onap/policy/rest/util/PolicyValidation.java
+++ b/ONAP-REST/src/main/java/org/onap/policy/rest/util/PolicyValidation.java
@@ -900,48 +900,74 @@ public class PolicyValidation {
}
}
- if("GUARD_YAML".equals(policyData.getRuleProvider()) || "GUARD_BL_YAML".equals(policyData.getRuleProvider())){
- if(policyData.getYamlparams()==null){
+ if ("GUARD_YAML".equals(policyData.getRuleProvider())
+ || "GUARD_BL_YAML".equals(policyData.getRuleProvider())
+ || "GUARD_MIN_MAX".equals(policyData.getRuleProvider())) {
+ if (policyData.getYamlparams() == null) {
responseString.append(" Guard Params are Required " + HTML_ITALICS_LNBREAK);
valid = false;
- }else{
- if(Strings.isNullOrEmpty(policyData.getYamlparams().getActor())){
+ } else {
+ if (Strings.isNullOrEmpty(policyData.getYamlparams().getActor())) {
responseString.append("Guard Params Actor is Required " + HTML_ITALICS_LNBREAK);
valid = false;
}
- if(Strings.isNullOrEmpty(policyData.getYamlparams().getRecipe())){
+ if (Strings.isNullOrEmpty(policyData.getYamlparams().getRecipe())) {
responseString.append("Guard Params Recipe is Required " + HTML_ITALICS_LNBREAK);
valid = false;
}
- if(Strings.isNullOrEmpty(policyData.getYamlparams().getGuardActiveStart())){
- responseString.append("Guard Params Guard Active Start is Required " + HTML_ITALICS_LNBREAK);
+ if (Strings.isNullOrEmpty(policyData.getYamlparams().getGuardActiveStart())) {
+ responseString.append(
+ "Guard Params Guard Active Start is Required " + HTML_ITALICS_LNBREAK);
valid = false;
}
- if(Strings.isNullOrEmpty(policyData.getYamlparams().getGuardActiveEnd())){
- responseString.append("Guard Params Guard Active End is Required " + HTML_ITALICS_LNBREAK);
+ if (Strings.isNullOrEmpty(policyData.getYamlparams().getGuardActiveEnd())) {
+ responseString
+ .append("Guard Params Guard Active End is Required " + HTML_ITALICS_LNBREAK);
valid = false;
}
- if("GUARD_YAML".equals(policyData.getRuleProvider())){
- if(Strings.isNullOrEmpty(policyData.getYamlparams().getLimit())){
+ if ("GUARD_YAML".equals(policyData.getRuleProvider())) {
+ if (Strings.isNullOrEmpty(policyData.getYamlparams().getLimit())) {
responseString.append(" Guard Params Limit is Required " + HTML_ITALICS_LNBREAK);
valid = false;
- }else if(!PolicyUtils.isInteger(policyData.getYamlparams().getLimit())){
- responseString.append(" Guard Params Limit Should be Integer " + HTML_ITALICS_LNBREAK);
+ } else if (!PolicyUtils.isInteger(policyData.getYamlparams().getLimit())) {
+ responseString
+ .append(" Guard Params Limit Should be Integer " + HTML_ITALICS_LNBREAK);
+ valid = false;
+ }
+ if (Strings.isNullOrEmpty(policyData.getYamlparams().getTimeWindow())) {
+ responseString
+ .append("Guard Params Time Window is Required" + HTML_ITALICS_LNBREAK);
+ valid = false;
+ } else if (!PolicyUtils.isInteger(policyData.getYamlparams().getTimeWindow())) {
+ responseString.append(
+ " Guard Params Time Window Should be Integer " + HTML_ITALICS_LNBREAK);
valid = false;
}
- if(Strings.isNullOrEmpty(policyData.getYamlparams().getTimeWindow())){
- responseString.append("Guard Params Time Window is Required" + HTML_ITALICS_LNBREAK);
+ if (Strings.isNullOrEmpty(policyData.getYamlparams().getTimeUnits())) {
+ responseString
+ .append("Guard Params Time Units is Required" + HTML_ITALICS_LNBREAK);
+ valid = false;
+ }
+ } else if ("GUARD_MIN_MAX".equals(policyData.getRuleProvider())) {
+ if (Strings.isNullOrEmpty(policyData.getYamlparams().getMin())) {
+ responseString.append(" Guard Params Min is Required " + HTML_ITALICS_LNBREAK);
valid = false;
- }else if(!PolicyUtils.isInteger(policyData.getYamlparams().getTimeWindow())){
- responseString.append(" Guard Params Time Window Should be Integer " + HTML_ITALICS_LNBREAK);
+ } else if (!PolicyUtils.isInteger(policyData.getYamlparams().getMin())) {
+ responseString
+ .append(" Guard Params Min Should be Integer " + HTML_ITALICS_LNBREAK);
valid = false;
}
- if(Strings.isNullOrEmpty(policyData.getYamlparams().getTimeUnits())){
- responseString.append("Guard Params Time Units is Required" + HTML_ITALICS_LNBREAK);
+ if (Strings.isNullOrEmpty(policyData.getYamlparams().getMax())) {
+ responseString.append(" Guard Params Max is Required " + HTML_ITALICS_LNBREAK);
+ valid = false;
+ } else if (!PolicyUtils.isInteger(policyData.getYamlparams().getMax())) {
+ responseString
+ .append(" Guard Params Max Should be Integer " + HTML_ITALICS_LNBREAK);
valid = false;
}
} else if ("GUARD_BL_YAML".equals(policyData.getRuleProvider())
&& "Use Manual Entry".equals(policyData.getBlackListEntryType())) {
+
if (policyData.getYamlparams().getBlackList() == null
|| policyData.getYamlparams().getBlackList().isEmpty()) {
responseString