import java.util.LinkedList;
import java.util.List;
import java.util.Map;
+import java.util.Map.Entry;
import javax.xml.bind.JAXBElement;
+import org.onap.policy.common.logging.flexlogger.FlexLogger;
+import org.onap.policy.common.logging.flexlogger.Logger;
import org.onap.policy.rest.adapter.PolicyRestAdapter;
import org.onap.policy.rest.jpa.PolicyEntity;
-import org.openecomp.portalsdk.core.controller.RestrictedBaseController;
+import org.onap.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.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.onap.policy.common.logging.flexlogger.FlexLogger;
-import org.onap.policy.common.logging.flexlogger.Logger;
@Controller
@RequestMapping({ "/" })
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 {
AttributeValueType attributeValue = (AttributeValueType) attributeAssignmentExpression
.getExpression().getValue();
if (attributeID.equals(PERFORMER_ATTRIBUTEID)) {
- for (String key : performer.keySet()) {
- String keyValue = performer.get(key);
+ for ( Entry<String, String> entry: performer.entrySet()) {
+ String key = entry.getKey();
+ String keyValue = entry.getValue();
if (keyValue.equals(attributeValue.getContent().get(0))) {
policyAdapter.setActionPerformer(key);
}
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Prepopulating Compound rule algorithm: " + index);
}
- Map<String, String> rule = new HashMap<String, String>();
+ Map<String, String> rule = new HashMap<>();
for (String key : PolicyController.getDropDownMap().keySet()) {
String keyValue = PolicyController.getDropDownMap().get(key);
if (keyValue.equals(actionApply.getFunctionId())) {
}
private void prePopulateRuleAlgorithms(int index, ApplyType actionApply, List<JAXBElement<?>> jaxbActionTypes) {
- Map<String, String> ruleMap = new HashMap<String, String>();
+ Map<String, String> ruleMap = new HashMap<>();
ruleMap.put("id", "A" + (index + 1));
// Populate combo box
Map<String, String> dropDownMap = PolicyController.getDropDownMap();
- for (String key : dropDownMap.keySet()) {
- String keyValue = dropDownMap.get(key);
- if (keyValue.equals(actionApply.getFunctionId())) {
- ruleMap.put("dynamicRuleAlgorithmCombo", key);
+ for ( Entry<String, String> entry : dropDownMap.entrySet()) {
+ if (entry.getValue().equals(actionApply.getFunctionId())) {
+ ruleMap.put("dynamicRuleAlgorithmCombo", entry.getKey());
}
}
// Populate the key and value fields
ruleMap.put("dynamicRuleAlgorithmField2", attributeValue);
}
// Rule Attribute added as value
- else if (((jaxbActionTypes.get(0).getValue()) instanceof AttributeValueType)) {
+ else if ((jaxbActionTypes.get(0).getValue()) instanceof AttributeValueType) {
AttributeValueType actionConditionAttributeValue = (AttributeValueType) jaxbActionTypes.get(0).getValue();
String attributeValue = (String) actionConditionAttributeValue.getContent().get(0);
ruleMap.put("dynamicRuleAlgorithmField2", attributeValue);