X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=POLICY-SDK-APP%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fpolicy%2Fcontroller%2FActionPolicyController.java;h=a556beeaa56f5252b2637228e71ae4359d36d737;hb=3ee17bad27b036a9e4ca6e50a7fbdfe2ed0a8e7f;hp=2f3c91476364fe2a5be33259212db429e9a19f84;hpb=fb3cc27605623672fb8971bd9030872f117c7af8;p=policy%2Fengine.git diff --git a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/ActionPolicyController.java b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/ActionPolicyController.java index 2f3c91476..a556beeaa 100644 --- a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/ActionPolicyController.java +++ b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/ActionPolicyController.java @@ -26,6 +26,7 @@ import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.Map; +import java.util.Map.Entry; import javax.xml.bind.JAXBElement; @@ -77,7 +78,7 @@ public class ActionPolicyController extends RestrictedBaseController { PolicyType policy = (PolicyType) policyData; policyAdapter.setOldPolicyFileName(policyAdapter.getPolicyName()); String policyNameValue = policyAdapter.getPolicyName() - .substring(policyAdapter.getPolicyName().indexOf("_") + 1); + .substring(policyAdapter.getPolicyName().indexOf('_') + 1); policyAdapter.setPolicyName(policyNameValue); String description = ""; try { @@ -166,8 +167,9 @@ public class ActionPolicyController extends RestrictedBaseController { AttributeValueType attributeValue = (AttributeValueType) attributeAssignmentExpression .getExpression().getValue(); if (attributeID.equals(PERFORMER_ATTRIBUTEID)) { - for (String key : performer.keySet()) { - String keyValue = performer.get(key); + for ( Entry entry: performer.entrySet()) { + String key = entry.getKey(); + String keyValue = entry.getValue(); if (keyValue.equals(attributeValue.getContent().get(0))) { policyAdapter.setActionPerformer(key); } @@ -210,7 +212,7 @@ public class ActionPolicyController extends RestrictedBaseController { if (LOGGER.isDebugEnabled()) { LOGGER.debug("Prepopulating Compound rule algorithm: " + index); } - Map rule = new HashMap(); + Map rule = new HashMap<>(); for (String key : PolicyController.getDropDownMap().keySet()) { String keyValue = PolicyController.getDropDownMap().get(key); if (keyValue.equals(actionApply.getFunctionId())) { @@ -231,14 +233,13 @@ public class ActionPolicyController extends RestrictedBaseController { } private void prePopulateRuleAlgorithms(int index, ApplyType actionApply, List> jaxbActionTypes) { - Map ruleMap = new HashMap(); + Map ruleMap = new HashMap<>(); ruleMap.put("id", "A" + (index + 1)); // Populate combo box Map dropDownMap = PolicyController.getDropDownMap(); - for (String key : dropDownMap.keySet()) { - String keyValue = dropDownMap.get(key); - if (keyValue.equals(actionApply.getFunctionId())) { - ruleMap.put("dynamicRuleAlgorithmCombo", key); + for ( Entry entry : dropDownMap.entrySet()) { + if (entry.getValue().equals(actionApply.getFunctionId())) { + ruleMap.put("dynamicRuleAlgorithmCombo", entry.getKey()); } } // Populate the key and value fields