X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=POLICY-SDK-APP%2Fsrc%2Fmain%2Fjava%2Forg%2Fopenecomp%2Fpolicy%2Fcontroller%2FCreateBRMSRawController.java;h=c5b97ad45f134e4a32d70aa48243ad9b00ea6d58;hb=4ca818fdfb9b807562166800a086b413593d6894;hp=381673ca5ea996a8be9322f43c36cbeb0abb144d;hpb=a330af579866dacbe595e2e4ad1dd29cd3c96945;p=policy%2Fengine.git 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 381673ca5..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 @@ -35,6 +35,7 @@ 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; import oasis.names.tc.xacml._3_0.core.schema.wd_17.AttributeAssignmentExpressionType; +import oasis.names.tc.xacml._3_0.core.schema.wd_17.AttributeDesignatorType; import oasis.names.tc.xacml._3_0.core.schema.wd_17.AttributeValueType; import oasis.names.tc.xacml._3_0.core.schema.wd_17.MatchType; import oasis.names.tc.xacml._3_0.core.schema.wd_17.PolicyType; @@ -71,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); @@ -79,7 +81,7 @@ public class CreateBRMSRawController{ for( AdviceExpressionType adviceExpression: expressionTypes.getAdviceExpression()){ for(AttributeAssignmentExpressionType attributeAssignment: adviceExpression.getAttributeAssignmentExpression()){ if(attributeAssignment.getAttributeId().startsWith("key:")){ - Map attribute = new HashMap(); + Map attribute = new HashMap<>(); String key = attributeAssignment.getAttributeId().replace("key:", ""); attribute.put("key", key); JAXBElement attributevalue = (JAXBElement) attributeAssignment.getExpression(); @@ -112,7 +114,6 @@ public class CreateBRMSRawController{ List allOfList = anyOf.getAllOf(); if (allOfList != null) { Iterator iterAllOf = allOfList.iterator(); - int index = 0; while (iterAllOf.hasNext()) { AllOfType allOf = iterAllOf.next(); // Under AllOFType we have Match @@ -122,29 +123,27 @@ public class CreateBRMSRawController{ while (iterMatch.hasNext()) { MatchType match = iterMatch.next(); // - // Under the match we have attributevalue and + // Under the match we have attribute value and // attributeDesignator. So,finally down to the actual attribute. // AttributeValueType attributeValue = match.getAttributeValue(); String value = (String) attributeValue.getContent().get(0); - - if (index == 3){ + AttributeDesignatorType designator = match.getAttributeDesignator(); + String attributeId = designator.getAttributeId(); + + if (attributeId.equals("RiskType")){ policyAdapter.setRiskType(value); } - - if (index == 4){ + if (attributeId.equals("RiskLevel")){ policyAdapter.setRiskLevel(value); } - - if (index == 5){ + if (attributeId.equals("guard")){ policyAdapter.setGuard(value); } - if (index == 6 && !value.contains("NA")){ + if (attributeId.equals("TTLDate") && !value.contains("NA")){ String newDate = convertDate(value, true); policyAdapter.setTtlDate(newDate); } - - index++; } } }