2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.onap.policy.pap.xacml.rest.components;
24 import java.io.IOException;
25 import java.io.PrintWriter;
27 import java.net.URISyntaxException;
28 import java.nio.charset.Charset;
29 import java.nio.file.Files;
30 import java.nio.file.Path;
31 import java.nio.file.Paths;
32 import java.util.ArrayList;
33 import java.util.HashMap;
34 import java.util.Iterator;
35 import java.util.List;
37 import java.util.Map.Entry;
38 import java.util.UUID;
39 import java.util.regex.Matcher;
40 import java.util.regex.Pattern;
42 import javax.script.SimpleBindings;
44 import org.apache.commons.io.FilenameUtils;
45 import org.onap.policy.common.logging.eelf.MessageCodes;
46 import org.onap.policy.common.logging.eelf.PolicyLogger;
47 import org.onap.policy.common.logging.flexlogger.FlexLogger;
48 import org.onap.policy.common.logging.flexlogger.Logger;
49 import org.onap.policy.pap.xacml.rest.controller.BRMSDictionaryController;
50 import org.onap.policy.pap.xacml.rest.daoimpl.CommonClassDaoImpl;
51 import org.onap.policy.rest.adapter.PolicyRestAdapter;
52 import org.onap.policy.rest.jpa.BRMSParamTemplate;
54 import com.att.research.xacml.api.pap.PAPException;
55 import com.att.research.xacml.std.IdentifierImpl;
57 import oasis.names.tc.xacml._3_0.core.schema.wd_17.AdviceExpressionType;
58 import oasis.names.tc.xacml._3_0.core.schema.wd_17.AdviceExpressionsType;
59 import oasis.names.tc.xacml._3_0.core.schema.wd_17.AllOfType;
60 import oasis.names.tc.xacml._3_0.core.schema.wd_17.AnyOfType;
61 import oasis.names.tc.xacml._3_0.core.schema.wd_17.AttributeAssignmentExpressionType;
62 import oasis.names.tc.xacml._3_0.core.schema.wd_17.AttributeDesignatorType;
63 import oasis.names.tc.xacml._3_0.core.schema.wd_17.AttributeValueType;
64 import oasis.names.tc.xacml._3_0.core.schema.wd_17.EffectType;
65 import oasis.names.tc.xacml._3_0.core.schema.wd_17.MatchType;
66 import oasis.names.tc.xacml._3_0.core.schema.wd_17.ObjectFactory;
67 import oasis.names.tc.xacml._3_0.core.schema.wd_17.PolicyType;
68 import oasis.names.tc.xacml._3_0.core.schema.wd_17.RuleType;
69 import oasis.names.tc.xacml._3_0.core.schema.wd_17.TargetType;
71 public class CreateBrmsParamPolicy extends Policy {
73 private static final Logger LOGGER = FlexLogger.getLogger(CreateBrmsParamPolicy.class);
75 public CreateBrmsParamPolicy() {
79 public CreateBrmsParamPolicy(PolicyRestAdapter policyAdapter) {
80 this.policyAdapter = policyAdapter;
81 this.policyAdapter.setConfigType(policyAdapter.getConfigType());
85 public String expandConfigBody(String ruleContents, Map<String, String> brmsParamBody) {
87 Map<String,String> copyMap=new HashMap<>();
88 copyMap.putAll(brmsParamBody);
89 copyMap.put("policyName", policyName.substring(0, policyName.replace(".xml", "").lastIndexOf('.')));
90 copyMap.put("policyScope", policyAdapter.getDomainDir());
91 copyMap.put("policyVersion",policyAdapter.getHighestVersion().toString());
92 copyMap.put("unique", ("p"+policyName+UUID.randomUUID().toString()).replaceAll("[^A-Za-z0-9]", ""));
94 //Finding all the keys in the Map data-structure.
95 Iterator<String> iterator = copyMap.keySet().iterator();
98 while(iterator.hasNext()) {
99 //Converting the first character of the key into a lower case.
100 String input= iterator.next();
101 String output = Character.toLowerCase(input.charAt(0)) +
102 (input.length() > 1 ? input.substring(1) : "");
103 //Searching for a pattern in the String using the key.
104 p=Pattern.compile("\\$\\{"+output+"\\}");
105 m=p.matcher(ruleContents);
106 //Replacing the value with the inputs provided by the user in the editor.
107 String finalInput = copyMap.get(input);
108 if(finalInput.contains("$")){
109 finalInput = finalInput.replace("$", "\\$");
111 ruleContents=m.replaceAll(finalInput);
118 // Utility to read json data from the existing file to a string
119 static String readFile(String path, Charset encoding) throws IOException {
120 byte[] encoded = Files.readAllBytes(Paths.get(path));
121 return new String(encoded, encoding);
124 // Saving the Configurations file at server location for config policy.
125 protected void saveConfigurations(String policyName, String ruleBody) {
126 if (policyName.endsWith(".xml")) {
127 policyName = policyName.substring(0, policyName.lastIndexOf(".xml"));
129 try (PrintWriter out = new PrintWriter(CONFIG_HOME + File.separator + policyName + ".txt")) {
130 String expandedBody=expandConfigBody(ruleBody,policyAdapter.getBrmsParamBody());
131 out.println(expandedBody);
132 policyAdapter.setJsonBody(expandedBody);
133 policyAdapter.setConfigBodyData(expandedBody);
135 } catch (Exception e) {
136 PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "CreateBrmsParamPolicy", "Exception saving configuration file");
141 // Here we are adding the extension for the configurations file based on the
142 // config type selection for saving.
143 private String getConfigFile(String filename) {
144 filename = FilenameUtils.removeExtension(filename);
145 if (filename.endsWith(".txt")) {
146 filename = filename.substring(0, filename.length() - 3);
149 filename = filename + ".txt";
153 // Validations for Config form
154 public boolean validateConfigForm() {
156 // Validating mandatory Fields.
163 public Map<String, String> savePolicies() throws PAPException {
165 Map<String, String> successMap = new HashMap<>();
166 if(isPolicyExists()){
167 successMap.put("EXISTS", "This Policy already exist on the PAP");
171 if (!isPreparedToSave()) {
174 // Until here we prepared the data and here calling the method to create
176 Path newPolicyPath = null;
177 newPolicyPath = Paths.get(policyAdapter.getNewFileName());
178 successMap = createPolicy(newPolicyPath,getCorrectPolicyDataObject());
179 if(successMap == null){
180 successMap = new HashMap<>();
181 PolicyLogger.error("Failed to Update the Database Dictionary Tables.");
182 successMap.put("error", "DB UPDATE");
187 private String getValueFromDictionary(String templateName){
188 String ruleTemplate = null;
189 CommonClassDaoImpl dbConnection = new CommonClassDaoImpl();
190 String queryString="from BRMSParamTemplate where param_template_name= :templateName";
191 SimpleBindings params = new SimpleBindings();
192 params.put("templateName", templateName);
193 List<Object> result = dbConnection.getDataByQuery(queryString, params);
194 if(!result.isEmpty()){
195 BRMSParamTemplate template = (BRMSParamTemplate) result.get(0);
196 ruleTemplate = template.getRule();
201 protected Map<String, String> findType(String rule) {
202 Map<String, String> mapFieldType= new HashMap<>();
205 StringBuilder params = new StringBuilder();
206 Boolean flag = false;
207 Boolean comment = false;
208 String lines[] = rule.split("\n");
209 for(String line : lines){
210 if (line.isEmpty() || line.startsWith("//")) {
213 if (line.startsWith("/*")) {
217 if (line.contains("//")) {
218 if(!(line.contains("http://") || line.contains("https://"))){
219 line = line.split("\\/\\/")[0];
222 if (line.contains("/*")) {
224 if (line.contains("*/")) {
227 line = line.split("\\/\\*")[0]
228 + line.split("\\*\\/")[1].replace("*/", "");
229 } catch (Exception e) {
231 line = line.split("\\/\\*")[0];
234 line = line.split("\\/\\*")[0];
237 if (line.contains("*/")) {
240 line = line.split("\\*\\/")[1].replace("*/", "");
241 } catch (Exception e) {
252 if (line.contains("declare Params")) {
256 if (line.contains("end") && flag) {
260 String param = params.toString().replace("declare Params", "").replace("end", "")
261 .replaceAll("\\s+", "");
262 String[] components = param.split(":");
264 for (int i = 0; i < components.length; i++) {
267 caption = components[i];
269 if(caption.equals("")){
272 String nextComponent = "";
274 nextComponent = components[i + 1];
275 } catch (Exception e) {
277 nextComponent = components[i];
279 //If the type is of type String then we add the UI Item and type to the map.
280 if (nextComponent.startsWith("String")) {
282 mapFieldType.put(caption, type);
283 caption = nextComponent.replace("String", "");
284 } else if (nextComponent.startsWith("int")) {
286 mapFieldType.put(caption, type);
287 caption = nextComponent.replace("int", "");
290 } catch (Exception e) {
291 PolicyLogger.error(MessageCodes.ERROR_SYSTEM_ERROR, e, "CreateBrmsParamPolicy", "Exception parsing file in findType");
297 // This is the method for preparing the policy for saving. We have broken it
299 // separately because the fully configured policy is used for multiple
302 public boolean prepareToSave() throws PAPException {
304 if (isPreparedToSave()) {
305 // we have already done this
310 String policyID = policyAdapter.getPolicyID();
311 version = policyAdapter.getHighestVersion();
313 // Create the Instance for pojo, PolicyType object is used in
315 if (policyAdapter.getPolicyType().equals("Config")) {
316 PolicyType policyConfig = new PolicyType();
318 policyConfig.setVersion(Integer.toString(version));
319 policyConfig.setPolicyId(policyID);
320 policyConfig.setTarget(new TargetType());
321 policyAdapter.setData(policyConfig);
324 policyName = policyAdapter.getNewFileName();
326 if (policyAdapter.getData() != null) {
327 Map<String,String> ruleAndUIValue= policyAdapter.getBrmsParamBody();
328 String templateValue= ruleAndUIValue.get("templateName");
329 String valueFromDictionary= getValueFromDictionary(templateValue);
331 StringBuilder body = new StringBuilder();
334 body.append("/* Autogenerated Code Please Don't change/remove this comment section. This is for the UI purpose. \n\t " +
335 "<$%BRMSParamTemplate=" + templateValue + "%$> \n");
336 body.append("<%$Values=");
337 for (Map.Entry<String, String> entry : ruleAndUIValue.entrySet()) {
338 String uiKey = entry.getKey();
339 if(!"templateName".equals(uiKey)) {
340 body.append(uiKey+":-:"+entry.getValue()+":|:");
343 body.append("$%> \n*/ \n");
344 body.append(valueFromDictionary + "\n");
346 catch (Exception e) {
347 PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "CreateBrmsParamPolicy", "Exception saving policy");
350 saveConfigurations(policyName,body.toString());
352 // Make sure the filename ends with an extension
353 if (!policyName.endsWith(".xml")) {
354 policyName = policyName + ".xml";
357 PolicyType configPolicy = (PolicyType) policyAdapter.getData();
359 configPolicy.setDescription(policyAdapter.getPolicyDescription());
361 configPolicy.setRuleCombiningAlgId(policyAdapter.getRuleCombiningAlgId());
363 AllOfType allOfOne = new AllOfType();
365 String fileName = policyAdapter.getNewFileName();
366 String name = fileName.substring(fileName.lastIndexOf("\\") + 1, fileName.length());
367 if ((name == null) || (name.equals(""))) {
368 name = fileName.substring(fileName.lastIndexOf("/") + 1,
371 allOfOne.getMatch().add(createMatch("PolicyName", name));
374 AllOfType allOf = new AllOfType();
376 // Match for ONAPName
377 allOf.getMatch().add(createMatch("ONAPName", policyAdapter.getOnapName()));
378 allOf.getMatch().add(createMatch("ConfigName", policyAdapter.getConfigName()));
379 // Match for riskType
380 allOf.getMatch().add(createDynamicMatch("RiskType", policyAdapter.getRiskType()));
381 // Match for riskLevel
382 allOf.getMatch().add(createDynamicMatch("RiskLevel", String.valueOf(policyAdapter.getRiskLevel())));
383 // Match for riskguard
384 allOf.getMatch().add(createDynamicMatch("guard", policyAdapter.getGuard()));
386 allOf.getMatch().add(createDynamicMatch("TTLDate", policyAdapter.getTtlDate()));
387 AnyOfType anyOf = new AnyOfType();
388 anyOf.getAllOf().add(allOfOne);
389 anyOf.getAllOf().add(allOf);
391 TargetType target = new TargetType();
392 target.getAnyOf().add(anyOf);
394 // Adding the target to the policy element
395 configPolicy.setTarget((TargetType) target);
397 RuleType rule = new RuleType();
398 rule.setRuleId(policyAdapter.getRuleID());
400 rule.setEffect(EffectType.PERMIT);
402 // Create Target in Rule
403 AllOfType allOfInRule = new AllOfType();
405 // Creating match for ACCESS in rule target
406 MatchType accessMatch = new MatchType();
407 AttributeValueType accessAttributeValue = new AttributeValueType();
408 accessAttributeValue.setDataType(STRING_DATATYPE);
409 accessAttributeValue.getContent().add("ACCESS");
410 accessMatch.setAttributeValue(accessAttributeValue);
411 AttributeDesignatorType accessAttributeDesignator = new AttributeDesignatorType();
412 URI accessURI = null;
414 accessURI = new URI(ACTION_ID);
415 } catch (URISyntaxException e) {
416 PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, "CreateBrmsParamPolicy", "Exception creating ACCESS URI");
418 accessAttributeDesignator.setCategory(CATEGORY_ACTION);
419 accessAttributeDesignator.setDataType(STRING_DATATYPE);
420 accessAttributeDesignator.setAttributeId(new IdentifierImpl(
421 accessURI).stringValue());
422 accessMatch.setAttributeDesignator(accessAttributeDesignator);
423 accessMatch.setMatchId(FUNCTION_STRING_EQUAL_IGNORE);
425 // Creating Config Match in rule Target
426 MatchType configMatch = new MatchType();
427 AttributeValueType configAttributeValue = new AttributeValueType();
428 configAttributeValue.setDataType(STRING_DATATYPE);
430 configAttributeValue.getContent().add("Config");
432 configMatch.setAttributeValue(configAttributeValue);
433 AttributeDesignatorType configAttributeDesignator = new AttributeDesignatorType();
434 URI configURI = null;
436 configURI = new URI(RESOURCE_ID);
437 } catch (URISyntaxException e) {
438 PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, "CreateBrmsParamPolicy", "Exception creating Config URI");
441 configAttributeDesignator.setCategory(CATEGORY_RESOURCE);
442 configAttributeDesignator.setDataType(STRING_DATATYPE);
443 configAttributeDesignator.setAttributeId(new IdentifierImpl(configURI).stringValue());
444 configMatch.setAttributeDesignator(configAttributeDesignator);
445 configMatch.setMatchId(FUNCTION_STRING_EQUAL_IGNORE);
447 allOfInRule.getMatch().add(accessMatch);
448 allOfInRule.getMatch().add(configMatch);
450 AnyOfType anyOfInRule = new AnyOfType();
451 anyOfInRule.getAllOf().add(allOfInRule);
453 TargetType targetInRule = new TargetType();
454 targetInRule.getAnyOf().add(anyOfInRule);
456 rule.setTarget(targetInRule);
457 rule.setAdviceExpressions(getAdviceExpressions(version, policyName));
460 .getCombinerParametersOrRuleCombinerParametersOrVariableDefinition()
462 policyAdapter.setPolicyData(configPolicy);
465 PolicyLogger.error("Unsupported data object."
466 + policyAdapter.getData().getClass().getCanonicalName());
468 setPreparedToSave(true);
472 // Data required for Advice part is setting here.
473 private AdviceExpressionsType getAdviceExpressions(int version,
476 //Policy Config ID Assignment
477 AdviceExpressionsType advices = new AdviceExpressionsType();
478 AdviceExpressionType advice = new AdviceExpressionType();
479 advice.setAdviceId("BRMSPARAMID");
480 advice.setAppliesTo(EffectType.PERMIT);
482 AttributeAssignmentExpressionType assignment1 = new AttributeAssignmentExpressionType();
483 assignment1.setAttributeId("type");
484 assignment1.setCategory(CATEGORY_RESOURCE);
485 assignment1.setIssuer("");
486 AttributeValueType configNameAttributeValue = new AttributeValueType();
487 configNameAttributeValue.setDataType(STRING_DATATYPE);
488 configNameAttributeValue.getContent().add("Configuration");
489 assignment1.setExpression(new ObjectFactory()
490 .createAttributeValue(configNameAttributeValue));
491 advice.getAttributeAssignmentExpression().add(assignment1);
493 // For Config file Url if configurations are provided.
495 AttributeAssignmentExpressionType assignment2 = new AttributeAssignmentExpressionType();
496 assignment2.setAttributeId("URLID");
497 assignment2.setCategory(CATEGORY_RESOURCE);
498 assignment2.setIssuer("");
499 AttributeValueType attributeValue = new AttributeValueType();
500 attributeValue.setDataType(URI_DATATYPE);
502 String content = CONFIG_URL + "/Config/"+ getConfigFile(policyName);
504 attributeValue.getContent().add(content);
505 assignment2.setExpression(new ObjectFactory()
506 .createAttributeValue(attributeValue));
507 advice.getAttributeAssignmentExpression().add(assignment2);
509 // Policy Name Assignment
510 AttributeAssignmentExpressionType assignment3 = new AttributeAssignmentExpressionType();
511 assignment3.setAttributeId("PolicyName");
512 assignment3.setCategory(CATEGORY_RESOURCE);
513 assignment3.setIssuer("");
514 AttributeValueType attributeValue3 = new AttributeValueType();
515 attributeValue3.setDataType(STRING_DATATYPE);
516 fileName = FilenameUtils.removeExtension(fileName);
517 fileName = fileName + ".xml";
518 String name = fileName.substring(fileName.lastIndexOf("\\") + 1,
520 if ((name == null) || (name.equals(""))) {
521 name = fileName.substring(fileName.lastIndexOf("/") + 1,
524 attributeValue3.getContent().add(name);
525 assignment3.setExpression(new ObjectFactory()
526 .createAttributeValue(attributeValue3));
527 advice.getAttributeAssignmentExpression().add(assignment3);
529 // Version Number Assignment
530 AttributeAssignmentExpressionType assignment4 = new AttributeAssignmentExpressionType();
531 assignment4.setAttributeId("VersionNumber");
532 assignment4.setCategory(CATEGORY_RESOURCE);
533 assignment4.setIssuer("");
534 AttributeValueType configNameAttributeValue4 = new AttributeValueType();
535 configNameAttributeValue4.setDataType(STRING_DATATYPE);
536 configNameAttributeValue4.getContent().add(Integer.toString(version));
537 assignment4.setExpression(new ObjectFactory()
538 .createAttributeValue(configNameAttributeValue4));
539 advice.getAttributeAssignmentExpression().add(assignment4);
541 // Onap Name Assignment
542 AttributeAssignmentExpressionType assignment5 = new AttributeAssignmentExpressionType();
543 assignment5.setAttributeId("matching:" + ONAPID);
544 assignment5.setCategory(CATEGORY_RESOURCE);
545 assignment5.setIssuer("");
546 AttributeValueType configNameAttributeValue5 = new AttributeValueType();
547 configNameAttributeValue5.setDataType(STRING_DATATYPE);
548 configNameAttributeValue5.getContent().add(policyAdapter.getOnapName());
549 assignment5.setExpression(new ObjectFactory()
550 .createAttributeValue(configNameAttributeValue5));
551 advice.getAttributeAssignmentExpression().add(assignment5);
554 //Config Name Assignment
555 AttributeAssignmentExpressionType assignment6 = new AttributeAssignmentExpressionType();
556 assignment6.setAttributeId("matching:" +CONFIGID);
557 assignment6.setCategory(CATEGORY_RESOURCE);
558 assignment6.setIssuer("");
559 AttributeValueType configNameAttributeValue6 = new AttributeValueType();
560 configNameAttributeValue6.setDataType(STRING_DATATYPE);
561 configNameAttributeValue6.getContent().add(policyAdapter.getConfigName());
562 assignment6.setExpression(new ObjectFactory().createAttributeValue(configNameAttributeValue6));
563 advice.getAttributeAssignmentExpression().add(assignment6);
564 // Adding Controller Information.
565 if(policyAdapter.getBrmsController()!=null){
566 BRMSDictionaryController brmsDicitonaryController = new BRMSDictionaryController();
567 advice.getAttributeAssignmentExpression().add(
568 createResponseAttributes("controller:"+ policyAdapter.getBrmsController(),
569 brmsDicitonaryController.getControllerDataByID(policyAdapter.getBrmsController()).getController()));
572 // Adding Dependencies.
573 if(policyAdapter.getBrmsDependency()!=null){
574 BRMSDictionaryController brmsDicitonaryController = new BRMSDictionaryController();
575 ArrayList<String> dependencies = new ArrayList<>();
576 StringBuilder key = new StringBuilder();
577 for(String dependencyName: policyAdapter.getBrmsDependency()){
578 dependencies.add(brmsDicitonaryController.getDependencyDataByID(dependencyName).getDependency());
579 key.append(dependencyName + ",");
581 advice.getAttributeAssignmentExpression().add(
582 createResponseAttributes("dependencies:"+key.toString(), dependencies.toString()));
585 // Dynamic Field Config Attributes.
586 Map<String, String> dynamicFieldConfigAttributes = policyAdapter.getDynamicFieldConfigAttributes();
587 for (Entry<String, String> map : dynamicFieldConfigAttributes.entrySet()) {
588 advice.getAttributeAssignmentExpression().add(createResponseAttributes("key:"+map.getKey(), map.getValue()));
592 AttributeAssignmentExpressionType assignment8 = new AttributeAssignmentExpressionType();
593 assignment8.setAttributeId("RiskType");
594 assignment8.setCategory(CATEGORY_RESOURCE);
595 assignment8.setIssuer("");
597 AttributeValueType configNameAttributeValue8 = new AttributeValueType();
598 configNameAttributeValue8.setDataType(STRING_DATATYPE);
599 configNameAttributeValue8.getContent().add(policyAdapter.getRiskType());
600 assignment8.setExpression(new ObjectFactory().createAttributeValue(configNameAttributeValue8));
602 advice.getAttributeAssignmentExpression().add(assignment8);
604 AttributeAssignmentExpressionType assignment9 = new AttributeAssignmentExpressionType();
605 assignment9.setAttributeId("RiskLevel");
606 assignment9.setCategory(CATEGORY_RESOURCE);
607 assignment9.setIssuer("");
609 AttributeValueType configNameAttributeValue9 = new AttributeValueType();
610 configNameAttributeValue9.setDataType(STRING_DATATYPE);
611 configNameAttributeValue9.getContent().add(policyAdapter.getRiskLevel());
612 assignment9.setExpression(new ObjectFactory().createAttributeValue(configNameAttributeValue9));
614 advice.getAttributeAssignmentExpression().add(assignment9);
616 AttributeAssignmentExpressionType assignment10 = new AttributeAssignmentExpressionType();
617 assignment10.setAttributeId("guard");
618 assignment10.setCategory(CATEGORY_RESOURCE);
619 assignment10.setIssuer("");
621 AttributeValueType configNameAttributeValue10 = new AttributeValueType();
622 configNameAttributeValue10.setDataType(STRING_DATATYPE);
623 configNameAttributeValue10.getContent().add(policyAdapter.getGuard());
624 assignment10.setExpression(new ObjectFactory().createAttributeValue(configNameAttributeValue10));
626 advice.getAttributeAssignmentExpression().add(assignment10);
628 AttributeAssignmentExpressionType assignment11 = new AttributeAssignmentExpressionType();
629 assignment11.setAttributeId("TTLDate");
630 assignment11.setCategory(CATEGORY_RESOURCE);
631 assignment11.setIssuer("");
633 AttributeValueType configNameAttributeValue11 = new AttributeValueType();
634 configNameAttributeValue11.setDataType(STRING_DATATYPE);
635 configNameAttributeValue11.getContent().add(policyAdapter.getTtlDate());
636 assignment11.setExpression(new ObjectFactory().createAttributeValue(configNameAttributeValue11));
638 advice.getAttributeAssignmentExpression().add(assignment11);
640 advices.getAdviceExpression().add(advice);
645 public Object getCorrectPolicyDataObject() {
646 return policyAdapter.getData();
649 private AttributeAssignmentExpressionType createResponseAttributes(String key, String value){
650 AttributeAssignmentExpressionType assignment7 = new AttributeAssignmentExpressionType();
651 assignment7.setAttributeId(key);
652 assignment7.setCategory(CATEGORY_RESOURCE);
653 assignment7.setIssuer("");
654 AttributeValueType configNameAttributeValue7 = new AttributeValueType();
655 configNameAttributeValue7.setDataType(STRING_DATATYPE);
656 configNameAttributeValue7.getContent().add(value);
657 assignment7.setExpression(new ObjectFactory().createAttributeValue(configNameAttributeValue7));