summaryrefslogtreecommitdiffstats
path: root/POLICY-SDK-APP/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'POLICY-SDK-APP/src/main')
-rw-r--r--POLICY-SDK-APP/src/main/java/org/openecomp/policy/admin/PolicyManagerServlet.java35
-rw-r--r--POLICY-SDK-APP/src/main/java/org/openecomp/policy/admin/PolicyNotificationMail.java69
-rw-r--r--POLICY-SDK-APP/src/main/java/org/openecomp/policy/admin/PolicyRestController.java156
-rw-r--r--POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/ActionPolicyController.java4
-rw-r--r--POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/CreateBRMSParamController.java74
-rw-r--r--POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/CreateBRMSRawController.java1
-rw-r--r--POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/CreateClosedLoopFaultController.java164
-rw-r--r--POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/CreateClosedLoopPMController.java1
-rw-r--r--POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/CreateDcaeMicroServiceController.java41
-rw-r--r--POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/CreateFirewallController.java49
-rw-r--r--POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/DashboardController.java67
-rw-r--r--POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/DecisionPolicyController.java40
-rw-r--r--POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/PDPController.java88
-rw-r--r--POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/PolicyExportAndImportController.java10
-rw-r--r--POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/PolicyValidationController.java22
-rw-r--r--POLICY-SDK-APP/src/main/webapp/app/policyApp/CSS/bootstrap/docs/assets/js/vendor/autoprefixer.js6
-rw-r--r--POLICY-SDK-APP/src/main/webapp/app/policyApp/Windows/PushtabWindow/removeGroupPoliciesWindow.html2
-rw-r--r--POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/DCAEMicroServicePolicyController.js74
-rw-r--r--POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/DecisionPolicyController.js60
-rw-r--r--POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/DCAEMicroServicePolicyTemplate.html2
-rw-r--r--POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/DecisionPolicyTemplate.html109
-rw-r--r--POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/css/main.css36
-rw-r--r--POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/templates/modals.html22
-rw-r--r--POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/templates/searchNavbar.html4
24 files changed, 673 insertions, 463 deletions
diff --git a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/admin/PolicyManagerServlet.java b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/admin/PolicyManagerServlet.java
index 639e29e3d..1821e1031 100644
--- a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/admin/PolicyManagerServlet.java
+++ b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/admin/PolicyManagerServlet.java
@@ -95,13 +95,13 @@ public class PolicyManagerServlet extends HttpServlet {
LIST, RENAME, COPY, DELETE, EDITFILE, ADDFOLDER, DESCRIBEPOLICYFILE, VIEWPOLICY, ADDSUBSCOPE, SWITCHVERSION, EXPORT, SEARCHLIST
}
- private PolicyController policyController;
- public PolicyController getPolicyController() {
+ private static PolicyController policyController;
+ public synchronized PolicyController getPolicyController() {
return policyController;
}
- public void setPolicyController(PolicyController policyController) {
- this.policyController = policyController;
+ public synchronized static void setPolicyController(PolicyController policyController) {
+ PolicyManagerServlet.policyController = policyController;
}
private static String CONTENTTYPE = "application/json";
@@ -115,7 +115,7 @@ public class PolicyManagerServlet extends HttpServlet {
private static Path closedLoopJsonLocation;
private static JsonArray policyNames;
- private String testUserId = null;
+ private static String testUserId = null;
public static JsonArray getPolicyNames() {
return policyNames;
@@ -126,7 +126,6 @@ public class PolicyManagerServlet extends HttpServlet {
}
private static List<String> serviceTypeNamesList = new ArrayList<>();
- private List<Object> policyData;
public static List<String> getServiceTypeNamesList() {
return serviceTypeNamesList;
@@ -192,7 +191,11 @@ public class PolicyManagerServlet extends HttpServlet {
fileOperation(request, response);
}
} catch (Exception e) {
- setError(e, response);
+ try {
+ setError(e, response);
+ }catch(Exception e1){
+ LOGGER.error("Exception Occured"+e1);
+ }
}
}
@@ -270,6 +273,7 @@ public class PolicyManagerServlet extends HttpServlet {
Mode mode = Mode.valueOf(params.getString("mode"));
switch (mode) {
case ADDFOLDER:
+ case ADDSUBSCOPE:
responseJsonObject = addFolder(params, request);
break;
case COPY:
@@ -278,12 +282,10 @@ public class PolicyManagerServlet extends HttpServlet {
case DELETE:
responseJsonObject = delete(params, request);
break;
- case EDITFILE:
+ case EDITFILE:
+ case VIEWPOLICY:
responseJsonObject = editFile(params);
break;
- case VIEWPOLICY:
- responseJsonObject = editFile(params);
- break;
case LIST:
responseJsonObject = list(params, request);
break;
@@ -293,9 +295,6 @@ public class PolicyManagerServlet extends HttpServlet {
case DESCRIBEPOLICYFILE:
responseJsonObject = describePolicy(params);
break;
- case ADDSUBSCOPE:
- responseJsonObject = addFolder(params, request);
- break;
case SWITCHVERSION:
responseJsonObject = switchVersion(params, request);
break;
@@ -321,7 +320,7 @@ public class PolicyManagerServlet extends HttpServlet {
private JSONObject searchPolicyList(JSONObject params, HttpServletRequest request) {
Set<String> scopes = null;
List<String> roles = null;
- policyData = new ArrayList<>();
+ List<Object> policyData = new ArrayList<>();
JSONArray policyList = null;
if(params.has("policyList")){
policyList = (JSONArray) params.get("policyList");
@@ -1230,7 +1229,7 @@ public class PolicyManagerServlet extends HttpServlet {
policyEntity = (PolicyEntity) object;
String policyEntityName = policyEntity.getPolicyName().replace(".xml", "");
int policyEntityVersion = Integer.parseInt(policyEntityName.substring(policyEntityName.lastIndexOf(".")+1));
- if(policyEntityVersion > highestVersion){
+ if(policyEntityVersion > highestVersion && policyEntityVersion != version){
highestVersion = policyEntityVersion;
}
}
@@ -1472,7 +1471,7 @@ public class PolicyManagerServlet extends HttpServlet {
return testUserId;
}
- public void setTestUserId(String testUserId) {
- this.testUserId = testUserId;
+ public static void setTestUserId(String testUserId) {
+ PolicyManagerServlet.testUserId = testUserId;
}
} \ No newline at end of file
diff --git a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/admin/PolicyNotificationMail.java b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/admin/PolicyNotificationMail.java
index 9bd6e4f43..1a535dc76 100644
--- a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/admin/PolicyNotificationMail.java
+++ b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/admin/PolicyNotificationMail.java
@@ -106,7 +106,7 @@ public class PolicyNotificationMail{
+ '\n' + '\n' + "Moved By : " +entityItem.getModifiedBy() + '\n' + "Moved Time : " +dateFormat.format(date) + '\n' + '\n' + '\n' + '\n' + "Policy Notification System (please don't respond to this email)";
}
String policyFileName = entityItem.getPolicyName();
- String checkPolicyName = policyFileName;
+ String checkPolicyName = policyName;
if(policyFileName.contains("/")){
policyFileName = policyFileName.substring(0, policyFileName.indexOf("/"));
policyFileName = policyFileName.replace("/", File.separator);
@@ -119,40 +119,41 @@ public class PolicyNotificationMail{
String query = "from WatchPolicyNotificationTable where policyName like'" +policyFileName+"%'";
boolean sendFlag = false;
List<Object> watchList = policyNotificationDao.getDataByQuery(query);
- if(watchList != null){
- if(watchList.isEmpty()){
- for(Object watch : watchList){
- WatchPolicyNotificationTable list = (WatchPolicyNotificationTable) watch;
- String watchPolicyName = list.getPolicyName();
- if(watchPolicyName.contains("Config_") || watchPolicyName.contains("Action_") || watchPolicyName.contains("Decision_")){
- if(watchPolicyName.equals(checkPolicyName)){
- sendFlag = true;
- }else{
- sendFlag = false;
- }
+ if(watchList != null && !watchList.isEmpty()){
+ for(Object watch : watchList){
+ WatchPolicyNotificationTable list = (WatchPolicyNotificationTable) watch;
+ String watchPolicyName = list.getPolicyName();
+ if(watchPolicyName.contains("Config_") || watchPolicyName.contains("Action_") || watchPolicyName.contains("Decision_")){
+ if(watchPolicyName.equals(checkPolicyName)){
+ sendFlag = true;
+ }else{
+ sendFlag = false;
}
- if(sendFlag){
- AnnotationConfigApplicationContext ctx = null;
- try {
- to = list.getLoginIds()+"@"+PolicyController.getSmtpApplicationName();
- to = to.trim();
- ctx = new AnnotationConfigApplicationContext();
- ctx.register(PolicyNotificationMail.class);
- ctx.refresh();
- JavaMailSenderImpl mailSender = ctx.getBean(JavaMailSenderImpl.class);
- MimeMessage mimeMessage = mailSender.createMimeMessage();
- MimeMessageHelper mailMsg = new MimeMessageHelper(mimeMessage);
- mailMsg.setFrom(new InternetAddress(from, "Policy Notification System"));
- mailMsg.setTo(to);
- mailMsg.setSubject(subject);
- mailMsg.setText(message);
- mailSender.send(mimeMessage);
- } catch (Exception e) {
- policyLogger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW+"Exception Occured in Policy Notification" +e);
- }finally{
- if(ctx != null){
- ctx.close();
- }
+ }
+ if(sendFlag){
+ AnnotationConfigApplicationContext ctx = null;
+ try {
+ to = list.getLoginIds()+"@"+PolicyController.getSmtpEmailExtension();
+ to = to.trim();
+ ctx = new AnnotationConfigApplicationContext();
+ ctx.register(PolicyNotificationMail.class);
+ ctx.refresh();
+ JavaMailSenderImpl mailSender = ctx.getBean(JavaMailSenderImpl.class);
+ MimeMessage mimeMessage = mailSender.createMimeMessage();
+ MimeMessageHelper mailMsg = new MimeMessageHelper(mimeMessage);
+ mailMsg.setFrom(new InternetAddress(from, "Policy Notification System"));
+ mailMsg.setTo(to);
+ mailMsg.setSubject(subject);
+ mailMsg.setText(message);
+ mailSender.send(mimeMessage);
+ if(mode.equalsIgnoreCase("Rename") || mode.contains("Delete") || mode.contains("Move")){
+ policyNotificationDao.delete(watch);
+ }
+ } catch (Exception e) {
+ policyLogger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW+"Exception Occured in Policy Notification" +e);
+ }finally{
+ if(ctx != null){
+ ctx.close();
}
}
}
diff --git a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/admin/PolicyRestController.java b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/admin/PolicyRestController.java
index 2c04bc66d..08ef99f94 100644
--- a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/admin/PolicyRestController.java
+++ b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/admin/PolicyRestController.java
@@ -86,90 +86,90 @@ public class PolicyRestController extends RestrictedBaseController{
CommonClassDao commonClassDao;
@RequestMapping(value={"/policycreation/save_policy"}, method={RequestMethod.POST})
- public ModelAndView policyCreationController(HttpServletRequest request, HttpServletResponse response) throws Exception{
-
+ public void policyCreationController(HttpServletRequest request, HttpServletResponse response) {
String userId = UserUtils.getUserSession(request).getOrgUserId();
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
- JsonNode root = mapper.readTree(request.getReader());
-
- PolicyRestAdapter policyData = mapper.readValue(root.get(PolicyController.getPolicydata()).get("policy").toString(), PolicyRestAdapter.class);
-
- if("file".equals(root.get(PolicyController.getPolicydata()).get(modal).get("type").toString().replace("\"", ""))){
- policyData.setEditPolicy(true);
- }
- if(root.get(PolicyController.getPolicydata()).get(modal).get("path").size() != 0){
- String dirName = "";
- for(int i = 0; i < root.get(PolicyController.getPolicydata()).get(modal).get("path").size(); i++){
- dirName = dirName.replace("\"", "") + root.get(PolicyController.getPolicydata()).get(modal).get("path").get(i).toString().replace("\"", "") + File.separator;
+ try{
+ JsonNode root = mapper.readTree(request.getReader());
+
+ PolicyRestAdapter policyData = mapper.readValue(root.get(PolicyController.getPolicydata()).get("policy").toString(), PolicyRestAdapter.class);
+
+ if("file".equals(root.get(PolicyController.getPolicydata()).get(modal).get("type").toString().replace("\"", ""))){
+ policyData.setEditPolicy(true);
}
- if(policyData.isEditPolicy()){
- policyData.setDomainDir(dirName.substring(0, dirName.lastIndexOf(File.separator)));
+ if(root.get(PolicyController.getPolicydata()).get(modal).get("path").size() != 0){
+ String dirName = "";
+ for(int i = 0; i < root.get(PolicyController.getPolicydata()).get(modal).get("path").size(); i++){
+ dirName = dirName.replace("\"", "") + root.get(PolicyController.getPolicydata()).get(modal).get("path").get(i).toString().replace("\"", "") + File.separator;
+ }
+ if(policyData.isEditPolicy()){
+ policyData.setDomainDir(dirName.substring(0, dirName.lastIndexOf(File.separator)));
+ }else{
+ policyData.setDomainDir(dirName + root.get(PolicyController.getPolicydata()).get(modal).get("name").toString().replace("\"", ""));
+ }
}else{
- policyData.setDomainDir(dirName + root.get(PolicyController.getPolicydata()).get(modal).get("name").toString().replace("\"", ""));
- }
- }else{
- String domain = root.get(PolicyController.getPolicydata()).get("model").get("name").toString();
- if(domain.contains("/")){
- domain = domain.substring(0, domain.lastIndexOf('/')).replace("/", File.separator);
+ String domain = root.get(PolicyController.getPolicydata()).get("model").get("name").toString();
+ if(domain.contains("/")){
+ domain = domain.substring(0, domain.lastIndexOf('/')).replace("/", File.separator);
+ }
+ domain = domain.replace("\"", "");
+ policyData.setDomainDir(domain);
}
- domain = domain.replace("\"", "");
- policyData.setDomainDir(domain);
- }
-
- if(policyData.getConfigPolicyType() != null){
- if("ClosedLoop_Fault".equalsIgnoreCase(policyData.getConfigPolicyType())){
- CreateClosedLoopFaultController faultController = new CreateClosedLoopFaultController();
- policyData = faultController.setDataToPolicyRestAdapter(policyData, root);
- }else if("Firewall Config".equalsIgnoreCase(policyData.getConfigPolicyType())){
- CreateFirewallController fwController = new CreateFirewallController();
- policyData = fwController.setDataToPolicyRestAdapter(policyData);
- }else if("Micro Service".equalsIgnoreCase(policyData.getConfigPolicyType())){
- CreateDcaeMicroServiceController msController = new CreateDcaeMicroServiceController();
- policyData = msController.setDataToPolicyRestAdapter(policyData, root);
+
+ if(policyData.getConfigPolicyType() != null){
+ if("ClosedLoop_Fault".equalsIgnoreCase(policyData.getConfigPolicyType())){
+ CreateClosedLoopFaultController faultController = new CreateClosedLoopFaultController();
+ policyData = faultController.setDataToPolicyRestAdapter(policyData, root);
+ }else if("Firewall Config".equalsIgnoreCase(policyData.getConfigPolicyType())){
+ CreateFirewallController fwController = new CreateFirewallController();
+ policyData = fwController.setDataToPolicyRestAdapter(policyData);
+ }else if("Micro Service".equalsIgnoreCase(policyData.getConfigPolicyType())){
+ CreateDcaeMicroServiceController msController = new CreateDcaeMicroServiceController();
+ policyData = msController.setDataToPolicyRestAdapter(policyData, root);
+ }
}
- }
-
- policyData.setUserId(userId);
-
- String result;
- String body = PolicyUtils.objectToJsonString(policyData);
- String uri = request.getRequestURI();
- ResponseEntity<?> responseEntity = sendToPAP(body, uri, HttpMethod.POST);
- if(responseEntity != null && responseEntity.getBody().equals(HttpServletResponse.SC_CONFLICT)){
- result = "PolicyExists";
- }else if(responseEntity != null){
- result = responseEntity.getBody().toString();
- String policyName = responseEntity.getHeaders().get("policyName").get(0);
- if(policyData.isEditPolicy() && "success".equalsIgnoreCase(result)){
- PolicyNotificationMail email = new PolicyNotificationMail();
- String mode = "EditPolicy";
- String watchPolicyName = policyName.replace(".xml", "");
- String version = watchPolicyName.substring(watchPolicyName.lastIndexOf('.')+1);
- watchPolicyName = watchPolicyName.substring(0, watchPolicyName.lastIndexOf('.')).replace(".", File.separator);
- String policyVersionName = watchPolicyName.replace(".", File.separator);
- watchPolicyName = watchPolicyName + "." + version + ".xml";
- PolicyVersion entityItem = new PolicyVersion();
- entityItem.setPolicyName(policyVersionName);
- entityItem.setActiveVersion(Integer.parseInt(version));
- entityItem.setModifiedBy(userId);
- email.sendMail(entityItem, watchPolicyName, mode, commonClassDao);
+
+ policyData.setUserId(userId);
+
+ String result;
+ String body = PolicyUtils.objectToJsonString(policyData);
+ String uri = request.getRequestURI();
+ ResponseEntity<?> responseEntity = sendToPAP(body, uri, HttpMethod.POST);
+ if(responseEntity != null && responseEntity.getBody().equals(HttpServletResponse.SC_CONFLICT)){
+ result = "PolicyExists";
+ }else if(responseEntity != null){
+ result = responseEntity.getBody().toString();
+ String policyName = responseEntity.getHeaders().get("policyName").get(0);
+ if(policyData.isEditPolicy() && "success".equalsIgnoreCase(result)){
+ PolicyNotificationMail email = new PolicyNotificationMail();
+ String mode = "EditPolicy";
+ String watchPolicyName = policyName.replace(".xml", "");
+ String version = watchPolicyName.substring(watchPolicyName.lastIndexOf('.')+1);
+ watchPolicyName = watchPolicyName.substring(0, watchPolicyName.lastIndexOf('.')).replace(".", File.separator);
+ String policyVersionName = watchPolicyName.replace(".", File.separator);
+ watchPolicyName = watchPolicyName + "." + version + ".xml";
+ PolicyVersion entityItem = new PolicyVersion();
+ entityItem.setPolicyName(policyVersionName);
+ entityItem.setActiveVersion(Integer.parseInt(version));
+ entityItem.setModifiedBy(userId);
+ email.sendMail(entityItem, watchPolicyName, mode, commonClassDao);
+ }
+ }else{
+ result = "Response is null from PAP";
}
- }else{
- result = "Response is null from PAP";
- }
-
-
- response.setCharacterEncoding(PolicyController.getCharacterencoding());
- response.setContentType(PolicyController.getContenttype());
- request.setCharacterEncoding(PolicyController.getCharacterencoding());
- PrintWriter out = response.getWriter();
- String responseString = mapper.writeValueAsString(result);
- JSONObject j = new JSONObject("{policyData: " + responseString + "}");
- out.write(j.toString());
- return null;
+ response.setCharacterEncoding(PolicyController.getCharacterencoding());
+ response.setContentType(PolicyController.getContenttype());
+ request.setCharacterEncoding(PolicyController.getCharacterencoding());
+ PrintWriter out = response.getWriter();
+ String responseString = mapper.writeValueAsString(result);
+ JSONObject j = new JSONObject("{policyData: " + responseString + "}");
+ out.write(j.toString());
+ }catch(Exception e){
+ policyLogger.error("Exception Occured while saving policy" , e);
+ }
}
@@ -344,7 +344,7 @@ public class PolicyRestController extends RestrictedBaseController{
}
@RequestMapping(value={"/getDictionary/*"}, method={RequestMethod.GET})
- public void getDictionaryController(HttpServletRequest request, HttpServletResponse response) throws Exception{
+ public void getDictionaryController(HttpServletRequest request, HttpServletResponse response){
String uri = request.getRequestURI().replace("/getDictionary", "");
String body = null;
ResponseEntity<?> responseEntity = sendToPAP(null, uri, HttpMethod.GET);
@@ -353,7 +353,11 @@ public class PolicyRestController extends RestrictedBaseController{
}else{
body = "";
}
- response.getWriter().write(body);
+ try {
+ response.getWriter().write(body);
+ } catch (IOException e) {
+ policyLogger.error("Exception occured while getting Dictionary entries", e);
+ }
}
@RequestMapping(value={"/saveDictionary/*/*"}, method={RequestMethod.POST})
diff --git a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/ActionPolicyController.java b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/ActionPolicyController.java
index 2c68df65f..c88412b8b 100644
--- a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/ActionPolicyController.java
+++ b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/ActionPolicyController.java
@@ -58,7 +58,9 @@ import org.openecomp.policy.common.logging.flexlogger.Logger;
public class ActionPolicyController extends RestrictedBaseController{
private static final Logger LOGGER = FlexLogger.getLogger(ActionPolicyController.class);
- public ActionPolicyController(){}
+ public ActionPolicyController(){
+ //Default Constructor
+ }
private ArrayList<Object> attributeList;
protected LinkedList<Integer> ruleAlgoirthmTracker;
diff --git a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/CreateBRMSParamController.java b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/CreateBRMSParamController.java
index 8258b8bed..4f4838dc7 100644
--- a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/CreateBRMSParamController.java
+++ b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/CreateBRMSParamController.java
@@ -42,17 +42,19 @@ import javax.servlet.http.HttpServletResponse;
import javax.xml.bind.JAXBElement;
import org.json.JSONObject;
+import org.openecomp.policy.common.logging.flexlogger.FlexLogger;
+import org.openecomp.policy.common.logging.flexlogger.Logger;
import org.openecomp.policy.rest.adapter.PolicyRestAdapter;
import org.openecomp.policy.rest.dao.CommonClassDao;
import org.openecomp.policy.rest.jpa.BRMSParamTemplate;
import org.openecomp.policy.rest.jpa.PolicyEntity;
+import org.openecomp.policy.xacml.api.XACMLErrorConstants;
import org.openecomp.portalsdk.core.controller.RestrictedBaseController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
-import org.openecomp.policy.xacml.api.XACMLErrorConstants;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
@@ -69,9 +71,6 @@ import oasis.names.tc.xacml._3_0.core.schema.wd_17.PolicyType;
import oasis.names.tc.xacml._3_0.core.schema.wd_17.RuleType;
import oasis.names.tc.xacml._3_0.core.schema.wd_17.TargetType;
-import org.openecomp.policy.common.logging.flexlogger.FlexLogger;
-import org.openecomp.policy.common.logging.flexlogger.Logger;
-
@Controller
@RequestMapping("/")
public class CreateBRMSParamController extends RestrictedBaseController {
@@ -79,6 +78,14 @@ public class CreateBRMSParamController extends RestrictedBaseController {
private static CommonClassDao commonClassDao;
+ public static CommonClassDao getCommonClassDao() {
+ return commonClassDao;
+ }
+
+ public static void setCommonClassDao(CommonClassDao commonClassDao) {
+ CreateBRMSParamController.commonClassDao = commonClassDao;
+ }
+
@Autowired
private CreateBRMSParamController(CommonClassDao commonClassDao){
CreateBRMSParamController.commonClassDao = commonClassDao;
@@ -90,35 +97,36 @@ public class CreateBRMSParamController extends RestrictedBaseController {
private HashMap<String, String> dynamicLayoutMap;
private static String brmsTemplateVlaue = "<$%BRMSParamTemplate=";
- private static String String = "String";
+ private static String string = "String";
@RequestMapping(value={"/policyController/getBRMSTemplateData.htm"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
- public ModelAndView getBRMSParamPolicyRuleData(HttpServletRequest request, HttpServletResponse response) throws Exception{
- dynamicLayoutMap = new HashMap<>();
- ObjectMapper mapper = new ObjectMapper();
- mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
- JsonNode root = mapper.readTree(request.getReader());
- String rule = findRule(root.get(PolicyController.getPolicydata()).toString().replaceAll("^\"|\"$", ""));
- generateUI(rule);
- response.setCharacterEncoding(PolicyController.getCharacterencoding());
- response.setContentType(PolicyController.getContenttype());
- request.setCharacterEncoding(PolicyController.getCharacterencoding());
+ public void getBRMSParamPolicyRuleData(HttpServletRequest request, HttpServletResponse response){
+ try{
+ dynamicLayoutMap = new HashMap<>();
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+ JsonNode root = mapper.readTree(request.getReader());
+ String rule = findRule(root.get(PolicyController.getPolicydata()).toString().replaceAll("^\"|\"$", ""));
+ generateUI(rule);
+ response.setCharacterEncoding(PolicyController.getCharacterencoding());
+ response.setContentType(PolicyController.getContenttype());
+ request.setCharacterEncoding(PolicyController.getCharacterencoding());
- PrintWriter out = response.getWriter();
- String responseString = mapper.writeValueAsString(dynamicLayoutMap);
- JSONObject j = new JSONObject("{policyData: " + responseString + "}");
- out.write(j.toString());
- return null;
+ PrintWriter out = response.getWriter();
+ String responseString = mapper.writeValueAsString(dynamicLayoutMap);
+ JSONObject j = new JSONObject("{policyData: " + responseString + "}");
+ out.write(j.toString());
+ }catch(Exception e){
+ policyLogger.error("Exception Occured while getting BRMS Rule data" , e);
+ }
}
protected String findRule(String ruleTemplate) {
- List<Object> datas = commonClassDao.getData(BRMSParamTemplate.class);
- for (Object data: datas){
- BRMSParamTemplate bRMSParamTemplate = (BRMSParamTemplate) data;
- if(bRMSParamTemplate.getRuleName().equals(ruleTemplate)){
- return bRMSParamTemplate.getRule();
- }
+ List<Object> datas = commonClassDao.getDataById(BRMSParamTemplate.class, "ruleName", ruleTemplate);
+ if(datas != null && !datas.isEmpty()){
+ BRMSParamTemplate bRMSParamTemplate = (BRMSParamTemplate) datas.get(0);
+ return bRMSParamTemplate.getRule();
}
return null;
}
@@ -197,10 +205,10 @@ public class CreateBRMSParamController extends RestrictedBaseController {
policyLogger.info("Just for Logging"+e);
nextComponent = components[i];
}
- if (nextComponent.startsWith(String)) {
+ if (nextComponent.startsWith(string)) {
type = "String";
createField(caption, type);
- caption = nextComponent.replace(String, "");
+ caption = nextComponent.replace(string, "");
} else if (nextComponent.startsWith("int")) {
type = "int";
createField(caption, type);
@@ -357,7 +365,7 @@ public class CreateBRMSParamController extends RestrictedBaseController {
return formateDate;
}
// This method generates the UI from rule configuration
- private void paramUIGenerate(PolicyRestAdapter policyAdapter, PolicyEntity entity) {
+ public void paramUIGenerate(PolicyRestAdapter policyAdapter, PolicyEntity entity) {
String data = entity.getConfigurationData().getConfigBody();
if(data != null){
File file = new File(PolicyController.getConfigHome() +File.separator+ entity.getConfigurationData().getConfigurationName());
@@ -471,7 +479,7 @@ public class CreateBRMSParamController extends RestrictedBaseController {
// set View Rule
@SuppressWarnings("unchecked")
@RequestMapping(value={"/policyController/ViewBRMSParamPolicyRule.htm"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
- public ModelAndView setViewRule(HttpServletRequest request, HttpServletResponse response) throws Exception{
+ public void setViewRule(HttpServletRequest request, HttpServletResponse response){
try {
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
@@ -493,7 +501,7 @@ public class CreateBRMSParamController extends RestrictedBaseController {
if(policyData.getRuleData().size() > 0){
for(Object keyValue: policyData.getRuleData().keySet()){
String key = keyValue.toString().substring(0, 1).toUpperCase() + keyValue.toString().substring(1);
- if (String.equals(keyValue)) {
+ if (string.equals(keyValue)) {
generatedRule.append("\n\t\tparams.set"
+ key + "(\""
+ policyData.getRuleData().get(keyValue).toString() + "\");");
@@ -537,10 +545,8 @@ public class CreateBRMSParamController extends RestrictedBaseController {
String responseString = mapper.writeValueAsString(body);
JSONObject j = new JSONObject("{policyData: " + responseString + "}");
out.write(j.toString());
- return null;
} catch (Exception e) {
policyLogger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
- }
- return null;
+ }
}
}
diff --git a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/CreateBRMSRawController.java b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/CreateBRMSRawController.java
index 67945e1b9..c5b97ad45 100644
--- a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/CreateBRMSRawController.java
+++ b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/CreateBRMSRawController.java
@@ -72,6 +72,7 @@ public class CreateBRMSRawController{
try{
description = policy.getDescription().substring(0, policy.getDescription().indexOf("@CreatedBy:"));
}catch(Exception e){
+ logger.info("Not able to see the createdby in description. So, add generic description", e);
description = policy.getDescription();
}
policyAdapter.setPolicyDescription(description);
diff --git a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/CreateClosedLoopFaultController.java b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/CreateClosedLoopFaultController.java
index ccecf5d7f..08c0c38e7 100644
--- a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/CreateClosedLoopFaultController.java
+++ b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/CreateClosedLoopFaultController.java
@@ -61,7 +61,7 @@ import oasis.names.tc.xacml._3_0.core.schema.wd_17.TargetType;
@RequestMapping("/")
public class CreateClosedLoopFaultController extends RestrictedBaseController{
- private static final Logger LOGGER = FlexLogger.getLogger(CreateClosedLoopFaultController.class);
+ private static final Logger policyLogger = FlexLogger.getLogger(CreateClosedLoopFaultController.class);
protected PolicyRestAdapter policyAdapter = null;
@@ -75,86 +75,91 @@ public class CreateClosedLoopFaultController extends RestrictedBaseController{
public CreateClosedLoopFaultController(){}
- public PolicyRestAdapter setDataToPolicyRestAdapter(PolicyRestAdapter policyData, JsonNode root) throws Exception{
- 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);
- 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);
-
- ArrayList<Object> trapSignatureDatas = new ArrayList<>();
- if(trapDatas.getTrap1() != null){
- trapSignatureDatas.add(trapDatas);
- }
- ArrayList<Object> faultSignatureDatas = new ArrayList<>();
- if(faultDatas.getTrap1() != null){
- faultSignatureDatas.add(faultDatas);
- }
-
- String resultBody = "";
- if(!policyJsonData.getConnecttriggerSignatures().isEmpty()){
- resultBody = resultBody + "(";
- for(int i = policyJsonData.getConnecttriggerSignatures().size()-1; i>=0 ; i--){
- String connectBody = connectTriggerSignature(i, policyJsonData.getConnecttriggerSignatures(), trapSignatureDatas.get(0));
- resultBody = resultBody + connectBody;
+ 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);
+ 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);
+
+ ArrayList<Object> trapSignatureDatas = new ArrayList<>();
+ if(trapDatas.getTrap1() != null){
+ trapSignatureDatas.add(trapDatas);
}
- resultBody = resultBody + ")";
- }else{
- if(!trapSignatureDatas.isEmpty()){
- resultBody = callTrap("nill", trapSignatureDatas.get(0));
+ ArrayList<Object> faultSignatureDatas = new ArrayList<>();
+ if(faultDatas.getTrap1() != null){
+ faultSignatureDatas.add(faultDatas);
}
- }
- ClosedLoopSignatures triggerSignatures = new ClosedLoopSignatures();
- triggerSignatures.setSignatures(resultBody);
- if(policyData.getClearTimeOut() != null){
- triggerSignatures.setTimeWindow(Integer.parseInt(policyData.getClearTimeOut()));
- triggerSignatures.setTrapMaxAge(Integer.parseInt(policyData.getTrapMaxAge()));
- ClosedLoopFaultTriggerUISignatures uiTriggerSignatures = new ClosedLoopFaultTriggerUISignatures();
- if(!trapSignatureDatas.isEmpty()){
- uiTriggerSignatures.setSignatures(getUITriggerSignature("Trap", trapSignatureDatas.get(0)));
- if(!policyJsonData.getConnecttriggerSignatures().isEmpty()){
- uiTriggerSignatures.setConnectSignatures(getUIConnectTraps(policyJsonData.getConnecttriggerSignatures()));
- }
- }
- jsonBody.setTriggerSignaturesUsedForUI(uiTriggerSignatures);
- jsonBody.setTriggerTimeWindowUsedForUI(Integer.parseInt(policyData.getClearTimeOut()));
- jsonBody.setTrapMaxAgeUsedForUI(Integer.parseInt(policyData.getTrapMaxAge()));
- }
-
- jsonBody.setTriggerSignatures(triggerSignatures);
- String faultBody = "";
- if(!policyJsonData.getConnectVerificationSignatures().isEmpty()){
- faultBody = faultBody + "(";
- for(int i = policyJsonData.getConnectVerificationSignatures().size()-1; i>=0 ; i--){
- String connectBody = connectTriggerSignature(i, policyJsonData.getConnectVerificationSignatures(), faultSignatureDatas.get(0));
- faultBody = faultBody + connectBody;
+
+ String resultBody = "";
+ if(!policyJsonData.getConnecttriggerSignatures().isEmpty()){
+ resultBody = resultBody + "(";
+ for(int i = policyJsonData.getConnecttriggerSignatures().size()-1; i>=0 ; i--){
+ String connectBody = connectTriggerSignature(i, policyJsonData.getConnecttriggerSignatures(), trapSignatureDatas.get(0));
+ resultBody = resultBody + connectBody;
+ }
+ resultBody = resultBody + ")";
+ }else{
+ if(!trapSignatureDatas.isEmpty()){
+ resultBody = callTrap("nill", trapSignatureDatas.get(0));
+ }
}
- faultBody = faultBody + ")";
- }else{
- if(!faultSignatureDatas.isEmpty()){
- faultBody = callTrap("nill", faultSignatureDatas.get(0));
+ ClosedLoopSignatures triggerSignatures = new ClosedLoopSignatures();
+ triggerSignatures.setSignatures(resultBody);
+ if(policyData.getClearTimeOut() != null){
+ triggerSignatures.setTimeWindow(Integer.parseInt(policyData.getClearTimeOut()));
+ triggerSignatures.setTrapMaxAge(Integer.parseInt(policyData.getTrapMaxAge()));
+ ClosedLoopFaultTriggerUISignatures uiTriggerSignatures = new ClosedLoopFaultTriggerUISignatures();
+ if(!trapSignatureDatas.isEmpty()){
+ uiTriggerSignatures.setSignatures(getUITriggerSignature("Trap", trapSignatureDatas.get(0)));
+ if(!policyJsonData.getConnecttriggerSignatures().isEmpty()){
+ uiTriggerSignatures.setConnectSignatures(getUIConnectTraps(policyJsonData.getConnecttriggerSignatures()));
+ }
+ }
+ jsonBody.setTriggerSignaturesUsedForUI(uiTriggerSignatures);
+ jsonBody.setTriggerTimeWindowUsedForUI(Integer.parseInt(policyData.getClearTimeOut()));
+ jsonBody.setTrapMaxAgeUsedForUI(Integer.parseInt(policyData.getTrapMaxAge()));
}
- }
- ClosedLoopSignatures faultSignatures = new ClosedLoopSignatures();
- faultSignatures.setSignatures(faultBody);
- if(policyData.getVerificationclearTimeOut() != null){
- faultSignatures.setTimeWindow(Integer.parseInt(policyData.getVerificationclearTimeOut()));
- ClosedLoopFaultTriggerUISignatures uifaultSignatures = new ClosedLoopFaultTriggerUISignatures();
- if(!faultSignatureDatas.isEmpty()){
- uifaultSignatures.setSignatures(getUITriggerSignature("Fault", faultSignatureDatas.get(0)));
- if(!policyJsonData.getConnectVerificationSignatures().isEmpty()){
- uifaultSignatures.setConnectSignatures(getUIConnectTraps(policyJsonData.getConnectVerificationSignatures()));
- }
+
+ jsonBody.setTriggerSignatures(triggerSignatures);
+ String faultBody = "";
+ if(!policyJsonData.getConnectVerificationSignatures().isEmpty()){
+ faultBody = faultBody + "(";
+ for(int i = policyJsonData.getConnectVerificationSignatures().size()-1; i>=0 ; i--){
+ String connectBody = connectTriggerSignature(i, policyJsonData.getConnectVerificationSignatures(), faultSignatureDatas.get(0));
+ faultBody = faultBody + connectBody;
+ }
+ faultBody = faultBody + ")";
+ }else{
+ if(!faultSignatureDatas.isEmpty()){
+ faultBody = callTrap("nill", faultSignatureDatas.get(0));
+ }
}
-
- jsonBody.setVerificationSignaturesUsedForUI(uifaultSignatures);
- jsonBody.setVerfificationTimeWindowUsedForUI(Integer.parseInt(policyData.getVerificationclearTimeOut()));
- }
- jsonBody.setVerificationSignatures(faultSignatures);
- ObjectWriter om = new ObjectMapper().writer();
- String json = om.writeValueAsString(jsonBody);
- policyData.setJsonBody(json);
+ ClosedLoopSignatures faultSignatures = new ClosedLoopSignatures();
+ faultSignatures.setSignatures(faultBody);
+ if(policyData.getVerificationclearTimeOut() != null){
+ faultSignatures.setTimeWindow(Integer.parseInt(policyData.getVerificationclearTimeOut()));
+ ClosedLoopFaultTriggerUISignatures uifaultSignatures = new ClosedLoopFaultTriggerUISignatures();
+ if(!faultSignatureDatas.isEmpty()){
+ uifaultSignatures.setSignatures(getUITriggerSignature("Fault", faultSignatureDatas.get(0)));
+ if(!policyJsonData.getConnectVerificationSignatures().isEmpty()){
+ uifaultSignatures.setConnectSignatures(getUIConnectTraps(policyJsonData.getConnectVerificationSignatures()));
+ }
+ }
+
+ jsonBody.setVerificationSignaturesUsedForUI(uifaultSignatures);
+ jsonBody.setVerfificationTimeWindowUsedForUI(Integer.parseInt(policyData.getVerificationclearTimeOut()));
+ }
+ jsonBody.setVerificationSignatures(faultSignatures);
+ ObjectWriter om = new ObjectMapper().writer();
+ String json = om.writeValueAsString(jsonBody);
+ policyData.setJsonBody(json);
+
+ }catch(Exception e){
+ policyLogger.error("Exception Occured while setting data to Adapter" , e);
+ }
return policyData;
}
@@ -170,6 +175,7 @@ public class CreateClosedLoopFaultController extends RestrictedBaseController{
}
resultBody = resultBody + "(" + notBox;
}catch(NullPointerException e){
+ policyLogger.info("General error" , e);
resultBody = resultBody + "(";
}
String connectTrap1 = connectTraps.get("connectTrap1");
@@ -194,11 +200,13 @@ public class CreateClosedLoopFaultController extends RestrictedBaseController{
String trapCount1 = connectTraps.get("trapCount1");
resultBody = resultBody + ", Time = " + trapCount1 + ")";
}catch(NullPointerException e){
+ policyLogger.info("General error" , e);
}
try{
String operatorBox = connectTraps.get("operatorBox");
resultBody = resultBody + operatorBox +"(";
}catch (NullPointerException e){
+ policyLogger.info("General error" , e);
}
try{
String connectTrap2 = connectTraps.get("connectTrap2");
@@ -220,11 +228,13 @@ public class CreateClosedLoopFaultController extends RestrictedBaseController{
}
}
}catch(NullPointerException e){
+ policyLogger.info("General error" , e);
}
try{
String trapCount2 = connectTraps.get("trapCount2");
resultBody = resultBody + ", Time = " + trapCount2 + ")";
}catch(NullPointerException e){
+ policyLogger.info("General error" , e);
}
return resultBody;
}
@@ -603,7 +613,7 @@ public class CreateClosedLoopFaultController extends RestrictedBaseController{
}
} catch (Exception e) {
- LOGGER.error("Exception Occured"+e);
+ policyLogger.error("Exception Occured"+e);
}
return null;
diff --git a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/CreateClosedLoopPMController.java b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/CreateClosedLoopPMController.java
index 385ca159c..39850d990 100644
--- a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/CreateClosedLoopPMController.java
+++ b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/CreateClosedLoopPMController.java
@@ -63,6 +63,7 @@ public class CreateClosedLoopPMController{
try{
description = policy.getDescription().substring(0, policy.getDescription().indexOf("@CreatedBy:"));
}catch(Exception e){
+ LOGGER.info("General error" , e);
description = policy.getDescription();
}
policyAdapter.setPolicyDescription(description);
diff --git a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/CreateDcaeMicroServiceController.java b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/CreateDcaeMicroServiceController.java
index e156002bf..777fb89e3 100644
--- a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/CreateDcaeMicroServiceController.java
+++ b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/CreateDcaeMicroServiceController.java
@@ -35,6 +35,7 @@ import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.HashSet;
@@ -160,7 +161,7 @@ public class CreateDcaeMicroServiceController extends RestrictedBaseController {
jsonContent = decodeContent(root.get("policyJSON")).toString();
constructJson(policyData, jsonContent);
}catch(Exception e){
- LOGGER.error("Error while decoding microservice content");
+ LOGGER.error("Error while decoding microservice content", e);
}
return policyData;
@@ -224,7 +225,7 @@ public class CreateDcaeMicroServiceController extends RestrictedBaseController {
try {
json = om.writeValueAsString(microServiceObject);
} catch (JsonProcessingException e) {
- LOGGER.error("Error writing out the object");
+ LOGGER.error("Error writing out the object", e);
}
LOGGER.info(json);
String cleanJson = cleanUPJson(json);
@@ -254,7 +255,7 @@ public class CreateDcaeMicroServiceController extends RestrictedBaseController {
cleanJson = returnNode.toString();
}
} catch (IOException e) {
- LOGGER.error("Error writing out the JsonNode");
+ LOGGER.error("Error writing out the JsonNode",e);
}
return cleanJson;
}
@@ -311,7 +312,7 @@ public class CreateDcaeMicroServiceController extends RestrictedBaseController {
public Map<String, String> load(byte[] source) throws IOException {
Yaml yaml = new Yaml();
@SuppressWarnings("unchecked")
- Map<Object, Object> yamlMap = (Map<Object, Object>) yaml.load(source.toString());
+ Map<Object, Object> yamlMap = (Map<Object, Object>) yaml.load(Arrays.toString(source));
StringBuilder sb = new StringBuilder();
Map<String, String> settings = new HashMap <>();
if (yamlMap == null) {
@@ -397,10 +398,7 @@ public class CreateDcaeMicroServiceController extends RestrictedBaseController {
HashMap<String,String> dataMapForJson=new HashMap <>();
for(String uniqueDataKey: uniqueDataKeys){
if(uniqueDataKey.contains("%")){
- String[] uniqueDataKeySplit= uniqueDataKey.split("%",2);
- if (uniqueDataKeySplit.length < 2) {
- continue;
- }
+ String[] uniqueDataKeySplit= uniqueDataKey.split("%");
String findType=DATATYPE+uniqueDataKeySplit[0]+PROPERTIES+uniqueDataKeySplit[1]+TYPE;
String typeValue=map.get(findType);
LOGGER.info(typeValue);
@@ -476,10 +474,7 @@ public class CreateDcaeMicroServiceController extends RestrictedBaseController {
HashMap<String,String> hmSub;
for(Map.Entry<String, String> entry: dataMapForJson.entrySet()){
String uniqueDataKey= entry.getKey();
- String[] uniqueDataKeySplit=uniqueDataKey.split("%",2);
- if (uniqueDataKeySplit.length < 2) {
- continue;
- }
+ String[] uniqueDataKeySplit=uniqueDataKey.split("%");
String value= dataMapForJson.get(uniqueDataKey);
if(dataMapKey.containsKey(uniqueDataKeySplit[0])){
hmSub = dataMapKey.get(uniqueDataKeySplit[0]);
@@ -743,10 +738,7 @@ public class CreateDcaeMicroServiceController extends RestrictedBaseController {
if(jsonArray != null && arryKey.equals(nodeKey.substring(0,nodeKey.indexOf("@")))){
jsonArray.put(decodeContent(node));
}
- if(key.contains("@") && !arryKey.equals(key.substring(0,nodeKey.indexOf("@")))){
- jsonResult.put(arryKey, jsonArray);
- jsonArray = new JSONArray();
- }else if(!key.contains("@")){
+ if((key.contains("@") && !arryKey.equals(key.substring(0,nodeKey.indexOf("@")))) || !key.contains("@")){
jsonResult.put(arryKey, jsonArray);
jsonArray = new JSONArray();
}
@@ -1231,18 +1223,13 @@ public class CreateDcaeMicroServiceController extends RestrictedBaseController {
}
}
- private String getPolicyScope(String value) {
- GroupPolicyScopeList pScope = new GroupPolicyScopeList();
- List<Object> groupList= commonClassDao.getData(GroupPolicyScopeList.class);
- if(groupList.size() > 0){
- for(int i = 0 ; i < groupList.size() ; i ++){
- pScope = (GroupPolicyScopeList) groupList.get(i);
- if (pScope.getGroupList().equals(value)){
- break;
- }
- }
+ private String getPolicyScope(String value) {
+ List<Object> groupList= commonClassDao.getDataById(GroupPolicyScopeList.class, "groupList", value);
+ if(groupList != null && !groupList.isEmpty()){
+ GroupPolicyScopeList pScope = (GroupPolicyScopeList) groupList.get(0);
+ return pScope.getGroupName();
}
- return pScope.getGroupName();
+ return null;
}
//Convert the map values and set into JSON body
diff --git a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/CreateFirewallController.java b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/CreateFirewallController.java
index 4aea6370b..2232da608 100644
--- a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/CreateFirewallController.java
+++ b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/CreateFirewallController.java
@@ -19,7 +19,6 @@
*/
package org.openecomp.policy.controller;
-import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.HashMap;
@@ -67,11 +66,8 @@ import org.openecomp.portalsdk.core.controller.RestrictedBaseController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.servlet.ModelAndView;
-import com.fasterxml.jackson.core.JsonGenerationException;
import com.fasterxml.jackson.databind.DeserializationFeature;
-import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectWriter;
@@ -87,7 +83,7 @@ import oasis.names.tc.xacml._3_0.core.schema.wd_17.TargetType;
@Controller
@RequestMapping("/")
public class CreateFirewallController extends RestrictedBaseController {
- private static Logger logger = FlexLogger.getLogger(CreateFirewallController.class);
+ private static Logger policyLogger = FlexLogger.getLogger(CreateFirewallController.class);
@Autowired
SessionFactory sessionFactory;
@@ -110,9 +106,9 @@ public class CreateFirewallController extends RestrictedBaseController {
public PolicyRestAdapter setDataToPolicyRestAdapter(PolicyRestAdapter policyData){
- termCollectorList = new ArrayList<String>();
- tagCollectorList = new ArrayList<String>();
- if(policyData.getAttributes().size() > 0){
+ termCollectorList = new ArrayList<>();
+ tagCollectorList = new ArrayList<>();
+ if(!policyData.getAttributes().isEmpty()){
for(Object attribute : policyData.getAttributes()){
if(attribute instanceof LinkedHashMap<?, ?>){
String key = ((LinkedHashMap<?, ?>) attribute).get("key").toString();
@@ -135,16 +131,14 @@ public class CreateFirewallController extends RestrictedBaseController {
}
private List<String> mapping(String expandableList) {
- String value = new String();
- String desc = new String();
List <String> valueDesc= new ArrayList<>();
List<Object> prefixListData = commonClassDao.getData(PrefixList.class);
for (int i = 0; i< prefixListData.size(); i++) {
PrefixList prefixList = (PrefixList) prefixListData.get(i);
if (prefixList.getPrefixListName().equals(expandableList)) {
- value = prefixList.getPrefixListValue();
+ String value = prefixList.getPrefixListValue();
valueDesc.add(value);
- desc= prefixList.getDescription();
+ String desc= prefixList.getDescription();
valueDesc.add(desc);
break;
}
@@ -198,14 +192,15 @@ public class CreateFirewallController extends RestrictedBaseController {
// policy name value is the policy name without any prefix and Extensions.
policyAdapter.setOldPolicyFileName(policyAdapter.getPolicyName());
String policyNameValue = policyAdapter.getPolicyName().substring(policyAdapter.getPolicyName().indexOf("FW_") +3);
- if (logger.isDebugEnabled()) {
- logger.debug("Prepopulating form data for Config Policy selected:"+ policyAdapter.getPolicyName());
+ if (policyLogger.isDebugEnabled()) {
+ policyLogger.debug("Prepopulating form data for Config Policy selected:"+ policyAdapter.getPolicyName());
}
policyAdapter.setPolicyName(policyNameValue);
String description = "";
try{
description = policy.getDescription().substring(0, policy.getDescription().indexOf("@CreatedBy:"));
}catch(Exception e){
+ policyLogger.info("General error", e);
description = policy.getDescription();
}
policyAdapter.setPolicyDescription(description);
@@ -229,7 +224,7 @@ public class CreateFirewallController extends RestrictedBaseController {
}
}
catch(Exception e) {
- logger.error("Exception Caused while Retriving the JSON body data" +e);
+ policyLogger.error("Exception Caused while Retriving the JSON body data" +e);
}
Map<String, String> termTagMap=null;
@@ -317,14 +312,14 @@ public class CreateFirewallController extends RestrictedBaseController {
}
@RequestMapping(value={"/policyController/ViewFWPolicyRule.htm"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
- public ModelAndView setFWViewRule(HttpServletRequest request, HttpServletResponse response) throws Exception{
+ public void setFWViewRule(HttpServletRequest request, HttpServletResponse response){
try {
termCollectorList = new ArrayList<>();
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
JsonNode root = mapper.readTree(request.getReader());
PolicyRestAdapter policyData = (PolicyRestAdapter)mapper.readValue(root.get("policyData").toString(), PolicyRestAdapter.class);
- if(policyData.getAttributes().size() > 0){
+ if(!policyData.getAttributes().isEmpty()){
for(Object attribute : policyData.getAttributes()){
if(attribute instanceof LinkedHashMap<?, ?>){
String key = ((LinkedHashMap<?, ?>) attribute).get("key").toString();
@@ -450,7 +445,7 @@ public class CreateFirewallController extends RestrictedBaseController {
}
}
}
- displayString.append("\n");
+ displayString.append("\n");
}
ruleAction=(jpaTermList).getAction();
@@ -469,11 +464,9 @@ public class CreateFirewallController extends RestrictedBaseController {
String responseString = mapper.writeValueAsString(displayString);
JSONObject j = new JSONObject("{policyData: " + responseString + "}");
out.write(j.toString());
- return null;
} catch (Exception e) {
- logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
+ policyLogger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
}
- return null;
}
private String constructJson(PolicyRestAdapter policyData) {
@@ -847,10 +840,10 @@ public class CreateFirewallController extends RestrictedBaseController {
PrefixIPList targetAddressList = new PrefixIPList();
AddressMembers addressMembers= new AddressMembers();
targetAddressList.setName(prefixIP);
- logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "PrefixList value:"+prefixIP);
+ policyLogger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "PrefixList value:"+prefixIP);
valueDesc = mapping(prefixIP);
if(!valueDesc.isEmpty()){
- logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "PrefixList description:"+valueDesc.get(1));
+ policyLogger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "PrefixList description:"+valueDesc.get(1));
targetAddressList.setDescription(valueDesc.get(1));
}
@@ -922,16 +915,12 @@ public class CreateFirewallController extends RestrictedBaseController {
ObjectWriter om = new ObjectMapper().writer();
try {
json = om.writeValueAsString(tc);
- } catch (JsonGenerationException e) {
- logger.error("Exception Occured"+e);
- } catch (JsonMappingException e) {
- logger.error("Exception Occured"+e);
- } catch (IOException e) {
- logger.error("Exception Occured"+e);
+ } catch (Exception e) {
+ policyLogger.error("Exception Occured"+e);
}
}catch (Exception e) {
- logger.error("Exception Occured"+e);
+ policyLogger.error("Exception Occured"+e);
}
return json;
diff --git a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/DashboardController.java b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/DashboardController.java
index 56ff637e9..089470671 100644
--- a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/DashboardController.java
+++ b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/DashboardController.java
@@ -73,7 +73,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
@Controller
@RequestMapping({"/"})
public class DashboardController extends RestrictedBaseController{
- private static final Logger logger = FlexLogger.getLogger(DashboardController.class);
+ private static final Logger policyLogger = FlexLogger.getLogger(DashboardController.class);
@Autowired
SystemLogDbDao systemDAO;
@@ -110,7 +110,7 @@ public class DashboardController extends RestrictedBaseController{
response.getWriter().write(j.toString());
}
catch (Exception e){
- logger.error("Exception Occured"+e);
+ policyLogger.error("Exception Occured"+e);
}
}
@@ -125,7 +125,7 @@ public class DashboardController extends RestrictedBaseController{
response.getWriter().write(j.toString());
}
catch (Exception e){
- logger.error("Exception Occured"+e);
+ policyLogger.error("Exception Occured"+e);
}
}
@@ -142,7 +142,7 @@ public class DashboardController extends RestrictedBaseController{
response.getWriter().write(j.toString());
}
catch (Exception e){
- logger.error("Exception Occured"+e);
+ policyLogger.error("Exception Occured"+e);
}
}
@@ -161,7 +161,7 @@ public class DashboardController extends RestrictedBaseController{
response.getWriter().write(j.toString());
}
catch (Exception e){
- logger.error("Exception Occured"+e);
+ policyLogger.error("Exception Occured"+e);
}
}
@@ -180,7 +180,7 @@ public class DashboardController extends RestrictedBaseController{
response.getWriter().write(j.toString());
}
catch (Exception e){
- logger.error("Exception Occured"+e);
+ policyLogger.error("Exception Occured"+e);
}
}
@@ -201,7 +201,7 @@ public class DashboardController extends RestrictedBaseController{
}
} catch (PAPException | NullPointerException e1) {
papStatus = "CANNOT_CONNECT";
- logger.error("Error getting PAP status, PAP not responding to requests");
+ policyLogger.error("Error getting PAP status, PAP not responding to requests", e1);
}
String papURL = XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_URL);
JSONObject object = new JSONObject();
@@ -229,11 +229,12 @@ public class DashboardController extends RestrictedBaseController{
if (pdp.getStatus().getStatus().toString() == "UP_TO_DATE" && ((EcompPDP) pdp).getJmxPort() != 0){
String pdpIpAddress = parseIPSystem(pdp.getId());
int port = ((EcompPDP) pdp).getJmxPort();
- if (port != 0)
- logger.debug("Getting JMX Response Counts from " + pdpIpAddress + " at JMX port " + port);
- naCount = getRequestCounts(pdpIpAddress, port, "pdpEvaluationNA");
- permitCount = getRequestCounts(pdpIpAddress, port, "PdpEvaluationPermit");
- denyCount = getRequestCounts(pdpIpAddress, port, "PdpEvaluationDeny");
+ if (port != 0){
+ policyLogger.debug("Getting JMX Response Counts from " + pdpIpAddress + " at JMX port " + port);
+ naCount = getRequestCounts(pdpIpAddress, port, "pdpEvaluationNA");
+ permitCount = getRequestCounts(pdpIpAddress, port, "PdpEvaluationPermit");
+ denyCount = getRequestCounts(pdpIpAddress, port, "PdpEvaluationDeny");
+ }
}
if (naCount == -1){
JSONObject object = new JSONObject();
@@ -279,7 +280,7 @@ public class DashboardController extends RestrictedBaseController{
@SuppressWarnings({ "rawtypes", "unchecked" })
private long getRequestCounts(String host, int port, String jmxAttribute) {
- logger.debug("Create an RMI connector client and connect it to the JMX connector server");
+ policyLogger.debug("Create an RMI connector client and connect it to the JMX connector server");
HashMap map = new HashMap();
map = null;
JMXConnector jmxConnection;
@@ -288,23 +289,23 @@ public class DashboardController extends RestrictedBaseController{
jmxConnection.connect();
Object o = jmxConnection.getMBeanServerConnection().getAttribute(new ObjectName("PdpRest:type=PdpRestMonitor"), jmxAttribute);
jmxConnection.close();
- logger.debug("pdpEvaluationNA value retreived: " + o);
+ policyLogger.debug("pdpEvaluationNA value retreived: " + o);
return (long) o;
} catch (MalformedURLException e) {
- logger.error("MalformedURLException for JMX connection");
+ policyLogger.error("MalformedURLException for JMX connection" , e);
} catch (IOException e) {
- logger.error("Error in reteriving" + jmxAttribute + " from JMX connection");
+ policyLogger.error("Error in reteriving" + jmxAttribute + " from JMX connection", e);
} catch (AttributeNotFoundException e) {
- logger.error("AttributeNotFoundException " + jmxAttribute + " for JMX connection");
+ policyLogger.error("AttributeNotFoundException " + jmxAttribute + " for JMX connection", e);
} catch (InstanceNotFoundException e) {
- logger.error("InstanceNotFoundException " + host + " for JMX connection");
+ policyLogger.error("InstanceNotFoundException " + host + " for JMX connection", e);
} catch (MalformedObjectNameException e) {
- logger.error("MalformedObjectNameException for JMX connection");
+ policyLogger.error("MalformedObjectNameException for JMX connection", e);
} catch (MBeanException e) {
- logger.error("MBeanException for JMX connection");
- logger.error("Exception Occured"+e);
+ policyLogger.error("MBeanException for JMX connection");
+ policyLogger.error("Exception Occured"+e);
} catch (ReflectionException e) {
- logger.error("ReflectionException for JMX connection");
+ policyLogger.error("ReflectionException for JMX connection", e);
}
return -1;
@@ -332,7 +333,7 @@ public class DashboardController extends RestrictedBaseController{
try{
policyMap.put(policy.getPolicyId().replace(" ", ""), policy.getId());
}catch(Exception e){
- logger.error(XACMLErrorConstants.ERROR_SCHEMA_INVALID+policy.getName() +e);
+ policyLogger.error(XACMLErrorConstants.ERROR_SCHEMA_INVALID+policy.getName() +e);
}
}
@@ -386,7 +387,7 @@ public class DashboardController extends RestrictedBaseController{
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
private Object getPolicy(String host, int port, String jmxAttribute){
- logger.debug("Create an RMI connector client and connect it to the JMX connector server for Policy: " + host);
+ policyLogger.debug("Create an RMI connector client and connect it to the JMX connector server for Policy: " + host);
HashMap map = new HashMap();
map = null;
JMXConnector jmxConnection;
@@ -395,23 +396,23 @@ public class DashboardController extends RestrictedBaseController{
jmxConnection.connect();
Object o = jmxConnection.getMBeanServerConnection().getAttribute(new ObjectName("PdpRest:type=PdpRestMonitor"), "policyMap");
jmxConnection.close();
- logger.debug("policyMap value retreived: " + o);
+ policyLogger.debug("policyMap value retreived: " + o);
return o;
} catch (MalformedURLException e) {
- logger.error("MalformedURLException for JMX connection");
+ policyLogger.error("MalformedURLException for JMX connection");
} catch (IOException e) {
- logger.error("AttributeNotFoundException for policyMap" );
+ policyLogger.error("AttributeNotFoundException for policyMap" );
} catch (AttributeNotFoundException e) {
- logger.error("AttributeNotFoundException for JMX connection");
+ policyLogger.error("AttributeNotFoundException for JMX connection");
} catch (InstanceNotFoundException e) {
- logger.error("InstanceNotFoundException " + host + " for JMX connection");
+ policyLogger.error("InstanceNotFoundException " + host + " for JMX connection");
} catch (MalformedObjectNameException e) {
- logger.error("MalformedObjectNameException for JMX connection");
+ policyLogger.error("MalformedObjectNameException for JMX connection");
} catch (MBeanException e) {
- logger.error("MBeanException for JMX connection");
- logger.error("Exception Occured"+e);
+ policyLogger.error("MBeanException for JMX connection");
+ policyLogger.error("Exception Occured"+e);
} catch (ReflectionException e) {
- logger.error("ReflectionException for JMX connection");
+ policyLogger.error("ReflectionException for JMX connection");
}
return null;
diff --git a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/DecisionPolicyController.java b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/DecisionPolicyController.java
index ef43135c2..f959495c6 100644
--- a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/DecisionPolicyController.java
+++ b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/DecisionPolicyController.java
@@ -21,6 +21,7 @@
package org.openecomp.policy.controller;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
@@ -39,7 +40,6 @@ import org.openecomp.portalsdk.core.controller.RestrictedBaseController;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
-import oasis.names.tc.xacml._3_0.core.schema.wd_17.AdviceExpressionType;
import oasis.names.tc.xacml._3_0.core.schema.wd_17.AdviceExpressionsType;
import oasis.names.tc.xacml._3_0.core.schema.wd_17.AllOfType;
import oasis.names.tc.xacml._3_0.core.schema.wd_17.AnyOfType;
@@ -58,7 +58,7 @@ import oasis.names.tc.xacml._3_0.core.schema.wd_17.VariableReferenceType;
@Controller
@RequestMapping("/")
public class DecisionPolicyController extends RestrictedBaseController {
- private static final Logger logger = FlexLogger.getLogger(DecisionPolicyController.class);
+ private static final Logger policyLogger = FlexLogger.getLogger(DecisionPolicyController.class);
public DecisionPolicyController(){}
@@ -88,6 +88,7 @@ public class DecisionPolicyController extends RestrictedBaseController {
try{
description = policy.getDescription().substring(0, policy.getDescription().indexOf("@CreatedBy:"));
}catch(Exception e){
+ policyLogger.info("General error", e);
description = policy.getDescription();
}
policyAdapter.setPolicyDescription(description);
@@ -141,23 +142,28 @@ public class DecisionPolicyController extends RestrictedBaseController {
}
}
// Setting rainy day attributes to the parameters object if they exist
+ boolean rainy = false;
if(!attributeList.isEmpty()) {
for(int i=0; i<attributeList.size() ; i++){
Map<String, String> map = (Map<String,String>)attributeList.get(i);
if(map.get("key").equals("WorkStep")){
rainydayParams.setWorkstep(map.get("value"));
+ rainy=true;
}else if(map.get("key").equals("BB_ID")){
rainydayParams.setBbid(map.get("value"));
+ rainy=true;
}else if(map.get("key").equals("ServiceType")){
rainydayParams.setServiceType(map.get("value"));
+ rainy=true;
}else if(map.get("key").equals("VNFType")){
rainydayParams.setVnfType(map.get("value"));
+ rainy=true;
}
}
}
-
- policyAdapter.setRuleProvider("Rainy_Day");
-
+ if(rainy){
+ policyAdapter.setRuleProvider("Rainy_Day");
+ }
}
List<Object> ruleList = policy.getCombinerParametersOrRuleCombinerParametersOrVariableDefinition();
@@ -165,7 +171,7 @@ public class DecisionPolicyController extends RestrictedBaseController {
for (Object object : ruleList) {
if (object instanceof VariableDefinitionType) {
VariableDefinitionType variableDefinitionType = (VariableDefinitionType) object;
- Map<String, String> settings = new HashMap<String, String>();
+ Map<String, String> settings = new HashMap<>();
settings.put("key", variableDefinitionType.getVariableId());
JAXBElement<AttributeValueType> attributeValueTypeElement = (JAXBElement<AttributeValueType>) variableDefinitionType.getExpression();
if (attributeValueTypeElement != null) {
@@ -201,6 +207,10 @@ public class DecisionPolicyController extends RestrictedBaseController {
yamlParams.setActor(map.get("value"));
}else if(map.get("key").equals("recipe")){
yamlParams.setRecipe(map.get("value"));
+ }else if(map.get("key").equals("targets")){
+ yamlParams.setTargets(Arrays.asList(map.get("value").split("\\|")));
+ }else if(map.get("key").equals("clname")){
+ yamlParams.setClname(map.get("value"));
}
}
ApplyType apply = ((ApplyType)((ApplyType)decisionApply.getExpression().get(0).getValue()).getExpression().get(0).getValue());
@@ -215,9 +225,11 @@ public class DecisionPolicyController extends RestrictedBaseController {
}
yamlParams.setBlackList(blackList);
}else{
- yamlParams.setLimit(((AttributeValueType)((ApplyType)decisionApply.getExpression().get(1).getValue()).getExpression().get(1).getValue()).getContent().get(0).toString());
- String timeWindow = ((AttributeDesignatorType)((ApplyType)((ApplyType)decisionApply.getExpression().get(1).getValue()).getExpression().get(0).getValue()).getExpression().get(0).getValue()).getIssuer();
- yamlParams.setTimeWindow(timeWindow.substring(timeWindow.lastIndexOf(":")+1));
+ ApplyType timeWindowSection = (ApplyType)((ApplyType)decisionApply.getExpression().get(0).getValue()).getExpression().get(1).getValue();
+ yamlParams.setLimit(((AttributeValueType)timeWindowSection.getExpression().get(1).getValue()).getContent().get(0).toString());
+ String timeWindow = ((AttributeDesignatorType)((ApplyType)timeWindowSection.getExpression().get(0).getValue()).getExpression().get(0).getValue()).getIssuer();
+ yamlParams.setTimeUnits(timeWindow.substring(timeWindow.lastIndexOf(':')+1));
+ yamlParams.setTimeWindow(timeWindow.substring(timeWindow.indexOf(":tw:")+4,timeWindow.lastIndexOf(':')));
}
policyAdapter.setYamlparams(yamlParams);
policyAdapter.setAttributes(new ArrayList<Object>());
@@ -228,7 +240,7 @@ public class DecisionPolicyController extends RestrictedBaseController {
prePopulateDecisionCompoundRuleAlgorithm(index, decisionApply);
policyAdapter.setRuleAlgorithmschoices(ruleAlgorithmList);
}
- } else if (((RuleType) object).getEffect().equals(EffectType.PERMIT)) {
+ } else if(policyAdapter.getRuleProvider()!=null && policyAdapter.getRuleProvider().equals("Rainy_Day")&& ((RuleType) object).getEffect().equals(EffectType.PERMIT)) {
TargetType ruleTarget = ((RuleType) object).getTarget();
AdviceExpressionsType adviceExpression = ((RuleType) object).getAdviceExpressions();
@@ -303,8 +315,8 @@ public class DecisionPolicyController extends RestrictedBaseController {
List<JAXBElement<?>> jaxbDecisionTypes = decisionApply.getExpression();
for (JAXBElement<?> jaxbElement : jaxbDecisionTypes) {
// If There is Attribute Value under Decision Type that means we came to the final child
- if (logger.isDebugEnabled()) {
- logger.debug("Prepopulating rule algoirthm: " + index);
+ if (policyLogger.isDebugEnabled()) {
+ policyLogger.debug("Prepopulating rule algoirthm: " + index);
}
// Check to see if Attribute Value exists, if yes then it is not a compound rule
if(jaxbElement.getValue() instanceof AttributeValueType) {
@@ -321,8 +333,8 @@ public class DecisionPolicyController extends RestrictedBaseController {
index = prePopulateDecisionCompoundRuleAlgorithm(index, innerDecisionApply);
}
// Populate combo box
- if (logger.isDebugEnabled()) {
- logger.debug("Prepopulating Compound rule algorithm: " + index);
+ if (policyLogger.isDebugEnabled()) {
+ policyLogger.debug("Prepopulating Compound rule algorithm: " + index);
}
Map<String, String> rule = new HashMap<>();
for (String key : PolicyController.getDropDownMap().keySet()) {
diff --git a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/PDPController.java b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/PDPController.java
index 2e9771ec8..6ef7165b3 100644
--- a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/PDPController.java
+++ b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/PDPController.java
@@ -59,7 +59,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
@Controller
@RequestMapping({"/"})
public class PDPController extends RestrictedBaseController {
- private static final Logger logger = FlexLogger.getLogger(PDPController.class);
+ private static final Logger policyLogger = FlexLogger.getLogger(PDPController.class);
protected List<EcompPDPGroup> groups = Collections.synchronizedList(new ArrayList<EcompPDPGroup>());
private PDPGroupContainer container;
@@ -152,7 +152,7 @@ public class PDPController extends RestrictedBaseController {
}
} catch (PAPException e) {
String message = "Unable to retrieve Groups from server: " + e;
- logger.error(XACMLErrorConstants.ERROR_SYSTEM_ERROR+"Pap Engine is Null" + message);
+ policyLogger.error(XACMLErrorConstants.ERROR_SYSTEM_ERROR+"Pap Engine is Null" + message);
}
}
}
@@ -167,12 +167,12 @@ public class PDPController extends RestrictedBaseController {
response.getWriter().write(j.toString());
}
catch (Exception e){
- logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE+"Error Occured while retrieving the PDP Group data" + e);
+ policyLogger.error(XACMLErrorConstants.ERROR_DATA_ISSUE+"Error Occured while retrieving the PDP Group data" + e);
}
}
@RequestMapping(value={"/pdp_Group/save_pdp_group"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
- public ModelAndView savePDPGroup(HttpServletRequest request, HttpServletResponse response) throws Exception{
+ public void savePDPGroup(HttpServletRequest request, HttpServletResponse response){
try {
ObjectMapper mapper = new ObjectMapper();
PolicyController controller = getPolicyControllerInstance();
@@ -189,7 +189,7 @@ public class PDPController extends RestrictedBaseController {
} catch (Exception e) {
String message = "Unable to create Group. Reason:\n" + e.getMessage();
- logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE+"Error Occured while creating the PDP Group" + message);
+ policyLogger.error(XACMLErrorConstants.ERROR_DATA_ISSUE+"Error Occured while creating the PDP Group" + message + e);
}
@@ -202,21 +202,23 @@ public class PDPController extends RestrictedBaseController {
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(groups));
JSONObject j = new JSONObject(msg);
out.write(j.toString());
-
- return null;
}
catch (Exception e){
- logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE+"Error Occured while Saving the PDP Group" + e);
+ policyLogger.error(XACMLErrorConstants.ERROR_DATA_ISSUE+"Error Occured while Saving the PDP Group" + e);
response.setCharacterEncoding("UTF-8");
- request.setCharacterEncoding("UTF-8");
- PrintWriter out = response.getWriter();
- out.write(e.getMessage());
+ PrintWriter out = null;
+ try {
+ request.setCharacterEncoding("UTF-8");
+ out = response.getWriter();
+ out.write(e.getMessage());
+ } catch (Exception e1) {
+ policyLogger.error(XACMLErrorConstants.ERROR_DATA_ISSUE+"Error Occured while Saving the PDP Group" + e1);
+ }
}
- return null;
}
@RequestMapping(value={"/pdp_Group/remove_pdp_group"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
- public ModelAndView removePDPGroup(HttpServletRequest request, HttpServletResponse response) throws Exception {
+ public void removePDPGroup(HttpServletRequest request, HttpServletResponse response){
try{
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
@@ -240,21 +242,23 @@ public class PDPController extends RestrictedBaseController {
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(groups));
JSONObject j = new JSONObject(msg);
out.write(j.toString());
-
- return null;
}
catch (Exception e){
- logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE+"Error Occured while Removing the PDP Group" + e);
- response.setCharacterEncoding("UTF-8");
- request.setCharacterEncoding("UTF-8");
- PrintWriter out = response.getWriter();
- out.write(e.getMessage());
+ policyLogger.error(XACMLErrorConstants.ERROR_DATA_ISSUE+"Error Occured while Removing the PDP Group" + e);
+ PrintWriter out;
+ try {
+ response.setCharacterEncoding("UTF-8");
+ request.setCharacterEncoding("UTF-8");
+ out = response.getWriter();
+ out.write(e.getMessage());
+ } catch (Exception e1) {
+ policyLogger.error("Exception Occured"+ e1);
+ }
}
- return null;
}
@RequestMapping(value={"/pdp_Group/save_pdpTogroup"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
- public ModelAndView savePDPToGroup(HttpServletRequest request, HttpServletResponse response) throws Exception{
+ public void savePDPToGroup(HttpServletRequest request, HttpServletResponse response){
try {
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
@@ -273,7 +277,7 @@ public class PDPController extends RestrictedBaseController {
}
} catch (Exception e) {
String message = "Unable to create Group. Reason:\n" + e.getMessage();
- logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE+"Error Occured while Creating Pdp in PDP Group" + message);
+ policyLogger.error(XACMLErrorConstants.ERROR_DATA_ISSUE+"Error Occured while Creating Pdp in PDP Group" + message + e);
}
@@ -286,21 +290,23 @@ public class PDPController extends RestrictedBaseController {
JsonMessage msg = new JsonMessage(mapper.writeValueAsString(groups));
JSONObject j = new JSONObject(msg);
out.write(j.toString());
-
- return null;
}
catch (Exception e){
- logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE+"Error Occured while Creating Pdp in PDP Group" + e);
- response.setCharacterEncoding("UTF-8");
- request.setCharacterEncoding("UTF-8");
- PrintWriter out = response.getWriter();
- out.write(e.getMessage());
+ policyLogger.error(XACMLErrorConstants.ERROR_DATA_ISSUE+"Error Occured while Creating Pdp in PDP Group" + e);
+ PrintWriter out;
+ try {
+ response.setCharacterEncoding("UTF-8");
+ request.setCharacterEncoding("UTF-8");
+ out = response.getWriter();
+ out.write(e.getMessage());
+ } catch (Exception e1) {
+ policyLogger.error("Exception Occured"+ e1);
+ }
}
- return null;
}
@RequestMapping(value={"/pdp_Group/remove_pdpFromGroup"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
- public ModelAndView removePDPFromGroup(HttpServletRequest request, HttpServletResponse response) throws Exception {
+ public void removePDPFromGroup(HttpServletRequest request, HttpServletResponse response){
try{
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
@@ -320,17 +326,19 @@ public class PDPController extends RestrictedBaseController {
String responseString = mapper.writeValueAsString(groups);
JSONObject j = new JSONObject("{pdpEntityDatas: " + responseString + "}");
out.write(j.toString());
-
- return null;
}
catch (Exception e){
- logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE+"Error Occured while Removing Pdp from PDP Group" + e);
- response.setCharacterEncoding("UTF-8");
- request.setCharacterEncoding("UTF-8");
- PrintWriter out = response.getWriter();
- out.write(e.getMessage());
+ policyLogger.error(XACMLErrorConstants.ERROR_DATA_ISSUE+"Error Occured while Removing Pdp from PDP Group" + e);
+ PrintWriter out;
+ try {
+ response.setCharacterEncoding("UTF-8");
+ request.setCharacterEncoding("UTF-8");
+ out = response.getWriter();
+ out.write(e.getMessage());
+ } catch (Exception e1) {
+ policyLogger.error("Exception Occured"+ e1);
+ }
}
- return null;
}
private PolicyController getPolicyControllerInstance(){
diff --git a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/PolicyExportAndImportController.java b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/PolicyExportAndImportController.java
index bf2a148e6..8fe2d492f 100644
--- a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/PolicyExportAndImportController.java
+++ b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/PolicyExportAndImportController.java
@@ -99,6 +99,14 @@ public class PolicyExportAndImportController extends RestrictedBaseController {
this.policyController = policyController;
}
+ public static CommonClassDao getCommonClassDao() {
+ return commonClassDao;
+ }
+
+ public static void setCommonClassDao(CommonClassDao commonClassDao) {
+ PolicyExportAndImportController.commonClassDao = commonClassDao;
+ }
+
@Autowired
private PolicyExportAndImportController(CommonClassDao commonClassDao){
PolicyExportAndImportController.commonClassDao = commonClassDao;
@@ -107,7 +115,7 @@ public class PolicyExportAndImportController extends RestrictedBaseController {
public PolicyExportAndImportController(){}
@RequestMapping(value={"/policy_download/exportPolicy.htm"}, method={org.springframework.web.bind.annotation.RequestMethod.POST})
- public void ExportPolicy(HttpServletRequest request, HttpServletResponse response) throws Exception{
+ public void exportPolicy(HttpServletRequest request, HttpServletResponse response) throws Exception{
try{
String file = null;
selectedPolicy = new ArrayList<>();
diff --git a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/PolicyValidationController.java b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/PolicyValidationController.java
index cc6903b91..0f8b3795f 100644
--- a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/PolicyValidationController.java
+++ b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/PolicyValidationController.java
@@ -401,10 +401,8 @@ public class PolicyValidationController extends RestrictedBaseController {
int endNum = Integer.parseInt(tempString[1]);
String returnString = "Invalid Range:" + rMap.getKey() + " must be between "
+ startNum + " - " + endNum + ",";
- if (isInteger(value.replace("\"", ""))){
+ if (PolicyUtils.isInteger(value.replace("\"", ""))){
int result = Integer.parseInt(value.replace("\"", ""));
-
-
if (result < startNum || result > endNum){
responseString.append(returnString);
valid = false;
@@ -492,13 +490,20 @@ public class PolicyValidationController extends RestrictedBaseController {
if(policyData.getYamlparams().getLimit()==null){
responseString.append(" Guard Params <b>Limit</b> is Required " + "<br>");
valid = false;
- }else if(!isInteger(policyData.getYamlparams().getLimit())){
+ }else if(!PolicyUtils.isInteger(policyData.getYamlparams().getLimit())){
responseString.append(" Guard Params <b>Limit</b> Should be Integer " + "<br>");
valid = false;
}
if(policyData.getYamlparams().getTimeWindow()==null){
responseString.append("Guard Params <b>Time Window</b> is Required" + "<br>");
valid = false;
+ }else if(!PolicyUtils.isInteger(policyData.getYamlparams().getTimeWindow())){
+ responseString.append(" Guard Params <b>Time Window</b> Should be Integer " + "<br>");
+ valid = false;
+ }
+ if(policyData.getYamlparams().getTimeUnits()==null){
+ responseString.append("Guard Params <b>Time Units</b> is Required" + "<br>");
+ valid = false;
}
}else if("GUARD_BL_YAML".equals(policyData.getRuleProvider())){
if(policyData.getYamlparams().getBlackList()==null || policyData.getYamlparams().getBlackList().isEmpty()){
@@ -623,15 +628,6 @@ public class PolicyValidationController extends RestrictedBaseController {
return null;
}
- protected boolean isInteger(String number) {
- try{
- Integer.parseInt(number);
- }catch(NumberFormatException e){
- return false;
- }
- return true;
- }
-
protected String emptyValidator(String field){
String error;
if ("".equals(field) || field.contains(" ") || !field.matches("^[a-zA-Z0-9_]*$")) {
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/CSS/bootstrap/docs/assets/js/vendor/autoprefixer.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/CSS/bootstrap/docs/assets/js/vendor/autoprefixer.js
index 2919f5f62..2cf57d3ed 100644
--- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/CSS/bootstrap/docs/assets/js/vendor/autoprefixer.js
+++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/CSS/bootstrap/docs/assets/js/vendor/autoprefixer.js
@@ -14778,7 +14778,7 @@ var _inherits = function (subClass, superClass) { if (typeof superClass !== "fun
var Container = require("./container");
-// CSS at-rule like “this.keyframes name { }”.
+// CSS at-rule like �this.keyframes name { }�.
//
// Can contain declarations (like this.font-face or this.page) ot another rules.
var AtRule = (function (Container) {
@@ -15486,7 +15486,7 @@ var _inherits = function (subClass, superClass) { if (typeof superClass !== "fun
var Node = require("./node");
var vendor = require("./vendor");
-// CSS declaration like “color: black” in rules
+// CSS declaration like �color: black� in rules
var Declaration = (function (Node) {
function Declaration(defaults) {
this.type = "decl";
@@ -17281,7 +17281,7 @@ var Container = require("./container");
var Declaration = require("./declaration");
var list = require("./list");
-// CSS rule like “a { }”
+// CSS rule like �a { }�
var Rule = (function (Container) {
function Rule(defaults) {
this.type = "rule";
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/Windows/PushtabWindow/removeGroupPoliciesWindow.html b/POLICY-SDK-APP/src/main/webapp/app/policyApp/Windows/PushtabWindow/removeGroupPoliciesWindow.html
index 6ebda43a7..0cd3c52bd 100644
--- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/Windows/PushtabWindow/removeGroupPoliciesWindow.html
+++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/Windows/PushtabWindow/removeGroupPoliciesWindow.html
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/-->
<script type="text/ng-template" id="remove_PDPGroupPolicies_popup.html">
-<div class="modal" style="margin-bottom: 20px; width: 100%; height:80%" data-backdrop="static"
+<div class="modal" style="margin-bottom: 20px; width: 100%" height:80%" data-backdrop="static"
data-keyboard="false">
<div class="modal-dialog-lg">
<div class="modal-content">
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/DCAEMicroServicePolicyController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/DCAEMicroServicePolicyController.js
index fb966430c..94c1bc998 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
@@ -163,10 +163,14 @@ angular.module('abs').controller('dcaeMicroServiceController', ['$scope', '$wind
var addElement = parentElement.childElementCount + 1;
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);
}else{
div = document.getElementById("div."+value+"@0");
+
+ div.className += ' children_group'; //here is div with a group of children.
+
var childElement = parentElement.firstElementChild;
var countParent = parentElement.childElementCount;
var childElementString = childElement.innerHTML;
@@ -295,9 +299,12 @@ angular.module('abs').controller('dcaeMicroServiceController', ['$scope', '$wind
var plainAttributeKeys = [];
$scope.dcaeModelData = data[0].dcaeModelData;
$scope.dcaeJsonDate = data[0].jsonValue;
+ console.log("$scope.dcaeJsonDate: " + $scope.dcaeJsonDate);
var attributes = $scope.dcaeModelData.attributes;
var refAttributes = $scope.dcaeModelData.ref_attributes;
- var subAttributes = $scope.dcaeModelData.sub_attributes;
+ var subAttributes = $scope.dcaeModelData.sub_attributes;
+ console.log("subAttributes: " + subAttributes);
+
var enumAttributes = $scope.dcaeModelData.enumValues;
var annotation = $scope.dcaeModelData.annotation;
var dictionary = $scope.microServiceAttributeDictionaryDatas;
@@ -442,11 +449,11 @@ angular.module('abs').controller('dcaeMicroServiceController', ['$scope', '$wind
return Object.prototype.toString.call(arrayTest) === '[object Array]';
}
var lableList = [];
-
function deconstructJSON(dataTest, level , name) {
var array = false;
var label = level;
var stringValue = "java.lang.String";
+ var string = "string";
var intValue = "int";
var double = "double";
var boolean = "boolean";
@@ -459,6 +466,7 @@ angular.module('abs').controller('dcaeMicroServiceController', ['$scope', '$wind
for (key in dataTest) {
array = isArray(dataTest[key]);
console.log(key , dataTest[key]);
+
if (!!dataTest[key] && typeof(dataTest[key])=="object") {
if (array==false && key!=="0"){
$scope.labelLayout(label, key, array );
@@ -500,11 +508,35 @@ angular.module('abs').controller('dcaeMicroServiceController', ['$scope', '$wind
if (dataTest[key].includes('required-true')){
isRequired = true;
}
- console.log("attirbuteLabel = " + attirbuteLabel);
+
+ var subAttributes = $scope.dcaeModelData.sub_attributes;
+
+ if(subAttributes){
+ var jsonObject = JSON.parse(subAttributes);
+ var allkeys = Object.keys(jsonObject);
+ if(allkeys){
+ for (var k = 0; k < allkeys.length; k++) {
+ var keyValue = allkeys[k];
+ console.log(" keyValue:jsonObject["+keyValue+ "]: " + jsonObject[keyValue]);
+ if(jsonObject[keyValue]){
+ var tempObject = jsonObject[keyValue];
+ if(tempObject && tempObject[key]){
+ if (tempObject[key].includes('required-true')){
+ isRequired = true;
+ }
+ }
+ }
+ }
+ }
+ }
+
switch (dataTest[key].split(splitcolon)[0]){
case stringValue:
$scope.attributeBox(attributekey, array, attirbuteLabel, defaultValue, isRequired);
break;
+ case string:
+ $scope.attributeBox(attributekey, array, attirbuteLabel, defaultValue, isRequired);
+ break;
case intValue:
$scope.attributeBox(attributekey, array, attirbuteLabel, defaultValue, isRequired);
break;
@@ -582,13 +614,13 @@ angular.module('abs').controller('dcaeMicroServiceController', ['$scope', '$wind
var buttonaddLabel = document.createTextNode("+");
addButton.appendChild(buttonaddLabel);
addButton.setAttribute("id", labelValue + attibuteKey);
- addButton.setAttribute("class", "btn btn-default");
+ addButton.setAttribute("class", "btn btn-add-remove");
addButton.setAttribute("ng-click" , 'addNewChoice("'+labelValue + attibuteKey+'");');
addButton.setAttribute("ng-disabled" , "temp.policy.readOnly");
var removeButton = document.createElement("BUTTON");
var buttonremoveLabel = document.createTextNode("-");
removeButton.appendChild(buttonremoveLabel);
- removeButton.setAttribute("class", "btn btn-default");
+ removeButton.setAttribute("class", "btn btn-add-remove");
removeButton.setAttribute("ng-click" , 'removeChoice("'+labelValue + attibuteKey+'");');
removeButton.setAttribute("ng-disabled" , "temp.policy.readOnly");
document.getElementById(divID).appendChild(addButton);
@@ -597,6 +629,7 @@ angular.module('abs').controller('dcaeMicroServiceController', ['$scope', '$wind
document.getElementById(divID).appendChild(textField);
document.getElementById(divID).appendChild(br);
document.getElementById(divID).appendChild(divTag);
+
}else{
checkKey = labelValue + attibuteKey;
textField.setAttribute("id" , ''+labelValue +attibuteKey+'');
@@ -609,6 +642,16 @@ angular.module('abs').controller('dcaeMicroServiceController', ['$scope', '$wind
}
+ if(divID.includes("@0") && divID.includes("div.")){
+ var firstChild_Id = divID.split("@0")[0];
+ var firstChild_element = document.getElementById(firstChild_Id);
+ if(firstChild_element){
+ firstChild_element.className += ' children_group'; //here is a div with a group of children.
+ }
+ }
+ console.log('firstChild_Id: ' + firstChild_Id);
+ console.log('divID: ' + divID);
+
if (defaultValue.length > 0){
if(defaultValue.includes(":")){
defaultValue = defaultValue.split(":")[0];
@@ -661,18 +704,20 @@ angular.module('abs').controller('dcaeMicroServiceController', ['$scope', '$wind
var labeltext = document.createTextNode(lableName);
label.appendChild(labeltext);
+
+ var subAttributes = $scope.dcaeModelData.sub_attributes;
if(labelManyKey){
var addButton = document.createElement("BUTTON");
var buttonLabel = document.createTextNode("+");
addButton.appendChild(buttonLabel);
- addButton.setAttribute("class", "btn btn-default");
+ addButton.setAttribute("class", "btn btn-add-remove");
addButton.setAttribute("ng-click" , 'addNewChoice("'+labelValue + lableName+'");');
addButton.setAttribute("ng-disabled" , "temp.policy.readOnly");
var removeButton = document.createElement("BUTTON");
var buttonremoveLabel = document.createTextNode("-");
removeButton.appendChild(buttonremoveLabel);
- removeButton.setAttribute("class", "btn btn-default");
+ removeButton.setAttribute("class", "btn btn-add-remove");
removeButton.setAttribute("ng-click" , 'removeChoice("'+labelValue +lableName+'");');
removeButton.setAttribute("ng-disabled" , "temp.policy.readOnly");
document.getElementById(divID).appendChild(addButton);
@@ -685,12 +730,16 @@ angular.module('abs').controller('dcaeMicroServiceController', ['$scope', '$wind
var divTag = document.createElement("div");
divTag.setAttribute("id", id +'@0');
+
+ divTag.className += ' children_group'; //here is div with a group of children.
+
document.getElementById(id).appendChild(divTag);
}else{
var divTag = document.createElement("div");
divTag.setAttribute("id", "div."+labelValue+lableName);
+ divTag.className += ' children_group'; //here is div with a group of children.
document.getElementById(divID).appendChild(label);
- document.getElementById(divID).appendChild(divTag);
+ document.getElementById(divID).appendChild(divTag);
}
};
@@ -801,7 +850,6 @@ angular.module('abs').controller('dcaeMicroServiceController', ['$scope', '$wind
if (elumentLocation > 1){
enumKey = keySplit[keySplit.length - 1];
}
- var aWhiteSpace = " ";
if (enumKeyList.indexOf(enumKey) != -1){
if (splitPlainAttributeKey[1].indexOf("true") !== -1){
var multiSlect = [];
@@ -810,19 +858,11 @@ angular.module('abs').controller('dcaeMicroServiceController', ['$scope', '$wind
}
jsonPolicy[key]= multiSlect;
}else{
- //set a space due to empty value caused JSON format error in PolicyRestAdapter and remove it in back-end.
- if(searchElement.value == ""){
- searchElement.value = aWhiteSpace;
- }
console.log(" searchElement.value = > " + searchElement.value);
jsonPolicy[key]= searchElement.value;
}
} else {
if(searchElement.value != null){
- //set a default value due to empty value caused JSON format error in PolicyRestAdapter
- if(searchElement.value == ""){
- searchElement.value = aWhiteSpace;
- }
console.log(" searchElement.value = > " + searchElement.value);
jsonPolicy[key]= searchElement.value;
}
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/DecisionPolicyController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/DecisionPolicyController.js
index 4b5a990ef..72b6f06ca 100644
--- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/DecisionPolicyController.js
+++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/DecisionPolicyController.js
@@ -80,6 +80,26 @@ angular.module('abs').controller('decisionPolicyController', ['$scope', 'PolicyA
console.log("failed");
});
+ PolicyAppService.getData('getDictionary/get_RainyDayDictionaryDataByName').then(function (data) {
+ var j = data;
+ $scope.data = JSON.parse(j.data);
+ console.log($scope.data);
+ $scope.rainyDayDictionaryDatas = JSON.parse($scope.data.rainyDayDictionaryDatas);
+ console.log($scope.rainyDayDictionaryDatas);
+ }, function (error) {
+ console.log("failed");
+ });
+
+ PolicyAppService.getData('getDictionary/get_RainyDayDictionaryData').then(function (data) {
+ var j = data;
+ $scope.data = JSON.parse(j.data);
+ console.log($scope.data);
+ $scope.rainyDayDictionaryDataEntity = JSON.parse($scope.data.rainyDayDictionaryDatas);
+ console.log($scope.rainyDayDictionaryDatasEntity);
+ }, function (error) {
+ console.log("failed");
+ });
+
function extend(obj, src) {
for (var key in src) {
if (src.hasOwnProperty(key)) obj[key] = src[key];
@@ -166,6 +186,9 @@ angular.module('abs').controller('decisionPolicyController', ['$scope', 'PolicyA
if(!$scope.temp.policy.yamlparams){
$scope.temp.policy.yamlparams = {};
}
+ if(!$scope.temp.policy.yamlparams.targets){
+ $scope.temp.policy.yamlparams.targets = [];
+ }
if(!$scope.temp.policy.yamlparams.blackList){
$scope.temp.policy.yamlparams.blackList = [];
}
@@ -178,7 +201,7 @@ angular.module('abs').controller('decisionPolicyController', ['$scope', 'PolicyA
}else if($scope.temp.policy.ruleProvider=="Custom"){
if($scope.temp.policy.attributes.length == 0){
- $scope.temp.policy.attributes = [];
+ $scope.temp.policy.attributes = [];
}
if($scope.temp.policy.settings.length == 0){
$scope.temp.policy.settings = [];
@@ -190,6 +213,10 @@ angular.module('abs').controller('decisionPolicyController', ['$scope', 'PolicyA
if($scope.temp.policy.yamlparams.blackList.length==0){
$scope.temp.policy.yamlparams.blackList = [];
}
+ }else if($scope.temp.policy.ruleProvider=="GUARD_YAML"){
+ if($scope.temp.policy.yamlparams.targets.length==0){
+ $scope.temp.policy.yamlparams.targets = [];
+ }
}else if($scope.temp.policy.ruleProvider=="Rainy_Day"){
if($scope.temp.policy.rainyday.treatmentTableChoices == null || $scope.temp.policy.rainyday.treatmentTableChoices.length == 0){
$scope.temp.policy.rainyday.treatmentTableChoices = [];
@@ -215,6 +242,14 @@ angular.module('abs').controller('decisionPolicyController', ['$scope', 'PolicyA
$scope.temp.policy.settings.splice(lastItem);
};
+ $scope.addNewTarget = function(){
+ $scope.temp.policy.yamlparams.targets.push('');
+ };
+ $scope.removeTarget = function(){
+ var lastItem = $scope.temp.policy.yamlparams.targets.length-1;
+ $scope.temp.policy.yamlparams.targets.splice(lastItem);
+ };
+
$scope.addNewBL = function() {
$scope.temp.policy.yamlparams.blackList.push('');
};
@@ -232,6 +267,29 @@ angular.module('abs').controller('decisionPolicyController', ['$scope', 'PolicyA
$scope.temp.policy.rainyday.treatmentTableChoices.splice(lastItem);
};
+ $scope.workstepDictionaryDatas = [];
+ $scope.getWorkstepValues = function(bbidValue){
+ for (var i = 0; i < $scope.rainyDayDictionaryDataEntity.length; ++i) {
+ var obj = $scope.rainyDayDictionaryDataEntity[i];
+ if (obj.bbid == bbidValue){
+ $scope.workstepDictionaryDatas.push(obj.workstep);
+ }
+ }
+ };
+
+ $scope.allowedTreatmentsDatas = [];
+ $scope.getTreatmentValues = function(bbidValue, workstepValue){
+ for (var i = 0; i < $scope.rainyDayDictionaryDataEntity.length; ++i) {
+ var obj = $scope.rainyDayDictionaryDataEntity[i];
+ if (obj.bbid == bbidValue && obj.workstep == workstepValue){
+ var splitAlarm = obj.treatments.split(',');
+ for (var j = 0; j < splitAlarm.length; ++j) {
+ $scope.allowedTreatmentsDatas.push(splitAlarm[j]);
+ }
+ }
+ }
+ };
+
$scope.ItemNo = 0;
$scope.ruleAlgorithmDatas = [{"ruleAlgorithms" : $scope.temp.policy.ruleAlgorithmschoices }];
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/DCAEMicroServicePolicyTemplate.html b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/DCAEMicroServicePolicyTemplate.html
index a12300b97..f621f2cba 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
@@ -83,7 +83,7 @@
</div>
</div>
<div class="well">
- <div class="form-group col-sm-3" id="DynamicTemplate">
+ <div class="form-group col-sm-12" id="DynamicTemplate">
<label>Micro Service Attributes:<sup><b>*</b></sup></label><br>
</div>
</br>
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 49fc70df4..973a7afc2 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
@@ -62,17 +62,25 @@
<label>Building Block ID:<sup><b>*</b></sup></label>
</div>
<div class="form-group col-sm-2">
- <input type="text" class="form-control"
- ng-disabled="temp.policy.readOnly" ng-model="temp.policy.rainyday.bbid"
- placeholder="Building Block ID" />
+ <select
+ 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)">
+ <option value="">{{temp.policy.rainyday.bbid}}</option>
+ </select>
</div>
<div class="form-group col-sm-1">
<label>Work Step:<sup><b>*</b></sup></label>
</div>
<div class="form-group col-sm-2">
- <input type="text" class="form-control"
- ng-disabled="temp.policy.readOnly" ng-model="temp.policy.rainyday.workstep"
- placeholder="Work Step" />
+ <select
+ class="form-control" ng-disabled="temp.policy.readOnly"
+ ng-model="temp.policy.rainyday.workstep"
+ ng-options="option for option in workstepDictionaryDatas track by option"
+ ng-change="getTreatmentValues(temp.policy.rainyday.bbid, temp.policy.rainyday.workstep)">
+ <option value="">{{temp.policy.rainyday.workstep}}</option>
+ </select>
</div>
</div>
<div class="form-group row">
@@ -100,19 +108,14 @@
<div class="form-group col-sm-1">
<label>Desired Treatment:<sup><b>*</b></sup></label>
</div>
- <div class="form-group col-sm-3">
- <select class="form-control" id="mySelect"
+ <div class="form-group col-sm-3">
+ <select
+ class="form-control"
ng-disabled="temp.policy.readOnly"
ng-model="treatmentTableChoice.treatment"
- placeholder="Desired Treatment">
-<!-- <option value="">{{tableChoice.desiredtreatment}}</option> -->
- <option>Rollback</option>
- <option>Manual Handling</option>
- <option>Abort</option>
- <option>Auto Rollback</option>
- <option>Retry</option>
- <option>Skip</option>
- </select>
+ ng-options="option for option in allowedTreatmentsDatas track by option">
+ <option value="">{{treatmentTableChoice.treatment}}</option>
+ </select>
</div>
<div class="form-group col-sm-1">
<button type="button" class="btn btn-default"
@@ -131,7 +134,7 @@
<div class="well">
<div class="form-group row">
<div class="form-group col-sm-1">
- <label>Guard YAML Attributes:</label><br>
+ <label>Guard BlackList YAML Attributes:</label><br>
</div>
</div>
<div class="form-group row">
@@ -157,6 +160,16 @@
</div>
<div class="form-group row" style="margin-left: 2%">
<div class="form-group col-sm-3">
+ <label> CLName: </label>
+ </div>
+ <div class="form-group col-sm-3">
+ <input type="text" class="form-control"
+ ng-disabled="temp.policy.readOnly" ng-model="temp.policy.yamlparams.clname"
+ placeholder="CLName" />
+ </div>
+ </div>
+ <div class="form-group row" style="margin-left: 2%">
+ <div class="form-group col-sm-3">
<label> guardActiveStart: </label>
</div>
<div class="form-group col-sm-3">
@@ -235,6 +248,42 @@
</div>
<div class="form-group row" style="margin-left: 2%">
<div class="form-group col-sm-3">
+ <label> CLName: </label>
+ </div>
+ <div class="form-group col-sm-3">
+ <input type="text" class="form-control"
+ ng-disabled="temp.policy.readOnly" ng-model="temp.policy.yamlparams.clname"
+ placeholder="CLName" />
+ </div>
+ </div>
+ <div class="form-group row" style="margin-left: 2%">
+ <div class="form-group col-sm-3">
+ <label> Targets: </label>
+ <button type="button" class="btn btn-default"
+ ng-disabled="temp.policy.readOnly" ng-click="addNewTarget()">
+ <i class="fa fa-plus"></i>
+ </button>
+ </div>
+ <div class="form-group col-sm-4">
+ <div data-ng-repeat="choice in temp.policy.yamlparams.targets track by $index">
+ <div class="form-group row">
+ <div class="form-group col-sm-9">
+ <input type="text" class="form-control"
+ ng-disabled="temp.policy.readOnly"
+ ng-model="temp.policy.yamlparams.targets[$index]" placeholder="Target" />
+ </div>
+ <div class="form-group col-sm-1">
+ <button type="button" class="btn btn-default" ng-show="$last"
+ ng-disabled="temp.policy.readOnly" ng-click="removeTarget()">
+ <i class="fa fa-minus"></i>
+ </button>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ <div class="form-group row" style="margin-left: 2%">
+ <div class="form-group col-sm-3">
<label> limit: </label>
</div>
<div class="form-group col-sm-3">
@@ -247,18 +296,20 @@
<div class="form-group col-sm-3">
<label> timeWindow: </label>
</div>
- <div class="form-group col-sm-3">
+ <div class="form-group col-sm-2">
+ <input type="text" class="form-control"
+ ng-disabled="temp.policy.readOnly" ng-model="temp.policy.yamlparams.timeWindow"
+ placeholder="Time Window" />
+ </div>
+ <div class="form-group col-sm-1">
<select class="form-control" ng-disabled="temp.policy.readOnly"
- ng-model="temp.policy.yamlparams.timeWindow">
- <option>tw5min</option>
- <option>tw10min</option>
- <option>tw30min</option>
- <option>tw1h</option>
- <option>tw12h</option>
- <option>tw1d</option>
- <option>tw5d</option>
- <option>tw1w</option>
- <option>tw1mon</option>
+ ng-model="temp.policy.yamlparams.timeUnits">
+ <option>minute</option>
+ <option>hour</option>
+ <option>day</option>
+ <option>week</option>
+ <option>month</option>
+ <option>year</option>
</select>
</div>
</div>
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 78001f400..1122b6f1b 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
@@ -58,11 +58,47 @@ body {
margin-top: -5px;
}
+.btn.btn-pedefault {
+ color: #444;
+ background-color: #FAFAFA;
+}
+
.btn.btn-default {
color: #444;
background-color: #FAFAFA;
}
+.btn-add-remove {
+ color: #444;
+ background-color: #FAFAFA;
+ margin-right: 12px;
+ margin-bottom: 10px;
+}
+
+.child_single {
+ color: #444;
+ background-color: #FAFAFA;
+ margin-left: 0px;
+ margin-bottom: 10px;
+ border: 1px solid #ccc;
+ border-radius: 4px;
+}
+
+.children_group {
+ color: #444;
+ background-color: white;
+ margin-left: 20px;
+ margin-bottom: 20px;
+ margin-top: 20px;
+ margin-right: 20px;
+ padding-top: 10px;
+ padding-left: 10px;
+ padding-right: 20px;
+ padding-bottom: 10px;
+ border: 1px solid #ccc;
+ border-radius: 4px;
+}
+
.btn {
box-shadow: 0 2px 5px 0 rgba(0, 0, 0, .26);
font-weight: 500;
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 754f95bb5..f7a6d2442 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,7 +13,7 @@
<div ng-include data-src="'error-bar'" class="clearfix"></div>
</div>
<div class="modal-footer">
- <button type="button" class="btn btn-default" data-dismiss="modal" ng-click="refresh();" ng-disabled="temp.inprocess">Cancel</button>
+ <button type="button" class="btn btn-pedefault" data-dismiss="modal" ng-click="refresh();" ng-disabled="temp.inprocess">Cancel</button>
<button type="submit" class="btn btn-primary" ng-disabled="temp.inprocess" autofocus="autofocus">Delete</button>
</div>
</form>
@@ -42,7 +42,7 @@
<div ng-include data-src="'error-bar'" class="clearfix"></div>
</div>
<div class="modal-footer">
- <button type="button" class="btn btn-default" data-dismiss="modal" ng-click="refresh();" ng-disabled="temp.inprocess">Cancel</button>
+ <button type="button" class="btn btn-pedefault" data-dismiss="modal" ng-click="refresh();" ng-disabled="temp.inprocess">Cancel</button>
<button type="submit" class="btn btn-primary" ng-disabled="temp.inprocess" autofocus="autofocus">Delete</button>
</div>
</form>
@@ -67,7 +67,7 @@
<div ng-include data-src="'error-bar'" class="clearfix"></div>
</div>
<div class="modal-footer">
- <button type="button" class="btn btn-default" data-dismiss="modal" ng-click="refresh();" ng-disabled="temp.inprocess">Cancel</button>
+ <button type="button" class="btn btn-pedefault" data-dismiss="modal" ng-click="refresh();" ng-disabled="temp.inprocess">Cancel</button>
<button type="submit" class="btn btn-primary" ng-disabled="temp.inprocess">Rename</button>
</div>
</form>
@@ -89,7 +89,7 @@
<div ng-include data-src="'error-bar'" class="clearfix"></div>
</div>
<div class="modal-footer">
- <button type="button" class="btn btn-default" data-dismiss="modal" ng-disabled="temp.inprocess">Cancel</button>
+ <button type="button" class="btn btn-pedefault" data-dismiss="modal" ng-disabled="temp.inprocess">Cancel</button>
</div>
</form>
</div>
@@ -111,7 +111,7 @@
<div ng-include data-src="'error-bar'" class="clearfix"></div>
</div>
<div class="modal-footer">
- <button type="button" class="btn btn-default" data-dismiss="modal" ng-click="refresh();" ng-disabled="temp.inprocess">Cancel</button>
+ <button type="button" class="btn btn-pedefault" data-dismiss="modal" ng-click="refresh();" ng-disabled="temp.inprocess">Cancel</button>
<button type="submit" class="btn btn-primary" ng-disabled="temp.inprocess">Move</button>
</div>
</form>
@@ -139,7 +139,7 @@
<div ng-include data-src="'error-bar'" class="clearfix"></div>
</div>
<div class="modal-footer">
- <button type="button" class="btn btn-default" data-dismiss="modal" ng-disabled="temp.inprocess">Cancel</button>
+ <button type="button" class="btn btn-pedefault" data-dismiss="modal" ng-disabled="temp.inprocess">Cancel</button>
<button type="submit" class="btn btn-primary" ng-disabled="temp.inprocess">Save</button>
</div>
</form>
@@ -165,7 +165,7 @@
<div ng-include data-src="'error-bar'" class="clearfix"></div>
</div>
<div class="modal-footer">
- <button type="button" class="btn btn-default" data-dismiss="modal" ng-disabled="temp.inprocess">Cancel</button>
+ <button type="button" class="btn btn-pedefault" data-dismiss="modal" ng-disabled="temp.inprocess">Cancel</button>
<button type="submit" class="btn btn-primary" ng-disabled="temp.inprocess">Clone</button>
</div>
</form>
@@ -189,7 +189,7 @@
<div ng-include data-src="'error-bar'" class="clearfix"></div>
</div>
<div class="modal-footer">
- <button id = "cancel" type="button" class="btn btn-default" data-dismiss="modal" ng-disabled="temp.inprocess">Cancel</button>
+ <button id = "cancel" type="button" class="btn btn-pedefault" data-dismiss="modal" ng-disabled="temp.inprocess">Cancel</button>
<button type="submit" class="btn btn-primary" ng-disabled="temp.inprocess">Create</button>
</div>
</form>
@@ -213,7 +213,7 @@
<div ng-include data-src="'error-bar'" class="clearfix"></div>
</div>
<div class="modal-footer">
- <button type="button" class="btn btn-default" data-dismiss="modal" ng-disabled="temp.inprocess">Cancel</button>
+ <button type="button" class="btn btn-pedefault" data-dismiss="modal" ng-disabled="temp.inprocess">Cancel</button>
<button type="submit" class="btn btn-primary" ng-disabled="temp.inprocess">Create</button>
</div>
</form>
@@ -238,7 +238,7 @@
</div>
<div class="modal-footer">
<div ng-show="!fileUploader.requesting">
- <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
+ <button type="button" class="btn btn-pedefault" data-dismiss="modal">Cancel</button>
<button type="submit" class="btn btn-primary" ng-disabled="!uploadFileList.length || fileUploader.requesting">{{'upload' | translate}}</button>
</div>
<div ng-show="fileUploader.requesting">
@@ -266,7 +266,7 @@
</div>
</div>
<div class="modal-footer">
- <button type="button" class="btn btn-default" data-dismiss="modal" ng-disabled="temp.inprocess">Close</button>
+ <button type="button" class="btn btn-pedefault" data-dismiss="modal" ng-disabled="temp.inprocess">Close</button>
</div>
</div>
</div>
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/templates/searchNavbar.html b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/templates/searchNavbar.html
index 72985a190..768fe5e19 100644
--- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/templates/searchNavbar.html
+++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/templates/searchNavbar.html
@@ -62,7 +62,7 @@ body {
<div class="input-group-btn">
<div class="btn-group" role="group">
<div class="dropdown dropdown-lg">
- <button type="button" class="btn btn-default dropdown-toggle"
+ <button type="button" class="btn btn-pedefault dropdown-toggle"
data-toggle="dropdown" aria-expanded="false">
<span class="caret"></span>
</button>
@@ -166,7 +166,7 @@ body {
</form>
</div>
</div>
- <button type="button" class="btn btn-default"
+ <button type="button" class="btn btn-pedefault"
ng-click="refresh(search = null);">
<span aria-hidden="true">Clear</span>
</button>