aboutsummaryrefslogtreecommitdiffstats
path: root/POLICY-SDK-APP/src/main
diff options
context:
space:
mode:
authorRavindra Bakkamanthala <rb7147@att.com>2017-06-05 22:42:02 -0400
committerRavindra Bakkamanthala <rb7147@att.com>2017-06-07 14:47:34 -0400
commitfc5c07705edc4dcb7083b39116a43844bb6a1490 (patch)
treeab5c7258197fc776fef8106413704a5f0a829160 /POLICY-SDK-APP/src/main
parentd9007d680d19734d5dc106479784c420236cca4b (diff)
Fixed the Policy API issues and Bugfixes
Change-Id: I6e8b54442421b6ebd0ff88426fc6e5f3a36b0690 Signed-off-by: Ravindra Bakkamanthala <rb7147@att.com>
Diffstat (limited to 'POLICY-SDK-APP/src/main')
-rw-r--r--POLICY-SDK-APP/src/main/java/org/openecomp/policy/admin/PolicyManagerServlet.java140
-rw-r--r--POLICY-SDK-APP/src/main/java/org/openecomp/policy/admin/PolicyRestController.java17
-rw-r--r--POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/CreateBRMSParamController.java21
-rw-r--r--POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/DecisionPolicyController.java20
-rw-r--r--POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/PolicyValidationController.java314
-rw-r--r--POLICY-SDK-APP/src/main/webapp/app/policyApp/Windows/PDPTabWindows/AddorEditPDPtoGroup.html2
-rw-r--r--POLICY-SDK-APP/src/main/webapp/app/policyApp/Windows/PushtabWindow/removeGroupPoliciesWindow.html2
-rw-r--r--POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/BRMSParamDictGridController.js2
-rw-r--r--POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLPepOptionsDictGridController.js2
-rw-r--r--POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLServiceDictGridController.js2
-rw-r--r--POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLSiteDictGridController.js2
-rw-r--r--POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLVarbindDictGridController.js2
-rw-r--r--POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLVnfTypeDictGridController.js2
-rw-r--r--POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLVsclActionDictGridController.js2
-rw-r--r--POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/ActionPolicyController.js1
-rw-r--r--POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/DCAEMicroServicePolicyController.js7
-rw-r--r--POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/DecisionPolicyController.js26
-rw-r--r--POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/ActionPolicyTemplate.html2
-rw-r--r--POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/ClosedLoopFaultPolicyTemplate.html2
-rw-r--r--POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/DecisionPolicyTemplate.html81
-rw-r--r--POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/PolicyTypeTemplate.html2
-rw-r--r--POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/policy_AutoPush.html13
-rw-r--r--POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/policy_Dictionary.html25
-rw-r--r--POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/policy_PDPManagement.html13
-rw-r--r--POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/policy_Roles.html21
25 files changed, 472 insertions, 251 deletions
diff --git a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/admin/PolicyManagerServlet.java b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/admin/PolicyManagerServlet.java
index fdf43264f..639e29e3d 100644
--- a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/admin/PolicyManagerServlet.java
+++ b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/admin/PolicyManagerServlet.java
@@ -353,6 +353,16 @@ public class PolicyManagerServlet extends HttpServlet {
if(scopes.isEmpty()){
return error("No Scopes has been Assigned to the User. Please, Contact Super-Admin");
}
+ Set<String> tempScopes = scopes;
+ for(String scope : tempScopes){
+ List<Object> scopesList = queryPolicyEditorScopes(scope);
+ if(!scopesList.isEmpty()){
+ for(int i = 0; i < scopesList.size(); i++){
+ PolicyEditorScopes tempScope = (PolicyEditorScopes) scopesList.get(i);
+ scopes.add(tempScope.getScopeName());
+ }
+ }
+ }
}
if(policyList!= null){
for(int i = 0; i < policyList.length(); i++){
@@ -384,9 +394,13 @@ public class PolicyManagerServlet extends HttpServlet {
List<Object> filterdatas = controller.getData(PolicyVersion.class);
for(Object filter : filterdatas){
PolicyVersion filterdata = (PolicyVersion) filter;
- String scopeName = filterdata.getPolicyName().substring(0, filterdata.getPolicyName().lastIndexOf(File.separator));
- if(scopes.contains(scopeName)){
- policyData.add(filterdata);
+ try{
+ String scopeName = filterdata.getPolicyName().substring(0, filterdata.getPolicyName().lastIndexOf(File.separator));
+ if(scopes.contains(scopeName)){
+ policyData.add(filterdata);
+ }
+ }catch(Exception e){
+ LOGGER.error("Exception occured while filtering policyversion data"+e);
}
}
}
@@ -567,11 +581,6 @@ public class PolicyManagerServlet extends HttpServlet {
}
}
}
- if (roles.contains(ADMIN) || roles.contains(EDITOR) || roles.contains(GUEST) ) {
- if(scopes.isEmpty()){
- return error("No Scopes has been Assigned to the User. Please, Contact Super-Admin");
- }
- }
List<JSONObject> resultList = new ArrayList<>();
boolean onlyFolders = params.getBoolean("onlyFolders");
@@ -580,7 +589,18 @@ public class PolicyManagerServlet extends HttpServlet {
path = path.replaceAll("..xml", "").trim();
}
-
+ if (roles.contains(ADMIN) || roles.contains(EDITOR) || roles.contains(GUEST) ) {
+ if(scopes.isEmpty()){
+ return error("No Scopes has been Assigned to the User. Please, Contact Super-Admin");
+ }else{
+ if(!"/".equals(path)){
+ String tempScope = path.substring(1, path.length());
+ tempScope = tempScope.replace("/", File.separator);
+ scopes.add(tempScope);
+ }
+ }
+ }
+
if("/".equals(path)){
if(roles.contains(SUPERADMIN) || roles.contains(SUPEREDITOR) || roles.contains(SUPERGUEST)){
List<Object> scopesList = queryPolicyEditorScopes(null);
@@ -601,14 +621,16 @@ public class PolicyManagerServlet extends HttpServlet {
for(Object scope : scopes){
JSONObject el = new JSONObject();
List<Object> scopesList = queryPolicyEditorScopes(scope.toString());
- PolicyEditorScopes scopeById = (PolicyEditorScopes) scopesList.get(0);
- el.put("name", scopeById.getScopeName());
- el.put("date", scopeById.getCreatedDate());
- el.put("size", "");
- el.put("type", "dir");
- el.put("createdBy", scopeById.getUserCreatedBy().getUserName());
- el.put("modifiedBy", scopeById.getUserModifiedBy().getUserName());
- resultList.add(el);
+ if(!scopesList.isEmpty()){
+ PolicyEditorScopes scopeById = (PolicyEditorScopes) scopesList.get(0);
+ el.put("name", scopeById.getScopeName());
+ el.put("date", scopeById.getCreatedDate());
+ el.put("size", "");
+ el.put("type", "dir");
+ el.put("createdBy", scopeById.getUserCreatedBy().getUserName());
+ el.put("modifiedBy", scopeById.getUserModifiedBy().getUserName());
+ resultList.add(el);
+ }
}
}
}else{
@@ -632,7 +654,7 @@ public class PolicyManagerServlet extends HttpServlet {
if(scopeName == null){
scopeNamequery = "from PolicyEditorScopes";
}else{
- scopeNamequery = "from PolicyEditorScopes where SCOPENAME like'" +scopeName+"'";
+ scopeNamequery = "from PolicyEditorScopes where SCOPENAME like'" +scopeName+"%'";
}
PolicyController controller = getPolicyControllerInstance();
List<Object> scopesList = controller.getDataByQuery(scopeNamequery);
@@ -945,6 +967,7 @@ public class PolicyManagerServlet extends HttpServlet {
}
private JSONObject cloneRecord(String newpolicyName, String oldScope, String removeoldPolicyExtension, String newScope, String removenewPolicyExtension, PolicyEntity entity, String userId) throws ServletException{
+ FileWriter fw = null;
String queryEntityName = null;
PolicyController controller = getPolicyControllerInstance();
PolicyEntity cloneEntity = new PolicyEntity();
@@ -967,6 +990,15 @@ public class PolicyManagerServlet extends HttpServlet {
controller.saveData(configurationDataEntity);
ConfigurationDataEntity configEntiy = (ConfigurationDataEntity) controller.getEntityItem(ConfigurationDataEntity.class, "configurationName", queryEntityName);
cloneEntity.setConfigurationData(configEntiy);
+ String newConfigurationName = configEntiy.getConfigurationName();
+ try {
+ fw = new FileWriter(PolicyController.getConfigHome() + File.separator + newConfigurationName);
+ BufferedWriter bw = new BufferedWriter(fw);
+ bw.write(configEntiy.getConfigBody());
+ bw.close();
+ } catch (IOException e) {
+ LOGGER.error("Exception Occured While cloning the configuration file"+e);
+ }
}else if(newpolicyName.contains("Action_")){
ActionBodyEntity actionBodyEntity = new ActionBodyEntity();
actionBodyEntity.setActionBodyName(entity.getActionBodyEntity().getActionBodyName().replace(oldScope+"."+oldConfigRemoveExtension, newScope+"."+newConfigRemoveExtension));
@@ -978,6 +1010,22 @@ public class PolicyManagerServlet extends HttpServlet {
controller.saveData(actionBodyEntity);
ActionBodyEntity actionEntiy = (ActionBodyEntity) controller.getEntityItem(ActionBodyEntity.class, "actionBodyName", queryEntityName);
cloneEntity.setActionBodyEntity(actionEntiy);
+ String newConfigurationName = actionEntiy.getActionBodyName();
+ try {
+ fw = new FileWriter(PolicyController.getActionHome() + File.separator + newConfigurationName);
+ BufferedWriter bw = new BufferedWriter(fw);
+ bw.write(actionEntiy.getActionBody());
+ bw.close();
+ } catch (IOException e) {
+ LOGGER.error("Exception Occured While cloning the configuration file"+e);
+ }
+ }
+ if(fw != null){
+ try {
+ fw.close();
+ } catch (IOException e) {
+ LOGGER.error("Exception Occured While closing the File input stream"+e);
+ }
}
cloneEntity.setDeleted(entity.isDeleted());
cloneEntity.setCreatedBy(userId);
@@ -1033,45 +1081,20 @@ public class PolicyManagerServlet extends HttpServlet {
String policyEntityquery = "FROM PolicyEntity where policyName = '"+newPolicySplit[1]+"' and scope ='"+newPolicySplit[0]+"'";
List<Object> queryData = controller.getDataByQuery(policyEntityquery);
if(!queryData.isEmpty()){
+ return error("Policy already exists with same name");
+ }
+
+ //Query the Policy Entity with oldPolicy Name
+ policyEntityquery = "FROM PolicyEntity where policyName = '"+oldPolicySplit[1]+"' and scope ='"+oldPolicySplit[0]+"'";
+ queryData = controller.getDataByQuery(policyEntityquery);
+ if(!queryData.isEmpty()){
entity = (PolicyEntity) queryData.get(0);
}
if(entity != null){
- //if a policy exists with new name check if it is deleted or not
- if(entity.isDeleted()){
- //Check Policy Group Entity table if policy has been pushed or not
- String query = "from PolicyGroupEntity where policyid = '"+entity.getPolicyId()+"'";
- List<Object> object = controller.getDataByQuery(query);
- if(object == null){
- //if PolicyGroupEntity data is empty delete the entry from database
- controller.deleteData(entity);
- //Query the Policy Entity with oldPolicy Name
- policyEntityquery = "FROM PolicyEntity where policyName = '"+oldPolicySplit[1]+"' and scope ='"+oldPolicySplit[0]+"'";
- queryData = controller.getDataByQuery(policyEntityquery);
- if(!queryData.isEmpty()){
- entity = (PolicyEntity) queryData.get(0);
- }
- if(entity != null){
- cloneRecord(newPolicySplit[1], oldPolicySplit[0], oldPolicySplit[1], newPolicySplit[0], newPolicySplit[1], entity, userId);
- success = true;
- }
- }else{
- return error("Policy Clone failed due to policy with new name existing in PDP Group.");
- }
- }else{
- return error("Policy Clone failed due to same name existing.");
- }
- }else{
- //Query the Policy Entity with oldPolicy Name
- policyEntityquery = "FROM PolicyEntity where policyName = '"+oldPolicySplit[1]+"' and scope ='"+oldPolicySplit[0]+"'";
- queryData = controller.getDataByQuery(policyEntityquery);
- if(!queryData.isEmpty()){
- entity = (PolicyEntity) queryData.get(0);
- }
- if(entity != null){
- cloneRecord(newPolicySplit[1], oldPolicySplit[0], oldPolicySplit[1], newPolicySplit[0], newPolicySplit[1], entity, userId);
- success = true;
- }
+ cloneRecord(newPolicySplit[1], oldPolicySplit[0], oldPolicySplit[1], newPolicySplit[0], newPolicySplit[1], entity, userId);
+ success = true;
}
+
if(success){
PolicyVersion entityItem = new PolicyVersion();
entityItem.setActiveVersion(Integer.parseInt(version));
@@ -1394,18 +1417,15 @@ public class PolicyManagerServlet extends HttpServlet {
}
LOGGER.debug("addFolder path: {} name: {}" + path +name);
if(!name.equals("")){
+ if(name.startsWith(File.separator)){
+ name = name.substring(1);
+ }
PolicyEditorScopes entity = (PolicyEditorScopes) controller.getEntityItem(PolicyEditorScopes.class, "scopeName", name);
if(entity == null){
UserInfo userInfo = new UserInfo();
userInfo.setUserLoginId(userId);
PolicyEditorScopes newScope = new PolicyEditorScopes();
- String scopeName = null;
- if(name.startsWith(File.separator)){
- scopeName = name.substring(1);
- }else{
- scopeName = name;
- }
- newScope.setScopeName(scopeName);
+ newScope.setScopeName(name);
newScope.setUserCreatedBy(userInfo);
newScope.setUserModifiedBy(userInfo);
controller.saveData(newScope);
diff --git a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/admin/PolicyRestController.java b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/admin/PolicyRestController.java
index 582dd6c68..2c04bc66d 100644
--- a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/admin/PolicyRestController.java
+++ b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/admin/PolicyRestController.java
@@ -380,14 +380,21 @@ public class PolicyRestController extends RestrictedBaseController{
public ModelAndView searchDictionaryController(HttpServletRequest request, HttpServletResponse response) throws Exception{
Object resultList = null;
String uri = request.getRequestURI();
- String body = callPAP(request, "POST", uri.replaceFirst("/", "").trim());
- if(body.contains("CouldNotConnectException")){
+ try{
+ String body = callPAP(request, "POST", uri.replaceFirst("/", "").trim());
+ if(body.contains("CouldNotConnectException")){
+ List<String> data = new ArrayList<>();
+ data.add("Elastic Search Server is down");
+ resultList = data;
+ }else{
+ JSONObject json = new JSONObject(body);
+ resultList = json.get("policyresult");
+ }
+ }catch(Exception e){
+ policyLogger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Exception Occured while querying Elastic Search: " + e);
List<String> data = new ArrayList<>();
data.add("Elastic Search Server is down");
resultList = data;
- }else{
- JSONObject json = new JSONObject(body);
- resultList = json.get("policyresult");
}
response.setCharacterEncoding(PolicyController.getCharacterencoding());
diff --git a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/CreateBRMSParamController.java b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/CreateBRMSParamController.java
index 68dff19bd..8258b8bed 100644
--- a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/CreateBRMSParamController.java
+++ b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/CreateBRMSParamController.java
@@ -20,7 +20,12 @@
package org.openecomp.policy.controller;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
import java.io.PrintWriter;
+import java.nio.file.Files;
+import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
@@ -355,11 +360,25 @@ public class CreateBRMSParamController extends RestrictedBaseController {
private void paramUIGenerate(PolicyRestAdapter policyAdapter, PolicyEntity entity) {
String data = entity.getConfigurationData().getConfigBody();
if(data != null){
+ File file = new File(PolicyController.getConfigHome() +File.separator+ entity.getConfigurationData().getConfigurationName());
+ if(file.exists()){
+ try (BufferedReader br = new BufferedReader(new FileReader(file))) {
+ StringBuilder sb = new StringBuilder();
+ String line = br.readLine();
+ while (line != null) {
+ sb.append(line);
+ sb.append("\n");
+ line = br.readLine();
+ }
+ }catch(Exception e){
+ policyLogger.error(XACMLErrorConstants.ERROR_DATA_ISSUE+ e.getMessage() + e);
+ }
+ }
try {
StringBuilder params = new StringBuilder("");
Boolean flag = false;
Boolean comment = false;
- for (String line : data.split("\n")) {
+ for (String line : Files.readAllLines(Paths.get(file.toString()))) {
if (line.isEmpty() || line.startsWith("//")) {
continue;
}
diff --git a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/DecisionPolicyController.java b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/DecisionPolicyController.java
index 2fecd7eea..28278062d 100644
--- a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/DecisionPolicyController.java
+++ b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/DecisionPolicyController.java
@@ -157,6 +157,8 @@ public class DecisionPolicyController extends RestrictedBaseController {
break;
}else if(((RuleType) object).getAdviceExpressions().getAdviceExpression().get(0).getAdviceId().toString().equalsIgnoreCase("GUARD_YAML")){
policyAdapter.setRuleProvider("GUARD_YAML");
+ }else if(((RuleType) object).getAdviceExpressions().getAdviceExpression().get(0).getAdviceId().toString().equalsIgnoreCase("GUARD_BL_YAML")){
+ policyAdapter.setRuleProvider("GUARD_BL_YAML");
}
}else{
policyAdapter.setRuleProvider("Custom");
@@ -166,7 +168,7 @@ public class DecisionPolicyController extends RestrictedBaseController {
ApplyType decisionApply = (ApplyType) condition.getExpression().getValue();
decisionApply = (ApplyType) decisionApply.getExpression().get(0).getValue();
ruleAlgoirthmTracker = new LinkedList<>();
- if(policyAdapter.getRuleProvider()!=null && policyAdapter.getRuleProvider().equals("GUARD_YAML")){
+ if(policyAdapter.getRuleProvider()!=null && (policyAdapter.getRuleProvider().equals("GUARD_YAML")||(policyAdapter.getRuleProvider().equals("GUARD_BL_YAML")))){
YAMLParams yamlParams = new YAMLParams();
for(int i=0; i<attributeList.size() ; i++){
Map<String, String> map = (Map<String,String>)attributeList.get(i);
@@ -179,9 +181,19 @@ public class DecisionPolicyController extends RestrictedBaseController {
ApplyType apply = ((ApplyType)((ApplyType)decisionApply.getExpression().get(0).getValue()).getExpression().get(0).getValue());
yamlParams.setGuardActiveStart(((AttributeValueType)apply.getExpression().get(1).getValue()).getContent().get(0).toString());
yamlParams.setGuardActiveEnd(((AttributeValueType)apply.getExpression().get(2).getValue()).getContent().get(0).toString());
- yamlParams.setLimit(((AttributeValueType)((ApplyType)decisionApply.getExpression().get(1).getValue()).getExpression().get(1).getValue()).getContent().get(0).toString());
- String timeWindow = ((AttributeDesignatorType)((ApplyType)((ApplyType)decisionApply.getExpression().get(1).getValue()).getExpression().get(0).getValue()).getExpression().get(0).getValue()).getIssuer();
- yamlParams.setTimeWindow(timeWindow.substring(timeWindow.lastIndexOf(":")+1));
+ if(policyAdapter.getRuleProvider().equals("GUARD_BL_YAML")){
+ apply = (ApplyType)((ApplyType)((ApplyType)decisionApply.getExpression().get(0).getValue()).getExpression().get(1).getValue()).getExpression().get(2).getValue();
+ Iterator<JAXBElement<?>> attributes = apply.getExpression().iterator();
+ List<String> blackList = new ArrayList<>();
+ while(attributes.hasNext()){
+ blackList.add(((AttributeValueType)attributes.next().getValue()).getContent().get(0).toString());
+ }
+ yamlParams.setBlackList(blackList);
+ }else{
+ yamlParams.setLimit(((AttributeValueType)((ApplyType)decisionApply.getExpression().get(1).getValue()).getExpression().get(1).getValue()).getContent().get(0).toString());
+ String timeWindow = ((AttributeDesignatorType)((ApplyType)((ApplyType)decisionApply.getExpression().get(1).getValue()).getExpression().get(0).getValue()).getExpression().get(0).getValue()).getIssuer();
+ yamlParams.setTimeWindow(timeWindow.substring(timeWindow.lastIndexOf(":")+1));
+ }
policyAdapter.setYamlparams(yamlParams);
policyAdapter.setAttributes(new ArrayList<Object>());
policyAdapter.setRuleAlgorithmschoices(new ArrayList<Object>());
diff --git a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/PolicyValidationController.java b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/PolicyValidationController.java
index ff91e9381..bb138d415 100644
--- a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/PolicyValidationController.java
+++ b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/PolicyValidationController.java
@@ -30,6 +30,7 @@ import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
+import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
@@ -89,8 +90,6 @@ public class PolicyValidationController extends RestrictedBaseController {
public static final String MICROSERVICES="Micro Service";
private Pattern pattern;
private Matcher matcher;
-
- private static Map<String, String> rangeMap = new HashMap<>();
private static Map<String, String> mapAttribute = new HashMap<>();
private static final String EMAIL_PATTERN =
@@ -104,7 +103,7 @@ public class PolicyValidationController extends RestrictedBaseController {
public ModelAndView validatePolicy(HttpServletRequest request, HttpServletResponse response) throws Exception{
try{
boolean valid = true;
- String responseString = "";
+ StringBuilder responseString = new StringBuilder();
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
JsonNode root = mapper.readTree(request.getReader());
@@ -112,17 +111,17 @@ public class PolicyValidationController extends RestrictedBaseController {
if(policyData.getPolicyName() != null){
String policyNameValidate = emptyValidator(policyData.getPolicyName());
if(!policyNameValidate.contains("success")){
- responseString = responseString + "PolicyName:" + policyNameValidate + "<br>";
+ responseString.append("PolicyName:" + policyNameValidate + "<br>");
valid = false;
};
}else{
- responseString = responseString + "PolicyName: PolicyName Should not be empty" + "<br>";
+ responseString.append( "PolicyName: PolicyName Should not be empty" + "<br>");
valid = false;
}
if(policyData.getPolicyDescription() != null){
String descriptionValidate = descriptionValidator(policyData.getPolicyDescription());
if(!descriptionValidate.contains("success")){
- responseString = responseString + "Description:" + descriptionValidate + "<br>";
+ responseString.append("Description:" + descriptionValidate + "<br>");
valid = false;
}
}
@@ -133,11 +132,11 @@ public class PolicyValidationController extends RestrictedBaseController {
if(policyData.getEcompName() != null){
String ecompNameValidate = emptyValidator(policyData.getEcompName());
if(!ecompNameValidate.contains("success")){
- responseString = responseString + "EcompName:" + ecompNameValidate + "<br>";
+ responseString.append("EcompName:" + ecompNameValidate + "<br>");
valid = false;
}
}else{
- responseString = responseString + "Ecomp Name: Ecomp Name Should not be empty" + "<br>";
+ responseString.append("Ecomp Name: Ecomp Name Should not be empty" + "<br>");
valid = false;
}
}
@@ -145,33 +144,33 @@ public class PolicyValidationController extends RestrictedBaseController {
if(policyData.getRiskType() != null){
String riskTypeValidate = emptyValidator(policyData.getRiskType());
if(!riskTypeValidate.contains("success")){
- responseString = responseString + "RiskType:" + riskTypeValidate + "<br>";
+ responseString.append("RiskType:" + riskTypeValidate + "<br>");
valid = false;
}
}else {
- responseString = responseString + "Risk Type: Risk Type Should not be Empty" + "<br>";
+ responseString.append("Risk Type: Risk Type Should not be Empty" + "<br>");
valid = false;
}
if(policyData.getRiskLevel() != null){
String validateRiskLevel = emptyValidator(policyData.getRiskLevel());
if(!validateRiskLevel.contains("success")){
- responseString = responseString + "RiskLevel:" + validateRiskLevel + "<br>";
+ responseString.append("RiskLevel:" + validateRiskLevel + "<br>");
valid = false;
}
}else {
- responseString = responseString + "Risk Level: Risk Level Should not be Empty" + "<br>";
+ responseString.append("Risk Level: Risk Level Should not be Empty" + "<br>");
valid = false;
}
if(policyData.getGuard() != null){
String validateGuard = emptyValidator(policyData.getGuard());
if(!validateGuard.contains("success")){
- responseString = responseString + "Guard:" + validateGuard + "<br>";
+ responseString.append("Guard:" + validateGuard + "<br>");
valid = false;
}
}else {
- responseString = responseString + "Guard: Guard Value Should not be Empty" + "<br>";
+ responseString.append("Guard: Guard Value Should not be Empty" + "<br>");
valid = false;
}
@@ -179,21 +178,21 @@ public class PolicyValidationController extends RestrictedBaseController {
if(policyData.getConfigName() != null){
String configNameValidate = emptyValidator(policyData.getConfigName());
if(!configNameValidate.contains("success")){
- responseString = responseString + "ConfigName:" + configNameValidate + "<br>";
+ responseString.append("ConfigName:" + configNameValidate + "<br>");
valid = false;
}
}else{
- responseString = responseString + "Config Name: Config Name Should not be Empty" + "<br>";
+ responseString.append("Config Name: Config Name Should not be Empty" + "<br>");
valid = false;
}
if(policyData.getConfigType() != null){
String configTypeValidate = emptyValidator(policyData.getConfigType());
if(!configTypeValidate.contains("success")){
- responseString = responseString + "ConfigType:" + configTypeValidate + "<br>";
+ responseString.append("ConfigType:" + configTypeValidate + "<br>");
valid = false;
}
}else{
- responseString = responseString + "Config Type: Config Type Should not be Empty" + "<br>";
+ responseString.append("Config Type: Config Type Should not be Empty" + "<br>");
valid = false;
}
if(policyData.getConfigBodyData() != null){
@@ -202,28 +201,28 @@ public class PolicyValidationController extends RestrictedBaseController {
if (policyType != null) {
if (policyType.equals("JSON")) {
if (!isJSONValid(configBodyData)) {
- responseString = responseString + "Config Body: JSON Content is not valid" + "<br>";
+ responseString.append("Config Body: JSON Content is not valid" + "<br>");
valid = false;
}
} else if (policyType.equals("XML")) {
if (!isXMLValid(configBodyData)) {
- responseString = responseString + "Config Body: XML Content data is not valid" + "<br>";
+ responseString.append("Config Body: XML Content data is not valid" + "<br>");
valid = false;
}
} else if (policyType.equals("PROPERTIES")) {
if (!isPropValid(configBodyData)||configBodyData.equals("")) {
- responseString = responseString + "Config Body: Property data is not valid" + "<br>";
+ responseString.append("Config Body: Property data is not valid" + "<br>");
valid = false;
}
} else if (policyType.equals("OTHER")) {
if (configBodyData.equals("")) {
- responseString = responseString + "Config Body: Config Body Should not be Empty" + "<br>";
+ responseString.append("Config Body: Config Body Should not be Empty" + "<br>");
valid = false;
}
}
}
}else{
- responseString = responseString + "Config Body: Config Body Should not be Empty" + "<br>";
+ responseString.append("Config Body: Config Body Should not be Empty" + "<br>");
valid = false;
}
}
@@ -232,21 +231,21 @@ public class PolicyValidationController extends RestrictedBaseController {
if(policyData.getConfigName() != null){
String configNameValidate = PolicyUtils.emptyPolicyValidator(policyData.getConfigName());
if(!configNameValidate.contains("success")){
- responseString = responseString + "<b>ConfigName</b>:<i>" + configNameValidate + "</i><br>";
+ responseString.append("<b>ConfigName</b>:<i>" + configNameValidate + "</i><br>");
valid = false;
}
}else{
- responseString = responseString + "<b>Config Name</b>:<i> Config Name is required" + "</i><br>";
+ responseString.append("<b>Config Name</b>:<i> Config Name is required" + "</i><br>");
valid = false;
}
if(policyData.getSecurityZone() == null){
- responseString = responseString + "<b>Security Zone</b>:<i> Security Zone is required" + "</i><br>";
+ responseString.append("<b>Security Zone</b>:<i> Security Zone is required" + "</i><br>");
valid = false;
}
}
if(policyData.getConfigPolicyType().equals("BRMS_Param")){
if(policyData.getRuleName() == null){
- responseString = responseString + "<b>BRMS Template</b>:<i>BRMS Template is required</i><br>";
+ responseString.append("<b>BRMS Template</b>:<i>BRMS Template is required</i><br>");
valid = false;
}
}
@@ -255,38 +254,38 @@ public class PolicyValidationController extends RestrictedBaseController {
String message = PolicyUtils.brmsRawValidate(policyData.getConfigBodyData());
// If there are any error other than Annotations then this is not Valid
if(message.contains("[ERR")){
- responseString = responseString + "<b>Raw Rule Validate</b>:<i>Raw Rule has error"+ message +"</i><br>";
+ responseString.append("<b>Raw Rule Validate</b>:<i>Raw Rule has error"+ message +"</i><br>");
valid = false;
}
}else{
- responseString = responseString + "<b>Raw Rule</b>:<i>Raw Rule is required</i><br>";
+ responseString.append("<b>Raw Rule</b>:<i>Raw Rule is required</i><br>");
valid = false;
}
}
if(policyData.getConfigPolicyType().equals("ClosedLoop_PM")){
try{
if(root.get("policyData").get("verticaMetrics").get("serviceTypePolicyName") == null && policyData.getServiceTypePolicyName().isEmpty()){
- responseString = responseString + "<b>ServiceType PolicyName</b>:<i>ServiceType PolicyName is required</i><br>";
+ responseString.append("<b>ServiceType PolicyName</b>:<i>ServiceType PolicyName is required</i><br>");
valid = false;
}
}catch(Exception e){
- responseString = responseString + "<b>ServiceType PolicyName</b>:<i>ServiceType PolicyName is required</i><br>";
+ responseString.append("<b>ServiceType PolicyName</b>:<i>ServiceType PolicyName is required</i><br>");
valid = false;
}
if(root.get("policyData").get("jsonBodyData") != null){
ClosedLoopPMBody pmBody = (ClosedLoopPMBody)mapper.readValue(root.get("policyData").get("jsonBodyData").toString(), ClosedLoopPMBody.class);
if(pmBody.getEmailAddress() != null){
- String result = emailValidation(pmBody.getEmailAddress(), responseString);
+ String result = emailValidation(pmBody.getEmailAddress(), responseString.toString());
if(result != "success"){
- responseString = result + "<br>";
+ responseString.append(result + "<br>");
valid = false;
}
}
if(pmBody.getGeoLink() != null){
String result = PolicyUtils.emptyPolicyValidator(pmBody.getGeoLink());
if(!result.contains("success")){
- responseString = responseString + "<b>GeoLink</b>:<i>" + result + "</i><br>";
+ responseString.append("<b>GeoLink</b>:<i>" + result + "</i><br>");
valid = false;
};
}
@@ -297,14 +296,14 @@ public class PolicyValidationController extends RestrictedBaseController {
if(!key.contains("Message")){
String attributeValidate = PolicyUtils.emptyPolicyValidator(value);
if(!attributeValidate.contains("success")){
- responseString = responseString + "<b>Attributes</b>:<i>" + key + " : value has spaces</i><br>";
+ responseString.append("<b>Attributes</b>:<i>" + key + " : value has spaces</i><br>");
valid = false;
};
}
}
}
}else{
- responseString = responseString + "<b>D2/Virtualized Services</b>:<i>Select atleast one D2/Virtualized Services</i><br>";
+ responseString.append("<b>D2/Virtualized Services</b>:<i>Select atleast one D2/Virtualized Services</i><br>");
valid = false;
}
}
@@ -312,73 +311,69 @@ public class PolicyValidationController extends RestrictedBaseController {
if(root.get("policyData").get("jsonBodyData") != null){
ClosedLoopFaultBody faultBody = (ClosedLoopFaultBody)mapper.readValue(root.get("policyData").get("jsonBodyData").toString(), ClosedLoopFaultBody.class);
if(faultBody.getEmailAddress() != null){
- String result = emailValidation(faultBody.getEmailAddress(), responseString);
+ String result = emailValidation(faultBody.getEmailAddress(), responseString.toString());
if(result != "success"){
- responseString = result+ "<br>";
+ responseString.append(result+ "<br>");
valid = false;
}
}
if((faultBody.isGama() || faultBody.isMcr() || faultBody.isTrinity() || faultBody.isvDNS() || faultBody.isvUSP()) != true){
- responseString = responseString + "<b>D2/Virtualized Services</b>:<i>Select atleast one D2/Virtualized Services</i><br>";
+ responseString.append("<b>D2/Virtualized Services</b>:<i>Select atleast one D2/Virtualized Services</i><br>");
valid = false;
}
if(faultBody.getActions() == null){
- responseString = responseString + "<b>vPRO Actions</b>:<i>vPRO Actions is required</i><br>";
- valid = false;
- }
- if(faultBody.getAgingWindow() == 0){
- responseString = responseString + "<b>Aging Window</b>:<i>Aging Window is required</i><br>";
+ responseString.append("<b>vPRO Actions</b>:<i>vPRO Actions is required</i><br>");
valid = false;
}
if(faultBody.getClosedLoopPolicyStatus() == null){
- responseString = responseString + "<b>Policy Status</b>:<i>Policy Status is required</i><br>";
+ responseString.append("<b>Policy Status</b>:<i>Policy Status is required</i><br>");
valid = false;
}
if(faultBody.getConditions() == null){
- responseString = responseString + "<b>Conditions</b>:<i>Select Atleast one Condition</i><br>";
+ responseString.append("<b>Conditions</b>:<i>Select Atleast one Condition</i><br>");
valid = false;
}
if(faultBody.getGeoLink() != null){
- String result = PolicyUtils.emptyPolicyValidator(faultBody.getGeoLink());
+ String result = PolicyUtils.emptyPolicyValidatorWithSpaceAllowed(faultBody.getGeoLink());
if(!result.contains("success")){
- responseString = responseString + "<b>GeoLink</b>:<i>" + result + "</i><br>";
+ responseString.append("<b>GeoLink</b>:<i>" + result + "</i><br>");
valid = false;
};
}
if(faultBody.getTimeInterval() == 0){
- responseString = responseString + "<b>Time Interval</b>:<i>Time Interval is required</i><br>";
+ responseString.append("<b>Time Interval</b>:<i>Time Interval is required</i><br>");
valid = false;
}
if(faultBody.getRetrys() == 0){
- responseString = responseString + "<b>Number of Retries</b>:<i>Number of Retries is required</i><br>";
+ responseString.append("<b>Number of Retries</b>:<i>Number of Retries is required</i><br>");
valid = false;
}
if(faultBody.getTimeOutvPRO() == 0){
- responseString = responseString + "<b>APP-C Timeout</b>:<i>APP-C Timeout is required</i><br>";
+ responseString.append("<b>APP-C Timeout</b>:<i>APP-C Timeout is required</i><br>");
valid = false;
}
if(faultBody.getTimeOutRuby() == 0){
- responseString = responseString + "<b>TimeOutRuby</b>:<i>TimeOutRuby is required</i><br>";
+ responseString.append("<b>TimeOutRuby</b>:<i>TimeOutRuby is required</i><br>");
valid = false;
}
if(faultBody.getVnfType() == null){
- responseString = responseString + "<b>Vnf Type</b>:<i>Vnf Type is required</i><br>";
+ responseString.append("<b>Vnf Type</b>:<i>Vnf Type is required</i><br>");
valid = false;
}
}else{
- responseString = responseString + "<b>D2/Virtualized Services</b>:<i>Select atleast one D2/Virtualized Services</i><br>";
- responseString = responseString + "<b>vPRO Actions</b>:<i>vPRO Actions is required</i><br>";
- responseString = responseString + "<b>Aging Window</b>:<i>Aging Window is required</i><br>";
- responseString = responseString + "<b>Policy Status</b>:<i>Policy Status is required</i><br>";
- responseString = responseString + "<b>Conditions</b>:<i>Select Atleast one Condition</i><br>";
- responseString = responseString + "<b>PEP Name</b>:<i>PEP Name is required</i><br>";
- responseString = responseString + "<b>PEP Action</b>:<i>PEP Action is required</i><br>";
- responseString = responseString + "<b>Time Interval</b>:<i>Time Interval is required</i><br>";
- responseString = responseString + "<b>Number of Retries</b>:<i>Number of Retries is required</i><br>";
- responseString = responseString + "<b>APP-C Timeout</b>:<i>APP-C Timeout is required</i><br>";
- responseString = responseString + "<b>TimeOutRuby</b>:<i>TimeOutRuby is required</i><br>";
- responseString = responseString + "<b>Vnf Type</b>:<i>Vnf Type is required</i><br>";
+ responseString.append("<b>D2/Virtualized Services</b>:<i>Select atleast one D2/Virtualized Services</i><br>");
+ responseString.append("<b>vPRO Actions</b>:<i>vPRO Actions is required</i><br>");
+ responseString.append("<b>Aging Window</b>:<i>Aging Window is required</i><br>");
+ responseString.append("<b>Policy Status</b>:<i>Policy Status is required</i><br>");
+ responseString.append("<b>Conditions</b>:<i>Select Atleast one Condition</i><br>");
+ responseString.append("<b>PEP Name</b>:<i>PEP Name is required</i><br>");
+ responseString.append("<b>PEP Action</b>:<i>PEP Action is required</i><br>");
+ responseString.append("<b>Time Interval</b>:<i>Time Interval is required</i><br>");
+ responseString.append("<b>Number of Retries</b>:<i>Number of Retries is required</i><br>");
+ responseString.append("<b>APP-C Timeout</b>:<i>APP-C Timeout is required</i><br>");
+ responseString.append("<b>TimeOutRuby</b>:<i>TimeOutRuby is required</i><br>");
+ responseString.append("<b>Vnf Type</b>:<i>Vnf Type is required</i><br>");
valid = false;
}
}
@@ -399,7 +394,7 @@ public class PolicyValidationController extends RestrictedBaseController {
returnModel = getAttributeObject(service, version);
String annoation = returnModel.getAnnotation();
if (!Strings.isNullOrEmpty(annoation)){
- rangeMap = new HashMap<String,String>();
+ Map<String, String> rangeMap = new HashMap<>();
rangeMap = Splitter.on(",").withKeyValueSeparator("=").split(annoation);
for (Entry<String, String> rMap : rangeMap.entrySet()){
if (rMap.getValue().contains("range::")){
@@ -409,16 +404,16 @@ public class PolicyValidationController extends RestrictedBaseController {
int endNum = Integer.parseInt(tempString[1]);
String returnString = "Invalid Range:" + rMap.getKey() + " must be between "
+ startNum + " - " + endNum + ",";
- if (isType(value.replace("\"", ""))){
+ if (isInteger(value.replace("\"", ""))){
int result = Integer.parseInt(value.replace("\"", ""));
if (result < startNum || result > endNum){
- responseString = responseString + returnString;
+ responseString.append(returnString);
valid = false;
}
}else {
- responseString = responseString + returnString;
+ responseString.append(returnString);
valid = false;
}
}
@@ -426,17 +421,17 @@ public class PolicyValidationController extends RestrictedBaseController {
}
//for continue testing for Dkat, just blocked this validation until fixing it. gw1218 on 3/30/17
//if (!checkAttributeValues()){
- //responseString = responseString + "<b>Micro Service</b>:<i> Attribute Values Missing" + "</i><br>";
+ //responseString.append("<b>Micro Service</b>:<i> Attribute Values Missing" + "</i><br>");
//valid = false;
//}
}else{
- responseString = responseString + "<b>Micro Service</b>:<i> Micro Service is required" + "</i><br>";
+ responseString.append("<b>Micro Service</b>:<i> Micro Service is required" + "</i><br>");
valid = false;
}
if(policyData.getPriority() == null){
- responseString = responseString + "<b>Priority</b>:<i> Priority is required" + "</i><br>";
+ responseString.append("<b>Priority</b>:<i> Priority is required" + "</i><br>");
valid = false;
}
}
@@ -445,49 +440,60 @@ public class PolicyValidationController extends RestrictedBaseController {
if(policyData.getEcompName() != null){
String ecompNameValidate = emptyValidator(policyData.getEcompName());
if(!ecompNameValidate.contains("success")){
- responseString = responseString + "EcompName:" + ecompNameValidate + "<br>";
+ responseString.append("EcompName:" + ecompNameValidate + "<br>");
valid = false;
}
}else{
- responseString = responseString + "Ecomp Name: Ecomp Name Should not be empty" + "<br>";
+ responseString.append("Ecomp Name: Ecomp Name Should not be empty" + "<br>");
valid = false;
}
- if(policyData.getRuleProvider().equals("GUARD_YAML")){
+ if("GUARD_YAML".equals(policyData.getRuleProvider()) || "GUARD_BL_YAML".equals(policyData.getRuleProvider())){
if(policyData.getYamlparams()==null){
- responseString = responseString + "<b> Guard Params are Required </b>" + "<br>";
+ responseString.append("<b> Guard Params are Required </b>" + "<br>");
valid = false;
}else{
if(policyData.getYamlparams().getActor()==null){
- responseString = responseString + "Guard Params <b>Actor</b> is Required " + "<br>";
+ responseString.append("Guard Params <b>Actor</b> is Required " + "<br>");
valid = false;
}
if(policyData.getYamlparams().getRecipe()==null){
- responseString = responseString + "Guard Params <b>Recipe</b> is Required " + "<br>";
- valid = false;
- }
- if(policyData.getYamlparams().getLimit()==null){
- responseString = responseString + " Guard Params <b>Limit</b> is Required " + "<br>";
- valid = false;
- }else{
- try{
- Integer.parseInt(policyData.getYamlparams().getLimit());
- }catch(NumberFormatException e){
- responseString = responseString + " Guard Params <b>Limit</b> Should be Integer " + "<br>";
- valid = false;
- }
- }
- if(policyData.getYamlparams().getTimeWindow()==null){
- responseString = responseString + "Guard Params <b>Time Window</b> is Required" + "<br>";
+ responseString.append("Guard Params <b>Recipe</b> is Required " + "<br>");
valid = false;
}
if(policyData.getYamlparams().getGuardActiveStart()==null){
- responseString = responseString + "Guard Params <b>Guard Active Start/b>is Required " + "<br>";
+ responseString.append("Guard Params <b>Guard Active Start/b>is Required " + "<br>");
valid = false;
}
if(policyData.getYamlparams().getGuardActiveEnd()==null){
- responseString = responseString + "Guard Params <b>Guard Active End</b>is Required " + "<br>";
+ responseString.append("Guard Params <b>Guard Active End</b>is Required " + "<br>");
valid = false;
}
+ if("GUARD_YAML".equals(policyData.getRuleProvider())){
+ if(policyData.getYamlparams().getLimit()==null){
+ responseString.append(" Guard Params <b>Limit</b> is Required " + "<br>");
+ valid = false;
+ }else if(!isInteger(policyData.getYamlparams().getLimit())){
+ responseString.append(" Guard Params <b>Limit</b> Should be Integer " + "<br>");
+ valid = false;
+ }
+ if(policyData.getYamlparams().getTimeWindow()==null){
+ responseString.append("Guard Params <b>Time Window</b> is Required" + "<br>");
+ 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 " + "<br>");
+ valid = false;
+ }else{
+ for(String blackList: policyData.getYamlparams().getBlackList()){
+ if(blackList==null || !("success".equals(emptyValidator(blackList)))){
+ responseString.append(" Guard Params <b>BlackList</b> Should be valid String" + "<br>");
+ valid = false;
+ break;
+ }
+ }
+ }
+ }
}
}
}
@@ -496,49 +502,99 @@ public class PolicyValidationController extends RestrictedBaseController {
if(policyData.getActionPerformer() != null){
String actionPerformer = emptyValidator(policyData.getActionPerformer());
if(!actionPerformer.contains("success")){
- responseString = responseString + "ActionPerformer:" + actionPerformer + "<br>";
+ responseString.append("ActionPerformer:" + actionPerformer + "<br>");
valid = false;
};
}else{
- responseString = responseString + "ActionPerformer: ActionPerformer Should not be empty" + "<br>";
+ responseString.append("ActionPerformer: ActionPerformer Should not be empty" + "<br>");
+ valid = false;
+ }
+ if(policyData.getAttributes() != null){
+ for(Object attribute : policyData.getAttributes()){
+ if(attribute instanceof LinkedHashMap<?, ?>){
+ try{
+ //This is for validation check if the value exists or not
+ String key = ((LinkedHashMap<?, ?>) attribute).get("key").toString();
+ String value = ((LinkedHashMap<?, ?>) attribute).get("value").toString();
+ if("".equals(key) || "".equals(value)){
+ responseString.append("Component Attributes: One or more Fields in Component Attributes is Empty." + "<br>");
+ valid = false;
+ break;
+ }
+ }catch(Exception e){
+ LOGGER.error("This is a Policy Validation check" +e);
+ responseString.append("Component Attributes: One or more Fields in Component Attributes is Empty." + "<br>");
+ valid = false;
+ break;
+ }
+ }
+ }
+ }else{
+ responseString.append("Component Attributes: One or more Fields in Component Attributes is Empty." + "<br>");
valid = false;
}
if(policyData.getActionAttributeValue() != null){
String actionAttribute = emptyValidator(policyData.getActionAttributeValue());
if(!actionAttribute.contains("success")){
- responseString = responseString + "ActionAttribute:" + actionAttribute + "<br>";
+ responseString.append("ActionAttribute:" + actionAttribute + "<br>");
valid = false;
};
}else{
- responseString = responseString + "ActionAttribute: ActionAttribute Should not be empty" + "<br>";
+ responseString.append("ActionAttribute: ActionAttribute Should not be empty" + "<br>");
valid = false;
}
}
+
+ if(policyData.getPolicyType().equals(ACTION_POLICY) || policyData.getPolicyType().equals(DECISION_POLICY)){
+ if(!policyData.getRuleAlgorithmschoices().isEmpty()){
+ for(Object attribute : policyData.getRuleAlgorithmschoices()){
+ if(attribute instanceof LinkedHashMap<?, ?>){
+ try{
+ String label = ((LinkedHashMap<?, ?>) attribute).get("id").toString();
+ String key = ((LinkedHashMap<?, ?>) attribute).get("dynamicRuleAlgorithmField1").toString();
+ String rule = ((LinkedHashMap<?, ?>) attribute).get("dynamicRuleAlgorithmCombo").toString();
+ String value = ((LinkedHashMap<?, ?>) attribute).get("dynamicRuleAlgorithmField2").toString();
+ if("".equals(label) || "".equals(key) || "".equals(rule) || "".equals(value)){
+ responseString.append("Rule Algorithms: One or more Fields in Rule Algorithms is Empty." + "<br>");
+ valid = false;
+ }
+ }catch(Exception e){
+ LOGGER.error("This is a Policy Validation check" +e);
+ responseString.append("Rule Algorithms: One or more Fields in Rule Algorithms is Empty." + "<br>");
+ valid = false;
+ break;
+ }
+ }
+ }
+ }
+ }
if(policyData.getPolicyType().equals(CONFIG_POLICY)){
+ String value = "";
if(valid){
List<Object> spData = commonClassDao.getDataById(SafePolicyWarning.class, "riskType", policyData.getRiskType());
if (!spData.isEmpty()){
SafePolicyWarning safePolicyWarningData = (SafePolicyWarning) spData.get(0);
safePolicyWarningData.getMessage();
- responseString = responseString + "Messaage:" + safePolicyWarningData.getMessage();
+ value = "Messaage:" + safePolicyWarningData.getMessage();
}
- responseString = "success" + "@#"+ responseString;
+ responseString.append("success" + "@#"+ value);
}
}else{
if(valid){
- responseString = "success";
+ responseString.append("success");
}
}
PrintWriter out = response.getWriter();
- JsonMessage msg = new JsonMessage(mapper.writeValueAsString(responseString));
+ JsonMessage msg = new JsonMessage(mapper.writeValueAsString(responseString.toString()));
JSONObject j = new JSONObject(msg);
out.write(j.toString());
return null;
}
catch (Exception e){
+ LOGGER.error("Exception Occured while Policy Validation" +e);
response.setCharacterEncoding("UTF-8");
request.setCharacterEncoding("UTF-8");
PrintWriter out = response.getWriter();
@@ -547,9 +603,18 @@ public class PolicyValidationController extends RestrictedBaseController {
return null;
}
+ protected boolean isInteger(String number) {
+ try{
+ Integer.parseInt(number);
+ }catch(NumberFormatException e){
+ return false;
+ }
+ return true;
+ }
+
protected String emptyValidator(String field){
- String error = "success";
- if (field.equals("") || field.contains(" ") || !field.matches("^[a-zA-Z0-9_]*$")) {
+ String error;
+ if ("".equals(field) || field.contains(" ") || !field.matches("^[a-zA-Z0-9_]*$")) {
error = "The Value in Required Field will allow only '{0-9}, {a-z}, {A-Z}, _' following set of Combinations";
return error;
} else {
@@ -564,7 +629,7 @@ public class PolicyValidationController extends RestrictedBaseController {
}
protected String descriptionValidator(String field) {
- String error = "success";
+ String error;
if (field.contains("@CreatedBy:") || field.contains("@ModifiedBy:")) {
error = "The value in the description shouldn't contain @CreatedBy: or @ModifiedBy:";
return error;
@@ -590,16 +655,16 @@ public class PolicyValidationController extends RestrictedBaseController {
return error;
}
- protected String emailValidation(String email, String responseString){
+ protected String emailValidation(String email, String response){
if(email != null){
String validateEmail = PolicyUtils.validateEmailAddress(email.replace("\"", ""));
if(!validateEmail.contains("success")){
- responseString = responseString + "<b>Email</b>:<i>" + validateEmail+ "</i><br>";
+ response += "<b>Email</b>:<i>" + validateEmail+ "</i><br>";
}else{
return "success";
}
}
- return responseString;
+ return response;
}
private MicroServiceModels getAttributeObject(String name, String version) {
@@ -631,35 +696,16 @@ public class PolicyValidationController extends RestrictedBaseController {
}
}
- private Boolean isType(String testStr) {
- try {
- Integer.parseInt(testStr);
- return true;
- } catch(Exception e) {
- return false;
- }
- }
-
// Validation for json.
protected static boolean isJSONValid(String data) {
- InputStream stream = null;
- JsonReader jsonReader = null;
try {
new JSONObject(data);
- stream = new ByteArrayInputStream(data.getBytes(StandardCharsets.UTF_8));
- jsonReader = Json.createReader(stream);
+ InputStream stream = new ByteArrayInputStream(data.getBytes(StandardCharsets.UTF_8));
+ JsonReader jsonReader = Json.createReader(stream);
+ System.out.println("Json Value is: " + jsonReader.read().toString() );
} catch (Exception e) {
- LOGGER.error("Exception Occured"+e);
+ e.printStackTrace();
return false;
- }finally{
- try {
- if(stream != null && jsonReader != null){
- jsonReader.close();
- stream.close();
- }
- } catch (IOException e) {
- LOGGER.error("Exception Occured while closing the input stream"+e);
- }
}
return true;
}
@@ -689,7 +735,7 @@ public class PolicyValidationController extends RestrictedBaseController {
Scanner scanner = new Scanner(prop);
while (scanner.hasNextLine()) {
String line = scanner.nextLine();
- line.replaceAll("\\s+", "");
+ line = line.replaceAll("\\s+", "");
if (line.startsWith("#")) {
continue;
} else {
@@ -709,4 +755,4 @@ public class PolicyValidationController extends RestrictedBaseController {
return true;
}
-}
+} \ No newline at end of file
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/Windows/PDPTabWindows/AddorEditPDPtoGroup.html b/POLICY-SDK-APP/src/main/webapp/app/policyApp/Windows/PDPTabWindows/AddorEditPDPtoGroup.html
index 19e11bfeb..3bfb50fd7 100644
--- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/Windows/PDPTabWindows/AddorEditPDPtoGroup.html
+++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/Windows/PDPTabWindows/AddorEditPDPtoGroup.html
@@ -19,7 +19,7 @@
*/-->
<script type="text/ng-template" id="create_newPDP_InGroup.html">
<div class="modal">
- <div class="modal-dialog-lg">
+ <div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h2 class="font-showcase-font-name" style="color : #157bb2">{{label}}</h2>
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/Windows/PushtabWindow/removeGroupPoliciesWindow.html b/POLICY-SDK-APP/src/main/webapp/app/policyApp/Windows/PushtabWindow/removeGroupPoliciesWindow.html
index 9a880bd52..6ebda43a7 100644
--- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/Windows/PushtabWindow/removeGroupPoliciesWindow.html
+++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/Windows/PushtabWindow/removeGroupPoliciesWindow.html
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/-->
<script type="text/ng-template" id="remove_PDPGroupPolicies_popup.html">
-<div class="modal" style="margin-bottom: 20px; width: 100%" data-backdrop="static"
+<div class="modal" style="margin-bottom: 20px; width: 100%; height:80%" data-backdrop="static"
data-keyboard="false">
<div class="modal-dialog-lg">
<div class="modal-content">
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/BRMSParamDictGridController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/BRMSParamDictGridController.js
index fd49a3a9e..fc0cbc1a6 100644
--- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/BRMSParamDictGridController.js
+++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/BRMSParamDictGridController.js
@@ -125,7 +125,7 @@ app.controller('brmsParamDictGridController', function ($scope, PolicyAppService
var i;
if($scope.searchDatas.length > 0){
for(i = 0 ; i < $scope.searchDatas.length; i++){
- searchString += $scope.searchDatas[i].name + "\n";
+ searchString += $scope.searchDatas[i] + "\n";
}
}else{
searchString += "No Policies is Using this Value"
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLPepOptionsDictGridController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLPepOptionsDictGridController.js
index 9ec2a2091..db6d2a7b1 100644
--- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLPepOptionsDictGridController.js
+++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLPepOptionsDictGridController.js
@@ -151,7 +151,7 @@ app.controller('pepOptionsDictGridController', function ($scope, PolicyAppServic
var i;
if($scope.searchDatas.length > 0){
for(i = 0 ; i < $scope.searchDatas.length; i++){
- searchString += $scope.searchDatas[i].name + "\n";
+ searchString += $scope.searchDatas[i] + "\n";
}
}else{
searchString += "No Policies is Using this Value"
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLServiceDictGridController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLServiceDictGridController.js
index 099c1e648..b63cec043 100644
--- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLServiceDictGridController.js
+++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLServiceDictGridController.js
@@ -126,7 +126,7 @@ app.controller('serviceDictGridController', function ($scope, PolicyAppService,
var i;
if($scope.searchDatas.length > 0){
for(i = 0 ; i < $scope.searchDatas.length; i++){
- searchString += $scope.searchDatas[i].name + "\n";
+ searchString += $scope.searchDatas[i] + "\n";
}
}else{
searchString += "No Policies is Using this Value"
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLSiteDictGridController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLSiteDictGridController.js
index d42674a33..638fd84ad 100644
--- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLSiteDictGridController.js
+++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLSiteDictGridController.js
@@ -126,7 +126,7 @@ app.controller('siteDictGridController', function ($scope, PolicyAppService, mod
var i;
if($scope.searchDatas.length > 0){
for(i = 0 ; i < $scope.searchDatas.length; i++){
- searchString += $scope.searchDatas[i].name + "\n";
+ searchString += $scope.searchDatas[i] + "\n";
}
}else{
searchString += "No Policies is Using this Value"
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLVarbindDictGridController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLVarbindDictGridController.js
index f191da9c7..b2bb51b64 100644
--- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLVarbindDictGridController.js
+++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLVarbindDictGridController.js
@@ -150,7 +150,7 @@ app.controller('varbindDictGridController', function ($scope, PolicyAppService,
var i;
if($scope.searchDatas.length > 0){
for(i = 0 ; i < $scope.searchDatas.length; i++){
- searchString += $scope.searchDatas[i].name + "\n";
+ searchString += $scope.searchDatas[i] + "\n";
}
}else{
searchString += "No Policies is Using this Value"
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLVnfTypeDictGridController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLVnfTypeDictGridController.js
index 545568f68..bea675588 100644
--- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLVnfTypeDictGridController.js
+++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLVnfTypeDictGridController.js
@@ -149,7 +149,7 @@ app.controller('vnfTypeDictGridController', function ($scope, PolicyAppService,
var i;
if($scope.searchDatas.length > 0){
for(i = 0 ; i < $scope.searchDatas.length; i++){
- searchString += $scope.searchDatas[i].name + "\n";
+ searchString += $scope.searchDatas[i] + "\n";
}
}else{
searchString += "No Policies is Using this Value"
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLVsclActionDictGridController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLVsclActionDictGridController.js
index 61091523f..512e11464 100644
--- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLVsclActionDictGridController.js
+++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/dictionaryGridController/CLVsclActionDictGridController.js
@@ -150,7 +150,7 @@ app.controller('vsclActionDictGridController', function ($scope, PolicyAppServic
var i;
if($scope.searchDatas.length > 0){
for(i = 0 ; i < $scope.searchDatas.length; i++){
- searchString += $scope.searchDatas[i].name + "\n";
+ searchString += $scope.searchDatas[i] + "\n";
}
}else{
searchString += "No Policies is Using this Value"
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/ActionPolicyController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/ActionPolicyController.js
index 0bfcd3c01..398b285e6 100644
--- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/ActionPolicyController.js
+++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/ActionPolicyController.js
@@ -143,6 +143,7 @@ app.controller('actionPolicyController', ['$scope', 'PolicyAppService', 'policyN
if(!$scope.temp.policy.editPolicy && !$scope.temp.policy.readOnly){
$scope.temp.policy.attributes = [];
+ $scope.temp.policy.attributes.push({'id':'choice'+1});
$scope.temp.policy.ruleAlgorithmschoices = [];
}else{
if($scope.temp.policy.attributes.length == 0){
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/DCAEMicroServicePolicyController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/DCAEMicroServicePolicyController.js
index 5e602ae12..fb966430c 100644
--- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/DCAEMicroServicePolicyController.js
+++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/DCAEMicroServicePolicyController.js
@@ -403,9 +403,12 @@ angular.module('abs').controller('dcaeMicroServiceController', ['$scope', '$wind
if(attribute.includes(":")){
enumName = attribute.split(":")[0];
}
- }
+ }
var baseEnum = $scope.dcaeModelData.enumValues;
- var enumList = baseEnum.split(splitEnum);
+ var enumList = [];
+ if(baseEnum != null){
+ enumList = baseEnum.split(splitEnum);
+ }
var enumAttributes;
var patternTest = new RegExp(enumName);
for (k=0; k < enumList.length; k += 1){
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/DecisionPolicyController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/DecisionPolicyController.js
index ce27e04e0..e7858d7b5 100644
--- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/DecisionPolicyController.js
+++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/DecisionPolicyController.js
@@ -163,8 +163,14 @@ angular.module('abs').controller('decisionPolicyController', ['$scope', 'PolicyA
if(!$scope.temp.policy.editPolicy && !$scope.temp.policy.readOnly){
$scope.temp.policy.attributes = [];
- $scope.temp.policy.settings = [];
- $scope.temp.policy.ruleAlgorithmschoices = [];
+ $scope.temp.policy.settings = [];
+ $scope.temp.policy.ruleAlgorithmschoices = [];
+ if(!$scope.temp.policy.yamlparams){
+ $scope.temp.policy.yamlparams = {};
+ }
+ if(!$scope.temp.policy.yamlparams.blackList){
+ $scope.temp.policy.yamlparams.blackList = [];
+ }
}else if($scope.temp.policy.ruleProvider=="Custom"){
if($scope.temp.policy.attributes.length == 0){
$scope.temp.policy.attributes = [];
@@ -172,10 +178,14 @@ angular.module('abs').controller('decisionPolicyController', ['$scope', 'PolicyA
if($scope.temp.policy.settings.length == 0){
$scope.temp.policy.settings = [];
}
- if($scope.temp.policy.ruleAlgorithmschoices.length == 0){
+ if($scope.temp.policy.ruleAlgorithmschoices == null || $scope.temp.policy.ruleAlgorithmschoices.length == 0){
$scope.temp.policy.ruleAlgorithmschoices = [];
}
- }
+ }else if($scope.temp.policy.ruleProvider=="GUARD_BL_YAML"){
+ if($scope.temp.policy.yamlparams.blackList.length==0){
+ $scope.temp.policy.yamlparams.blackList = [];
+ }
+ }
$scope.attributeDatas = [{"attributes" : $scope.temp.policy.attributes}];
$scope.addNewChoice = function() {
var newItemNo = $scope.temp.policy.attributes.length+1;
@@ -197,6 +207,14 @@ angular.module('abs').controller('decisionPolicyController', ['$scope', 'PolicyA
$scope.temp.policy.settings.splice(lastItem);
};
+ $scope.addNewBL = function() {
+ $scope.temp.policy.yamlparams.blackList.push('');
+ };
+ $scope.removeBL = function() {
+ var lastItem = $scope.temp.policy.yamlparams.blackList.length-1;
+ $scope.temp.policy.yamlparams.blackList.splice(lastItem);
+ };
+
$scope.ItemNo = 0;
$scope.ruleAlgorithmDatas = [{"ruleAlgorithms" : $scope.temp.policy.ruleAlgorithmschoices }];
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/ActionPolicyTemplate.html b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/ActionPolicyTemplate.html
index ffb0e972f..e58e7bb62 100644
--- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/ActionPolicyTemplate.html
+++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/ActionPolicyTemplate.html
@@ -51,7 +51,7 @@
</div>
</div>
<div class="well">
- <label>Rule Algorithms:<sup><b>*</b></sup></label><br>
+ <label>Rule Algorithms:<sup><b></b></sup></label><br>
<div class="form-group row">
<div class="form-group col-sm-1">
<button type="button" class="btn btn-default"
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/ClosedLoopFaultPolicyTemplate.html b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/ClosedLoopFaultPolicyTemplate.html
index e831bb40e..fad038ddc 100644
--- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/ClosedLoopFaultPolicyTemplate.html
+++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/ClosedLoopFaultPolicyTemplate.html
@@ -301,7 +301,7 @@
</div>
<div class="well">
<div class="form-group row">
- <label>PEP:<sup><b>*</b></sup></label><br>
+ <label>PEP:<sup><b></b></sup></label><br>
<div class="form-group col-sm-3">
<label>PEP Options:<sup><b></b></sup></label><br> <select
class="form-control" ng-disabled="temp.policy.readOnly"
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/DecisionPolicyTemplate.html b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/DecisionPolicyTemplate.html
index a98dbff1d..637ecff03 100644
--- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/DecisionPolicyTemplate.html
+++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/DecisionPolicyTemplate.html
@@ -32,11 +32,90 @@
<option>Custom</option>
<option>AAF</option>
<option>GUARD_YAML</option>
+ <option>GUARD_BL_YAML<option>
</select>
</div>
</div>
</div>
+ <div ng-if="temp.policy.ruleProvider == 'GUARD_BL_YAML'">
+ <div class="well">
+ <div class="form-group row">
+ <div class="form-group col-sm-1">
+ <label>Guard YAML Attributes:</label><br>
+ </div>
+ </div>
+ <div class="form-group row">
+ <div class="form-group row" style="margin-left: 2%">
+ <div class="form-group col-sm-3">
+ <label> actor: </label>
+ </div>
+ <div class="form-group col-sm-3">
+ <input type="text" class="form-control"
+ ng-disabled="temp.policy.readOnly" ng-model="temp.policy.yamlparams.actor"
+ placeholder="Actor" />
+ </div>
+ </div>
+ <div class="form-group row" style="margin-left: 2%">
+ <div class="form-group col-sm-3">
+ <label> recipe: </label>
+ </div>
+ <div class="form-group col-sm-3">
+ <input type="text" class="form-control"
+ ng-disabled="temp.policy.readOnly" ng-model="temp.policy.yamlparams.recipe"
+ placeholder="Recipe" />
+ </div>
+ </div>
+ <div class="form-group row" style="margin-left: 2%">
+ <div class="form-group col-sm-3">
+ <label> guardActiveStart: </label>
+ </div>
+ <div class="form-group col-sm-3">
+ <input type="text" class="form-control"
+ ng-disabled="temp.policy.readOnly" ng-model="temp.policy.yamlparams.guardActiveStart"
+ placeholder="00:00:00-05:00" />
+ </div>
+ </div>
+ <div class="form-group row" style="margin-left: 2%">
+ <div class="form-group col-sm-3">
+ <label> guardActiveEnd: </label>
+ </div>
+ <div class="form-group col-sm-3">
+ <input type="text" class="form-control"
+ ng-disabled="temp.policy.readOnly" ng-model="temp.policy.yamlparams.guardActiveEnd"
+ placeholder="00:00:00-05:00" />
+ </div>
+ </div>
+ <div class="form-group row" style="margin-left: 2%">
+ <div class="form-group col-sm-3">
+ <label> BlackList: </label>
+ <button type="button" class="btn btn-default"
+ ng-disabled="temp.policy.readOnly" ng-click="addNewBL()">
+ <i class="fa fa-plus"></i>
+ </button>
+ </div>
+ <div class="form-group col-sm-4">
+ <div data-ng-repeat="choice in temp.policy.yamlparams.blackList track by $index">
+ <div class="form-group row">
+ <div class="form-group col-sm-9">
+ <input type="text" class="form-control"
+ ng-disabled="temp.policy.readOnly"
+ ng-model="temp.policy.yamlparams.blackList[$index]" placeholder="BlackList" />
+ </div>
+ <div class="form-group col-sm-1">
+ <button type="button" class="btn btn-default" ng-show="$last"
+ ng-disabled="temp.policy.readOnly" ng-click="removeBL()">
+ <i class="fa fa-minus"></i>
+ </button>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+
<div ng-if="temp.policy.ruleProvider == 'GUARD_YAML'">
<div class="well">
<div class="form-group row">
@@ -199,7 +278,7 @@
<div ng-if="temp.policy.ruleProvider == 'Custom'">
<div class="well">
- <label>Decision Rule Algorithms:<sup><b>*</b></sup></label><br>
+ <label>Decision Rule Algorithms:<sup><b></b></sup></label><br>
<div class="form-group row">
<div class="form-group col-sm-1">
<button type="button" class="btn btn-default"
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/PolicyTypeTemplate.html b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/PolicyTypeTemplate.html
index ada2428ed..acbc4eec5 100644
--- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/PolicyTypeTemplate.html
+++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/PolicyTypeTemplate.html
@@ -25,7 +25,7 @@
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
- <button type="button" class="close" data-dismiss="modal">
+ <button type="button" class="close" data-dismiss="modal" ng-click="refresh();">
<span class="sr-only">{{"close"
| translate}}</span>
</button>
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/policy_AutoPush.html b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/policy_AutoPush.html
index b53dab32a..776663595 100644
--- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/policy_AutoPush.html
+++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/policy_AutoPush.html
@@ -25,9 +25,18 @@
padding: 10px;
}
+/* The Modal (background) */
.modal {
- display: block;
- overflow-y: auto;
+ display: block;
+ position: fixed;
+ z-index: 1;
+ left: 0;
+ top: 0;
+ width: 100%;
+ height: 100%;
+ overflow: auto;
+ background-color: rgb(0,0,0);
+ background-color: rgba(0,0,0,0.4);
}
</style>
<div ng-app id="page-content" style="margin-bottom: 20px; width: 100%">
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/policy_Dictionary.html b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/policy_Dictionary.html
index db490c400..4e3a9746f 100644
--- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/policy_Dictionary.html
+++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/policy_Dictionary.html
@@ -18,21 +18,18 @@
============LICENSE_END=========================================================
-->
<style>
+/* The Modal (background) */
.modal {
- display: block;
-}
-
-.modal {
- overflow-y: auto;
- max-height: 90%;
- margin-top: 5%;
- margin-bottom: 5%;
- margin-left: 10%;
- margin-right: 10%;
-}
-
-.modal-backdrop {
- background-color: red;
+ display: block;
+ position: fixed;
+ z-index: 1;
+ left: 0;
+ top: 0;
+ width: 100%;
+ height: 100%;
+ overflow: auto;
+ background-color: rgb(0,0,0);
+ background-color: rgba(0,0,0,0.4);
}
</style>
<div ng-app id="page-content" style="margin-bottom: 20px; width: 100%">
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/policy_PDPManagement.html b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/policy_PDPManagement.html
index 1e88e7acb..4c77cf528 100644
--- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/policy_PDPManagement.html
+++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/policy_PDPManagement.html
@@ -18,9 +18,18 @@
* ============LICENSE_END=========================================================
*/-->
<style>
+/* The Modal (background) */
.modal {
- display: block;
- overflow-y: auto;
+ display: block;
+ position: fixed;
+ z-index: 1;
+ left: 0;
+ top: 0;
+ width: 100%;
+ height: 100%;
+ overflow: auto;
+ background-color: rgb(0,0,0);
+ background-color: rgba(0,0,0,0.4);
}
</style>
<div id="page-content" style="margin-bottom: 20px; width: 99%">
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/policy_Roles.html b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/policy_Roles.html
index 6ca03c963..6df44bc24 100644
--- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/policy_Roles.html
+++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/policy_Roles.html
@@ -18,17 +18,18 @@
* ============LICENSE_END=========================================================
*/-->
<style>
+/* The Modal (background) */
.modal {
- display: block;
-}
-
-.modal {
- overflow-y: auto;
- max-height: 90%;
- margin-top: 5%;
- margin-bottom: 5%;
- margin-left: 10%;
- margin-right: 10%;
+ display: block;
+ position: fixed;
+ z-index: 1;
+ left: 0;
+ top: 0;
+ width: 100%;
+ height: 100%;
+ overflow: auto;
+ background-color: rgb(0,0,0);
+ background-color: rgba(0,0,0,0.4);
}
</style>
<div id="page-content" style="margin-bottom: 20px; width: 100%">