aboutsummaryrefslogtreecommitdiffstats
path: root/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/CreateClosedLoopFaultController.java
diff options
context:
space:
mode:
Diffstat (limited to 'POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/CreateClosedLoopFaultController.java')
-rw-r--r--POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/CreateClosedLoopFaultController.java27
1 files changed, 15 insertions, 12 deletions
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 d75231ef0..d2a2845e8 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
@@ -29,6 +29,8 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
+import org.openecomp.policy.common.logging.flexlogger.FlexLogger;
+import org.openecomp.policy.common.logging.flexlogger.Logger;
import org.openecomp.policy.rest.adapter.ClosedLoopFaultBody;
import org.openecomp.policy.rest.adapter.ClosedLoopFaultTriggerUISignatures;
import org.openecomp.policy.rest.adapter.ClosedLoopSignatures;
@@ -49,6 +51,7 @@ import com.fasterxml.jackson.databind.ObjectWriter;
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.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;
@@ -58,6 +61,8 @@ 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);
+
protected PolicyRestAdapter policyAdapter = null;
@@ -512,7 +517,6 @@ public class CreateClosedLoopFaultController extends RestrictedBaseController{
List<AllOfType> allOfList = anyOf.getAllOf();
if (allOfList != null) {
Iterator<AllOfType> iterAllOf = allOfList.iterator();
- int index = 0;
while (iterAllOf.hasNext()) {
AllOfType allOf = iterAllOf.next();
// Under AllOFType we have Match
@@ -522,35 +526,34 @@ public class CreateClosedLoopFaultController extends RestrictedBaseController{
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);
-
+ AttributeDesignatorType designator = match.getAttributeDesignator();
+ String attributeId = designator.getAttributeId();
+
// First match in the target is EcompName, so set that value.
- if (index == 1) {
+ if (attributeId.equals("ECOMPName")) {
policyAdapter.setEcompName(value);
EcompName ecompName = new EcompName();
ecompName.setEcompName(value);
policyAdapter.setEcompNameField(ecompName);
}
- if (index == 2){
+ if (attributeId.equals("RiskType")){
policyAdapter.setRiskType(value);
}
-
- if (index == 3){
+ if (attributeId.equals("RiskLevel")){
policyAdapter.setRiskLevel(value);
}
-
- if (index == 4){
+ if (attributeId.equals("guard")){
policyAdapter.setGuard(value);
}
- if (index == 5 && !value.contains("NA")){
+ if (attributeId.equals("TTLDate") && !value.contains("NA")){
String newDate = convertDate(value, true);
policyAdapter.setTtlDate(newDate);
}
- index++;
}
}
}
@@ -600,7 +603,7 @@ public class CreateClosedLoopFaultController extends RestrictedBaseController{
}
} catch (Exception e) {
- e.printStackTrace();
+ LOGGER.error("Exception Occured"+e);
}
return null;