*/
package org.openecomp.policy.controller;
-
-
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
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;
// Under target we have AnyOFType
List<AnyOfType> anyOfList = target.getAnyOf();
if (anyOfList != null) {
- int index = 0;
Iterator<AnyOfType> iterAnyOf = anyOfList.iterator();
while (iterAnyOf.hasNext()) {
AnyOfType anyOf = iterAnyOf.next();
//
AttributeValueType attributeValue = match.getAttributeValue();
String value = (String) attributeValue.getContent().get(0);
- if (index == 1) {
+ AttributeDesignatorType designator = match.getAttributeDesignator();
+ String attributeId = designator.getAttributeId();
+ if (attributeId.equals("ConfigName")) {
policyAdapter.setConfigName(value);
}
- 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++;
}
}
}
ServiceListJson targetSl=null;
int i=0;
try{
-
+ String networkRole="";
for(String tag:tagCollectorList){
tags= new Tags();
List<Object> tagListData = commonClassDao.getData(FWTagPicker.class);
tagList.add(tagDefine);
}
-
+ networkRole=jpaTagPickerList.getNetworkRole();
+ break;
}
}
tags.setTags(tagList);
tags.setTagPickerName(tag);
tags.setRuleName(termCollectorList.get(i));
+ tags.setNetworkRole(networkRole);
tagsList.add(tags);
i++;
}
try {
json = om.writeValueAsString(tc);
} catch (JsonGenerationException e) {
- e.printStackTrace();
+ logger.error("Exception Occured"+e);
} catch (JsonMappingException e) {
- e.printStackTrace();
+ logger.error("Exception Occured"+e);
} catch (IOException e) {
- e.printStackTrace();
+ logger.error("Exception Occured"+e);
}
}catch (Exception e) {
- e.printStackTrace();
+ logger.error("Exception Occured"+e);
}
return json;