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);
117 // Utility to read json data from the existing file to a string
118 static String readFile(String path, Charset encoding) throws IOException {
119 byte[] encoded = Files.readAllBytes(Paths.get(path));
120 return new String(encoded, encoding);
123 // Saving the Configurations file at server location for config policy.
124 protected void saveConfigurations(String policyName, String ruleBody) {
125 if (policyName.endsWith(".xml")) {
126 policyName = policyName.substring(0, policyName.lastIndexOf(".xml"));
128 try (PrintWriter out = new PrintWriter(CONFIG_HOME + File.separator + policyName + ".txt")) {
129 String expandedBody = expandConfigBody(ruleBody, policyAdapter.getBrmsParamBody());
130 out.println(expandedBody);
131 policyAdapter.setJsonBody(expandedBody);
132 policyAdapter.setConfigBodyData(expandedBody);
134 } catch (Exception e) {
135 PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "CreateBrmsParamPolicy",
136 "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("//") && !(line.contains("http://") || line.contains("https://"))) {
218 line = line.split("\\/\\/")[0];
220 if (line.contains("/*")) {
222 if (line.contains("*/")) {
225 line = line.split("\\/\\*")[0]
226 + line.split("\\*\\/")[1].replace("*/", "");
227 } catch (Exception e) {
229 line = line.split("\\/\\*")[0];
232 line = line.split("\\/\\*")[0];
235 if (line.contains("*/")) {
238 line = line.split("\\*\\/")[1].replace("*/", "");
239 } catch (Exception e) {
250 if (line.contains("declare Params")) {
254 if (line.contains("end") && flag) {
258 String param = params.toString().replace("declare Params", "").replace("end", "")
259 .replaceAll("\\s+", "");
260 String[] components = param.split(":");
262 for (int i = 0; i < components.length; i++) {
265 caption = components[i];
267 if (caption.equals("")) {
270 String nextComponent = "";
272 nextComponent = components[i + 1];
273 } catch (Exception e) {
275 nextComponent = components[i];
277 //If the type is of type String then we add the UI Item and type to the map.
278 if (nextComponent.startsWith("String")) {
280 mapFieldType.put(caption, type);
281 caption = nextComponent.replace("String", "");
282 } else if (nextComponent.startsWith("int")) {
284 mapFieldType.put(caption, type);
285 caption = nextComponent.replace("int", "");
288 } catch (Exception e) {
289 PolicyLogger.error(MessageCodes.ERROR_SYSTEM_ERROR, e, "CreateBrmsParamPolicy",
290 "Exception parsing file in findType");
296 // This is the method for preparing the policy for saving. We have broken it
298 // separately because the fully configured policy is used for multiple
301 public boolean prepareToSave() throws PAPException {
303 if (isPreparedToSave()) {
304 // we have already done this
309 String policyID = policyAdapter.getPolicyID();
310 version = policyAdapter.getHighestVersion();
312 // Create the Instance for pojo, PolicyType object is used in
314 if (policyAdapter.getPolicyType().equals("Config")) {
315 PolicyType policyConfig = new PolicyType();
317 policyConfig.setVersion(Integer.toString(version));
318 policyConfig.setPolicyId(policyID);
319 policyConfig.setTarget(new TargetType());
320 policyAdapter.setData(policyConfig);
323 policyName = policyAdapter.getNewFileName();
325 if (policyAdapter.getData() != null) {
326 Map<String, String> ruleAndUIValue = policyAdapter.getBrmsParamBody();
327 String templateValue = ruleAndUIValue.get("templateName");
328 String valueFromDictionary = getValueFromDictionary(templateValue);
330 StringBuilder body = new StringBuilder();
334 "/* Autogenerated Code Please Don't change/remove this comment section. This is for the UI " +
336 "<$%BRMSParamTemplate=" + templateValue + "%$> \n");
337 body.append("<%$Values=");
338 for (Map.Entry<String, String> entry : ruleAndUIValue.entrySet()) {
339 String uiKey = entry.getKey();
340 if (!"templateName".equals(uiKey)) {
341 body.append(uiKey + ":-:" + entry.getValue() + ":|:");
344 body.append("$%> \n*/ \n");
345 body.append(valueFromDictionary + "\n");
346 } catch (Exception e) {
348 .error(MessageCodes.ERROR_PROCESS_FLOW, e, "CreateBrmsParamPolicy", "Exception saving policy");
351 saveConfigurations(policyName, body.toString());
353 // Make sure the filename ends with an extension
354 if (!policyName.endsWith(".xml")) {
355 policyName = policyName + ".xml";
358 PolicyType configPolicy = (PolicyType) policyAdapter.getData();
360 configPolicy.setDescription(policyAdapter.getPolicyDescription());
362 configPolicy.setRuleCombiningAlgId(policyAdapter.getRuleCombiningAlgId());
364 AllOfType allOfOne = new AllOfType();
366 String fileName = policyAdapter.getNewFileName();
367 String name = fileName.substring(fileName.lastIndexOf("\\") + 1);
368 if ((name == null) || (name.equals(""))) {
369 name = fileName.substring(fileName.lastIndexOf("/") + 1
372 allOfOne.getMatch().add(createMatch("PolicyName", name));
375 AllOfType allOf = new AllOfType();
377 // Match for ONAPName
378 allOf.getMatch().add(createMatch("ONAPName", policyAdapter.getOnapName()));
379 allOf.getMatch().add(createMatch("ConfigName", policyAdapter.getConfigName()));
380 // Match for riskType
381 allOf.getMatch().add(createDynamicMatch("RiskType", policyAdapter.getRiskType()));
382 // Match for riskLevel
383 allOf.getMatch().add(createDynamicMatch("RiskLevel", String.valueOf(policyAdapter.getRiskLevel())));
384 // Match for riskguard
385 allOf.getMatch().add(createDynamicMatch("guard", policyAdapter.getGuard()));
387 allOf.getMatch().add(createDynamicMatch("TTLDate", policyAdapter.getTtlDate()));
388 AnyOfType anyOf = new AnyOfType();
389 anyOf.getAllOf().add(allOfOne);
390 anyOf.getAllOf().add(allOf);
392 TargetType target = new TargetType();
393 target.getAnyOf().add(anyOf);
395 // Adding the target to the policy element
396 configPolicy.setTarget((TargetType) target);
398 RuleType rule = new RuleType();
399 rule.setRuleId(policyAdapter.getRuleID());
401 rule.setEffect(EffectType.PERMIT);
403 // Create Target in Rule
404 AllOfType allOfInRule = new AllOfType();
406 // Creating match for ACCESS in rule target
407 MatchType accessMatch = new MatchType();
408 AttributeValueType accessAttributeValue = new AttributeValueType();
409 accessAttributeValue.setDataType(STRING_DATATYPE);
410 accessAttributeValue.getContent().add("ACCESS");
411 accessMatch.setAttributeValue(accessAttributeValue);
412 AttributeDesignatorType accessAttributeDesignator = new AttributeDesignatorType();
413 URI accessURI = null;
415 accessURI = new URI(ACTION_ID);
416 } catch (URISyntaxException e) {
417 PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, "CreateBrmsParamPolicy",
418 "Exception creating ACCESS URI");
420 accessAttributeDesignator.setCategory(CATEGORY_ACTION);
421 accessAttributeDesignator.setDataType(STRING_DATATYPE);
422 accessAttributeDesignator.setAttributeId(new IdentifierImpl(
423 accessURI).stringValue());
424 accessMatch.setAttributeDesignator(accessAttributeDesignator);
425 accessMatch.setMatchId(FUNCTION_STRING_EQUAL_IGNORE);
427 // Creating Config Match in rule Target
428 MatchType configMatch = new MatchType();
429 AttributeValueType configAttributeValue = new AttributeValueType();
430 configAttributeValue.setDataType(STRING_DATATYPE);
432 configAttributeValue.getContent().add("Config");
434 configMatch.setAttributeValue(configAttributeValue);
435 AttributeDesignatorType configAttributeDesignator = new AttributeDesignatorType();
436 URI configURI = null;
438 configURI = new URI(RESOURCE_ID);
439 } catch (URISyntaxException e) {
440 PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, "CreateBrmsParamPolicy",
441 "Exception creating Config URI");
444 configAttributeDesignator.setCategory(CATEGORY_RESOURCE);
445 configAttributeDesignator.setDataType(STRING_DATATYPE);
446 configAttributeDesignator.setAttributeId(new IdentifierImpl(configURI).stringValue());
447 configMatch.setAttributeDesignator(configAttributeDesignator);
448 configMatch.setMatchId(FUNCTION_STRING_EQUAL_IGNORE);
450 allOfInRule.getMatch().add(accessMatch);
451 allOfInRule.getMatch().add(configMatch);
453 AnyOfType anyOfInRule = new AnyOfType();
454 anyOfInRule.getAllOf().add(allOfInRule);
456 TargetType targetInRule = new TargetType();
457 targetInRule.getAnyOf().add(anyOfInRule);
459 rule.setTarget(targetInRule);
460 rule.setAdviceExpressions(getAdviceExpressions(version, policyName));
463 .getCombinerParametersOrRuleCombinerParametersOrVariableDefinition()
465 policyAdapter.setPolicyData(configPolicy);
468 PolicyLogger.error("Unsupported data object."
469 + policyAdapter.getData().getClass().getCanonicalName());
471 setPreparedToSave(true);
475 // Data required for Advice part is setting here.
476 private AdviceExpressionsType getAdviceExpressions(int version,
479 //Policy Config ID Assignment
480 AdviceExpressionsType advices = new AdviceExpressionsType();
481 AdviceExpressionType advice = new AdviceExpressionType();
482 advice.setAdviceId("BRMSPARAMID");
483 advice.setAppliesTo(EffectType.PERMIT);
485 AttributeAssignmentExpressionType assignment1 = new AttributeAssignmentExpressionType();
486 assignment1.setAttributeId("type");
487 assignment1.setCategory(CATEGORY_RESOURCE);
488 assignment1.setIssuer("");
489 AttributeValueType configNameAttributeValue = new AttributeValueType();
490 configNameAttributeValue.setDataType(STRING_DATATYPE);
491 configNameAttributeValue.getContent().add("Configuration");
492 assignment1.setExpression(new ObjectFactory()
493 .createAttributeValue(configNameAttributeValue));
494 advice.getAttributeAssignmentExpression().add(assignment1);
496 // For Config file Url if configurations are provided.
498 AttributeAssignmentExpressionType assignment2 = new AttributeAssignmentExpressionType();
499 assignment2.setAttributeId("URLID");
500 assignment2.setCategory(CATEGORY_RESOURCE);
501 assignment2.setIssuer("");
502 AttributeValueType attributeValue = new AttributeValueType();
503 attributeValue.setDataType(URI_DATATYPE);
505 String content = CONFIG_URL + "/Config/" + getConfigFile(policyName);
507 attributeValue.getContent().add(content);
508 assignment2.setExpression(new ObjectFactory()
509 .createAttributeValue(attributeValue));
510 advice.getAttributeAssignmentExpression().add(assignment2);
512 // Policy Name Assignment
513 AttributeAssignmentExpressionType assignment3 = new AttributeAssignmentExpressionType();
514 assignment3.setAttributeId("PolicyName");
515 assignment3.setCategory(CATEGORY_RESOURCE);
516 assignment3.setIssuer("");
517 AttributeValueType attributeValue3 = new AttributeValueType();
518 attributeValue3.setDataType(STRING_DATATYPE);
519 fileName = FilenameUtils.removeExtension(fileName);
520 fileName = fileName + ".xml";
521 String name = fileName.substring(fileName.lastIndexOf("\\") + 1
523 if ((name == null) || (name.equals(""))) {
524 name = fileName.substring(fileName.lastIndexOf("/") + 1
527 attributeValue3.getContent().add(name);
528 assignment3.setExpression(new ObjectFactory()
529 .createAttributeValue(attributeValue3));
530 advice.getAttributeAssignmentExpression().add(assignment3);
532 // Version Number Assignment
533 AttributeAssignmentExpressionType assignment4 = new AttributeAssignmentExpressionType();
534 assignment4.setAttributeId("VersionNumber");
535 assignment4.setCategory(CATEGORY_RESOURCE);
536 assignment4.setIssuer("");
537 AttributeValueType configNameAttributeValue4 = new AttributeValueType();
538 configNameAttributeValue4.setDataType(STRING_DATATYPE);
539 configNameAttributeValue4.getContent().add(Integer.toString(version));
540 assignment4.setExpression(new ObjectFactory()
541 .createAttributeValue(configNameAttributeValue4));
542 advice.getAttributeAssignmentExpression().add(assignment4);
544 // Onap Name Assignment
545 AttributeAssignmentExpressionType assignment5 = new AttributeAssignmentExpressionType();
546 assignment5.setAttributeId("matching:" + ONAPID);
547 assignment5.setCategory(CATEGORY_RESOURCE);
548 assignment5.setIssuer("");
549 AttributeValueType configNameAttributeValue5 = new AttributeValueType();
550 configNameAttributeValue5.setDataType(STRING_DATATYPE);
551 configNameAttributeValue5.getContent().add(policyAdapter.getOnapName());
552 assignment5.setExpression(new ObjectFactory()
553 .createAttributeValue(configNameAttributeValue5));
554 advice.getAttributeAssignmentExpression().add(assignment5);
557 //Config Name Assignment
558 AttributeAssignmentExpressionType assignment6 = new AttributeAssignmentExpressionType();
559 assignment6.setAttributeId("matching:" + CONFIGID);
560 assignment6.setCategory(CATEGORY_RESOURCE);
561 assignment6.setIssuer("");
562 AttributeValueType configNameAttributeValue6 = new AttributeValueType();
563 configNameAttributeValue6.setDataType(STRING_DATATYPE);
564 configNameAttributeValue6.getContent().add(policyAdapter.getConfigName());
565 assignment6.setExpression(new ObjectFactory().createAttributeValue(configNameAttributeValue6));
566 advice.getAttributeAssignmentExpression().add(assignment6);
567 // Adding Controller Information.
568 if (policyAdapter.getBrmsController() != null) {
569 BRMSDictionaryController brmsDicitonaryController = new BRMSDictionaryController();
570 advice.getAttributeAssignmentExpression().add(
571 createResponseAttributes("controller:" + policyAdapter.getBrmsController(),
572 brmsDicitonaryController.getControllerDataByID(policyAdapter.getBrmsController())
576 // Adding Dependencies.
577 if (policyAdapter.getBrmsDependency() != null) {
578 BRMSDictionaryController brmsDicitonaryController = new BRMSDictionaryController();
579 ArrayList<String> dependencies = new ArrayList<>();
580 StringBuilder key = new StringBuilder();
581 for (String dependencyName : policyAdapter.getBrmsDependency()) {
582 dependencies.add(brmsDicitonaryController.getDependencyDataByID(dependencyName).getDependency());
583 key.append(dependencyName + ",");
585 advice.getAttributeAssignmentExpression().add(
586 createResponseAttributes("dependencies:" + key.toString(), dependencies.toString()));
589 // Dynamic Field Config Attributes.
590 Map<String, String> dynamicFieldConfigAttributes = policyAdapter.getDynamicFieldConfigAttributes();
591 for (Entry<String, String> map : dynamicFieldConfigAttributes.entrySet()) {
592 advice.getAttributeAssignmentExpression()
593 .add(createResponseAttributes("key:" + map.getKey(), map.getValue()));
597 AttributeAssignmentExpressionType assignment8 = new AttributeAssignmentExpressionType();
598 assignment8.setAttributeId("RiskType");
599 assignment8.setCategory(CATEGORY_RESOURCE);
600 assignment8.setIssuer("");
602 AttributeValueType configNameAttributeValue8 = new AttributeValueType();
603 configNameAttributeValue8.setDataType(STRING_DATATYPE);
604 configNameAttributeValue8.getContent().add(policyAdapter.getRiskType());
605 assignment8.setExpression(new ObjectFactory().createAttributeValue(configNameAttributeValue8));
607 advice.getAttributeAssignmentExpression().add(assignment8);
609 AttributeAssignmentExpressionType assignment9 = new AttributeAssignmentExpressionType();
610 assignment9.setAttributeId("RiskLevel");
611 assignment9.setCategory(CATEGORY_RESOURCE);
612 assignment9.setIssuer("");
614 AttributeValueType configNameAttributeValue9 = new AttributeValueType();
615 configNameAttributeValue9.setDataType(STRING_DATATYPE);
616 configNameAttributeValue9.getContent().add(policyAdapter.getRiskLevel());
617 assignment9.setExpression(new ObjectFactory().createAttributeValue(configNameAttributeValue9));
619 advice.getAttributeAssignmentExpression().add(assignment9);
621 AttributeAssignmentExpressionType assignment10 = new AttributeAssignmentExpressionType();
622 assignment10.setAttributeId("guard");
623 assignment10.setCategory(CATEGORY_RESOURCE);
624 assignment10.setIssuer("");
626 AttributeValueType configNameAttributeValue10 = new AttributeValueType();
627 configNameAttributeValue10.setDataType(STRING_DATATYPE);
628 configNameAttributeValue10.getContent().add(policyAdapter.getGuard());
629 assignment10.setExpression(new ObjectFactory().createAttributeValue(configNameAttributeValue10));
631 advice.getAttributeAssignmentExpression().add(assignment10);
633 AttributeAssignmentExpressionType assignment11 = new AttributeAssignmentExpressionType();
634 assignment11.setAttributeId("TTLDate");
635 assignment11.setCategory(CATEGORY_RESOURCE);
636 assignment11.setIssuer("");
638 AttributeValueType configNameAttributeValue11 = new AttributeValueType();
639 configNameAttributeValue11.setDataType(STRING_DATATYPE);
640 configNameAttributeValue11.getContent().add(policyAdapter.getTtlDate());
641 assignment11.setExpression(new ObjectFactory().createAttributeValue(configNameAttributeValue11));
643 advice.getAttributeAssignmentExpression().add(assignment11);
645 advices.getAdviceExpression().add(advice);
650 public Object getCorrectPolicyDataObject() {
651 return policyAdapter.getData();
654 private AttributeAssignmentExpressionType createResponseAttributes(String key, String value) {
655 AttributeAssignmentExpressionType assignment7 = new AttributeAssignmentExpressionType();
656 assignment7.setAttributeId(key);
657 assignment7.setCategory(CATEGORY_RESOURCE);
658 assignment7.setIssuer("");
659 AttributeValueType configNameAttributeValue7 = new AttributeValueType();
660 configNameAttributeValue7.setDataType(STRING_DATATYPE);
661 configNameAttributeValue7.getContent().add(value);
662 assignment7.setExpression(new ObjectFactory().createAttributeValue(configNameAttributeValue7));