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;
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;
45 import javax.script.SimpleBindings;
47 import oasis.names.tc.xacml._3_0.core.schema.wd_17.AdviceExpressionType;
48 import oasis.names.tc.xacml._3_0.core.schema.wd_17.AdviceExpressionsType;
49 import oasis.names.tc.xacml._3_0.core.schema.wd_17.AllOfType;
50 import oasis.names.tc.xacml._3_0.core.schema.wd_17.AnyOfType;
51 import oasis.names.tc.xacml._3_0.core.schema.wd_17.AttributeAssignmentExpressionType;
52 import oasis.names.tc.xacml._3_0.core.schema.wd_17.AttributeDesignatorType;
53 import oasis.names.tc.xacml._3_0.core.schema.wd_17.AttributeValueType;
54 import oasis.names.tc.xacml._3_0.core.schema.wd_17.EffectType;
55 import oasis.names.tc.xacml._3_0.core.schema.wd_17.MatchType;
56 import oasis.names.tc.xacml._3_0.core.schema.wd_17.ObjectFactory;
57 import oasis.names.tc.xacml._3_0.core.schema.wd_17.PolicyType;
58 import oasis.names.tc.xacml._3_0.core.schema.wd_17.RuleType;
59 import oasis.names.tc.xacml._3_0.core.schema.wd_17.TargetType;
61 import org.apache.commons.io.FilenameUtils;
62 import org.onap.policy.common.logging.eelf.MessageCodes;
63 import org.onap.policy.common.logging.eelf.PolicyLogger;
64 import org.onap.policy.common.logging.flexlogger.FlexLogger;
65 import org.onap.policy.common.logging.flexlogger.Logger;
66 import org.onap.policy.pap.xacml.rest.controller.BRMSDictionaryController;
67 import org.onap.policy.pap.xacml.rest.daoimpl.CommonClassDaoImpl;
68 import org.onap.policy.rest.adapter.PolicyRestAdapter;
69 import org.onap.policy.rest.jpa.BrmsParamTemplate;
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)) + (input.length() > 1 ? input.substring(1) : "");
102 // Searching for a pattern in the String using the key.
103 p = Pattern.compile("\\$\\{" + output + "\\}");
104 m = p.matcher(ruleContents);
105 // Replacing the value with the inputs provided by the user in the editor.
106 String finalInput = copyMap.get(input);
107 if (finalInput.contains("$")) {
108 finalInput = finalInput.replace("$", "\\$");
110 ruleContents = m.replaceAll(finalInput);
115 // Utility to read json data from the existing file to a string
116 static String readFile(String path, Charset encoding) throws IOException {
117 byte[] encoded = Files.readAllBytes(Paths.get(path));
118 return new String(encoded, encoding);
121 // Saving the Configurations file at server location for config policy.
122 protected void saveConfigurations(String policyName, String ruleBody) {
123 if (policyName.endsWith(".xml")) {
124 policyName = policyName.substring(0, policyName.lastIndexOf(".xml"));
126 try (PrintWriter out = new PrintWriter(CONFIG_HOME + File.separator + policyName + ".txt")) {
127 String expandedBody = expandConfigBody(ruleBody, policyAdapter.getBrmsParamBody());
128 out.println(expandedBody);
129 policyAdapter.setJsonBody(expandedBody);
130 policyAdapter.setConfigBodyData(expandedBody);
132 } catch (Exception e) {
133 PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "CreateBrmsParamPolicy",
134 "Exception saving configuration file");
138 // Here we are adding the extension for the configurations file based on the
139 // config type selection for saving.
140 private String getConfigFile(String filename) {
141 filename = FilenameUtils.removeExtension(filename);
142 if (filename.endsWith(".txt")) {
143 filename = filename.substring(0, filename.length() - 3);
146 filename = filename + ".txt";
150 // Validations for Config form
151 public boolean validateConfigForm() {
153 // Validating mandatory Fields.
160 public Map<String, String> savePolicies() throws PAPException {
162 Map<String, String> successMap = new HashMap<>();
163 if (isPolicyExists()) {
164 successMap.put("EXISTS", "This Policy already exist on the PAP");
168 if (!isPreparedToSave()) {
171 // Until here we prepared the data and here calling the method to create
173 Path newPolicyPath = null;
174 newPolicyPath = Paths.get(policyAdapter.getNewFileName());
175 successMap = createPolicy(newPolicyPath, getCorrectPolicyDataObject());
176 if (successMap == null) {
177 successMap = new HashMap<>();
178 PolicyLogger.error("Failed to Update the Database Dictionary Tables.");
179 successMap.put("error", "DB UPDATE");
184 private String getValueFromDictionary(String templateName) {
185 String ruleTemplate = null;
186 CommonClassDaoImpl dbConnection = new CommonClassDaoImpl();
187 String queryString = "from BrmsParamTemplate where param_template_name= :templateName";
188 SimpleBindings params = new SimpleBindings();
189 params.put("templateName", templateName);
190 List<Object> result = dbConnection.getDataByQuery(queryString, params);
191 if (!result.isEmpty()) {
192 BrmsParamTemplate template = (BrmsParamTemplate) result.get(0);
193 ruleTemplate = template.getRule();
198 protected Map<String, String> findType(String rule) {
199 Map<String, String> mapFieldType = new HashMap<>();
202 StringBuilder params = new StringBuilder();
203 Boolean flag = false;
204 Boolean comment = false;
205 String lines[] = rule.split("\n");
206 for (String line : lines) {
207 if (line.isEmpty() || line.startsWith("//")) {
210 if (line.startsWith("/*")) {
214 if (line.contains("//") && !(line.contains("http://") || line.contains("https://"))) {
215 line = line.split("\\/\\/")[0];
217 if (line.contains("/*")) {
219 if (line.contains("*/")) {
222 line = line.split("\\/\\*")[0] + line.split("\\*\\/")[1].replace("*/", "");
223 } catch (Exception e) {
225 line = line.split("\\/\\*")[0];
228 line = line.split("\\/\\*")[0];
231 if (line.contains("*/")) {
234 line = line.split("\\*\\/")[1].replace("*/", "");
235 } catch (Exception e) {
246 if (line.contains("declare Params")) {
250 if (line.contains("end") && flag) {
255 params.toString().replace("declare Params", "").replace("end", "").replaceAll("\\s+", "");
256 String[] components = param.split(":");
258 for (int i = 0; i < components.length; i++) {
261 caption = components[i];
263 if (caption.equals("")) {
266 String nextComponent = "";
268 nextComponent = components[i + 1];
269 } catch (Exception e) {
271 nextComponent = components[i];
273 // If the type is of type String then we add the UI Item and type to the map.
274 if (nextComponent.startsWith("String")) {
276 mapFieldType.put(caption, type);
277 caption = nextComponent.replace("String", "");
278 } else if (nextComponent.startsWith("int")) {
280 mapFieldType.put(caption, type);
281 caption = nextComponent.replace("int", "");
284 } catch (Exception e) {
285 PolicyLogger.error(MessageCodes.ERROR_SYSTEM_ERROR, e, "CreateBrmsParamPolicy",
286 "Exception parsing file in findType");
292 // This is the method for preparing the policy for saving. We have broken it
294 // separately because the fully configured policy is used for multiple
297 public boolean prepareToSave() throws PAPException {
299 if (isPreparedToSave()) {
300 // we have already done this
305 String policyID = policyAdapter.getPolicyID();
306 version = policyAdapter.getHighestVersion();
308 // Create the Instance for pojo, PolicyType object is used in
310 if (policyAdapter.getPolicyType().equals("Config")) {
311 PolicyType policyConfig = new PolicyType();
313 policyConfig.setVersion(Integer.toString(version));
314 policyConfig.setPolicyId(policyID);
315 policyConfig.setTarget(new TargetType());
316 policyAdapter.setData(policyConfig);
319 policyName = policyAdapter.getNewFileName();
321 if (policyAdapter.getData() != null) {
322 Map<String, String> ruleAndUIValue = policyAdapter.getBrmsParamBody();
323 String templateValue = ruleAndUIValue.get("templateName");
324 String valueFromDictionary = getValueFromDictionary(templateValue);
326 StringBuilder body = new StringBuilder();
329 body.append("/* Autogenerated Code Please Don't change/remove this comment section. This is for the UI "
330 + "purpose. \n\t " + "<$%BRMSParamTemplate=" + templateValue + "%$> \n");
331 body.append("<%$Values=");
332 for (Map.Entry<String, String> entry : ruleAndUIValue.entrySet()) {
333 String uiKey = entry.getKey();
334 if (!"templateName".equals(uiKey)) {
335 body.append(uiKey + ":-:" + entry.getValue() + ":|:");
338 body.append("$%> \n*/ \n");
339 body.append(valueFromDictionary + "\n");
340 } catch (Exception e) {
341 PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "CreateBrmsParamPolicy",
342 "Exception saving policy");
345 saveConfigurations(policyName, body.toString());
347 // Make sure the filename ends with an extension
348 if (!policyName.endsWith(".xml")) {
349 policyName = policyName + ".xml";
352 PolicyType configPolicy = (PolicyType) policyAdapter.getData();
354 configPolicy.setDescription(policyAdapter.getPolicyDescription());
356 configPolicy.setRuleCombiningAlgId(policyAdapter.getRuleCombiningAlgId());
358 AllOfType allOfOne = new AllOfType();
360 String fileName = policyAdapter.getNewFileName();
361 String name = fileName.substring(fileName.lastIndexOf("\\") + 1);
362 if ((name == null) || (name.equals(""))) {
363 name = fileName.substring(fileName.lastIndexOf("/") + 1);
365 allOfOne.getMatch().add(createMatch("PolicyName", name));
367 AllOfType allOf = new AllOfType();
369 // Match for ONAPName
370 allOf.getMatch().add(createMatch("ONAPName", policyAdapter.getOnapName()));
371 allOf.getMatch().add(createMatch("ConfigName", policyAdapter.getConfigName()));
372 // Match for riskType
373 allOf.getMatch().add(createDynamicMatch("RiskType", policyAdapter.getRiskType()));
374 // Match for riskLevel
375 allOf.getMatch().add(createDynamicMatch("RiskLevel", String.valueOf(policyAdapter.getRiskLevel())));
376 // Match for riskguard
377 allOf.getMatch().add(createDynamicMatch("guard", policyAdapter.getGuard()));
379 allOf.getMatch().add(createDynamicMatch("TTLDate", policyAdapter.getTtlDate()));
380 AnyOfType anyOf = new AnyOfType();
381 anyOf.getAllOf().add(allOfOne);
382 anyOf.getAllOf().add(allOf);
384 TargetType target = new TargetType();
385 target.getAnyOf().add(anyOf);
387 // Adding the target to the policy element
388 configPolicy.setTarget((TargetType) target);
390 RuleType rule = new RuleType();
391 rule.setRuleId(policyAdapter.getRuleID());
393 rule.setEffect(EffectType.PERMIT);
395 // Create Target in Rule
396 AllOfType allOfInRule = new AllOfType();
398 // Creating match for ACCESS in rule target
399 MatchType accessMatch = new MatchType();
400 AttributeValueType accessAttributeValue = new AttributeValueType();
401 accessAttributeValue.setDataType(STRING_DATATYPE);
402 accessAttributeValue.getContent().add("ACCESS");
403 accessMatch.setAttributeValue(accessAttributeValue);
404 AttributeDesignatorType accessAttributeDesignator = new AttributeDesignatorType();
405 URI accessURI = null;
407 accessURI = new URI(ACTION_ID);
408 } catch (URISyntaxException e) {
409 PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, "CreateBrmsParamPolicy",
410 "Exception creating ACCESS URI");
412 accessAttributeDesignator.setCategory(CATEGORY_ACTION);
413 accessAttributeDesignator.setDataType(STRING_DATATYPE);
414 accessAttributeDesignator.setAttributeId(new IdentifierImpl(accessURI).stringValue());
415 accessMatch.setAttributeDesignator(accessAttributeDesignator);
416 accessMatch.setMatchId(FUNCTION_STRING_EQUAL_IGNORE);
418 // Creating Config Match in rule Target
419 MatchType configMatch = new MatchType();
420 AttributeValueType configAttributeValue = new AttributeValueType();
421 configAttributeValue.setDataType(STRING_DATATYPE);
423 configAttributeValue.getContent().add("Config");
425 configMatch.setAttributeValue(configAttributeValue);
426 AttributeDesignatorType configAttributeDesignator = new AttributeDesignatorType();
427 URI configURI = null;
429 configURI = new URI(RESOURCE_ID);
430 } catch (URISyntaxException e) {
431 PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, "CreateBrmsParamPolicy",
432 "Exception creating Config URI");
435 configAttributeDesignator.setCategory(CATEGORY_RESOURCE);
436 configAttributeDesignator.setDataType(STRING_DATATYPE);
437 configAttributeDesignator.setAttributeId(new IdentifierImpl(configURI).stringValue());
438 configMatch.setAttributeDesignator(configAttributeDesignator);
439 configMatch.setMatchId(FUNCTION_STRING_EQUAL_IGNORE);
441 allOfInRule.getMatch().add(accessMatch);
442 allOfInRule.getMatch().add(configMatch);
444 AnyOfType anyOfInRule = new AnyOfType();
445 anyOfInRule.getAllOf().add(allOfInRule);
447 TargetType targetInRule = new TargetType();
448 targetInRule.getAnyOf().add(anyOfInRule);
450 rule.setTarget(targetInRule);
451 rule.setAdviceExpressions(getAdviceExpressions(version, policyName));
453 configPolicy.getCombinerParametersOrRuleCombinerParametersOrVariableDefinition().add(rule);
454 policyAdapter.setPolicyData(configPolicy);
457 PolicyLogger.error("Unsupported data object." + policyAdapter.getData().getClass().getCanonicalName());
459 setPreparedToSave(true);
463 // Data required for Advice part is setting here.
464 private AdviceExpressionsType getAdviceExpressions(int version, String fileName) {
466 // Policy Config ID Assignment
467 AdviceExpressionsType advices = new AdviceExpressionsType();
468 AdviceExpressionType advice = new AdviceExpressionType();
469 advice.setAdviceId("BRMSPARAMID");
470 advice.setAppliesTo(EffectType.PERMIT);
472 AttributeAssignmentExpressionType assignment1 = new AttributeAssignmentExpressionType();
473 assignment1.setAttributeId("type");
474 assignment1.setCategory(CATEGORY_RESOURCE);
475 assignment1.setIssuer("");
476 AttributeValueType configNameAttributeValue = new AttributeValueType();
477 configNameAttributeValue.setDataType(STRING_DATATYPE);
478 configNameAttributeValue.getContent().add("Configuration");
479 assignment1.setExpression(new ObjectFactory().createAttributeValue(configNameAttributeValue));
480 advice.getAttributeAssignmentExpression().add(assignment1);
482 // For Config file Url if configurations are provided.
484 AttributeAssignmentExpressionType assignment2 = new AttributeAssignmentExpressionType();
485 assignment2.setAttributeId("URLID");
486 assignment2.setCategory(CATEGORY_RESOURCE);
487 assignment2.setIssuer("");
488 AttributeValueType attributeValue = new AttributeValueType();
489 attributeValue.setDataType(URI_DATATYPE);
491 String content = CONFIG_URL + "/Config/" + getConfigFile(policyName);
493 attributeValue.getContent().add(content);
494 assignment2.setExpression(new ObjectFactory().createAttributeValue(attributeValue));
495 advice.getAttributeAssignmentExpression().add(assignment2);
497 // Policy Name Assignment
498 AttributeAssignmentExpressionType assignment3 = new AttributeAssignmentExpressionType();
499 assignment3.setAttributeId("PolicyName");
500 assignment3.setCategory(CATEGORY_RESOURCE);
501 assignment3.setIssuer("");
502 AttributeValueType attributeValue3 = new AttributeValueType();
503 attributeValue3.setDataType(STRING_DATATYPE);
504 fileName = FilenameUtils.removeExtension(fileName);
505 fileName = fileName + ".xml";
506 String name = fileName.substring(fileName.lastIndexOf("\\") + 1);
507 if ((name == null) || (name.equals(""))) {
508 name = fileName.substring(fileName.lastIndexOf("/") + 1);
510 attributeValue3.getContent().add(name);
511 assignment3.setExpression(new ObjectFactory().createAttributeValue(attributeValue3));
512 advice.getAttributeAssignmentExpression().add(assignment3);
514 // Version Number Assignment
515 AttributeAssignmentExpressionType assignment4 = new AttributeAssignmentExpressionType();
516 assignment4.setAttributeId("VersionNumber");
517 assignment4.setCategory(CATEGORY_RESOURCE);
518 assignment4.setIssuer("");
519 AttributeValueType configNameAttributeValue4 = new AttributeValueType();
520 configNameAttributeValue4.setDataType(STRING_DATATYPE);
521 configNameAttributeValue4.getContent().add(Integer.toString(version));
522 assignment4.setExpression(new ObjectFactory().createAttributeValue(configNameAttributeValue4));
523 advice.getAttributeAssignmentExpression().add(assignment4);
525 // Onap Name Assignment
526 AttributeAssignmentExpressionType assignment5 = new AttributeAssignmentExpressionType();
527 assignment5.setAttributeId("matching:" + ONAPID);
528 assignment5.setCategory(CATEGORY_RESOURCE);
529 assignment5.setIssuer("");
530 AttributeValueType configNameAttributeValue5 = new AttributeValueType();
531 configNameAttributeValue5.setDataType(STRING_DATATYPE);
532 configNameAttributeValue5.getContent().add(policyAdapter.getOnapName());
533 assignment5.setExpression(new ObjectFactory().createAttributeValue(configNameAttributeValue5));
534 advice.getAttributeAssignmentExpression().add(assignment5);
536 // Config Name Assignment
537 AttributeAssignmentExpressionType assignment6 = new AttributeAssignmentExpressionType();
538 assignment6.setAttributeId("matching:" + CONFIGID);
539 assignment6.setCategory(CATEGORY_RESOURCE);
540 assignment6.setIssuer("");
541 AttributeValueType configNameAttributeValue6 = new AttributeValueType();
542 configNameAttributeValue6.setDataType(STRING_DATATYPE);
543 configNameAttributeValue6.getContent().add(policyAdapter.getConfigName());
544 assignment6.setExpression(new ObjectFactory().createAttributeValue(configNameAttributeValue6));
545 advice.getAttributeAssignmentExpression().add(assignment6);
546 // Adding Controller Information.
547 if (policyAdapter.getBrmsController() != null) {
548 BRMSDictionaryController brmsDicitonaryController = new BRMSDictionaryController();
549 advice.getAttributeAssignmentExpression().add(createResponseAttributes(
550 "controller:" + policyAdapter.getBrmsController(),
551 brmsDicitonaryController.getControllerDataByID(policyAdapter.getBrmsController()).getController()));
554 // Adding Dependencies.
555 if (policyAdapter.getBrmsDependency() != null) {
556 BRMSDictionaryController brmsDicitonaryController = new BRMSDictionaryController();
557 ArrayList<String> dependencies = new ArrayList<>();
558 StringBuilder key = new StringBuilder();
559 for (String dependencyName : policyAdapter.getBrmsDependency()) {
560 dependencies.add(brmsDicitonaryController.getDependencyDataByID(dependencyName).getDependency());
561 key.append(dependencyName + ",");
563 advice.getAttributeAssignmentExpression()
564 .add(createResponseAttributes("dependencies:" + key.toString(), dependencies.toString()));
567 // Dynamic Field Config Attributes.
568 Map<String, String> dynamicFieldConfigAttributes = policyAdapter.getDynamicFieldConfigAttributes();
569 for (Entry<String, String> map : dynamicFieldConfigAttributes.entrySet()) {
570 advice.getAttributeAssignmentExpression()
571 .add(createResponseAttributes("key:" + map.getKey(), map.getValue()));
575 AttributeAssignmentExpressionType assignment8 = new AttributeAssignmentExpressionType();
576 assignment8.setAttributeId("RiskType");
577 assignment8.setCategory(CATEGORY_RESOURCE);
578 assignment8.setIssuer("");
580 AttributeValueType configNameAttributeValue8 = new AttributeValueType();
581 configNameAttributeValue8.setDataType(STRING_DATATYPE);
582 configNameAttributeValue8.getContent().add(policyAdapter.getRiskType());
583 assignment8.setExpression(new ObjectFactory().createAttributeValue(configNameAttributeValue8));
585 advice.getAttributeAssignmentExpression().add(assignment8);
587 AttributeAssignmentExpressionType assignment9 = new AttributeAssignmentExpressionType();
588 assignment9.setAttributeId("RiskLevel");
589 assignment9.setCategory(CATEGORY_RESOURCE);
590 assignment9.setIssuer("");
592 AttributeValueType configNameAttributeValue9 = new AttributeValueType();
593 configNameAttributeValue9.setDataType(STRING_DATATYPE);
594 configNameAttributeValue9.getContent().add(policyAdapter.getRiskLevel());
595 assignment9.setExpression(new ObjectFactory().createAttributeValue(configNameAttributeValue9));
597 advice.getAttributeAssignmentExpression().add(assignment9);
599 AttributeAssignmentExpressionType assignment10 = new AttributeAssignmentExpressionType();
600 assignment10.setAttributeId("guard");
601 assignment10.setCategory(CATEGORY_RESOURCE);
602 assignment10.setIssuer("");
604 AttributeValueType configNameAttributeValue10 = new AttributeValueType();
605 configNameAttributeValue10.setDataType(STRING_DATATYPE);
606 configNameAttributeValue10.getContent().add(policyAdapter.getGuard());
607 assignment10.setExpression(new ObjectFactory().createAttributeValue(configNameAttributeValue10));
609 advice.getAttributeAssignmentExpression().add(assignment10);
611 AttributeAssignmentExpressionType assignment11 = new AttributeAssignmentExpressionType();
612 assignment11.setAttributeId("TTLDate");
613 assignment11.setCategory(CATEGORY_RESOURCE);
614 assignment11.setIssuer("");
616 AttributeValueType configNameAttributeValue11 = new AttributeValueType();
617 configNameAttributeValue11.setDataType(STRING_DATATYPE);
618 configNameAttributeValue11.getContent().add(policyAdapter.getTtlDate());
619 assignment11.setExpression(new ObjectFactory().createAttributeValue(configNameAttributeValue11));
621 advice.getAttributeAssignmentExpression().add(assignment11);
623 advices.getAdviceExpression().add(advice);
628 public Object getCorrectPolicyDataObject() {
629 return policyAdapter.getData();
632 private AttributeAssignmentExpressionType createResponseAttributes(String key, String value) {
633 AttributeAssignmentExpressionType assignment7 = new AttributeAssignmentExpressionType();
634 assignment7.setAttributeId(key);
635 assignment7.setCategory(CATEGORY_RESOURCE);
636 assignment7.setIssuer("");
637 AttributeValueType configNameAttributeValue7 = new AttributeValueType();
638 configNameAttributeValue7.setDataType(STRING_DATATYPE);
639 configNameAttributeValue7.getContent().add(value);
640 assignment7.setExpression(new ObjectFactory().createAttributeValue(configNameAttributeValue7));