From 1148834bc4b10d00c1b1830b087357e63af8293f Mon Sep 17 00:00:00 2001 From: rb7147 Date: Thu, 1 Feb 2018 12:07:13 -0500 Subject: [PATCH] Included Policy GUI Enhancements and validations Added hover messages for all policy templates. Resolved few sonar issues. Added fixes for Policy GUI Validations. Issue-ID: POLICY-597 Change-Id: I74abb92dd6ac8722d7869b6a316fad1d8db11d9c Signed-off-by: rb7147 --- .../xacml/rest/util/AbstractPolicyCreation.java | 2 + .../rest/adapter/ClosedLoopFaultTrapDatas.java | 69 ++++ .../policy/rest/adapter/PolicyRestAdapter.java | 15 + .../java/org/onap/policy/rest/jpa/TermList.java | 14 + .../org/onap/policy/rest/util/MSModelUtils.java | 20 +- .../onap/policy/rest/util/PolicyValidation.java | 403 ++++++++++++++++----- .../rest/util/PolicyValidationRequestWrapper.java | 47 ++- .../rest/adapter/ClosedLoopFaultTrapDatasTest.java | 50 +++ .../org/onap/portalapp/conf/ExternalAppConfig.java | 1 - .../onap/policy/controller/AutoPushController.java | 7 +- .../CreateClosedLoopFaultController.java | 310 +++++++--------- .../CreateDcaeMicroServiceController.java | 8 +- .../org/onap/policy/controller/PDPController.java | 4 +- .../Windows/Dictionary/CLSiteDictionary.html | 4 - .../Windows/Dictionary/CLVarbindDictionary.html | 4 - .../Windows/Dictionary/FWZoneDictionary.html | 4 - .../Windows/Dictionary/MSConfigNameDictionary.html | 4 - .../Windows/Dictionary/MSDCAEUUIDDictionary.html | 4 - .../Windows/Dictionary/MSLocationDictionary.html | 4 - .../Windows/Dictionary/MSModelsDictionary.html | 4 - .../Dictionary/ModelAttributeDictionary.html | 1 - .../app/policyApp/Windows/Edit_Roles_Window.html | 6 +- .../Windows/PDPTabWindows/AddorEditPDPtoGroup.html | 12 +- .../PushtabWindow/removeGroupPoliciesWindow.html | 4 +- .../app/policyApp/Windows/new_PDPGroup_Window.html | 18 +- .../app/policyApp/controller/pdpController.js | 32 +- .../controller/pdpGroupPopUpController.js | 80 ++-- .../BaseConfigPolicyController.js | 8 - .../ClosedLoopFaultController.js | 57 +-- .../DCAEMicroServicePolicyController.js | 114 +++--- .../PolicyTemplates/ActionPolicyTemplate.html | 34 +- .../PolicyTemplates/BRMSParamPolicyTemplate.html | 37 +- .../PolicyTemplates/BRMSRawPolicyTemplate.html | 33 +- .../Editor/PolicyTemplates/BasePolicyTemplate.html | 38 +- .../ClosedLoopFaultPolicyTemplate.html | 119 +++--- .../ClosedLoopPMPolicyTemplate.html | 30 +- .../DCAEMicroServicePolicyTemplate.html | 41 ++- .../PolicyTemplates/DecisionPolicyTemplate.html | 55 +-- .../PolicyTemplates/FirewallPolicyTemplate.html | 36 +- .../policyApp/policy-models/Editor/css/main.css | 47 +++ .../Editor/js/controllers/policySearchManager.js | 61 ++-- .../Editor/templates/item-context-menu.html | 2 +- .../policy-models/Editor/templates/modals.html | 63 +++- .../policy-models/Editor/templates/navbar.html | 8 +- .../Editor/templates/searchNavbar.html | 30 +- .../policyApp/policy-models/policy_AdminTab.html | 2 +- .../policyApp/policy-models/policy_Dictionary.html | 6 +- .../policy-models/policy_PDPManagement.html | 8 +- .../java/org/onap/policy/utils/PolicyUtils.java | 7 +- 49 files changed, 1230 insertions(+), 737 deletions(-) create mode 100644 ONAP-REST/src/main/java/org/onap/policy/rest/adapter/ClosedLoopFaultTrapDatas.java create mode 100644 ONAP-REST/src/test/java/org/onap/policy/rest/adapter/ClosedLoopFaultTrapDatasTest.java diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/util/AbstractPolicyCreation.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/util/AbstractPolicyCreation.java index aa33729c9..0c98a44a3 100644 --- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/util/AbstractPolicyCreation.java +++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/util/AbstractPolicyCreation.java @@ -44,6 +44,8 @@ public abstract class AbstractPolicyCreation { String formateDate = null; if(dateTTL.contains("/")){ formateDate = dateTTL.replace("/", "-"); + }else { + formateDate = dateTTL; } return formateDate; } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/ClosedLoopFaultTrapDatas.java b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/ClosedLoopFaultTrapDatas.java new file mode 100644 index 000000000..efbbf27a6 --- /dev/null +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/adapter/ClosedLoopFaultTrapDatas.java @@ -0,0 +1,69 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP Policy Engine + * ================================================================================ + * Copyright (C) 2017 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; + +import java.util.List; + +public class ClosedLoopFaultTrapDatas { + + private List trap1; + private List trap2; + private List trap3; + private List trap4; + private List trap5; + private List trap6; + public List getTrap1() { + return trap1; + } + public void setTrap1(List trap1) { + this.trap1 = trap1; + } + public List getTrap2() { + return trap2; + } + public void setTrap2(List trap2) { + this.trap2 = trap2; + } + public List getTrap3() { + return trap3; + } + public void setTrap3(List trap3) { + this.trap3 = trap3; + } + public List getTrap4() { + return trap4; + } + public void setTrap4(List trap4) { + this.trap4 = trap4; + } + public List getTrap5() { + return trap5; + } + public void setTrap5(List trap5) { + this.trap5 = trap5; + } + public List getTrap6() { + return trap6; + } + public void setTrap6(List trap6) { + this.trap6 = trap6; + } + +} 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 b4056a3a0..dfc6dff49 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 @@ -98,6 +98,8 @@ public class PolicyRestAdapter { private String trapMaxAge; private String verificationclearTimeOut; private Map dynamicLayoutMap; + private ClosedLoopFaultTrapDatas trapDatas; + private ClosedLoopFaultTrapDatas faultDatas; //FireWall private String fwPolicyType; @@ -893,4 +895,17 @@ public class PolicyRestAdapter { public void setPolicyJSON(Object policyJSON) { this.policyJSON = policyJSON; } + + public ClosedLoopFaultTrapDatas getTrapDatas() { + return trapDatas; + } + public void setTrapDatas(ClosedLoopFaultTrapDatas trapDatas) { + this.trapDatas = trapDatas; + } + public ClosedLoopFaultTrapDatas getFaultDatas() { + return faultDatas; + } + public void setFaultDatas(ClosedLoopFaultTrapDatas faultDatas) { + this.faultDatas = faultDatas; + } } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/TermList.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/TermList.java index 099257c39..9c18343bf 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/TermList.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/TermList.java @@ -109,6 +109,20 @@ public class TermList implements Serializable { @JoinColumn(name="modified_by") private UserInfo userModifiedBy; + public Date getCreatedDate() { + return this.createdDate; + } + public void setCreatedDate(Date createdDate) { + this.createdDate = createdDate; + } + + public Date getModifiedDate() { + return this.modifiedDate; + } + public void setModifiedDate(Date modifiedDate) { + this.modifiedDate = modifiedDate; + } + public UserInfo getUserCreatedBy() { return userCreatedBy; } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/util/MSModelUtils.java b/ONAP-REST/src/main/java/org/onap/policy/rest/util/MSModelUtils.java index 3880b35d8..e96396e0c 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/util/MSModelUtils.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/util/MSModelUtils.java @@ -315,7 +315,11 @@ public class MSModelUtils { if (annotation && obj instanceof EReference) { EClass refType = ((EReference) obj).getEReferenceType(); if(!refType.toString().contains(eProxyURI)){ - subAttribute.put(eStrucClassifier.getName(), refType.getName()); + String required = ":required-false"; + if(eStrucClassifier.getLowerBound() == 1){ + required = ":required-true"; + } + subAttribute.put(eStrucClassifier.getName(), refType.getName() + required); } } } @@ -390,18 +394,28 @@ public class MSModelUtils { refAttribute.put(eStrucClassifier.getName(), refValue); } else { String array = arrayCheck(((EStructuralFeature) obj).getUpperBound()); - refAttribute.put(eStrucClassifier.getName(), refType.getName() + array); + String required = ":required-false"; + if(((EStructuralFeature) obj).getLowerBound() == 1){ + required = ":required-true"; + } + refAttribute.put(eStrucClassifier.getName(), refType.getName() + array + required); } } else if (annotation && obj instanceof EAttributeImpl){ EClassifier refType = ((EAttributeImpl) obj).getEType(); if (refType instanceof EEnumImpl){ String array = arrayCheck(((EStructuralFeature) obj).getUpperBound()); - refAttribute.put(eStrucClassifier.getName(), refType.getName() + array); } + String required = ":required-false"; + if(((EStructuralFeature) obj).getLowerBound() == 1){ + required = ":required-true"; + } + refAttribute.put(eStrucClassifier.getName(), refType.getName() + array + required); + } } } } } } + return refAttribute; } 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 df4fbf62d..77dcbdc1d 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 @@ -20,6 +20,8 @@ package org.onap.policy.rest.util; import java.io.IOException; +import java.io.StringReader; +import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.LinkedHashMap; @@ -27,6 +29,12 @@ import java.util.List; import java.util.Map; import java.util.Map.Entry; +import javax.json.Json; +import javax.json.JsonException; +import javax.json.JsonObject; +import javax.json.JsonReader; +import javax.json.JsonValue; + import org.apache.commons.lang.StringUtils; import org.json.JSONObject; import org.onap.policy.common.logging.flexlogger.FlexLogger; @@ -65,6 +73,8 @@ public class PolicyValidation { public static final String EMPTY_COMPONENT_ATTR = "Component Attributes: One or more Fields in Component Attributes is Empty."; private static Map mapAttribute = new HashMap<>(); + private static Map jsonRequestMap = new HashMap<>(); + private static List modelRequiredFieldsList = new ArrayList<>(); private static CommonClassDao commonClassDao; @@ -90,21 +100,126 @@ public class PolicyValidation { if(policyData.getPolicyName() != null){ String policyNameValidate = PolicyUtils.policySpecialCharValidator(policyData.getPolicyName()); if(!policyNameValidate.contains(SUCCESS)){ - responseString.append("PolicyName:" + policyNameValidate + "
"); + responseString.append("PolicyName:" + policyNameValidate + HTML_ITALICS_LNBREAK); valid = false; - }; + } }else{ - responseString.append( "PolicyName: PolicyName Should not be empty" + "
"); + responseString.append( "PolicyName: PolicyName Should not be empty" + HTML_ITALICS_LNBREAK); valid = false; } if(policyData.getPolicyDescription() != null){ String descriptionValidate = PolicyUtils.descriptionValidator(policyData.getPolicyDescription()); if(!descriptionValidate.contains(SUCCESS)){ - responseString.append("Description:" + descriptionValidate + "
"); + responseString.append("Description:" + descriptionValidate + HTML_ITALICS_LNBREAK); valid = false; } } + if(!"API".equals(policyData.getApiflag()) && policyData.getAttributes() != null && !policyData.getAttributes().isEmpty()){ + for(Object attribute : policyData.getAttributes()){ + if(attribute instanceof LinkedHashMap){ + String value = null; + String key = null; + if(((LinkedHashMap) attribute).get("key") != null){ + key = ((LinkedHashMap) attribute).get("key").toString(); + if(!PolicyUtils.policySpecialCharValidator(key).contains("success")){ + responseString.append("Attributes or Component Attributes:" + value + " : value has spaces or invalid characters
"); + valid = false; + } + }else{ + if(CONFIG_POLICY.equals(policyData.getPolicyType())){ + if("Base".equals(policyData.getConfigPolicyType())){ + responseString.append("Attributes: has one missing Attribute key
"); + } + if("BRMS_Param".equals(policyData.getConfigPolicyType()) || "BRMS_Raw".equals(policyData.getConfigPolicyType())){ + responseString.append("Rule Attributes: has one missing Attribute key
"); + } + }else{ + responseString.append("Component Attributes: has one missing Component Attribute key
"); + } + valid = false; + } + if(((LinkedHashMap) attribute).get("value") != null){ + value = ((LinkedHashMap) attribute).get("value").toString(); + if(!PolicyUtils.policySpecialCharValidator(value).contains("success")){ + if(CONFIG_POLICY.equals(policyData.getPolicyType())){ + if("Base".equals(policyData.getConfigPolicyType())){ + responseString.append("Attributes:" + value + " : value has spaces or invalid characters
"); + } + if("BRMS_Param".equals(policyData.getConfigPolicyType()) || "BRMS_Raw".equals(policyData.getConfigPolicyType())){ + responseString.append("Rule Attributes:" + value + " : value has spaces or invalid characters
"); + } + }else{ + responseString.append("Component Attributes:" + value + " : value has spaces or invalid characters
"); + } + valid = false; + } + }else{ + if(CONFIG_POLICY.equals(policyData.getPolicyType())){ + if("Base".equals(policyData.getConfigPolicyType())){ + responseString.append("Attributes: has one missing Attribute value
"); + } + if("BRMS_Param".equals(policyData.getConfigPolicyType()) || "BRMS_Raw".equals(policyData.getConfigPolicyType())){ + responseString.append("Rule Attributes: has one missing Attribute value
"); + } + }else{ + responseString.append("Component Attributes: has one missing Component Attribute value
"); + } + valid = false; + } + } + } + } + + //Decision Policy Attributes Validation + if(!"API".equals(policyData.getApiflag()) && policyData.getSettings() != null && !policyData.getSettings().isEmpty()){ + for(Object attribute : policyData.getAttributes()){ + if(attribute instanceof LinkedHashMap){ + String value = null; + if(((LinkedHashMap) attribute).get("key") == null){ + responseString.append("Settings Attributes: has one missing Attribute key
"); + valid = false; + } + if(((LinkedHashMap) attribute).get("value") != null){ + value = ((LinkedHashMap) attribute).get("value").toString(); + if(!PolicyUtils.policySpecialCharValidator(value).contains("success")){ + responseString.append("Settings Attributes:" + value + " : value has spaces or invalid characters
"); + valid = false; + } + }else{ + responseString.append("Settings Attributes: has one missing Attribute Value
"); + valid = false; + } + } + } + } + + if(!"API".equals(policyData.getApiflag()) && policyData.getRuleAlgorithmschoices() != null && !policyData.getRuleAlgorithmschoices().isEmpty()){ + for(Object attribute : policyData.getRuleAlgorithmschoices()){ + if(attribute instanceof LinkedHashMap){ + String label = ((LinkedHashMap) attribute).get("id").toString(); + if(((LinkedHashMap) attribute).get("dynamicRuleAlgorithmField1") == null){ + responseString.append("Rule Algorithms:" + label + " : Field 1 value is not selected
"); + valid = false; + } + if(((LinkedHashMap) attribute).get("dynamicRuleAlgorithmCombo") == null){ + responseString.append("Rule Algorithms:" + label + " : Field 2 value is not selected
"); + valid = false; + } + if(((LinkedHashMap) attribute).get("dynamicRuleAlgorithmField2") != null){ + String value = ((LinkedHashMap) attribute).get("dynamicRuleAlgorithmField2").toString(); + if(!PolicyUtils.policySpecialCharValidator(value).contains("success")){ + responseString.append("Rule Algorithms:" + label + " : Field 3 value has special characters
"); + valid = false; + } + }else{ + responseString.append("Rule Algorithms:" + label + " : Field 3 value is empty
"); + valid = false; + } + } + } + } + if(CONFIG_POLICY.equalsIgnoreCase(policyData.getPolicyType())){ if ("Base".equals(policyData.getConfigPolicyType()) || CLOSEDLOOP_POLICY.equals(policyData.getConfigPolicyType()) || CLOSEDLOOP_PM.equals(policyData.getConfigPolicyType()) || ENFORCER_CONFIG_POLICY.equals(policyData.getConfigPolicyType()) @@ -113,11 +228,11 @@ public class PolicyValidation { if(!Strings.isNullOrEmpty(policyData.getOnapName())) { String onapNameValidate = PolicyUtils.policySpecialCharValidator(policyData.getOnapName()); if(!onapNameValidate.contains(SUCCESS)){ - responseString.append("OnapName:" + onapNameValidate + "
"); + responseString.append("OnapName:" + onapNameValidate + HTML_ITALICS_LNBREAK); valid = false; } }else{ - responseString.append("Onap Name: Onap Name Should not be empty" + "
"); + responseString.append("Onap Name: Onap Name Should not be empty" + HTML_ITALICS_LNBREAK); valid = false; } } @@ -125,33 +240,33 @@ public class PolicyValidation { if(!Strings.isNullOrEmpty(policyData.getRiskType())) { String riskTypeValidate = PolicyUtils.policySpecialCharValidator(policyData.getRiskType()); if(!riskTypeValidate.contains(SUCCESS)){ - responseString.append("RiskType:" + riskTypeValidate + "
"); + responseString.append("RiskType:" + riskTypeValidate + HTML_ITALICS_LNBREAK); valid = false; } }else { - responseString.append("Risk Type: Risk Type Should not be Empty" + "
"); + responseString.append("RiskType: Risk Type Should not be Empty" + HTML_ITALICS_LNBREAK); valid = false; } if(!Strings.isNullOrEmpty(policyData.getRiskLevel())) { String validateRiskLevel = PolicyUtils.policySpecialCharValidator(policyData.getRiskLevel()); if(!validateRiskLevel.contains(SUCCESS)){ - responseString.append("RiskLevel:" + validateRiskLevel + "
"); + responseString.append("RiskLevel:" + validateRiskLevel + HTML_ITALICS_LNBREAK); valid = false; } }else { - responseString.append("Risk Level: Risk Level Should not be Empty" + "
"); + responseString.append("RiskLevel: Risk Level Should not be Empty" + HTML_ITALICS_LNBREAK); valid = false; } if(!Strings.isNullOrEmpty(policyData.getGuard())) { String validateGuard = PolicyUtils.policySpecialCharValidator(policyData.getGuard()); if(!validateGuard.contains(SUCCESS)){ - responseString.append("Guard:" + validateGuard + "
"); + responseString.append("Guard:" + validateGuard + HTML_ITALICS_LNBREAK); valid = false; } }else { - responseString.append("Guard: Guard Value Should not be Empty" + "
"); + responseString.append("Guard: Guard Value Should not be Empty" + HTML_ITALICS_LNBREAK); valid = false; } @@ -159,21 +274,21 @@ public class PolicyValidation { if(!Strings.isNullOrEmpty(policyData.getConfigName())) { String configNameValidate = PolicyUtils.policySpecialCharValidator(policyData.getConfigName()); if(!configNameValidate.contains(SUCCESS)){ - responseString.append("ConfigName:" + configNameValidate + "
"); + responseString.append("ConfigName:" + configNameValidate + HTML_ITALICS_LNBREAK); valid = false; } }else{ - responseString.append("Config Name: Config Name Should not be Empty" + "
"); + responseString.append("Config Name: Config Name Should not be Empty" + HTML_ITALICS_LNBREAK); valid = false; } if(!Strings.isNullOrEmpty(policyData.getConfigType())) { String configTypeValidate = PolicyUtils.policySpecialCharValidator(policyData.getConfigType()); if(!configTypeValidate.contains(SUCCESS)){ - responseString.append("ConfigType:" + configTypeValidate + "
"); + responseString.append("ConfigType:" + configTypeValidate + HTML_ITALICS_LNBREAK); valid = false; } }else{ - responseString.append("Config Type: Config Type Should not be Empty" + "
"); + responseString.append("Config Type: Config Type Should not be Empty" + HTML_ITALICS_LNBREAK); valid = false; } if(!Strings.isNullOrEmpty(policyData.getConfigBodyData())) { @@ -182,26 +297,26 @@ public class PolicyValidation { if (configType != null) { if ("JSON".equals(configType)) { if (!PolicyUtils.isJSONValid(configBodyData)) { - responseString.append("Config Body: JSON Content is not valid" + "
"); + responseString.append("Config Body: JSON Content is not valid" + HTML_ITALICS_LNBREAK); valid = false; } } else if ("XML".equals(configType)) { if (!PolicyUtils.isXMLValid(configBodyData)) { - responseString.append("Config Body: XML Content data is not valid" + "
"); + responseString.append("Config Body: XML Content data is not valid" + HTML_ITALICS_LNBREAK); valid = false; } } else if ("PROPERTIES".equals(configType)) { if (!PolicyUtils.isPropValid(configBodyData)||configBodyData.equals("")) { - responseString.append("Config Body: Property data is not valid" + "
"); + responseString.append("Config Body: Property data is not valid" + HTML_ITALICS_LNBREAK); valid = false; } } else if ("OTHER".equals(configType) && ("".equals(configBodyData))) { - responseString.append("Config Body: Config Body Should not be Empty" + "
"); + responseString.append("Config Body: Config Body Should not be Empty" + HTML_ITALICS_LNBREAK); valid = false; } } }else{ - responseString.append("Config Body: Config Body Should not be Empty" + "
"); + responseString.append("Config Body: Config Body Should not be Empty" + HTML_ITALICS_LNBREAK); valid = false; } } @@ -259,7 +374,7 @@ public class PolicyValidation { if(pmBody.getEmailAddress() != null){ String result = emailValidation(pmBody.getEmailAddress(), responseString.toString()); if(result != SUCCESS){ - responseString.append(result + "
"); + responseString.append(result + HTML_ITALICS_LNBREAK); valid = false; } } @@ -272,7 +387,7 @@ public class PolicyValidation { if(!result.contains(SUCCESS)){ responseString.append("GeoLink:" + result + HTML_ITALICS_LNBREAK); valid = false; - }; + } } if(pmBody.getAttributes() != null && !pmBody.getAttributes().isEmpty()){ for(Entry entry : pmBody.getAttributes().entrySet()){ @@ -283,7 +398,7 @@ public class PolicyValidation { if(!attributeValidate.contains(SUCCESS)){ responseString.append("Attributes:" + key + " : value has spaces or invalid characters" + HTML_ITALICS_LNBREAK); valid = false; - }; + } } } } @@ -308,13 +423,28 @@ public class PolicyValidation { responseString.append("Conditions: There were no conditions provided in configBody json" + HTML_ITALICS_LNBREAK); return responseString; } + }else{ + if(policyData.getTrapDatas().getTrap1() != null){ + if(policyData.getClearTimeOut() == null){ + responseString.append("Trigger Clear TimeOut: Trigger Clear TimeOut is required when atleast One Trigger Signature is enabled
"); + valid = false; + } + if(policyData.getTrapMaxAge() == null){ + responseString.append("Trap Max Age: Trap Max Age is required when atleast One Trigger Signature is enabled
"); + valid = false; + } + } + if(policyData.getFaultDatas().getTrap1() != null && policyData.getVerificationclearTimeOut() == null){ + responseString.append("Fault Clear TimeOut: Fault Clear TimeOut is required when atleast One Fault Signature is enabled
"); + valid = false; + } } ClosedLoopFaultBody faultBody = mapper.readValue(policyData.getJsonBody(), ClosedLoopFaultBody.class); if(faultBody.getEmailAddress() != null && !faultBody.getEmailAddress().isEmpty()){ String result = emailValidation(faultBody.getEmailAddress(), responseString.toString()); - if(result != SUCCESS){ - responseString.append(result+ "
"); + if(!SUCCESS.equals(result)){ + responseString.append(result+ HTML_ITALICS_LNBREAK); valid = false; } } @@ -384,6 +514,8 @@ public class PolicyValidation { if (MICROSERVICES.equals(policyData.getConfigPolicyType())){ if(!Strings.isNullOrEmpty(policyData.getServiceType())){ + + modelRequiredFieldsList = new ArrayList<>(); pullJsonKeyPairs((JsonNode) policyData.getPolicyJSON()); String service; @@ -400,7 +532,12 @@ public class PolicyValidation { MicroServiceModels returnModel = getAttributeObject(service, version); if(returnModel != null) { + String annotation = returnModel.getAnnotation(); + String refAttributes = returnModel.getRef_attributes(); + String subAttributes = returnModel.getSub_attributes(); + String modelAttributes = returnModel.getAttributes(); + if (!Strings.isNullOrEmpty(annotation)){ Map rangeMap = Splitter.on(",").withKeyValueSeparator("=").split(annotation); for (Entry rMap : rangeMap.entrySet()){ @@ -431,18 +568,85 @@ public class PolicyValidation { } } + } else { + // Validate for configName, location, uuid, and policyScope if no annotations exist for this model + if(Strings.isNullOrEmpty(policyData.getMsLocation())){ + responseString.append("Micro Service Model: location is required for this model" + HTML_ITALICS_LNBREAK); + valid = false; + } + + if(Strings.isNullOrEmpty(policyData.getConfigName())){ + responseString.append("Micro Service Model: configName is required for this model" + HTML_ITALICS_LNBREAK); + valid = false; + } + + if(Strings.isNullOrEmpty(policyData.getUuid())){ + responseString.append("Micro Service Model: uuid is required for this model" + HTML_ITALICS_LNBREAK); + valid = false; + } + + if(Strings.isNullOrEmpty(policyData.getPolicyScope())){ + responseString.append("Micro Service Model: policyScope is required for this model" + HTML_ITALICS_LNBREAK); + valid = false; + } + } + + // get list of required fields from the sub_Attributes of the Model + if(!Strings.isNullOrEmpty(subAttributes)) { + JsonObject subAttributesJson = stringToJsonObject(subAttributes); + findRequiredFields(subAttributesJson); + } + + // get list of required fields from the attributes of the Model + if (!Strings.isNullOrEmpty(modelAttributes)) { + Map modelAttributesMap = Splitter.on(",").withKeyValueSeparator("=").split(modelAttributes); + String json = new ObjectMapper().writeValueAsString(modelAttributesMap); + findRequiredFields(stringToJsonObject(json)); + } + + // get list of required fields from the ref_Attributes of the Model + if (!Strings.isNullOrEmpty(refAttributes)) { + Map refAttributesMap = Splitter.on(",").withKeyValueSeparator("=").split(refAttributes); + String json = new ObjectMapper().writeValueAsString(refAttributesMap); + findRequiredFields(stringToJsonObject(json)); + } + + // Validate Required Fields in the Micro Service Model + if (modelRequiredFieldsList!=null || !modelRequiredFieldsList.isEmpty()) { + // create jsonRequestMap with all json keys and values from request + JsonNode rootNode = (JsonNode) policyData.getPolicyJSON(); + pullModelJsonKeyPairs(rootNode); + + // validate if the requiredFields are in the request + for(String requiredField : modelRequiredFieldsList) { + if (jsonRequestMap.containsKey(requiredField)) { + String value = jsonRequestMap.get(requiredField); + if(Strings.isNullOrEmpty(jsonRequestMap.get(requiredField)) || + "\"\"".equals(value) || + "".equals(jsonRequestMap.get(requiredField))){ + responseString.append("Micro Service Model: " + requiredField + " is required" + HTML_ITALICS_LNBREAK); + valid = false; + } + } else { + responseString.append("Micro Service Model: " + requiredField + " is required" + HTML_ITALICS_LNBREAK); + valid = false; + } + } } + + + } else { responseString.append("Micro Service Model: Invalid Model. The model name, " + service + " of version, " + version + " was not found in the dictionary" + HTML_ITALICS_LNBREAK); valid = false; } } else { - responseString.append("Micro Version: Micro Service Version is required" + HTML_ITALICS_LNBREAK); + responseString.append("Micro Service Version: Micro Service Version is required" + HTML_ITALICS_LNBREAK); valid = false; } } else { - responseString.append("Micro Service: Micro Service is required" + HTML_ITALICS_LNBREAK); + responseString.append("Micro Service: Micro Service Model is required" + HTML_ITALICS_LNBREAK); valid = false; } @@ -456,11 +660,11 @@ public class PolicyValidation { if(!Strings.isNullOrEmpty(policyData.getOnapName())){ String onapNameValidate = PolicyUtils.policySpecialCharValidator(policyData.getOnapName()); if(!onapNameValidate.contains(SUCCESS)){ - responseString.append("OnapName:" + onapNameValidate + "
"); + responseString.append("OnapName:" + onapNameValidate + HTML_ITALICS_LNBREAK); valid = false; } }else{ - responseString.append("Onap Name: Onap Name Should not be empty" + "
"); + responseString.append("Onap Name: Onap Name Should not be empty" + HTML_ITALICS_LNBREAK); valid = false; } @@ -527,52 +731,52 @@ public class PolicyValidation { if("GUARD_YAML".equals(policyData.getRuleProvider()) || "GUARD_BL_YAML".equals(policyData.getRuleProvider())){ if(policyData.getYamlparams()==null){ - responseString.append(" Guard Params are Required " + "
"); + responseString.append(" Guard Params are Required " + HTML_ITALICS_LNBREAK); valid = false; }else{ if(Strings.isNullOrEmpty(policyData.getYamlparams().getActor())){ - responseString.append("Guard Params Actor is Required " + "
"); + responseString.append("Guard Params Actor is Required " + HTML_ITALICS_LNBREAK); valid = false; } if(Strings.isNullOrEmpty(policyData.getYamlparams().getRecipe())){ - responseString.append("Guard Params Recipe is Required " + "
"); + 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 " + "
"); + 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 " + "
"); + 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())){ - responseString.append(" Guard Params Limit is Required " + "
"); + 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 " + "
"); + 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" + "
"); + 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 " + "
"); + responseString.append(" Guard Params Time Window Should be Integer " + HTML_ITALICS_LNBREAK); valid = false; } if(Strings.isNullOrEmpty(policyData.getYamlparams().getTimeUnits())){ - responseString.append("Guard Params Time Units is Required" + "
"); + responseString.append("Guard Params Time Units 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 BlackList is Required " + "
"); + responseString.append(" Guard Params BlackList 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 BlackList Should be valid String" + "
"); + responseString.append(" Guard Params BlackList Should be valid String" + HTML_ITALICS_LNBREAK); valid = false; break; } @@ -587,70 +791,24 @@ public class PolicyValidation { if(!Strings.isNullOrEmpty(policyData.getActionPerformer())){ String actionPerformer = PolicyUtils.policySpecialCharValidator(policyData.getActionPerformer()); if(!actionPerformer.contains(SUCCESS)){ - responseString.append("ActionPerformer:" + actionPerformer + "
"); + responseString.append("ActionPerformer:" + actionPerformer + HTML_ITALICS_LNBREAK); valid = false; } }else{ - responseString.append("ActionPerformer: ActionPerformer Should not be empty" + "
"); - 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(EMPTY_COMPONENT_ATTR + "
"); - valid = false; - break; - } - }catch(Exception e){ - LOGGER.error("This is a Policy Validation check" +e); - responseString.append(EMPTY_COMPONENT_ATTR + "
"); - valid = false; - break; - } - } - } - }else{ - responseString.append(EMPTY_COMPONENT_ATTR + "
"); + responseString.append("ActionPerformer: ActionPerformer Should not be empty" + HTML_ITALICS_LNBREAK); valid = false; } + if(!Strings.isNullOrEmpty(policyData.getActionAttributeValue())){ String actionAttribute = PolicyUtils.policySpecialCharValidator(policyData.getActionAttributeValue()); if(!actionAttribute.contains(SUCCESS)){ - responseString.append("ActionAttribute:" + actionAttribute + "
"); + responseString.append("ActionAttribute:" + actionAttribute + HTML_ITALICS_LNBREAK); valid = false; - }; + } }else{ - responseString.append("ActionAttribute: ActionAttribute Should not be empty" + "
"); + responseString.append("ActionAttribute: ActionAttribute Should not be empty" + HTML_ITALICS_LNBREAK); valid = false; } - - 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(Strings.isNullOrEmpty(label) || Strings.isNullOrEmpty(key) || Strings.isNullOrEmpty(rule) || Strings.isNullOrEmpty(value)){ - responseString.append("Rule Algorithms: One or more Fields in Rule Algorithms is Empty." + "
"); - 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." + "
"); - valid = false; - break; - } - } - } - } } if(CONFIG_POLICY.equals(policyData.getPolicyType())){ @@ -660,7 +818,7 @@ public class PolicyValidation { List spData = commonClassDao.getDataById(SafePolicyWarning.class, "riskType", policyData.getRiskType()); if (!spData.isEmpty()){ SafePolicyWarning safePolicyWarningData = (SafePolicyWarning) spData.get(0); - value = "Message:" + safePolicyWarningData.getMessage(); + value = "Message:" + safePolicyWarningData.getMessage() +""; } } responseString.append(SUCCESS + "@#"+ value); @@ -729,5 +887,60 @@ public class PolicyValidation { } } } + + private void pullModelJsonKeyPairs(JsonNode rootNode) { + Iterator> fieldsIterator = rootNode.fields(); + + while (fieldsIterator.hasNext()) { + Map.Entry field = fieldsIterator.next(); + final String key = field.getKey(); + final JsonNode value = field.getValue(); + + if (value.isContainerNode() && !value.isArray()) { + pullModelJsonKeyPairs(value); // RECURSIVE CALL + } else if (value.isArray()) { + try { + String stringValue = StringUtils.replaceEach(value.toString(), new String[]{"[", "]"}, new String[]{"",""}); + ObjectMapper mapper = new ObjectMapper(); + JsonNode newValue = mapper.readTree(stringValue); + pullModelJsonKeyPairs(newValue); + } catch (IOException e) { + LOGGER.info("PolicyValidation: Exception occurred while mapping string to JsonNode " + e); + } + } else { + jsonRequestMap.put(key, value.toString().trim()); + } + } + + } + + private JsonObject stringToJsonObject(String value) { + try(JsonReader jsonReader = Json.createReader(new StringReader(value))){ + return jsonReader.readObject(); + } catch(JsonException| IllegalStateException e){ + LOGGER.info(XACMLErrorConstants.ERROR_DATA_ISSUE+ "Improper JSON format... may or may not cause issues in validating the policy: " + value, e); + return null; + } + } + + private void findRequiredFields(JsonObject json) { + + for(Entry keyMap : json.entrySet()){ + Object obj = keyMap.getValue(); + if(obj instanceof JsonObject){ + JsonObject jsonObj = (JsonObject)obj; + for(Entry jsonMap : jsonObj.entrySet()){ + if(jsonMap.getValue().toString().contains("required-true")){ + modelRequiredFieldsList.add(jsonMap.getKey()); + } + } + } else { + if(keyMap.getValue().toString().contains("required-true")){ + modelRequiredFieldsList.add(keyMap.getKey()); + } + } + } + + } } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/util/PolicyValidationRequestWrapper.java b/ONAP-REST/src/main/java/org/onap/policy/rest/util/PolicyValidationRequestWrapper.java index ac97fb0ee..4267ff9fc 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/util/PolicyValidationRequestWrapper.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/util/PolicyValidationRequestWrapper.java @@ -37,6 +37,7 @@ import org.onap.policy.api.AttributeType; import org.onap.policy.api.PolicyParameters; import org.onap.policy.common.logging.flexlogger.FlexLogger; import org.onap.policy.common.logging.flexlogger.Logger; +import org.onap.policy.rest.adapter.ClosedLoopFaultTrapDatas; import org.onap.policy.rest.adapter.PolicyRestAdapter; import org.onap.policy.rest.adapter.RainyDayParams; import org.onap.policy.rest.adapter.YAMLParams; @@ -55,12 +56,21 @@ public class PolicyValidationRequestWrapper { public PolicyRestAdapter populateRequestParameters(HttpServletRequest request) { PolicyRestAdapter policyData = null; - + ClosedLoopFaultTrapDatas trapDatas = null; + ClosedLoopFaultTrapDatas faultDatas = null; try { ObjectMapper mapper = new ObjectMapper(); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); JsonNode root = mapper.readTree(request.getReader()); policyData = mapper.readValue(root.get("policyData").toString(), PolicyRestAdapter.class); + if(root.get("trapData") != null){ + trapDatas = mapper.readValue(root.get("trapData").toString(), ClosedLoopFaultTrapDatas.class); + policyData.setTrapDatas(trapDatas); + } + if(root.get("faultData") != null){ + faultDatas = mapper.readValue(root.get("faultData").toString(), ClosedLoopFaultTrapDatas.class); + policyData.setFaultDatas(faultDatas); + } JsonObject json; json = stringToJsonObject(root.toString()); @@ -88,9 +98,15 @@ public class PolicyValidationRequestWrapper { /* * set policy adapter values for Building JSON object containing policy data */ - //Common among policy types + //Common Policy Fields policyData.setPolicyName(parameters.getPolicyName()); policyData.setOnapName(parameters.getOnapName()); + policyData.setPriority(parameters.getPriority()); //Micro Service + policyData.setConfigName(parameters.getConfigName()); //Base and Firewall + policyData.setRiskType(parameters.getRiskType()); //Safe parameters Attributes + policyData.setRiskLevel(parameters.getRiskLevel());//Safe parameters Attributes + policyData.setGuard(String.valueOf(parameters.getGuard()));//Safe parameters Attributes + policyData.setTtlDate(convertDate(parameters.getTtlDate()));//Safe parameters Attributes //Some policies require jsonObject conversion from String for configBody (i.e. MicroService and Firewall) JsonObject json = null; @@ -298,6 +314,26 @@ public class PolicyValidationRequestWrapper { String version = json.get("version").toString().replace("\"", ""); policyData.setVersion(version); } + if(json.containsKey("policyScope")){ + String policyScope = json.get("policyScope").toString().replace("\"", ""); + policyData.setPolicyScope(policyScope); + } + if(json.containsKey("riskType")){ + String riskType = json.get("riskType").toString().replace("\"", ""); + policyData.setRiskType(riskType); + } + if(json.containsKey("riskLevel")){ + String riskLevel = json.get("riskLevel").toString().replace("\"", ""); + policyData.setRiskLevel(riskLevel); + } + if(json.containsKey("guard")){ + String guard = json.get("guard").toString().replace("\"", ""); + policyData.setGuard(guard); + } + } else { + String message = XACMLErrorConstants.ERROR_DATA_ISSUE+ " improper JSON object : " + parameters.getConfigBody(); + LOGGER.error(message); + return null; } } else if("Fault".equals(parameters.getPolicyConfigType().toString())){ @@ -337,13 +373,6 @@ public class PolicyValidationRequestWrapper { } } - - policyData.setPriority(parameters.getPriority()); //Micro Service - policyData.setConfigName(parameters.getConfigName()); //Base and Firewall - policyData.setRiskType(parameters.getRiskType()); //Safe parameters Attributes - policyData.setRiskLevel(parameters.getRiskLevel());//Safe parameters Attributes - policyData.setGuard(String.valueOf(parameters.getGuard()));//Safe parameters Attributes - policyData.setTtlDate(convertDate(parameters.getTtlDate()));//Safe parameters Attributes return policyData; diff --git a/ONAP-REST/src/test/java/org/onap/policy/rest/adapter/ClosedLoopFaultTrapDatasTest.java b/ONAP-REST/src/test/java/org/onap/policy/rest/adapter/ClosedLoopFaultTrapDatasTest.java new file mode 100644 index 000000000..bb8385bc3 --- /dev/null +++ b/ONAP-REST/src/test/java/org/onap/policy/rest/adapter/ClosedLoopFaultTrapDatasTest.java @@ -0,0 +1,50 @@ +/*- + * ============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; + +import static org.junit.Assert.*; + +import java.util.ArrayList; +import java.util.List; + +import org.junit.Test; + +public class ClosedLoopFaultTrapDatasTest { + + @Test + public void testClosedLoopFaultTrapDatas(){ + List trap = new ArrayList<>(); + trap.add("Test"); + ClosedLoopFaultTrapDatas closedLoopTrapData = new ClosedLoopFaultTrapDatas(); + closedLoopTrapData.setTrap1(trap); + assertTrue("Test".equals(closedLoopTrapData.getTrap1().get(0))); + closedLoopTrapData.setTrap2(trap); + assertTrue("Test".equals(closedLoopTrapData.getTrap2().get(0))); + closedLoopTrapData.setTrap3(trap); + assertTrue("Test".equals(closedLoopTrapData.getTrap3().get(0))); + closedLoopTrapData.setTrap4(trap); + assertTrue("Test".equals(closedLoopTrapData.getTrap4().get(0))); + closedLoopTrapData.setTrap5(trap); + assertTrue("Test".equals(closedLoopTrapData.getTrap5().get(0))); + closedLoopTrapData.setTrap6(trap); + assertTrue("Test".equals(closedLoopTrapData.getTrap6().get(0))); + + } +} diff --git a/ONAP-SDK-APP/src/main/java/org/onap/portalapp/conf/ExternalAppConfig.java b/ONAP-SDK-APP/src/main/java/org/onap/portalapp/conf/ExternalAppConfig.java index ccc469166..20601724c 100644 --- a/ONAP-SDK-APP/src/main/java/org/onap/portalapp/conf/ExternalAppConfig.java +++ b/ONAP-SDK-APP/src/main/java/org/onap/portalapp/conf/ExternalAppConfig.java @@ -29,7 +29,6 @@ import org.onap.portalsdk.core.conf.AppConfig; import org.onap.portalsdk.core.conf.Configurable; import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; import org.onap.portalsdk.core.objectcache.AbstractCacheManager; -import org.onap.portalsdk.core.onboarding.exception.PortalAPIException; import org.onap.portalsdk.core.service.DataAccessService; import org.onap.portalsdk.core.util.CacheManager; import org.onap.portalsdk.core.util.SystemProperties; diff --git a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/AutoPushController.java b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/AutoPushController.java index 9ade81d17..e0388e5d6 100644 --- a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/AutoPushController.java +++ b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/AutoPushController.java @@ -52,6 +52,7 @@ import org.onap.policy.rest.adapter.AutoPushTabAdapter; import org.onap.policy.rest.dao.CommonClassDao; import org.onap.policy.rest.jpa.PolicyEntity; import org.onap.policy.rest.jpa.PolicyVersion; +import org.onap.policy.utils.PolicyUtils; import org.onap.policy.xacml.api.XACMLErrorConstants; import org.onap.policy.xacml.api.pap.OnapPDPGroup; import org.onap.policy.xacml.std.pap.StdPDPGroup; @@ -288,6 +289,7 @@ public class AutoPushController extends RestrictedBaseController{ updatedGroupObject.setOnapPdps(pdpGroup.getOnapPdps()); updatedGroupObject.setPipConfigs(pdpGroup.getPipConfigs()); updatedGroupObject.setStatus(pdpGroup.getStatus()); + updatedGroupObject.setOperation("push"); // replace the original set of Policies with the set from the // container (possibly modified by the user) @@ -334,7 +336,7 @@ public class AutoPushController extends RestrictedBaseController{ request.setCharacterEncoding("UTF-8"); PrintWriter out = response.getWriter(); logger.error(e); - out.write(e.getMessage()); + out.write(PolicyUtils.CATCH_EXCEPTION);; } return null; } @@ -369,6 +371,7 @@ public class AutoPushController extends RestrictedBaseController{ updatedGroupObject.setOnapPdps(group.getOnapPdps()); updatedGroupObject.setPipConfigs(group.getPipConfigs()); updatedGroupObject.setStatus(group.getStatus()); + updatedGroupObject.setOperation("delete"); this.container.updateGroup(updatedGroupObject); } @@ -390,7 +393,7 @@ public class AutoPushController extends RestrictedBaseController{ request.setCharacterEncoding("UTF-8"); PrintWriter out = response.getWriter(); logger.error(e); - out.write(e.getMessage()); + out.write(PolicyUtils.CATCH_EXCEPTION);; } return null; } diff --git a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateClosedLoopFaultController.java b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateClosedLoopFaultController.java index 158ea6248..7cfc4fed4 100644 --- a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateClosedLoopFaultController.java +++ b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateClosedLoopFaultController.java @@ -32,6 +32,7 @@ import java.util.Map; import org.onap.policy.common.logging.flexlogger.FlexLogger; import org.onap.policy.common.logging.flexlogger.Logger; import org.onap.policy.rest.adapter.ClosedLoopFaultBody; +import org.onap.policy.rest.adapter.ClosedLoopFaultTrapDatas; import org.onap.policy.rest.adapter.ClosedLoopFaultTriggerUISignatures; import org.onap.policy.rest.adapter.ClosedLoopSignatures; import org.onap.policy.rest.adapter.PolicyRestAdapter; @@ -62,27 +63,27 @@ import oasis.names.tc.xacml._3_0.core.schema.wd_17.TargetType; public class CreateClosedLoopFaultController extends RestrictedBaseController{ private static final Logger policyLogger = FlexLogger.getLogger(CreateClosedLoopFaultController.class); - + protected PolicyRestAdapter policyAdapter = null; - - + + private static CommonClassDao commonclassdao; - + @Autowired private CreateClosedLoopFaultController(CommonClassDao commonclassdao){ CreateClosedLoopFaultController.commonclassdao = commonclassdao; } - + public CreateClosedLoopFaultController(){ // Empty constructor } - + public PolicyRestAdapter setDataToPolicyRestAdapter(PolicyRestAdapter policyData, JsonNode root){ try{ ObjectMapper mapper = new ObjectMapper(); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - TrapDatas trapDatas = mapper.readValue(root.get("trapData").toString(), TrapDatas.class); - TrapDatas faultDatas = mapper.readValue(root.get("faultData").toString(), TrapDatas.class); + ClosedLoopFaultTrapDatas trapDatas = mapper.readValue(root.get("trapData").toString(), ClosedLoopFaultTrapDatas.class); + ClosedLoopFaultTrapDatas faultDatas = mapper.readValue(root.get("faultData").toString(), ClosedLoopFaultTrapDatas.class); ClosedLoopGridJSONData policyJsonData = mapper.readValue(root.get("policyData").get("policy").toString(), ClosedLoopGridJSONData.class); ClosedLoopFaultBody jsonBody = mapper.readValue(root.get("policyData").get("policy").get("jsonBodyData").toString(), ClosedLoopFaultBody.class); @@ -164,7 +165,7 @@ public class CreateClosedLoopFaultController extends RestrictedBaseController{ } return policyData; } - + @SuppressWarnings("unchecked") private String connectTriggerSignature(int index, ArrayList triggerSignatures, Object object) { @@ -241,17 +242,17 @@ public class CreateClosedLoopFaultController extends RestrictedBaseController{ return resultBody.toString(); } - + private String callTrap(String trap, Object object) { String signatureBody = ""; - TrapDatas trapDatas = (TrapDatas) object; - ArrayList attributeList = new ArrayList<>(); + ClosedLoopFaultTrapDatas trapDatas = (ClosedLoopFaultTrapDatas) object; + List attributeList = new ArrayList<>(); // Read the Trap if(! "nill".equals(trap)){ try{ if(trap.startsWith("Trap")){ if("Trap1".equals(trap)){ - attributeList = trapDatas.getTrap1(); + attributeList = trapDatas.getTrap1(); }else if("Trap2".equals(trap)){ attributeList = trapDatas.getTrap2(); }else if("Trap3".equals(trap)){ @@ -281,7 +282,7 @@ public class CreateClosedLoopFaultController extends RestrictedBaseController{ } } } catch(Exception e){ - policyLogger.warn("Error during callTrap" , e); + policyLogger.warn("Error during callTrap" , e); return "(" + trap + ")"; } }else{ @@ -294,9 +295,9 @@ public class CreateClosedLoopFaultController extends RestrictedBaseController{ signatureBody = signatureBody + "(" + readAttributes(attributeList, attributeList.size()-1) + ")"; return signatureBody; } - + @SuppressWarnings("unchecked") - private String readAttributes(ArrayList object, int index) { + private String readAttributes(List object, int index) { String attributes = ""; Map trapSignatures = (Map) object.get(index); // Read the Elements. @@ -365,144 +366,144 @@ public class CreateClosedLoopFaultController extends RestrictedBaseController{ } return attributes; } - + private String getVarbindOID(String attrib) { VarbindDictionary varbindId = null; try{ - varbindId = (VarbindDictionary) commonclassdao.getEntityItem(VarbindDictionary.class, "varbindName", attrib); - return varbindId.getVarbindOID(); + varbindId = (VarbindDictionary) commonclassdao.getEntityItem(VarbindDictionary.class, "varbindName", attrib); + return varbindId.getVarbindOID(); }catch(Exception e){ - policyLogger.error("Error during retrieving varbindName " + attrib, e); + policyLogger.error("Error during retrieving varbindName " + attrib, e); return attrib; } } - + //connect traps data set to JSON Body as String - @SuppressWarnings({ "unchecked", "rawtypes" }) - private String getUIConnectTraps(ArrayList connectTrapSignatures) { - StringBuilder resultBody = new StringBuilder(); - String connectMainBody = ""; - for(int j = 0; j < connectTrapSignatures.size(); j++){ - Map connectTraps = (Map)connectTrapSignatures.get(j); + @SuppressWarnings({ "unchecked", "rawtypes" }) + private String getUIConnectTraps(ArrayList connectTrapSignatures) { + StringBuilder resultBody = new StringBuilder(); + String connectMainBody = ""; + for(int j = 0; j < connectTrapSignatures.size(); j++){ + Map connectTraps = (Map)connectTrapSignatures.get(j); + String connectBody = ""; + Object object = connectTraps; + if(object instanceof LinkedHashMap){ + String notBox = ""; + String connectTrap1 = ""; + String trapCount1 = ""; + String operatorBox = ""; + String connectTrap2 = ""; + String trapCount2 = ""; + if(((LinkedHashMap) object).keySet().contains("notBox")){ + notBox = ((LinkedHashMap) object).get("notBox").toString(); + } + if(((LinkedHashMap) object).get("connectTrap1") != null){ + connectTrap1 = ((LinkedHashMap) object).get("connectTrap1").toString(); + } + if(((LinkedHashMap) object).get("trapCount1") != null){ + trapCount1 = ((LinkedHashMap) object).get("trapCount1").toString(); + } + if(((LinkedHashMap) object).get("operatorBox") != null){ + operatorBox = ((LinkedHashMap) object).get("operatorBox").toString(); + } + if(((LinkedHashMap) object).get("connectTrap2") != null){ + connectTrap2 = ((LinkedHashMap) object).get("connectTrap2").toString(); + } + if(((LinkedHashMap) object).get("trapCount2") != null){ + trapCount2 = ((LinkedHashMap) object).get("trapCount2").toString(); + } + connectBody = notBox + "@!" + connectTrap1 + "@!" + trapCount1 + "@!" + operatorBox + "@!" + connectTrap2 + "@!" + trapCount2 + "#!?!"; + } + resultBody.append(connectBody); + } + connectMainBody = connectMainBody + resultBody; + return connectMainBody; + } + + + + // get Trigger signature from JSON body + @SuppressWarnings({ "rawtypes", "unchecked" }) + private String getUITriggerSignature(String trap, Object object2) { + StringBuilder triggerBody = new StringBuilder(); + ClosedLoopFaultTrapDatas trapDatas = (ClosedLoopFaultTrapDatas) object2; + ArrayList attributeList = new ArrayList<>(); + // Read the Trap + if(trap.startsWith("Trap")){ + if(trapDatas.getTrap1()!= null){ + attributeList.add(trapDatas.getTrap1()); + } + if(trapDatas.getTrap2()!= null){ + attributeList.add(trapDatas.getTrap2()); + } + if(trapDatas.getTrap3()!= null){ + attributeList.add(trapDatas.getTrap3()); + } + if(trapDatas.getTrap4()!= null){ + attributeList.add(trapDatas.getTrap4()); + } + if(trapDatas.getTrap5()!= null){ + attributeList.add(trapDatas.getTrap5()); + } + if(trapDatas.getTrap6()!= null){ + attributeList.add(trapDatas.getTrap6()); + } + }else{ + if(trap.startsWith("Fault")){ + if(trapDatas.getTrap1()!= null){ + attributeList.add(trapDatas.getTrap1()); + } + if(trapDatas.getTrap2()!= null){ + attributeList.add(trapDatas.getTrap2()); + } + if(trapDatas.getTrap3()!= null){ + attributeList.add(trapDatas.getTrap3()); + } + if(trapDatas.getTrap4()!= null){ + attributeList.add(trapDatas.getTrap4()); + } + if(trapDatas.getTrap5()!= null){ + attributeList.add(trapDatas.getTrap5()); + } + if(trapDatas.getTrap6()!= null){ + attributeList.add(trapDatas.getTrap6()); + } + } + } + + for(int j = 0; j < attributeList.size(); j++){ + StringBuilder signatureBody = new StringBuilder(); + ArrayList connectTraps = (ArrayList) attributeList.get(j); + for(int i =0 ; i < connectTraps.size(); i++){ String connectBody = ""; - Object object = connectTraps; + Object object = connectTraps.get(i); if(object instanceof LinkedHashMap){ String notBox = ""; - String connectTrap1 = ""; - String trapCount1 = ""; + String trigger1 = ""; String operatorBox = ""; - String connectTrap2 = ""; - String trapCount2 = ""; + String trigger2 = ""; if(((LinkedHashMap) object).keySet().contains("notBox")){ notBox = ((LinkedHashMap) object).get("notBox").toString(); } - if(((LinkedHashMap) object).get("connectTrap1") != null){ - connectTrap1 = ((LinkedHashMap) object).get("connectTrap1").toString(); - } - if(((LinkedHashMap) object).get("trapCount1") != null){ - trapCount1 = ((LinkedHashMap) object).get("trapCount1").toString(); + if(((LinkedHashMap) object).get("trigger1") != null){ + trigger1 = ((LinkedHashMap) object).get("trigger1").toString(); } if(((LinkedHashMap) object).get("operatorBox") != null){ operatorBox = ((LinkedHashMap) object).get("operatorBox").toString(); } - if(((LinkedHashMap) object).get("connectTrap2") != null){ - connectTrap2 = ((LinkedHashMap) object).get("connectTrap2").toString(); + if(((LinkedHashMap) object).get("trigger2") != null){ + trigger2 = ((LinkedHashMap) object).get("trigger2").toString(); } - if(((LinkedHashMap) object).get("trapCount2") != null){ - trapCount2 = ((LinkedHashMap) object).get("trapCount2").toString(); - } - connectBody = notBox + "@!" + connectTrap1 + "@!" + trapCount1 + "@!" + operatorBox + "@!" + connectTrap2 + "@!" + trapCount2 + "#!?!"; + connectBody = notBox + "@!" + trigger1 + "@!" + operatorBox + "@!" + trigger2 + "#!"; } - resultBody.append(connectBody); + signatureBody.append(connectBody); } - connectMainBody = connectMainBody + resultBody; - return connectMainBody; + triggerBody.append(signatureBody + "?!"); } - - - // get Trigger signature from JSON body - @SuppressWarnings({ "rawtypes", "unchecked" }) - private String getUITriggerSignature(String trap, Object object2) { - StringBuilder triggerBody = new StringBuilder(); - TrapDatas trapDatas = (TrapDatas) object2; - ArrayList attributeList = new ArrayList<>(); - // Read the Trap - if(trap.startsWith("Trap")){ - if(trapDatas.getTrap1()!= null){ - attributeList.add(trapDatas.getTrap1()); - } - if(trapDatas.getTrap2()!= null){ - attributeList.add(trapDatas.getTrap2()); - } - if(trapDatas.getTrap3()!= null){ - attributeList.add(trapDatas.getTrap3()); - } - if(trapDatas.getTrap4()!= null){ - attributeList.add(trapDatas.getTrap4()); - } - if(trapDatas.getTrap5()!= null){ - attributeList.add(trapDatas.getTrap5()); - } - if(trapDatas.getTrap6()!= null){ - attributeList.add(trapDatas.getTrap6()); - } - }else{ - if(trap.startsWith("Fault")){ - if(trapDatas.getTrap1()!= null){ - attributeList.add(trapDatas.getTrap1()); - } - if(trapDatas.getTrap2()!= null){ - attributeList.add(trapDatas.getTrap2()); - } - if(trapDatas.getTrap3()!= null){ - attributeList.add(trapDatas.getTrap3()); - } - if(trapDatas.getTrap4()!= null){ - attributeList.add(trapDatas.getTrap4()); - } - if(trapDatas.getTrap5()!= null){ - attributeList.add(trapDatas.getTrap5()); - } - if(trapDatas.getTrap6()!= null){ - attributeList.add(trapDatas.getTrap6()); - } - } - } - - for(int j = 0; j < attributeList.size(); j++){ - StringBuilder signatureBody = new StringBuilder(); - ArrayList connectTraps = (ArrayList) attributeList.get(j); - for(int i =0 ; i < connectTraps.size(); i++){ - String connectBody = ""; - Object object = connectTraps.get(i); - if(object instanceof LinkedHashMap){ - String notBox = ""; - String trigger1 = ""; - String operatorBox = ""; - String trigger2 = ""; - if(((LinkedHashMap) object).keySet().contains("notBox")){ - notBox = ((LinkedHashMap) object).get("notBox").toString(); - } - if(((LinkedHashMap) object).get("trigger1") != null){ - trigger1 = ((LinkedHashMap) object).get("trigger1").toString(); - } - if(((LinkedHashMap) object).get("operatorBox") != null){ - operatorBox = ((LinkedHashMap) object).get("operatorBox").toString(); - } - if(((LinkedHashMap) object).get("trigger2") != null){ - trigger2 = ((LinkedHashMap) object).get("trigger2").toString(); - } - connectBody = notBox + "@!" + trigger1 + "@!" + operatorBox + "@!" + trigger2 + "#!"; - } - signatureBody.append(connectBody); - } - triggerBody.append(signatureBody + "?!"); - } - - return triggerBody.toString(); - } + return triggerBody.toString(); + } public void prePopulateClosedLoopFaultPolicyData(PolicyRestAdapter policyAdapter, PolicyEntity entity) { if (policyAdapter.getPolicyData() instanceof PolicyType) { @@ -515,7 +516,7 @@ public class CreateClosedLoopFaultController extends RestrictedBaseController{ try{ description = policy.getDescription().substring(0, policy.getDescription().indexOf("@CreatedBy:")); }catch(Exception e){ - policyLogger.error("Error during collecting the description tag info for createClosedLoopFault " + policyNameValue , e); + policyLogger.error("Error during collecting the description tag info for createClosedLoopFault " + policyNameValue , e); description = policy.getDescription(); } policyAdapter.setPolicyDescription(description); @@ -548,7 +549,7 @@ public class CreateClosedLoopFaultController extends RestrictedBaseController{ String value = (String) attributeValue.getContent().get(0); AttributeDesignatorType designator = match.getAttributeDesignator(); String attributeId = designator.getAttributeId(); - + // First match in the target is OnapName, so set that value. if ("ONAPName".equals(attributeId)) { policyAdapter.setOnapName(value); @@ -611,51 +612,6 @@ public class CreateClosedLoopFaultController extends RestrictedBaseController{ } -class TrapDatas{ - private ArrayList trap1; - private ArrayList trap2; - private ArrayList trap3; - private ArrayList trap4; - private ArrayList trap5; - private ArrayList trap6; - public ArrayList getTrap1() { - return trap1; - } - public void setTrap1(ArrayList trap1) { - this.trap1 = trap1; - } - public ArrayList getTrap2() { - return trap2; - } - public void setTrap2(ArrayList trap2) { - this.trap2 = trap2; - } - public ArrayList getTrap3() { - return trap3; - } - public void setTrap3(ArrayList trap3) { - this.trap3 = trap3; - } - public ArrayList getTrap4() { - return trap4; - } - public void setTrap4(ArrayList trap4) { - this.trap4 = trap4; - } - public ArrayList getTrap5() { - return trap5; - } - public void setTrap5(ArrayList trap5) { - this.trap5 = trap5; - } - public ArrayList getTrap6() { - return trap6; - } - public void setTrap6(ArrayList trap6) { - this.trap6 = trap6; - } -} - class ClosedLoopGridJSONData{ private String clearTimeOut; @@ -682,7 +638,7 @@ class ClosedLoopGridJSONData{ public void setVerificationclearTimeOut(String verificationclearTimeOut) { this.verificationclearTimeOut = verificationclearTimeOut; } - + public ArrayList getConnecttriggerSignatures() { return connecttriggerSignatures; diff --git a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateDcaeMicroServiceController.java b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateDcaeMicroServiceController.java index 431482d40..d1043f709 100644 --- a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateDcaeMicroServiceController.java +++ b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/CreateDcaeMicroServiceController.java @@ -701,6 +701,7 @@ public class CreateDcaeMicroServiceController extends RestrictedBaseController { //List Datatype Set keys= keyValues.keySet(); Iterator itr=keys.iterator(); + boolean isDefinedType = false; while(itr.hasNext()){ String key= itr.next(); if(!("type").equals(key) ||("required").equals(key)) @@ -713,18 +714,19 @@ public class CreateDcaeMicroServiceController extends RestrictedBaseController { constraints.add(keyValues.get(key)); } }else{ - //This is user defined string + //This is user defined type String trimValue=value.substring(value.lastIndexOf('.')+1); StringBuilder referenceIndividualStringBuilder= new StringBuilder(); referenceIndividualStringBuilder.append(keySetString+"="+trimValue+":MANY-true"); referenceStringBuilder.append(referenceIndividualStringBuilder+","); + isDefinedType = true; } } } - if(keyValues.get("type").equalsIgnoreCase(LIST) && - (constraints == null || constraints.isEmpty()) ) { + if(!isDefinedType && keyValues.get("type").equalsIgnoreCase(LIST) && + (constraints == null || constraints.isEmpty()) ) { //type is list but no constraints defined. referenceStringBuilder.append(keySetString+"=MANY-true"+","); } }else{ diff --git a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/PDPController.java b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/PDPController.java index 7966af15b..a8a427970 100644 --- a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/PDPController.java +++ b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/PDPController.java @@ -348,8 +348,8 @@ public class PDPController extends RestrictedBaseController { PrintWriter out = response.getWriter(); refreshGroups(request); - String responseString = mapper.writeValueAsString(groups); - JSONObject j = new JSONObject("{pdpEntityDatas: " + responseString + "}"); + JsonMessage msg = new JsonMessage(mapper.writeValueAsString(groups)); + JSONObject j = new JSONObject(msg); out.write(j.toString()); } catch (Exception e){ diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/Windows/Dictionary/CLSiteDictionary.html b/POLICY-SDK-APP/src/main/webapp/app/policyApp/Windows/Dictionary/CLSiteDictionary.html index 569f7bf5d..02175f92e 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/Windows/Dictionary/CLSiteDictionary.html +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/Windows/Dictionary/CLSiteDictionary.html @@ -23,10 +23,6 @@ diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/pdpController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/pdpController.js index cab5d26c0..966a0913e 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/pdpController.js +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/pdpController.js @@ -53,14 +53,7 @@ app.controller('pdpTabController', function ($scope, PolicyAppService, modalServ $scope.editPdpGroupId = true; } } - - PolicyAppService.getData('get_PDPGroupData').then(function(data){ - var j = data; - $scope.pdpdatas = JSON.parse(j.data); - console.log($scope.pdpdatas); - },function(error){ - console.log("failed"); - }); + getPDPGroups(); },function (error) { console.log("failed"); }); @@ -77,7 +70,6 @@ app.controller('pdpTabController', function ($scope, PolicyAppService, modalServ }; $scope.editPDPGroup = null; - var dialog = null; $scope.editPDPGroupFunctionPopup = function(pdpGroupData) { $scope.editPDPGroup = pdpGroupData; $( "#dialog" ).dialog({ @@ -87,8 +79,9 @@ app.controller('pdpTabController', function ($scope, PolicyAppService, modalServ $scope.editPDPGroupFunctionModalPopup = function(pdpGroupData) { $scope.editPDPGroup = pdpGroupData; + var modalInstance; if($scope.userRolesDatas[0] == 'super-guest' || $scope.userRolesDatas[0] == 'guest'){ - var modalInstance = $modal.open({ + modalInstance = $modal.open({ backdrop: 'static', keyboard: false, templateUrl: 'show_policies_pdp_group_popup.html', controller: 'editPDPGrouppopupController', @@ -102,7 +95,7 @@ app.controller('pdpTabController', function ($scope, PolicyAppService, modalServ } }); }else{ - var modalInstance = $modal.open({ + modalInstance = $modal.open({ backdrop: 'static', keyboard: false, templateUrl: 'edit_pdp_group_popup.html', controller: 'editPDPGrouppopupController', @@ -118,10 +111,20 @@ app.controller('pdpTabController', function ($scope, PolicyAppService, modalServ } modalInstance.result.then(function(response){ console.log('response', response); - $scope.pdpdatas=response.data; + getPDPGroups(); }); }; + function getPDPGroups(){ + PolicyAppService.getData('get_PDPGroupData').then(function(data){ + var j = data; + $scope.pdpdatas = JSON.parse(j.data); + console.log($scope.pdpdatas); + },function(error){ + console.log("failed"); + }); + } + $scope.addNewPDPGroupPopUpWindow = function(editPDPGroup) { $scope.editPDPGroup = null; var modalInstance = $modal.open({ @@ -161,9 +164,8 @@ app.controller('pdpTabController', function ($scope, PolicyAppService, modalServ dataType: 'json', contentType: 'application/json', data: JSON.stringify(postData), - success : function(data){ - $scope.$apply(function(){$scope.pdpdata=data.data;}); - $scope.pdpdatas=JSON.parse(data.data); + success : function(response){ + $scope.$apply(function(){$scope.pdpdatas=JSON.parse(response.data);}); }, error : function(data){ console.log(data); diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/pdpGroupPopUpController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/pdpGroupPopUpController.js index 4b2747635..0e28dc09f 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/pdpGroupPopUpController.js +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/controller/pdpGroupPopUpController.js @@ -18,15 +18,16 @@ * ============LICENSE_END========================================================= */ app.controller('editPDPGrouppopupController' , function ($scope, $modalInstance, message, modalService, $modal, Notification){ - if(message.pdpGroupData==null) + if(message.pdpGroupData==null){ $scope.label='Add New PDP Group' - else{ - $scope.label='Edit PDP Group' - $scope.disableCd=true; - $scope.policies = message.pdpGroupData.policies; - $scope.pdps = message.pdpGroupData.pdps; - $scope.selectedPdp = message.pdpGroupData; - } + }else{ + $scope.label='Edit PDP Group' + $scope.disableCd=true; + $scope.policies = message.pdpGroupData.policies; + $scope.pdps = message.pdpGroupData.pdps; + $scope.selectedPdp = message.pdpGroupData; + } + $scope.editPDPGroup = message.pdpGroupData; $scope.policiesGrid = { @@ -76,7 +77,7 @@ app.controller('editPDPGrouppopupController' , function ($scope, $modalInstance }); modalInstance.result.then(function(response){ console.log('response', response); - $scope.data=response.data; + refreshPDPGroupDatas(response); }); }; @@ -98,34 +99,34 @@ app.controller('editPDPGrouppopupController' , function ($scope, $modalInstance }); modalInstance.result.then(function(response){ console.log('response', response); - $scope.data=response.data; + refreshPDPGroupDatas(response); }); }; $scope.deletePDPFromGroup = function(data){ modalService.popupConfirmWin("Confirm","You are about to delete the PDP Group : "+data.name+". Do you want to continue?", - function(){ - var uuu = "pdp_Group/remove_pdpFromGroup.htm"; - var postData={data: data, - activePDP : $scope.selectedPdp}; - $.ajax({ - type : 'POST', - url : uuu, - dataType: 'json', - contentType: 'application/json', - data: JSON.stringify(postData), - success : function(data){ - $scope.$apply(function(){$scope.data=data.data;}); - Notification.success("PDP Group Deleted Successfully"); - }, - error : function(data){ - console.log(data); - Notification.error("Error Occured While Deleting a PDP Group") - //modalService.showFailure("Fail","Error while deleting: "+ data.responseText); - } - }); - - }) + function(){ + var uuu = "pdp_Group/remove_pdpFromGroup.htm"; + var postData={data: data, + activePDP : $scope.selectedPdp}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + refreshPDPGroupDatas(data); + }); + Notification.success("PDP Group Deleted Successfully"); + }, + error : function(data){ + console.log(data); + Notification.error("Error Occured While Deleting a PDP Group"); + } + }); + }) }; $scope.statusOfPDP = function(status){ @@ -167,10 +168,23 @@ app.controller('editPDPGrouppopupController' , function ($scope, $modalInstance $modalInstance.close({data:$scope.data}); }, error : function(data){ - alert("Error while saving."); + Notification.error("Error while saving PDP Group."); } }); }; + + function refreshPDPGroupDatas(response){ + $scope.selectedPDPName = $scope.selectedPdp.id; + if(response != undefined){ + $scope.data = JSON.parse(response.data); + for(var i=0; i< $scope.data.length; i++){ + if($scope.data[i].id === $scope.selectedPDPName){ + $scope.policies = $scope.data[i].policies; + $scope.pdps = $scope.data[i].pdps; + } + } + } + }; $scope.close = function() { $modalInstance.close(); diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/BaseConfigPolicyController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/BaseConfigPolicyController.js index 7425c92d4..02e10bddd 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/BaseConfigPolicyController.js +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/BaseConfigPolicyController.js @@ -82,14 +82,6 @@ app.controller('baseConfigController', ['$scope', 'PolicyAppService', 'policyNav }, function (error) { console.log("failed"); }); - - - function extend(obj, src) { - for (var key in src) { - if (src.hasOwnProperty(key)) obj[key] = src[key]; - } - return obj; - } $scope.savePolicy = function(policy){ if(policy.itemContent != undefined){ diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/ClosedLoopFaultController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/ClosedLoopFaultController.js index 1015e7aac..ebc9001ab 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/ClosedLoopFaultController.js +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/ClosedLoopFaultController.js @@ -529,64 +529,73 @@ angular.module("abs").controller('clFaultController', ['$scope', '$window', 'Pol } }; - $scope.saveFaultPolicy = function(policy){ - if(policy.itemContent != undefined){ - $scope.refreshCheck = true; - $scope.policyNavigator = policy.itemContent; - policy.itemContent = ""; - } - $scope.savebutton = false; + function trapData(){ var data = {}; - var faultData = {}; if($scope.temp.policy.triggerTrapSignatures.length == 1 || $scope.temp.policy.triggerTrapSignatures["Trap1"] != null){ - var data = {trap1 : $scope.temp.policy.triggerTrapSignatures.Trap1 } + data = {trap1 : $scope.temp.policy.triggerTrapSignatures.Trap1 } } if($scope.temp.policy.triggerTrapSignatures.length == 2 || $scope.temp.policy.triggerTrapSignatures["Trap2"] != null){ - var data = {trap1 : $scope.temp.policy.triggerTrapSignatures.Trap1, trap2 : $scope.temp.policy.triggerTrapSignatures.Trap2} + data = {trap1 : $scope.temp.policy.triggerTrapSignatures.Trap1, trap2 : $scope.temp.policy.triggerTrapSignatures.Trap2} } if($scope.temp.policy.triggerTrapSignatures.length == 3 || $scope.temp.policy.triggerTrapSignatures["Trap3"] != null){ - var data = {trap1 : $scope.temp.policy.triggerTrapSignatures.Trap1, trap2 : $scope.temp.policy.triggerTrapSignatures.Trap2, + data = {trap1 : $scope.temp.policy.triggerTrapSignatures.Trap1, trap2 : $scope.temp.policy.triggerTrapSignatures.Trap2, trap3 : $scope.temp.policy.triggerTrapSignatures.Trap3} } if($scope.temp.policy.triggerTrapSignatures.length == 4 || $scope.temp.policy.triggerTrapSignatures["Trap4"] != null){ - var data = {trap1 : $scope.temp.policy.triggerTrapSignatures.Trap1, trap2 : $scope.temp.policy.triggerTrapSignatures.Trap2, + data = {trap1 : $scope.temp.policy.triggerTrapSignatures.Trap1, trap2 : $scope.temp.policy.triggerTrapSignatures.Trap2, trap3 : $scope.temp.policy.triggerTrapSignatures.Trap3, trap4 : $scope.temp.policy.triggerTrapSignatures.Trap4} } if($scope.temp.policy.triggerTrapSignatures.length == 5 || $scope.temp.policy.triggerTrapSignatures["Trap5"] != null){ - var data = {trap1 : $scope.temp.policy.triggerTrapSignatures.Trap1, trap2 : $scope.temp.policy.triggerTrapSignatures.Trap2, + data = {trap1 : $scope.temp.policy.triggerTrapSignatures.Trap1, trap2 : $scope.temp.policy.triggerTrapSignatures.Trap2, trap3 : $scope.temp.policy.triggerTrapSignatures.Trap3, trap4 : $scope.temp.policy.triggerTrapSignatures.Trap4, trap5 : $scope.temp.policy.triggerTrapSignatures.Trap5} } if($scope.temp.policy.triggerTrapSignatures.length == 6 || $scope.temp.policy.triggerTrapSignatures["Trap6"] != null){ - var data = {trap1 : $scope.temp.policy.triggerTrapSignatures.Trap1, trap2 : $scope.temp.policy.triggerTrapSignatures.Trap2, + data = {trap1 : $scope.temp.policy.triggerTrapSignatures.Trap1, trap2 : $scope.temp.policy.triggerTrapSignatures.Trap2, trap3 : $scope.temp.policy.triggerTrapSignatures.Trap3, trap4 : $scope.temp.policy.triggerTrapSignatures.Trap4, trap5 : $scope.temp.policy.triggerTrapSignatures.Trap5, trap6 : $scope.temp.policy.triggerTrapSignatures.Trap6} - } - + } + return data; + } + + function faultDatas(){ + var faultData = {}; if($scope.temp.policy.triggerfaultSignatures.length == 1 || $scope.temp.policy.triggerfaultSignatures["Fault1"] != null){ - var faultData = {trap1 : $scope.temp.policy.triggerfaultSignatures.Fault1 } + faultData = {trap1 : $scope.temp.policy.triggerfaultSignatures.Fault1 } } if($scope.temp.policy.triggerfaultSignatures.length == 2 || $scope.temp.policy.triggerfaultSignatures["Fault2"] != null){ - var faultData = {trap1 : $scope.temp.policy.triggerfaultSignatures.Fault1, trap2 : $scope.temp.policy.triggerfaultSignatures.Fault2} + faultData = {trap1 : $scope.temp.policy.triggerfaultSignatures.Fault1, trap2 : $scope.temp.policy.triggerfaultSignatures.Fault2} } if($scope.temp.policy.triggerfaultSignatures.length == 3 || $scope.temp.policy.triggerfaultSignatures["Fault3"] != null){ - var faultData = {trap1 : $scope.temp.policy.triggerfaultSignatures.Fault1, trap2 : $scope.temp.policy.triggerfaultSignatures.Fault2, + faultData = {trap1 : $scope.temp.policy.triggerfaultSignatures.Fault1, trap2 : $scope.temp.policy.triggerfaultSignatures.Fault2, trap3 : $scope.temp.policy.triggerfaultSignatures.Fault3} } if($scope.temp.policy.triggerTrapSignatures.length == 4 || $scope.temp.policy.triggerfaultSignatures["Fault4"] != null){ - var faultData = {trap1 : $scope.temp.policy.triggerfaultSignatures.Fault1, trap2 : $scope.temp.policy.triggerfaultSignatures.Fault2, + faultData = {trap1 : $scope.temp.policy.triggerfaultSignatures.Fault1, trap2 : $scope.temp.policy.triggerfaultSignatures.Fault2, trap3 : $scope.temp.policy.triggerfaultSignatures.Fault3, trap4 : $scope.temp.policy.triggerfaultSignatures.Fault4} } if($scope.temp.policy.triggerfaultSignatures.length == 5 || $scope.temp.policy.triggerfaultSignatures["Fault5"] != null){ - var faultData = {trap1 : $scope.temp.policy.triggerfaultSignatures.Fault1, trap2 : $scope.temp.policy.triggerfaultSignatures.Fault2, + faultData = {trap1 : $scope.temp.policy.triggerfaultSignatures.Fault1, trap2 : $scope.temp.policy.triggerfaultSignatures.Fault2, trap3 : $scope.temp.policy.triggerfaultSignatures.Fault3, trap4 : $scope.temp.policy.triggerfaultSignatures.Fault4, trap5 : $scope.temp.policy.triggerfaultSignatures.Fault5} } if($scope.temp.policy.triggerfaultSignatures.length == 6 || $scope.temp.policy.triggerfaultSignatures["Fault6"] != null){ - var faultData = {trap1 : $scope.temp.policy.triggerfaultSignatures.Fault1, trap2 : $scope.temp.policy.triggerfaultSignatures.Fault2, + faultData = {trap1 : $scope.temp.policy.triggerfaultSignatures.Fault1, trap2 : $scope.temp.policy.triggerfaultSignatures.Fault2, trap3 : $scope.temp.policy.triggerfaultSignatures.Fault3, trap4 : $scope.temp.policy.triggerfaultSignatures.Fault4, trap5 : $scope.temp.policy.triggerfaultSignatures.Fault5, trap6 : $scope.temp.policy.triggerfaultSignatures.Fault6} } + return faultData; + } + + $scope.saveFaultPolicy = function(policy){ + if(policy.itemContent != undefined){ + $scope.refreshCheck = true; + $scope.policyNavigator = policy.itemContent; + policy.itemContent = ""; + } + $scope.savebutton = false; + var data = trapData(); + var faultData = faultDatas(); var uuu = "policycreation/save_policy"; var postData={policyData: policy, trapData : data, @@ -627,7 +636,9 @@ angular.module("abs").controller('clFaultController', ['$scope', '$window', 'Pol console.log(policy); document.getElementById("validate").innerHTML = ""; var uuu = "policyController/validate_policy.htm"; - var postData={policyData: policy}; + var data = trapData(); + var faultData = faultDatas(); + var postData={policyData: policy, trapData : data, faultData : faultData}; $.ajax({ type : 'POST', url : uuu, 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 5ae453aef..2b3b743d4 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 @@ -165,7 +165,7 @@ angular.module('abs').controller('dcaeMicroServiceController', ['$scope', '$wind $scope.choices = []; $scope.attributeDatas = [{"attributes" : $scope.choices}]; - + $scope.isInitEditTemplate = true; //just initially create the edit template, didn't click add button yet. $scope.addNewChoice = function(value) { console.log(value); if(value != undefined){ @@ -176,12 +176,23 @@ angular.module('abs').controller('dcaeMicroServiceController', ['$scope', '$wind var div = document.getElementById(value+"@0"); if(div != null){ var clone = div.cloneNode(true); - var addElement = parentElement.childElementCount + 1; + var addElement = parentElement.childElementCount; clone.id = ''+value+'@'+addElement; clone.value = ''; - clone.className += ' child_single'; //here cloned is single element - document.getElementById("div."+value).appendChild(clone); - plainAttributeKeys.push(''+value+'@'+addElement); + if($scope.temp.policy.editPolicy || $scope.temp.policy.readOnly){ //if it's view or edit + if($scope.temp.policy.ruleData[clone.id] || ($scope.temp.policy.editPolicy && !$scope.isInitEditTemplate)){ // Only append child if its value found in ruleData or edit mode + if($scope.temp.policy.ruleData[clone.id]){ + clone.value = $scope.temp.policy.ruleData[clone.id]; + } + clone.className += ' child_single'; //here cloned is single element + document.getElementById("div."+value).appendChild(clone); + plainAttributeKeys.push(''+value+'@'+addElement); + } + }else{ //not view or edit + clone.className += ' child_single'; //here cloned is single element + document.getElementById("div."+value).appendChild(clone); + plainAttributeKeys.push(''+value+'@'+addElement); + } }else{ div = document.getElementById("div."+value+"@0"); @@ -219,6 +230,7 @@ angular.module('abs').controller('dcaeMicroServiceController', ['$scope', '$wind plainAttributeKeys.push(inputs[i].id); } } else { +// removeValues.push(inputs[i].id); plainAttributeKeys.push(inputs[i].id); } }else { @@ -320,8 +332,9 @@ angular.module('abs').controller('dcaeMicroServiceController', ['$scope', '$wind var plainAttributeKeys = []; $scope.dcaeModelData = data[0].dcaeModelData; $scope.dcaeJsonDate = data[0].jsonValue; - $scope.allManyTrueKeys = data[0].allManyTrueKeys; - console.log("$scope.allManyTrueKeys: " + $scope.allManyTrueKeys); + if(data[0].allManyTrueKeys){ + console.log("$scope.allManyTrueKeys: " + $scope.allManyTrueKeys); + } console.log("$scope.dcaeJsonDate: " + $scope.dcaeJsonDate); var attributes = $scope.dcaeModelData.attributes; var refAttributes = $scope.dcaeModelData.ref_attributes; @@ -371,9 +384,15 @@ angular.module('abs').controller('dcaeMicroServiceController', ['$scope', '$wind }); - if($scope.temp.policy.editPolicy || $scope.temp.policy.readOnly){ + if($scope.temp.policy.editPolicy || $scope.temp.policy.readOnly){ // If it's veiw or edit + + if($scope.temp.policy.editPolicy){ + $scope.isInitEditTemplate = true; + } + var checkData = []; var data = []; + // If ruleData contains extra elements created by clicked add button if($scope.temp.policy.ruleData != null){ var propNames = Object.getOwnPropertyNames($scope.temp.policy.ruleData); propNames.forEach(function(name) { @@ -383,32 +402,36 @@ angular.module('abs').controller('dcaeMicroServiceController', ['$scope', '$wind var extraElements = data; if(plainAttributeKeys != null){ - for(b = 0; b < plainAttributeKeys.length; b++){ // remove already populated elements from extraElements array + for(b = 0; b < plainAttributeKeys.length; b++){ // Remove already populated elements from data array var newValue = plainAttributeKeys[b].split("*"); for(a = 0; a < data.length; a++){ - if(data[a] === newValue[0]){ + if(data[a] === newValue[0] || data[a] === (newValue[0]+"@0")){ extraElements.splice(a, 1); } } } - //--- populate these extral elements generated from clicking add button + //--- Populate these extra elements created by clicked add button for(a = 0; a < extraElements.length; a++){ if(extraElements[a].includes("@")){ var n = extraElements[a].lastIndexOf("@"); - var key = extraElements[a].substring(0, n+2); //include @x in key also by n+2 since x can be 1, or 2, or 3 - checkData.push(key); + if(n > 0){ + var key = extraElements[a].substring(0, n+2); //include @x in key also by n+2 since x can be 1, or 2, or 3 + checkData.push(key); + } } } var unique = checkData.filter(onlyUnique); for(i =0; i < unique.length; i++){ //remove @x and let addNewChoice add @1 or @2... var newKey = unique[i].substring(0, unique[i].length-2); + console.log("newKey: " + newKey); $scope.addNewChoice(newKey); } } } - + //After initially create the edit template, reset it to false. + $scope.isInitEditTemplate = false; } var ele = angular.element(document.getElementById("DynamicTemplate")); $compile(ele.contents())($scope); @@ -517,7 +540,7 @@ angular.module('abs').controller('dcaeMicroServiceController', ['$scope', '$wind if (lableList.length > 0){ array = true; } - if ( key=="0"){ + if ( key==="0"){ var newKey = lableList.pop(); $scope.labelLayout(baseLevel, newKey, array ); if (array){ @@ -597,7 +620,7 @@ angular.module('abs').controller('dcaeMicroServiceController', ['$scope', '$wind if (list.length===0){ //not dropdown element $scope.attributeBox(attributekey, array, attirbuteLabel, defaultValue, isRequired, "text"); }else{ - $scope.dropBoxLayout(attirbuteLabel, attributekey, array, dataTest[key], list); + $scope.dropBoxLayout(attirbuteLabel, attributekey, array, dataTest[key], list, isRequired); } break; } @@ -618,9 +641,9 @@ angular.module('abs').controller('dcaeMicroServiceController', ['$scope', '$wind var labeltext = null; var requiredLabName = ""; if (matching.includes(attibuteKey)){ - labeltext = document.createTextNode(attibuteKey + "*!"); + labeltext = document.createTextNode(attibuteKey + "*!"); + isRequired = true; //set required as true for matching element }else { - //var labeltext = document.createTextNode(refattributeLabel); if(isRequired){ requiredLabName = attibuteKey + " *"; labeltext = document.createTextNode(requiredLabName); @@ -656,7 +679,7 @@ angular.module('abs').controller('dcaeMicroServiceController', ['$scope', '$wind var checkKey; if(attributeManyKey){ checkKey = labelValue + attibuteKey+'@0'; - textField.setAttribute("id" , ''+labelValue + attibuteKey+'@0'+''); + textField.setAttribute("id" , ''+labelValue + attibuteKey+'@0'+''); var divTag = document.createElement("div"); divTag.setAttribute("id", "div."+ labelValue +attibuteKey); var addButton = document.createElement("BUTTON"); @@ -679,7 +702,10 @@ angular.module('abs').controller('dcaeMicroServiceController', ['$scope', '$wind var divTag = document.createElement("div"); divTag.setAttribute("id", id); document.getElementById(divID).appendChild(divTag); - textField.className += ' first_child'; + textField.className += ' first_child'; + if(isRequired){ + textField.setAttribute("required", "true"); + } divTag.appendChild(textField); document.getElementById(divID).appendChild(divTag); @@ -720,18 +746,6 @@ angular.module('abs').controller('dcaeMicroServiceController', ['$scope', '$wind if (attributeManyKey){ var newCheckKey = checkKey.replace(attibuteKey + '@0',attibuteKey); document.getElementById(newCheckKey +'@0').value = $scope.temp.policy.ruleData[newCheckKey +'@0']; - var i =1 ; - while(true){ - var newValue = $scope.temp.policy.ruleData[newCheckKey+'@'+i]; - if(newValue==null){ - break; - }else{ - $scope.addNewChoice(newCheckKey); - document.getElementById(newCheckKey+'@'+i).value = newValue; - i = i+1; - } - } - }else{ document.getElementById(checkKey).value = $scope.temp.policy.ruleData[checkKey]; } @@ -807,24 +821,24 @@ angular.module('abs').controller('dcaeMicroServiceController', ['$scope', '$wind var label = document.createElement("Label") + + var refAttributes = $scope.dcaeModelData.ref_attributes; + if(isRequired != true && refAttributes){ //check refAttributes also + var refAttributesList = refAttributes.split(splitComma); + for (k = 0; k < refAttributesList.length; k++){ + var refAttribute = refAttributesList[k].split(splitEqual); + if (attributeName == refAttribute[0].trim() && refAttribute[1].includes("required-true")){ + isRequired = true; + } + } + } + if (matching.includes(attributeName)){ var labeltext = document.createTextNode(attributeName + "*!"); label.appendChild(labeltext); + isRequired = true; //set required as true for matching element }else { - var labeltext = document.createTextNode(attributeName); - var isRequired = false; - var refAttributes = $scope.dcaeModelData.ref_attributes; - if(refAttributes){ - var refAttributesList = refAttributes.split(splitComma); - for (k = 0; k < refAttributesList.length; k++){ - var refAttribute = refAttributesList[k].split(splitEqual); - - if (attributeName == refAttribute[0].trim() && refAttribute[1].includes("required-true")){ - isRequired = true; - } - } - } - + var labeltext = document.createTextNode(attributeName); if(isRequired){ requiredLabName = attributeName+ " *"; labeltext = document.createTextNode(requiredLabName); @@ -844,9 +858,11 @@ angular.module('abs').controller('dcaeMicroServiceController', ['$scope', '$wind if(isRequired){ listField.setAttribute("required", true); } - var optionFirst = document.createElement('option'); - optionFirst.setAttribute('value', ""); - listField.appendChild(optionFirst); + if( many != true || isRequired != true){ // add an empty option for not required or not multiple select element + var optionFirst = document.createElement('option'); + optionFirst.setAttribute('value', ""); + listField.appendChild(optionFirst); + } for (i=0; i < listemunerateValues.length; i += 1) { option = document.createElement('option'); 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 313015d8e..3aa0508d5 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 @@ -7,12 +7,13 @@ class="form-control" ng-disabled="temp.policy.readOnly" ng-readonly="temp.policy.editPolicy" ng-model="temp.policy.policyName" required pattern="\S+" - title="Enter the Policy Name without any spaces" /> + title="Enter Policy Name without any spaces and special characters and will accept _." />
+ ng-model="temp.policy.policyDescription" + title="Description field will accept any type of data."/>
@@ -20,7 +21,7 @@

@@ -31,18 +32,19 @@
+ placeholder="Attribute Value" title="Enter the Attribute Value without any spaces and special characters"/>
@@ -56,7 +58,7 @@
@@ -75,7 +77,7 @@ ng-disabled="temp.policy.readOnly" ng-model="ruleAlgorithmschoice.dynamicRuleAlgorithmField1" ng-options="option for option in attributeDictionaryDatas track by option" - name="dynamicRuleAlgorithmField1"> + name="dynamicRuleAlgorithmField1" title="Select the dropdown value driven from Attribute (common)Dictionary.">
@@ -84,7 +86,7 @@ ng-disabled="temp.policy.readOnly" ng-model="ruleAlgorithmschoice.dynamicRuleAlgorithmCombo" ng-options="option for option in functionDefinitionDatas" - name="dynamicRuleAlgorithmCombo"> + name="dynamicRuleAlgorithmCombo" title="Select the dropdown value driven from FunctionDataType."> @@ -92,12 +94,12 @@ + name="dynamicRuleAlgorithmField2" title="Enter the Value without any spaces and special characters and for rule formation use A1, A2,..etc., based on above Rules."/>
@@ -110,7 +112,7 @@

@@ -120,7 +122,7 @@ class="form-control" ng-disabled="temp.policy.readOnly" ng-model="temp.policy.actionAttributeValue" - ng-options="option for option in actionPolicyDictionaryDatas track by option"> + ng-options="option for option in actionPolicyDictionaryDatas track by option" title="Select the dropdown value driven from Action (Action)Dictionary.">
@@ -129,11 +131,11 @@ diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/BRMSParamPolicyTemplate.html b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/BRMSParamPolicyTemplate.html index d941c2404..24994d3da 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/BRMSParamPolicyTemplate.html +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/BRMSParamPolicyTemplate.html @@ -8,12 +8,13 @@ class="form-control" ng-disabled="temp.policy.readOnly" ng-readonly="temp.policy.editPolicy" ng-model="temp.policy.policyName" required pattern="\S+" - title="Enter the Policy Name without any spaces" /> + title="Enter Policy Name without any spaces and special characters and will accept _." />
+ ng-model="temp.policy.policyDescription" + title="Description field will accept any type of data."/>
@@ -22,13 +23,13 @@ class="form-control" ng-disabled="temp.policy.readOnly" ng-model="temp.policy.riskType" ng-options="option for option in riskTypeDictionaryDatas track by option" - required pattern="\S+" title="RiskType is required"> + required pattern="\S+" title="Select the dropdown value driven from RiskType (Safe Policy)Dictionary.">
+ required pattern="\S+" title="Select the dropdown Guard value.">
@@ -48,19 +49,19 @@
+ ng-model="temp.policy.ttlDate" title="Select the date from calender onclick on the field."/>
+ ng-options="option for option in brmsControllerDatas track by option" title="Select the dropdown value driven from BRMS Controller (BRMS)Dictionary.">
+ ng-options="option for option in brmsDependencyDatas track by option" title="Select the dropdown value driven from BRMS Dependency (BRMS)Dictionary.">
@@ -69,7 +70,7 @@
@@ -79,17 +80,17 @@
@@ -104,7 +105,7 @@ class="form-control" ng-disabled="temp.policy.readOnly" ng-model="temp.policy.ruleName" ng-options="option for option in brmsParamDictionaryDatas track by option" - ng-click="addDataToFields(temp.policy.ruleName);"> + ng-click="addDataToFields(temp.policy.ruleName);" title="Select the dropdown value driven from BRMSParamTemplate (BRMS)Dictionary">
@@ -129,7 +130,7 @@

Rule Preview:


- +
@@ -137,14 +138,14 @@
+ ng-click="validatePolicy(temp.policy);" title="Validate the data entered in the Policy fields.">Validate - + ng-click="saveBrmsParamPolicy(temp);" title="Save the Policy with validated data.">Save +
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/BRMSRawPolicyTemplate.html b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/BRMSRawPolicyTemplate.html index 8751768c0..bb94f33c5 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/BRMSRawPolicyTemplate.html +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/BRMSRawPolicyTemplate.html @@ -7,12 +7,13 @@ class="form-control" ng-disabled="temp.policy.readOnly" ng-readonly="temp.policy.editPolicy" ng-model="temp.policy.policyName" required pattern="\S+" - title="Enter the Policy Name without any spaces" /> + title="Enter Policy Name without any spaces and special characters and will accept _." />
+ ng-model="temp.policy.policyDescription" + title="Description field will accept any type of data."/>
@@ -21,13 +22,13 @@ class="form-control" ng-disabled="temp.policy.readOnly" ng-model="temp.policy.riskType" ng-options="option for option in riskTypeDictionaryDatas track by option" - required pattern="\S+" title="RiskType is required"> + required pattern="\S+" title="Select the dropdown value driven from RiskType (Safe Policy)Dictionary.">
+ required pattern="\S+" title="Select the dropdown Guard value.">
@@ -47,19 +48,19 @@
+ ng-model="temp.policy.ttlDate" title="Select the date from calender onclick on the field."/>
+ ng-options="option for option in brmsControllerDatas track by option" title="Select the dropdown value driven from BRMS Controller (BRMS)Dictionary.">
+ ng-options="option for option in brmsDependencyDatas track by option" title="Select the dropdown value driven from BRMS Dependency (BRMS)Dictionary.">
@@ -68,7 +69,7 @@
@@ -78,17 +79,17 @@
@@ -101,7 +102,7 @@
@@ -112,11 +113,11 @@
+ ng-click="validatePolicy(temp.policy);" title="Validate the data entered in the Policy fields.">Validate - + ng-click="saveBrmsRawPolicy(temp);" title="Save the Policy with validated data.">Save +
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/BasePolicyTemplate.html b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/BasePolicyTemplate.html index c81a98d9b..682abaada 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/BasePolicyTemplate.html +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/BasePolicyTemplate.html @@ -7,12 +7,13 @@ class="form-control" ng-disabled="temp.policy.readOnly" ng-readonly="temp.policy.editPolicy" ng-model="temp.policy.policyName" required pattern="\S+" - title="Enter the Policy Name without any spaces" /> + title="Enter Policy Name without any spaces and special characters and will accept _." />
+ ng-model="temp.policy.policyDescription" + title="Description field will accept any type of data." />
@@ -21,18 +22,20 @@ class="form-control" ng-disabled="temp.policy.readOnly" ng-model="temp.policy.onapName" ng-options="option for option in onapNameDictionaryDatas track by option" - required pattern="\S+" title="OnapName is required"> + required pattern="\S+" + title="Select the dropdown value driven from OnapName (common)Dictionary.">
+ title="Enter the Config Name without any spaces and special characters." />
+ ng-model="temp.policy.ttlDate" + title="Select the date from calender onclick on the field."/>
@@ -42,13 +45,13 @@ class="form-control" ng-disabled="temp.policy.readOnly" ng-model="temp.policy.riskType" ng-options="option for option in riskTypeDictionaryDatas track by option" - required pattern="\S+" title="RiskType is required"> + required pattern="\S+" title="Select the dropdown value driven from RiskType (Safe Policy)Dictionary.">
+ required pattern="\S+" title="Select the dropdown Guard value.">
@@ -70,7 +73,7 @@
@@ -81,18 +84,19 @@
+ ng-options="option for option in attributeDictionaryDatas track by option" + title="Select the dropdown value driven from Attribute (common)Dictionary.">
+ title="Enter the Attribute Value without any spaces and special characters" />
@@ -106,7 +110,7 @@ + required title="Enter the ConfigBody based on ConfigType Selection"> @@ -129,10 +133,10 @@ 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 0912ac2eb..d3700c94b 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 @@ -7,12 +7,13 @@ class="form-control" ng-disabled="temp.policy.readOnly" ng-readonly="temp.policy.editPolicy" ng-model="temp.policy.policyName" required pattern="\S+" - title="Enter the Policy Name without any spaces" /> + title="Enter Policy Name without any spaces and special characters and will accept _." />
+ ng-model="temp.policy.policyDescription" + title="Description field will accept any type of data."/>
@@ -21,13 +22,13 @@ class="form-control" ng-disabled="temp.policy.readOnly" ng-model="temp.policy.riskType" ng-options="option for option in riskTypeDictionaryDatas track by option" - required pattern="\S+" title="RiskType is required"> + required pattern="\S+" title="Select the dropdown value driven from RiskType (Safe Policy)Dictionary.">
+ required pattern="\S+" title="Select the dropdown Guard value.">
@@ -47,7 +48,7 @@ class="form-control" ng-disabled="temp.policy.readOnly" ng-model="temp.policy.onapName" ng-options="option for option in onapNameDictionaryDatas track by option" - required pattern="\S+" title="OnapName is required"> + required pattern="\S+" title="Select the dropdown value driven from OnapName (common)Dictionary.">
@@ -55,7 +56,8 @@
@@ -63,7 +65,8 @@ @@ -84,7 +87,7 @@
+ ng-model="temp.policy.ttlDate" title="Select the date from calender onclick on the field."/>
@@ -95,12 +98,14 @@
@@ -112,12 +117,14 @@
@@ -138,7 +145,8 @@ @@ -152,7 +160,8 @@ @@ -170,7 +179,7 @@
@@ -189,7 +198,8 @@
@@ -206,7 +216,8 @@
@@ -218,7 +229,7 @@
@@ -228,16 +239,15 @@
-
-
Trap Max Age:
+ ng-init="temp.policy.jsonBodyData.trapMaxAge='300'" value="300" title="Enter the Trap Max Age value and the value should be numeric."/>
@@ -248,7 +258,8 @@
@@ -256,25 +267,25 @@
+ class="form-control" required title="Enter the Time Interval value and the value should be numeric."/>

+ class="form-control" required title="Enter the App-C Timeout value and the value should be numeric."/>

+ class="form-control" required title="Enter the Timeout for Ruby value and the value should be numeric."/>

+ required title="Enter the Number of retries value and the value should be numeric."/>
@@ -282,20 +293,20 @@
+ class="form-control" required title="Enter the Aging Window value and the value should be numeric."/>

+ required title="Enter the UEB Message value."/>

+ class="form-control" required title="Enter the email address for multiple use comma seperated value."/>
@@ -307,7 +318,8 @@ class="form-control" ng-disabled="temp.policy.readOnly" ng-model="temp.policy.jsonBodyData.pepName" ng-options="option for option in pepOptionsDictionaryDatas track by option" - ng-change="getPepActionValues(temp.policy.jsonBodyData.pepName)"> + ng-change="getPepActionValues(temp.policy.jsonBodyData.pepName)" + title="Select the dropdown value driven from PEP Options (ClosedLoop)Dictionary."> @@ -315,7 +327,8 @@
@@ -329,12 +342,14 @@
@@ -346,12 +361,14 @@ @@ -372,7 +389,8 @@ @@ -386,7 +404,8 @@ @@ -403,7 +422,7 @@
@@ -422,7 +441,8 @@
@@ -439,7 +459,8 @@
@@ -451,7 +472,7 @@
@@ -461,11 +482,11 @@
-
Clear TimeOut:
+ class="form-control" required title="Enter the Cleartimeout value and the value should be numeric."/>
@@ -493,11 +514,11 @@ \ No newline at end of file diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/ClosedLoopPMPolicyTemplate.html b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/ClosedLoopPMPolicyTemplate.html index 4e7cad3fd..b743224fb 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/ClosedLoopPMPolicyTemplate.html +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/ClosedLoopPMPolicyTemplate.html @@ -7,12 +7,13 @@ class="form-control" ng-disabled="temp.policy.readOnly" ng-readonly="temp.policy.editPolicy" ng-model="temp.policy.policyName" required pattern="\S+" - title="Enter the Policy Name without any spaces" /> + title="Enter Policy Name without any spaces and special characters and will accept _."/>
+ ng-model="temp.policy.policyDescription" + title="Description field will accept any type of data."/>
@@ -21,18 +22,18 @@ class="form-control" ng-disabled="temp.policy.readOnly" ng-model="temp.policy.onapName" ng-options="option for option in onapNameDictionaryDatas track by option" - required pattern="\S+" title="OnapName is required"> + required pattern="\S+" title="Select the dropdown value driven from OnapName (common)Dictionary.">
+ ng-model="temp.policy.ttlDate" title="Select the date from calender onclick on the field."/>
@@ -41,7 +42,7 @@ class="form-control" ng-disabled="temp.policy.readOnly" ng-model="temp.policy.riskType" ng-options="option for option in riskTypeDictionaryDatas track by option" - required pattern="\S+" title="RiskType is required"> + required pattern="\S+" title="Select the dropdown value driven from RiskType (Safe Policy)Dictionary.">
@@ -49,7 +50,7 @@ + ng-click="addDataToFields(temp.policy.serviceTypePolicyName);" + title="Select the Service Type PolicyName from dropdown value.">
@@ -125,7 +127,8 @@
+ ng-model="temp.policy.jsonBodyData.geoLink" + title="Enter the UEB Message value."/>
@@ -133,7 +136,8 @@
+ ng-model="temp.policy.jsonBodyData.emailAddress" + title="Enter the email address and for multiple use comma seperated value."/>
@@ -144,11 +148,11 @@
+ ng-click="validatePolicy(temp.policy);" title="Validate the data entered in the Policy fields.">Validate - + ng-click="saveCLPMPolicy(temp);" title="Save the Policy with validated data.">Save +
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/DCAEMicroServicePolicyTemplate.html b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/DCAEMicroServicePolicyTemplate.html index 11472b96a..9ce936e4e 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/DCAEMicroServicePolicyTemplate.html +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/DCAEMicroServicePolicyTemplate.html @@ -7,12 +7,13 @@ class="form-control" ng-disabled="temp.policy.readOnly" ng-readonly="temp.policy.editPolicy" ng-model="temp.policy.policyName" required pattern="\S+" - title="Enter the Policy Name without any spaces" /> + title="Enter Policy Name without any spaces and special characters and will accept _." />
+ ng-model="temp.policy.policyDescription" + title="Description field will accept any type of data."/>
@@ -21,18 +22,18 @@ class="form-control" ng-disabled="temp.policy.readOnly" ng-model="temp.policy.onapName" ng-options="option for option in onapNameDictionaryDatas track by option" - required pattern="\S+" title="OnapName is required"> + required pattern="\S+" title="Select the dropdown value driven from OnapName (common)Dictionary.">
+ ng-model="temp.policy.ttlDate" title="Select the date from calender onclick on the field."/>
@@ -41,7 +42,7 @@ class="form-control" ng-disabled="temp.policy.readOnly" ng-model="temp.policy.riskType" ng-options="option for option in riskTypeDictionaryDatas track by option" - required pattern="\S+" title="RiskType is required"> + required pattern="\S+" title="Select the dropdown value driven from RiskType (Safe Policy)Dictionary.">
@@ -49,7 +50,7 @@ + ng-options="option for option in priorityDatas track by option" title="Select the dropdown Priority value.">
@@ -70,7 +71,8 @@ ng-model="temp.policy.serviceType" ng-options="option for option in microServiceModelsDictionaryDatas track by option" ng-init="pullVersion(temp.policy.serviceType);" - ng-click="pullVersion(temp.policy.serviceType);"> + ng-click="pullVersion(temp.policy.serviceType);" + title="Select the dropdown value driven from MicroService Models (MicroService Policy)Dictionary.">
+ ng-click="addDataToFields(temp.policy.serviceType, temp.policy.version);" + title="Select the dropdown value driven based on MicroService Models (MicroService Policy)Dictionary selection.">
@@ -93,26 +96,30 @@ class="form-control" class="form-control" ng-disabled="temp.policy.readOnly" ng-model="temp.policy.configName" - ng-options="option for option in microServiceCongigNameDictionaryDatas track by option" required="true"> + ng-options="option for option in microServiceCongigNameDictionaryDatas track by option" required="true" + title="Select the dropdown value driven from MicroService ConfigName (MicroService Policy)Dictionary.">

+ ng-options="option for option in microServiceLocationDictionaryDatas track by option" required="true" + title="Select the dropdown value driven from MicroService Location (MicroService Policy)Dictionary.">

+ ng-options="option for option in dcaeUUIDDictionaryDatas track by option" required="true" + title="Select the dropdown value driven from DCAE UUID (MicroService Policy)Dictionary.">

+ ng-options="option for option in groupPolicyScopeListDatas track by option" required="true" + title="Select the dropdown value driven from Group Policy Scope (Policy Scope)Dictionary.">
@@ -122,11 +129,11 @@ 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 60f3e6dc1..95bf68964 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 @@ -7,12 +7,13 @@ class="form-control" ng-disabled="temp.policy.readOnly" ng-readonly="temp.policy.editPolicy" ng-model="temp.policy.policyName" required pattern="\S+" - title="Enter the Policy Name without any spaces" /> + title="Enter Policy Name without any spaces and special characters and will accept _." />
+ ng-model="temp.policy.policyDescription" + title="Description field will accept any type of data."/>
@@ -21,7 +22,7 @@ class="form-control" ng-disabled="temp.policy.readOnly" ng-model="temp.policy.onapName" ng-options="option for option in onapNameDictionaryDatas track by option" - required pattern="\S+" title="OnapName is required"> + required pattern="\S+" title="Select the dropdown value driven from OnapName (common)Dictionary.">
+ placeholder="Service Type" title="Enter Service Type value."/>
@@ -56,7 +57,7 @@
+ placeholder="VNF Type" title="Enter VNF Type value."/>
@@ -66,7 +67,7 @@ class="form-control" ng-disabled="temp.policy.readOnly" ng-model="temp.policy.rainyday.bbid" ng-options="option for option in rainyDayDictionaryDatas track by option" - ng-change="getWorkstepValues(temp.policy.rainyday.bbid)"> + ng-change="getWorkstepValues(temp.policy.rainyday.bbid)" title="Select the dropdown value driven from Rainday Allowed Treatments (Decision)Dictionary.">
@@ -289,7 +290,7 @@
+ placeholder="Limit" title="Enter time limit value."/>
@@ -299,11 +300,11 @@
+ placeholder="Time Window" title="Enter time window value."/>
@@ -329,7 +330,7 @@
@@ -344,7 +345,7 @@

@@ -355,18 +356,18 @@
+ placeholder="Attribute Value" title="Enter the Attribute Value without any spaces and special characters"/>
@@ -383,7 +384,7 @@
@@ -394,19 +395,19 @@
+ ng-model="settingschoice.value" placeholder="Settings Value" title="Enter the Settings Attribute Value without any spaces and special characters"/>
@@ -423,7 +424,7 @@
@@ -442,7 +443,7 @@ ng-disabled="temp.policy.readOnly" ng-model="ruleAlgorithmschoice.dynamicRuleAlgorithmField1" ng-options="option for option in attributeDictionaryDatas track by option" - name="dynamicRuleAlgorithmField1"> + name="dynamicRuleAlgorithmField1" title="Select the dropdown value driven from Attribute (common)Dictionary or Settings (Decision)Dictionary."> @@ -451,18 +452,18 @@ ng-disabled="temp.policy.readOnly" ng-model="ruleAlgorithmschoice.dynamicRuleAlgorithmCombo" ng-options="option for option in functionDefinitionDatas track by option" - name="dynamicRuleAlgorithmCombo"> + name="dynamicRuleAlgorithmCombo" title="Select the dropdown value driven from FunctionDataType.">
+ name="dynamicRuleAlgorithmField2" title="Enter the Value without any spaces and special characters and for rule formation use A1, A2,..etc., based on above Rules."/>
@@ -477,11 +478,11 @@ \ No newline at end of file diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/FirewallPolicyTemplate.html b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/FirewallPolicyTemplate.html index 7f6a36b39..af1bea1d6 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/FirewallPolicyTemplate.html +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/FirewallPolicyTemplate.html @@ -7,12 +7,13 @@ class="form-control" ng-disabled="temp.policy.readOnly" ng-readonly="temp.policy.editPolicy" ng-model="temp.policy.policyName" required pattern="\S+" - title="Enter the Policy Name without any spaces" /> + title="Enter Policy Name without any spaces and special characters and will accept _." />
+ ng-model="temp.policy.policyDescription" + title="Description field will accept any type of data."/>
@@ -21,13 +22,13 @@ class="form-control" ng-disabled="temp.policy.readOnly" ng-model="temp.policy.riskType" ng-options="option for option in riskTypeDictionaryDatas track by option" - required pattern="\S+" title="RiskType is required"> + required pattern="\S+" title="Select the dropdown value driven from RiskType (Safe Policy)Dictionary.">
+ required pattern="\S+" title="Select the dropdown Guard value.">
@@ -47,18 +48,19 @@
+ ng-model="temp.policy.configName" required title="Enter the Config Name without any spaces and special characters." />
+ ng-model="temp.policy.ttlDate" title="Select the date from calender onclick on the field."/>
+ ng-options="option for option in securityZoneDictionaryDatas track by option" + title="Select the dropdown value driven from Security Zone (Firewall Policy)Dictionary.">
@@ -67,7 +69,7 @@

@@ -78,19 +80,21 @@
@@ -103,15 +107,15 @@
\ No newline at end of file diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/css/main.css b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/css/main.css index 317efd9fa..078e8297a 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/css/main.css +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/css/main.css @@ -373,4 +373,51 @@ table th > a:focus { .table.table-files .btn { display: none; } +} + +/* Tooltip container */ +.tooltip { + position: relative; + display: inline-block; + border-bottom: 1px dotted black; /* If you want dots under the hoverable text */ +} + +/* Tooltip text */ +.tooltip .tooltiptext { + visibility: hidden; + width: 120px; + background-color: #555; + color: #fff; + text-align: center; + padding: 5px 0; + border-radius: 6px; + + /* Position the tooltip text */ + position: absolute; + z-index: 1; + bottom: 125%; + left: 50%; + margin-left: -60px; + + /* Fade in tooltip */ + opacity: 0; + transition: opacity 1s; +} + +/* Tooltip arrow */ +.tooltip .tooltiptext::after { + content: ""; + position: absolute; + top: 100%; + left: 50%; + margin-left: -5px; + border-width: 5px; + border-style: solid; + border-color: #555 transparent transparent transparent; +} + +/* Show the tooltip text when you mouse over the tooltip container */ +.tooltip:hover .tooltiptext { + visibility: visible; + opacity: 1; } \ No newline at end of file diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/js/controllers/policySearchManager.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/js/controllers/policySearchManager.js index f973a236a..42e6796cd 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/js/controllers/policySearchManager.js +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/js/controllers/policySearchManager.js @@ -157,35 +157,38 @@ app.controller('PolicySearchController', [ return currentPath.indexOf(path) !== -1; }; - $scope.searchPolicy = function(searchContent){ - var deferred = $q.defer(); - var uuu = "searchPolicy"; - var postData = {searchdata : searchContent}; - $.ajax({ - type : 'POST', - url : uuu, - dataType: 'json', - contentType: 'application/json', - data: JSON.stringify(postData), - success : function(data){ - $scope.$apply(function(){ - var searchdata = data.result; - if(searchdata.length > 0){ - if(searchdata[0] == "Elastic Search Server is down"){ - alert("Elastic Search Server is down."); - }else{ - $scope.policyNavigator.searchrefresh(searchdata); - } - }else{ - Notification.info("No Matches Found with your Search"); - } - }); - }, - error : function(data){ - alert("Error while Searching."); - } - }); - }; + $scope.searchPolicy = function(searchContent){ + if(searchContent != undefined){ + var uuu = "searchPolicy"; + var postData = {searchdata : searchContent}; + $.ajax({ + type : 'POST', + url : uuu, + dataType: 'json', + contentType: 'application/json', + data: JSON.stringify(postData), + success : function(data){ + $scope.$apply(function(){ + var searchdata = data.result; + if(searchdata.length > 0){ + if(searchdata[0] == "Exception"){ + Notification.error(searchdata[1]); + }else{ + $scope.policyNavigator.searchrefresh(searchdata); + } + }else{ + Notification.info("No Matches Found with your Search"); + } + }); + }, + error : function(data){ + Notification.error("Error while Searching."); + } + }); + }else{ + Notification.error("No data has been entered or selected to search"); + } + }; $scope.refresh = function(searchData){ $scope.policyNavigator.searchrefresh(null); diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/templates/item-context-menu.html b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/templates/item-context-menu.html index 3c41fbc1d..732b99baa 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/templates/item-context-menu.html +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/templates/item-context-menu.html @@ -27,7 +27,7 @@
  • - + Move Scope
  • diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/templates/modals.html b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/templates/modals.html index 1c33839f2..e50802090 100644 --- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/templates/modals.html +++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/templates/modals.html @@ -13,8 +13,8 @@
    @@ -42,8 +42,8 @@
    @@ -62,7 +62,7 @@ @@ -119,6 +119,29 @@ + + @@ -183,12 +206,12 @@ @@ -207,12 +230,12 @@ @@ -236,8 +259,8 @@