2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017-2019 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;
23 import com.att.research.xacml.api.pap.PAPException;
24 import com.att.research.xacml.std.IdentifierImpl;
25 import com.google.common.annotations.VisibleForTesting;
27 import java.io.IOException;
28 import java.io.PrintWriter;
30 import java.net.URISyntaxException;
31 import java.nio.charset.Charset;
32 import java.nio.file.Files;
33 import java.nio.file.Path;
34 import java.nio.file.Paths;
35 import java.util.ArrayList;
36 import java.util.HashMap;
37 import java.util.Iterator;
38 import java.util.List;
40 import java.util.Map.Entry;
41 import java.util.UUID;
42 import java.util.regex.Matcher;
43 import java.util.regex.Pattern;
44 import javax.script.SimpleBindings;
45 import oasis.names.tc.xacml._3_0.core.schema.wd_17.AdviceExpressionType;
46 import oasis.names.tc.xacml._3_0.core.schema.wd_17.AdviceExpressionsType;
47 import oasis.names.tc.xacml._3_0.core.schema.wd_17.AllOfType;
48 import oasis.names.tc.xacml._3_0.core.schema.wd_17.AnyOfType;
49 import oasis.names.tc.xacml._3_0.core.schema.wd_17.AttributeAssignmentExpressionType;
50 import oasis.names.tc.xacml._3_0.core.schema.wd_17.AttributeDesignatorType;
51 import oasis.names.tc.xacml._3_0.core.schema.wd_17.AttributeValueType;
52 import oasis.names.tc.xacml._3_0.core.schema.wd_17.EffectType;
53 import oasis.names.tc.xacml._3_0.core.schema.wd_17.MatchType;
54 import oasis.names.tc.xacml._3_0.core.schema.wd_17.ObjectFactory;
55 import oasis.names.tc.xacml._3_0.core.schema.wd_17.PolicyType;
56 import oasis.names.tc.xacml._3_0.core.schema.wd_17.RuleType;
57 import oasis.names.tc.xacml._3_0.core.schema.wd_17.TargetType;
58 import org.apache.commons.io.FilenameUtils;
59 import org.onap.policy.common.logging.eelf.MessageCodes;
60 import org.onap.policy.common.logging.eelf.PolicyLogger;
61 import org.onap.policy.common.logging.flexlogger.FlexLogger;
62 import org.onap.policy.common.logging.flexlogger.Logger;
63 import org.onap.policy.pap.xacml.rest.controller.BRMSDictionaryController;
64 import org.onap.policy.pap.xacml.rest.daoimpl.CommonClassDaoImpl;
65 import org.onap.policy.rest.adapter.PolicyRestAdapter;
66 import org.onap.policy.rest.jpa.BrmsParamTemplate;
68 public class CreateBrmsParamPolicy extends Policy {
70 private static final Logger LOGGER = FlexLogger.getLogger(CreateBrmsParamPolicy.class);
72 public CreateBrmsParamPolicy() {
76 public CreateBrmsParamPolicy(PolicyRestAdapter policyAdapter) {
77 this.policyAdapter = policyAdapter;
78 this.policyAdapter.setConfigType(policyAdapter.getConfigType());
82 public String expandConfigBody(String ruleContents, Map<String, String> brmsParamBody) {
84 Map<String, String> copyMap = new HashMap<>();
85 copyMap.putAll(brmsParamBody);
86 copyMap.put("policyName", policyName.substring(0, policyName.replace(".xml", "").lastIndexOf('.')));
87 copyMap.put("policyScope", policyAdapter.getDomainDir());
88 copyMap.put("policyVersion", policyAdapter.getHighestVersion().toString());
89 copyMap.put("unique", ("p" + policyName + UUID.randomUUID().toString()).replaceAll("[^A-Za-z0-9]", ""));
91 // Finding all the keys in the Map data-structure.
92 Iterator<String> iterator = copyMap.keySet().iterator();
95 while (iterator.hasNext()) {
96 // Converting the first character of the key into a lower case.
97 String input = iterator.next();
98 String output = Character.toLowerCase(input.charAt(0)) + (input.length() > 1 ? input.substring(1) : "");
99 // Searching for a pattern in the String using the key.
100 p = Pattern.compile("\\$\\{" + output + "\\}");
101 m = p.matcher(ruleContents);
102 // Replacing the value with the inputs provided by the user in the editor.
103 String finalInput = copyMap.get(input);
104 if (finalInput.contains("$")) {
105 finalInput = finalInput.replace("$", "\\$");
107 ruleContents = m.replaceAll(finalInput);
112 // Utility to read json data from the existing file to a string
113 static String readFile(String path, Charset encoding) throws IOException {
114 byte[] encoded = Files.readAllBytes(Paths.get(path));
115 return new String(encoded, encoding);
118 // Saving the Configurations file at server location for config policy.
119 protected void saveConfigurations(String policyName, String ruleBody) {
120 if (policyName.endsWith(".xml")) {
121 policyName = policyName.substring(0, policyName.lastIndexOf(".xml"));
123 try (PrintWriter out = new PrintWriter(CONFIG_HOME + File.separator + policyName + ".txt")) {
124 String expandedBody = expandConfigBody(ruleBody, policyAdapter.getBrmsParamBody());
125 out.println(expandedBody);
126 policyAdapter.setJsonBody(expandedBody);
127 policyAdapter.setConfigBodyData(expandedBody);
129 } catch (Exception e) {
130 PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "CreateBrmsParamPolicy",
131 "Exception saving configuration file");
135 // Here we are adding the extension for the configurations file based on the
136 // config type selection for saving.
137 private String getConfigFile(String filename) {
138 filename = FilenameUtils.removeExtension(filename);
139 if (filename.endsWith(".txt")) {
140 filename = filename.substring(0, filename.length() - 3);
143 filename = filename + ".txt";
147 // Validations for Config form
149 public boolean validateConfigForm() {
151 // Validating mandatory Fields.
158 public Map<String, String> savePolicies() throws PAPException {
160 Map<String, String> successMap = new HashMap<>();
161 if (isPolicyExists()) {
162 successMap.put("EXISTS", "This Policy already exist on the PAP");
166 if (!isPreparedToSave()) {
169 // Until here we prepared the data and here calling the method to create
171 Path newPolicyPath = null;
172 newPolicyPath = Paths.get(policyAdapter.getNewFileName());
173 successMap = createPolicy(newPolicyPath, getCorrectPolicyDataObject());
174 if (successMap == null) {
175 successMap = new HashMap<>();
176 PolicyLogger.error("Failed to Update the Database Dictionary Tables.");
177 successMap.put("error", "DB UPDATE");
182 private String getValueFromDictionary(String templateName) {
183 String ruleTemplate = null;
184 CommonClassDaoImpl dbConnection = new CommonClassDaoImpl();
185 String queryString = "from BrmsParamTemplate where param_template_name= :templateName";
186 SimpleBindings params = new SimpleBindings();
187 params.put("templateName", templateName);
188 List<Object> result = dbConnection.getDataByQuery(queryString, params);
189 if (!result.isEmpty()) {
190 BrmsParamTemplate template = (BrmsParamTemplate) result.get(0);
191 ruleTemplate = template.getRule();
196 protected Map<String, String> findType(String rule) {
197 Map<String, String> mapFieldType = new HashMap<>();
200 StringBuilder params = new StringBuilder();
201 Boolean flag = false;
202 Boolean comment = false;
203 String lines[] = rule.split("\n");
204 for (String line : lines) {
205 if (line.isEmpty() || line.startsWith("//")) {
208 if (line.startsWith("/*")) {
212 if (line.contains("//") && !(line.contains("http://") || line.contains("https://"))) {
213 line = line.split("\\/\\/")[0];
215 if (line.contains("/*")) {
217 if (line.contains("*/")) {
220 line = line.split("\\/\\*")[0] + line.split("\\*\\/")[1].replace("*/", "");
221 } catch (Exception e) {
223 line = line.split("\\/\\*")[0];
226 line = line.split("\\/\\*")[0];
229 if (line.contains("*/")) {
232 line = line.split("\\*\\/")[1].replace("*/", "");
233 } catch (Exception e) {
244 if (line.contains("declare Params")) {
248 if (line.contains("end") && flag) {
253 params.toString().replace("declare Params", "").replace("end", "").replaceAll("\\s+", "");
254 String[] components = param.split(":");
256 for (int i = 0; i < components.length; i++) {
259 caption = components[i];
261 if (caption.equals("")) {
264 String nextComponent = "";
266 nextComponent = components[i + 1];
267 } catch (Exception e) {
269 nextComponent = components[i];
271 // If the type is of type String then we add the UI Item and type to the map.
272 if (nextComponent.startsWith("String")) {
274 mapFieldType.put(caption, type);
275 caption = nextComponent.replace("String", "");
276 } else if (nextComponent.startsWith("int")) {
278 mapFieldType.put(caption, type);
279 caption = nextComponent.replace("int", "");
282 } catch (Exception e) {
283 PolicyLogger.error(MessageCodes.ERROR_SYSTEM_ERROR, e, "CreateBrmsParamPolicy",
284 "Exception parsing file in findType");
290 // This is the method for preparing the policy for saving. We have broken it
292 // separately because the fully configured policy is used for multiple
295 public boolean prepareToSave() throws PAPException {
297 if (isPreparedToSave()) {
298 // we have already done this
303 String policyID = policyAdapter.getPolicyID();
304 version = policyAdapter.getHighestVersion();
306 // Create the Instance for pojo, PolicyType object is used in
308 if (policyAdapter.getPolicyType().equals("Config")) {
309 PolicyType policyConfig = new PolicyType();
311 policyConfig.setVersion(Integer.toString(version));
312 policyConfig.setPolicyId(policyID);
313 policyConfig.setTarget(new TargetType());
314 policyAdapter.setData(policyConfig);
317 policyName = policyAdapter.getNewFileName();
319 if (policyAdapter.getData() != null) {
320 Map<String, String> ruleAndUIValue = policyAdapter.getBrmsParamBody();
321 String templateValue = ruleAndUIValue.get("templateName");
322 String valueFromDictionary = getValueFromDictionary(templateValue);
324 StringBuilder body = new StringBuilder();
327 body.append("/* Autogenerated Code Please Don't change/remove this comment section. This is for the UI "
328 + "purpose. \n\t " + "<$%BRMSParamTemplate=" + templateValue + "%$> \n");
329 body.append("<%$Values=");
330 for (Map.Entry<String, String> entry : ruleAndUIValue.entrySet()) {
331 String uiKey = entry.getKey();
332 if (!"templateName".equals(uiKey)) {
333 body.append(uiKey + ":-:" + entry.getValue() + ":|:");
336 body.append("$%> \n*/ \n");
337 body.append(valueFromDictionary + "\n");
338 } catch (Exception e) {
339 PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "CreateBrmsParamPolicy",
340 "Exception saving policy");
343 saveConfigurations(policyName, body.toString());
345 // Make sure the filename ends with an extension
346 if (!policyName.endsWith(".xml")) {
347 policyName = policyName + ".xml";
350 PolicyType configPolicy = (PolicyType) policyAdapter.getData();
352 configPolicy.setDescription(policyAdapter.getPolicyDescription());
354 configPolicy.setRuleCombiningAlgId(policyAdapter.getRuleCombiningAlgId());
356 AllOfType allOfOne = new AllOfType();
358 String fileName = policyAdapter.getNewFileName();
359 String name = fileName.substring(fileName.lastIndexOf("\\") + 1);
360 if ((name == null) || (name.equals(""))) {
361 name = fileName.substring(fileName.lastIndexOf("/") + 1);
363 allOfOne.getMatch().add(createMatch("PolicyName", name));
365 AllOfType allOf = new AllOfType();
367 // Match for ONAPName
368 allOf.getMatch().add(createMatch("ONAPName", policyAdapter.getOnapName()));
369 allOf.getMatch().add(createMatch("ConfigName", policyAdapter.getConfigName()));
370 // Match for riskType
371 allOf.getMatch().add(createDynamicMatch("RiskType", policyAdapter.getRiskType()));
372 // Match for riskLevel
373 allOf.getMatch().add(createDynamicMatch("RiskLevel", String.valueOf(policyAdapter.getRiskLevel())));
374 // Match for riskguard
375 allOf.getMatch().add(createDynamicMatch("guard", policyAdapter.getGuard()));
377 allOf.getMatch().add(createDynamicMatch("TTLDate", policyAdapter.getTtlDate()));
378 AnyOfType anyOf = new AnyOfType();
379 anyOf.getAllOf().add(allOfOne);
380 anyOf.getAllOf().add(allOf);
382 TargetType target = new TargetType();
383 target.getAnyOf().add(anyOf);
385 // Adding the target to the policy element
386 configPolicy.setTarget((TargetType) target);
388 RuleType rule = new RuleType();
389 rule.setRuleId(policyAdapter.getRuleID());
391 rule.setEffect(EffectType.PERMIT);
393 // Create Target in Rule
394 AllOfType allOfInRule = new AllOfType();
396 // Creating match for ACCESS in rule target
397 MatchType accessMatch = new MatchType();
398 AttributeValueType accessAttributeValue = new AttributeValueType();
399 accessAttributeValue.setDataType(STRING_DATATYPE);
400 accessAttributeValue.getContent().add("ACCESS");
401 accessMatch.setAttributeValue(accessAttributeValue);
402 AttributeDesignatorType accessAttributeDesignator = new AttributeDesignatorType();
403 URI accessURI = null;
405 accessURI = new URI(ACTION_ID);
406 } catch (URISyntaxException e) {
407 PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, "CreateBrmsParamPolicy",
408 "Exception creating ACCESS URI");
410 accessAttributeDesignator.setCategory(CATEGORY_ACTION);
411 accessAttributeDesignator.setDataType(STRING_DATATYPE);
412 accessAttributeDesignator.setAttributeId(new IdentifierImpl(accessURI).stringValue());
413 accessMatch.setAttributeDesignator(accessAttributeDesignator);
414 accessMatch.setMatchId(FUNCTION_STRING_EQUAL_IGNORE);
416 // Creating Config Match in rule Target
417 MatchType configMatch = new MatchType();
418 AttributeValueType configAttributeValue = new AttributeValueType();
419 configAttributeValue.setDataType(STRING_DATATYPE);
421 configAttributeValue.getContent().add("Config");
423 configMatch.setAttributeValue(configAttributeValue);
424 AttributeDesignatorType configAttributeDesignator = new AttributeDesignatorType();
425 URI configURI = null;
427 configURI = new URI(RESOURCE_ID);
428 } catch (URISyntaxException e) {
429 PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, "CreateBrmsParamPolicy",
430 "Exception creating Config URI");
433 configAttributeDesignator.setCategory(CATEGORY_RESOURCE);
434 configAttributeDesignator.setDataType(STRING_DATATYPE);
435 configAttributeDesignator.setAttributeId(new IdentifierImpl(configURI).stringValue());
436 configMatch.setAttributeDesignator(configAttributeDesignator);
437 configMatch.setMatchId(FUNCTION_STRING_EQUAL_IGNORE);
439 allOfInRule.getMatch().add(accessMatch);
440 allOfInRule.getMatch().add(configMatch);
442 AnyOfType anyOfInRule = new AnyOfType();
443 anyOfInRule.getAllOf().add(allOfInRule);
445 TargetType targetInRule = new TargetType();
446 targetInRule.getAnyOf().add(anyOfInRule);
448 rule.setTarget(targetInRule);
449 rule.setAdviceExpressions(getAdviceExpressions(version, policyName));
451 configPolicy.getCombinerParametersOrRuleCombinerParametersOrVariableDefinition().add(rule);
452 policyAdapter.setPolicyData(configPolicy);
455 PolicyLogger.error("Unsupported data object." + policyAdapter.getData().getClass().getCanonicalName());
457 setPreparedToSave(true);
461 // Data required for Advice part is setting here.
463 protected AdviceExpressionsType getAdviceExpressions(int version, String fileName) {
465 // Policy Config ID Assignment
466 AdviceExpressionsType advices = new AdviceExpressionsType();
467 AdviceExpressionType advice = new AdviceExpressionType();
468 advice.setAdviceId("BRMSPARAMID");
469 advice.setAppliesTo(EffectType.PERMIT);
471 AttributeAssignmentExpressionType assignment1 = new AttributeAssignmentExpressionType();
472 assignment1.setAttributeId("type");
473 assignment1.setCategory(CATEGORY_RESOURCE);
474 assignment1.setIssuer("");
475 AttributeValueType configNameAttributeValue = new AttributeValueType();
476 configNameAttributeValue.setDataType(STRING_DATATYPE);
477 configNameAttributeValue.getContent().add("Configuration");
478 assignment1.setExpression(new ObjectFactory().createAttributeValue(configNameAttributeValue));
479 advice.getAttributeAssignmentExpression().add(assignment1);
481 // For Config file Url if configurations are provided.
483 AttributeAssignmentExpressionType assignment2 = new AttributeAssignmentExpressionType();
484 assignment2.setAttributeId("URLID");
485 assignment2.setCategory(CATEGORY_RESOURCE);
486 assignment2.setIssuer("");
487 AttributeValueType attributeValue = new AttributeValueType();
488 attributeValue.setDataType(URI_DATATYPE);
490 String content = CONFIG_URL + "/Config/" + getConfigFile(policyName);
492 attributeValue.getContent().add(content);
493 assignment2.setExpression(new ObjectFactory().createAttributeValue(attributeValue));
494 advice.getAttributeAssignmentExpression().add(assignment2);
496 // Policy Name Assignment
497 AttributeAssignmentExpressionType assignment3 = new AttributeAssignmentExpressionType();
498 assignment3.setAttributeId("PolicyName");
499 assignment3.setCategory(CATEGORY_RESOURCE);
500 assignment3.setIssuer("");
501 AttributeValueType attributeValue3 = new AttributeValueType();
502 attributeValue3.setDataType(STRING_DATATYPE);
503 fileName = FilenameUtils.removeExtension(fileName);
504 fileName = fileName + ".xml";
505 String name = fileName.substring(fileName.lastIndexOf("\\") + 1);
506 if ((name == null) || (name.equals(""))) {
507 name = fileName.substring(fileName.lastIndexOf("/") + 1);
509 attributeValue3.getContent().add(name);
510 assignment3.setExpression(new ObjectFactory().createAttributeValue(attributeValue3));
511 advice.getAttributeAssignmentExpression().add(assignment3);
513 // Version Number Assignment
514 AttributeAssignmentExpressionType assignment4 = new AttributeAssignmentExpressionType();
515 assignment4.setAttributeId("VersionNumber");
516 assignment4.setCategory(CATEGORY_RESOURCE);
517 assignment4.setIssuer("");
518 AttributeValueType configNameAttributeValue4 = new AttributeValueType();
519 configNameAttributeValue4.setDataType(STRING_DATATYPE);
520 configNameAttributeValue4.getContent().add(Integer.toString(version));
521 assignment4.setExpression(new ObjectFactory().createAttributeValue(configNameAttributeValue4));
522 advice.getAttributeAssignmentExpression().add(assignment4);
524 // Onap Name Assignment
525 AttributeAssignmentExpressionType assignment5 = new AttributeAssignmentExpressionType();
526 assignment5.setAttributeId("matching:" + ONAPID);
527 assignment5.setCategory(CATEGORY_RESOURCE);
528 assignment5.setIssuer("");
529 AttributeValueType configNameAttributeValue5 = new AttributeValueType();
530 configNameAttributeValue5.setDataType(STRING_DATATYPE);
531 configNameAttributeValue5.getContent().add(policyAdapter.getOnapName());
532 assignment5.setExpression(new ObjectFactory().createAttributeValue(configNameAttributeValue5));
533 advice.getAttributeAssignmentExpression().add(assignment5);
535 // Config Name Assignment
536 AttributeAssignmentExpressionType assignment6 = new AttributeAssignmentExpressionType();
537 assignment6.setAttributeId("matching:" + CONFIGID);
538 assignment6.setCategory(CATEGORY_RESOURCE);
539 assignment6.setIssuer("");
540 AttributeValueType configNameAttributeValue6 = new AttributeValueType();
541 configNameAttributeValue6.setDataType(STRING_DATATYPE);
542 configNameAttributeValue6.getContent().add(policyAdapter.getConfigName());
543 assignment6.setExpression(new ObjectFactory().createAttributeValue(configNameAttributeValue6));
544 advice.getAttributeAssignmentExpression().add(assignment6);
545 // Adding Controller Information.
546 if (policyAdapter.getBrmsController() != null) {
547 BRMSDictionaryController brmsDicitonaryController = new BRMSDictionaryController();
548 advice.getAttributeAssignmentExpression()
549 .add(createResponseAttributes("controller:" + policyAdapter.getBrmsController(),
550 brmsDicitonaryController.getControllerDataByID(policyAdapter.getBrmsController()).getController()));
553 // Adding Dependencies.
554 if (policyAdapter.getBrmsDependency() != null) {
555 BRMSDictionaryController brmsDicitonaryController = new BRMSDictionaryController();
556 ArrayList<String> dependencies = new ArrayList<>();
557 StringBuilder key = new StringBuilder();
558 for (String dependencyName : policyAdapter.getBrmsDependency()) {
559 dependencies.add(brmsDicitonaryController.getDependencyDataByID(dependencyName).getDependency());
560 key.append(dependencyName + ",");
562 advice.getAttributeAssignmentExpression()
563 .add(createResponseAttributes("dependencies:" + key.toString(), dependencies.toString()));
566 // Dynamic Field Config Attributes.
567 Map<String, String> dynamicFieldConfigAttributes = policyAdapter.getDynamicFieldConfigAttributes();
568 for (Entry<String, String> map : dynamicFieldConfigAttributes.entrySet()) {
569 advice.getAttributeAssignmentExpression()
570 .add(createResponseAttributes("key:" + map.getKey(), map.getValue()));
574 AttributeAssignmentExpressionType assignment8 = new AttributeAssignmentExpressionType();
575 assignment8.setAttributeId("RiskType");
576 assignment8.setCategory(CATEGORY_RESOURCE);
577 assignment8.setIssuer("");
579 AttributeValueType configNameAttributeValue8 = new AttributeValueType();
580 configNameAttributeValue8.setDataType(STRING_DATATYPE);
581 configNameAttributeValue8.getContent().add(policyAdapter.getRiskType());
582 assignment8.setExpression(new ObjectFactory().createAttributeValue(configNameAttributeValue8));
584 advice.getAttributeAssignmentExpression().add(assignment8);
586 AttributeAssignmentExpressionType assignment9 = new AttributeAssignmentExpressionType();
587 assignment9.setAttributeId("RiskLevel");
588 assignment9.setCategory(CATEGORY_RESOURCE);
589 assignment9.setIssuer("");
591 AttributeValueType configNameAttributeValue9 = new AttributeValueType();
592 configNameAttributeValue9.setDataType(STRING_DATATYPE);
593 configNameAttributeValue9.getContent().add(policyAdapter.getRiskLevel());
594 assignment9.setExpression(new ObjectFactory().createAttributeValue(configNameAttributeValue9));
596 advice.getAttributeAssignmentExpression().add(assignment9);
598 AttributeAssignmentExpressionType assignment10 = new AttributeAssignmentExpressionType();
599 assignment10.setAttributeId("guard");
600 assignment10.setCategory(CATEGORY_RESOURCE);
601 assignment10.setIssuer("");
603 AttributeValueType configNameAttributeValue10 = new AttributeValueType();
604 configNameAttributeValue10.setDataType(STRING_DATATYPE);
605 configNameAttributeValue10.getContent().add(policyAdapter.getGuard());
606 assignment10.setExpression(new ObjectFactory().createAttributeValue(configNameAttributeValue10));
608 advice.getAttributeAssignmentExpression().add(assignment10);
610 AttributeAssignmentExpressionType assignment11 = new AttributeAssignmentExpressionType();
611 assignment11.setAttributeId("TTLDate");
612 assignment11.setCategory(CATEGORY_RESOURCE);
613 assignment11.setIssuer("");
615 AttributeValueType configNameAttributeValue11 = new AttributeValueType();
616 configNameAttributeValue11.setDataType(STRING_DATATYPE);
617 configNameAttributeValue11.getContent().add(policyAdapter.getTtlDate());
618 assignment11.setExpression(new ObjectFactory().createAttributeValue(configNameAttributeValue11));
620 advice.getAttributeAssignmentExpression().add(assignment11);
622 advices.getAdviceExpression().add(advice);
627 public Object getCorrectPolicyDataObject() {
628 return policyAdapter.getData();
631 private AttributeAssignmentExpressionType createResponseAttributes(String key, String value) {
632 AttributeAssignmentExpressionType assignment7 = new AttributeAssignmentExpressionType();
633 assignment7.setAttributeId(key);
634 assignment7.setCategory(CATEGORY_RESOURCE);
635 assignment7.setIssuer("");
636 AttributeValueType configNameAttributeValue7 = new AttributeValueType();
637 configNameAttributeValue7.setDataType(STRING_DATATYPE);
638 configNameAttributeValue7.getContent().add(value);
639 assignment7.setExpression(new ObjectFactory().createAttributeValue(configNameAttributeValue7));