diff options
Diffstat (limited to 'ONAP-REST/src/main/java/org/onap')
3 files changed, 91 insertions, 14 deletions
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/PolicyRestAdapter.java b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/PolicyRestAdapter.java index a9daf1732..e815fe2b9 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/PolicyRestAdapter.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/PolicyRestAdapter.java @@ -127,6 +127,9 @@ public class PolicyRestAdapter { private String actionDictUrl = null; private String actionDictMethod = null; private YAMLParams yamlparams; + private List<String> blackListEntries; + private List<String> appendBlackListEntries; + private String blackListEntryType; //Rainy Day Decision private RainyDayParams rainyday; @@ -907,4 +910,22 @@ public class PolicyRestAdapter { public void setFaultDatas(ClosedLoopFaultTrapDatas faultDatas) { this.faultDatas = faultDatas; } + public List<String> getAppendBlackListEntries() { + return appendBlackListEntries; + } + public void setAppendBlackListEntries(List<String> appendBlackListEntries) { + this.appendBlackListEntries = appendBlackListEntries; + } + public List<String> getBlackListEntries() { + return blackListEntries; + } + public void setBlackListEntries(List<String> blackListEntries) { + this.blackListEntries = blackListEntries; + } + public String getBlackListEntryType() { + return blackListEntryType; + } + public void setBlackListEntryType(String blackListEntryType) { + this.blackListEntryType = blackListEntryType; + } } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/ReturnBlackList.java b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/ReturnBlackList.java new file mode 100644 index 000000000..6ecf1b5e4 --- /dev/null +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/ReturnBlackList.java @@ -0,0 +1,51 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP Policy Engine + * ================================================================================ + * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.rest.adapter; + +public class ReturnBlackList { + private boolean entryCheck; + private int actionValue; + private String entryValue; + + public boolean isEntryCheck() { + return entryCheck; + } + + public void setEntryCheck(boolean entryCheck) { + this.entryCheck = entryCheck; + } + + public int getActionValue() { + return actionValue; + } + + public void setActionValue(int actionValue) { + this.actionValue = actionValue; + } + + public String getEntryValue() { + return entryValue; + } + + public void setEntryValue(String entryValue) { + this.entryValue = entryValue; + } +} 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 50985b12d..0478f5f95 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 @@ -940,20 +940,25 @@ public class PolicyValidation { responseString.append("Guard Params <b>Time Units</b> is Required" + HTML_ITALICS_LNBREAK); valid = false; } - }else if("GUARD_BL_YAML".equals(policyData.getRuleProvider())){ - if(policyData.getYamlparams().getBlackList()==null || policyData.getYamlparams().getBlackList().isEmpty()){ - responseString.append(" Guard Params <b>BlackList</b> is Required " + HTML_ITALICS_LNBREAK); - valid = false; - }else{ - for(String blackList: policyData.getYamlparams().getBlackList()){ - if(blackList==null || !(SUCCESS.equals(PolicyUtils.policySpecialCharValidator(blackList)))){ - responseString.append(" Guard Params <b>BlackList</b> Should be valid String" + HTML_ITALICS_LNBREAK); - valid = false; - break; - } - } - } - } + } else if ("GUARD_BL_YAML".equals(policyData.getRuleProvider()) + && "Use Manual Entry".equals(policyData.getBlackListEntryType())) { + if (policyData.getYamlparams().getBlackList() == null + || policyData.getYamlparams().getBlackList().isEmpty()) { + responseString + .append(" Guard Params <b>BlackList</b> is Required " + HTML_ITALICS_LNBREAK); + valid = false; + } else { + for (String blackList : policyData.getYamlparams().getBlackList()) { + if (blackList == null + || !(SUCCESS.equals(PolicyUtils.policySpecialCharValidator(blackList)))) { + responseString.append(" Guard Params <b>BlackList</b> Should be valid String" + + HTML_ITALICS_LNBREAK); + valid = false; + break; + } + } + } + } } } } |