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("//") && !(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", "Exception parsing file in findType");
295 // This is the method for preparing the policy for saving. We have broken it
297 // separately because the fully configured policy is used for multiple
300 public boolean prepareToSave() throws PAPException {
302 if (isPreparedToSave()) {
303 // we have already done this
308 String policyID = policyAdapter.getPolicyID();
309 version = policyAdapter.getHighestVersion();
311 // Create the Instance for pojo, PolicyType object is used in
313 if (policyAdapter.getPolicyType().equals("Config")) {
314 PolicyType policyConfig = new PolicyType();
316 policyConfig.setVersion(Integer.toString(version));
317 policyConfig.setPolicyId(policyID);
318 policyConfig.setTarget(new TargetType());
319 policyAdapter.setData(policyConfig);
322 policyName = policyAdapter.getNewFileName();
324 if (policyAdapter.getData() != null) {
325 Map<String,String> ruleAndUIValue= policyAdapter.getBrmsParamBody();
326 String templateValue= ruleAndUIValue.get("templateName");
327 String valueFromDictionary= getValueFromDictionary(templateValue);
329 StringBuilder body = new StringBuilder();
332 body.append("/* Autogenerated Code Please Don't change/remove this comment section. This is for the UI purpose. \n\t " +
333 "<$%BRMSParamTemplate=" + templateValue + "%$> \n");
334 body.append("<%$Values=");
335 for (Map.Entry<String, String> entry : ruleAndUIValue.entrySet()) {
336 String uiKey = entry.getKey();
337 if(!"templateName".equals(uiKey)) {
338 body.append(uiKey+":-:"+entry.getValue()+":|:");
341 body.append("$%> \n*/ \n");
342 body.append(valueFromDictionary + "\n");
344 catch (Exception e) {
345 PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "CreateBrmsParamPolicy", "Exception saving policy");
348 saveConfigurations(policyName,body.toString());
350 // Make sure the filename ends with an extension
351 if (!policyName.endsWith(".xml")) {
352 policyName = policyName + ".xml";
355 PolicyType configPolicy = (PolicyType) policyAdapter.getData();
357 configPolicy.setDescription(policyAdapter.getPolicyDescription());
359 configPolicy.setRuleCombiningAlgId(policyAdapter.getRuleCombiningAlgId());
361 AllOfType allOfOne = new AllOfType();
363 String fileName = policyAdapter.getNewFileName();
364 String name = fileName.substring(fileName.lastIndexOf("\\") + 1, fileName.length());
365 if ((name == null) || (name.equals(""))) {
366 name = fileName.substring(fileName.lastIndexOf("/") + 1,
369 allOfOne.getMatch().add(createMatch("PolicyName", name));
372 AllOfType allOf = new AllOfType();
374 // Match for ONAPName
375 allOf.getMatch().add(createMatch("ONAPName", policyAdapter.getOnapName()));
376 allOf.getMatch().add(createMatch("ConfigName", policyAdapter.getConfigName()));
377 // Match for riskType
378 allOf.getMatch().add(createDynamicMatch("RiskType", policyAdapter.getRiskType()));
379 // Match for riskLevel
380 allOf.getMatch().add(createDynamicMatch("RiskLevel", String.valueOf(policyAdapter.getRiskLevel())));
381 // Match for riskguard
382 allOf.getMatch().add(createDynamicMatch("guard", policyAdapter.getGuard()));
384 allOf.getMatch().add(createDynamicMatch("TTLDate", policyAdapter.getTtlDate()));
385 AnyOfType anyOf = new AnyOfType();
386 anyOf.getAllOf().add(allOfOne);
387 anyOf.getAllOf().add(allOf);
389 TargetType target = new TargetType();
390 target.getAnyOf().add(anyOf);
392 // Adding the target to the policy element
393 configPolicy.setTarget((TargetType) target);
395 RuleType rule = new RuleType();
396 rule.setRuleId(policyAdapter.getRuleID());
398 rule.setEffect(EffectType.PERMIT);
400 // Create Target in Rule
401 AllOfType allOfInRule = new AllOfType();
403 // Creating match for ACCESS in rule target
404 MatchType accessMatch = new MatchType();
405 AttributeValueType accessAttributeValue = new AttributeValueType();
406 accessAttributeValue.setDataType(STRING_DATATYPE);
407 accessAttributeValue.getContent().add("ACCESS");
408 accessMatch.setAttributeValue(accessAttributeValue);
409 AttributeDesignatorType accessAttributeDesignator = new AttributeDesignatorType();
410 URI accessURI = null;
412 accessURI = new URI(ACTION_ID);
413 } catch (URISyntaxException e) {
414 PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, "CreateBrmsParamPolicy", "Exception creating ACCESS URI");
416 accessAttributeDesignator.setCategory(CATEGORY_ACTION);
417 accessAttributeDesignator.setDataType(STRING_DATATYPE);
418 accessAttributeDesignator.setAttributeId(new IdentifierImpl(
419 accessURI).stringValue());
420 accessMatch.setAttributeDesignator(accessAttributeDesignator);
421 accessMatch.setMatchId(FUNCTION_STRING_EQUAL_IGNORE);
423 // Creating Config Match in rule Target
424 MatchType configMatch = new MatchType();
425 AttributeValueType configAttributeValue = new AttributeValueType();
426 configAttributeValue.setDataType(STRING_DATATYPE);
428 configAttributeValue.getContent().add("Config");
430 configMatch.setAttributeValue(configAttributeValue);
431 AttributeDesignatorType configAttributeDesignator = new AttributeDesignatorType();
432 URI configURI = null;
434 configURI = new URI(RESOURCE_ID);
435 } catch (URISyntaxException e) {
436 PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, "CreateBrmsParamPolicy", "Exception creating Config URI");
439 configAttributeDesignator.setCategory(CATEGORY_RESOURCE);
440 configAttributeDesignator.setDataType(STRING_DATATYPE);
441 configAttributeDesignator.setAttributeId(new IdentifierImpl(configURI).stringValue());
442 configMatch.setAttributeDesignator(configAttributeDesignator);
443 configMatch.setMatchId(FUNCTION_STRING_EQUAL_IGNORE);
445 allOfInRule.getMatch().add(accessMatch);
446 allOfInRule.getMatch().add(configMatch);
448 AnyOfType anyOfInRule = new AnyOfType();
449 anyOfInRule.getAllOf().add(allOfInRule);
451 TargetType targetInRule = new TargetType();
452 targetInRule.getAnyOf().add(anyOfInRule);
454 rule.setTarget(targetInRule);
455 rule.setAdviceExpressions(getAdviceExpressions(version, policyName));
458 .getCombinerParametersOrRuleCombinerParametersOrVariableDefinition()
460 policyAdapter.setPolicyData(configPolicy);
463 PolicyLogger.error("Unsupported data object."
464 + policyAdapter.getData().getClass().getCanonicalName());
466 setPreparedToSave(true);
470 // Data required for Advice part is setting here.
471 private AdviceExpressionsType getAdviceExpressions(int version,
474 //Policy Config ID Assignment
475 AdviceExpressionsType advices = new AdviceExpressionsType();
476 AdviceExpressionType advice = new AdviceExpressionType();
477 advice.setAdviceId("BRMSPARAMID");
478 advice.setAppliesTo(EffectType.PERMIT);
480 AttributeAssignmentExpressionType assignment1 = new AttributeAssignmentExpressionType();
481 assignment1.setAttributeId("type");
482 assignment1.setCategory(CATEGORY_RESOURCE);
483 assignment1.setIssuer("");
484 AttributeValueType configNameAttributeValue = new AttributeValueType();
485 configNameAttributeValue.setDataType(STRING_DATATYPE);
486 configNameAttributeValue.getContent().add("Configuration");
487 assignment1.setExpression(new ObjectFactory()
488 .createAttributeValue(configNameAttributeValue));
489 advice.getAttributeAssignmentExpression().add(assignment1);
491 // For Config file Url if configurations are provided.
493 AttributeAssignmentExpressionType assignment2 = new AttributeAssignmentExpressionType();
494 assignment2.setAttributeId("URLID");
495 assignment2.setCategory(CATEGORY_RESOURCE);
496 assignment2.setIssuer("");
497 AttributeValueType attributeValue = new AttributeValueType();
498 attributeValue.setDataType(URI_DATATYPE);
500 String content = CONFIG_URL + "/Config/"+ getConfigFile(policyName);
502 attributeValue.getContent().add(content);
503 assignment2.setExpression(new ObjectFactory()
504 .createAttributeValue(attributeValue));
505 advice.getAttributeAssignmentExpression().add(assignment2);
507 // Policy Name Assignment
508 AttributeAssignmentExpressionType assignment3 = new AttributeAssignmentExpressionType();
509 assignment3.setAttributeId("PolicyName");
510 assignment3.setCategory(CATEGORY_RESOURCE);
511 assignment3.setIssuer("");
512 AttributeValueType attributeValue3 = new AttributeValueType();
513 attributeValue3.setDataType(STRING_DATATYPE);
514 fileName = FilenameUtils.removeExtension(fileName);
515 fileName = fileName + ".xml";
516 String name = fileName.substring(fileName.lastIndexOf("\\") + 1,
518 if ((name == null) || (name.equals(""))) {
519 name = fileName.substring(fileName.lastIndexOf("/") + 1,
522 attributeValue3.getContent().add(name);
523 assignment3.setExpression(new ObjectFactory()
524 .createAttributeValue(attributeValue3));
525 advice.getAttributeAssignmentExpression().add(assignment3);
527 // Version Number Assignment
528 AttributeAssignmentExpressionType assignment4 = new AttributeAssignmentExpressionType();
529 assignment4.setAttributeId("VersionNumber");
530 assignment4.setCategory(CATEGORY_RESOURCE);
531 assignment4.setIssuer("");
532 AttributeValueType configNameAttributeValue4 = new AttributeValueType();
533 configNameAttributeValue4.setDataType(STRING_DATATYPE);
534 configNameAttributeValue4.getContent().add(Integer.toString(version));
535 assignment4.setExpression(new ObjectFactory()
536 .createAttributeValue(configNameAttributeValue4));
537 advice.getAttributeAssignmentExpression().add(assignment4);
539 // Onap Name Assignment
540 AttributeAssignmentExpressionType assignment5 = new AttributeAssignmentExpressionType();
541 assignment5.setAttributeId("matching:" + ONAPID);
542 assignment5.setCategory(CATEGORY_RESOURCE);
543 assignment5.setIssuer("");
544 AttributeValueType configNameAttributeValue5 = new AttributeValueType();
545 configNameAttributeValue5.setDataType(STRING_DATATYPE);
546 configNameAttributeValue5.getContent().add(policyAdapter.getOnapName());
547 assignment5.setExpression(new ObjectFactory()
548 .createAttributeValue(configNameAttributeValue5));
549 advice.getAttributeAssignmentExpression().add(assignment5);
552 //Config Name Assignment
553 AttributeAssignmentExpressionType assignment6 = new AttributeAssignmentExpressionType();
554 assignment6.setAttributeId("matching:" +CONFIGID);
555 assignment6.setCategory(CATEGORY_RESOURCE);
556 assignment6.setIssuer("");
557 AttributeValueType configNameAttributeValue6 = new AttributeValueType();
558 configNameAttributeValue6.setDataType(STRING_DATATYPE);
559 configNameAttributeValue6.getContent().add(policyAdapter.getConfigName());
560 assignment6.setExpression(new ObjectFactory().createAttributeValue(configNameAttributeValue6));
561 advice.getAttributeAssignmentExpression().add(assignment6);
562 // Adding Controller Information.
563 if(policyAdapter.getBrmsController()!=null){
564 BRMSDictionaryController brmsDicitonaryController = new BRMSDictionaryController();
565 advice.getAttributeAssignmentExpression().add(
566 createResponseAttributes("controller:"+ policyAdapter.getBrmsController(),
567 brmsDicitonaryController.getControllerDataByID(policyAdapter.getBrmsController()).getController()));
570 // Adding Dependencies.
571 if(policyAdapter.getBrmsDependency()!=null){
572 BRMSDictionaryController brmsDicitonaryController = new BRMSDictionaryController();
573 ArrayList<String> dependencies = new ArrayList<>();
574 StringBuilder key = new StringBuilder();
575 for(String dependencyName: policyAdapter.getBrmsDependency()){
576 dependencies.add(brmsDicitonaryController.getDependencyDataByID(dependencyName).getDependency());
577 key.append(dependencyName + ",");
579 advice.getAttributeAssignmentExpression().add(
580 createResponseAttributes("dependencies:"+key.toString(), dependencies.toString()));
583 // Dynamic Field Config Attributes.
584 Map<String, String> dynamicFieldConfigAttributes = policyAdapter.getDynamicFieldConfigAttributes();
585 for (Entry<String, String> map : dynamicFieldConfigAttributes.entrySet()) {
586 advice.getAttributeAssignmentExpression().add(createResponseAttributes("key:"+map.getKey(), map.getValue()));
590 AttributeAssignmentExpressionType assignment8 = new AttributeAssignmentExpressionType();
591 assignment8.setAttributeId("RiskType");
592 assignment8.setCategory(CATEGORY_RESOURCE);
593 assignment8.setIssuer("");
595 AttributeValueType configNameAttributeValue8 = new AttributeValueType();
596 configNameAttributeValue8.setDataType(STRING_DATATYPE);
597 configNameAttributeValue8.getContent().add(policyAdapter.getRiskType());
598 assignment8.setExpression(new ObjectFactory().createAttributeValue(configNameAttributeValue8));
600 advice.getAttributeAssignmentExpression().add(assignment8);
602 AttributeAssignmentExpressionType assignment9 = new AttributeAssignmentExpressionType();
603 assignment9.setAttributeId("RiskLevel");
604 assignment9.setCategory(CATEGORY_RESOURCE);
605 assignment9.setIssuer("");
607 AttributeValueType configNameAttributeValue9 = new AttributeValueType();
608 configNameAttributeValue9.setDataType(STRING_DATATYPE);
609 configNameAttributeValue9.getContent().add(policyAdapter.getRiskLevel());
610 assignment9.setExpression(new ObjectFactory().createAttributeValue(configNameAttributeValue9));
612 advice.getAttributeAssignmentExpression().add(assignment9);
614 AttributeAssignmentExpressionType assignment10 = new AttributeAssignmentExpressionType();
615 assignment10.setAttributeId("guard");
616 assignment10.setCategory(CATEGORY_RESOURCE);
617 assignment10.setIssuer("");
619 AttributeValueType configNameAttributeValue10 = new AttributeValueType();
620 configNameAttributeValue10.setDataType(STRING_DATATYPE);
621 configNameAttributeValue10.getContent().add(policyAdapter.getGuard());
622 assignment10.setExpression(new ObjectFactory().createAttributeValue(configNameAttributeValue10));
624 advice.getAttributeAssignmentExpression().add(assignment10);
626 AttributeAssignmentExpressionType assignment11 = new AttributeAssignmentExpressionType();
627 assignment11.setAttributeId("TTLDate");
628 assignment11.setCategory(CATEGORY_RESOURCE);
629 assignment11.setIssuer("");
631 AttributeValueType configNameAttributeValue11 = new AttributeValueType();
632 configNameAttributeValue11.setDataType(STRING_DATATYPE);
633 configNameAttributeValue11.getContent().add(policyAdapter.getTtlDate());
634 assignment11.setExpression(new ObjectFactory().createAttributeValue(configNameAttributeValue11));
636 advice.getAttributeAssignmentExpression().add(assignment11);
638 advices.getAdviceExpression().add(advice);
643 public Object getCorrectPolicyDataObject() {
644 return policyAdapter.getData();
647 private AttributeAssignmentExpressionType createResponseAttributes(String key, String value){
648 AttributeAssignmentExpressionType assignment7 = new AttributeAssignmentExpressionType();
649 assignment7.setAttributeId(key);
650 assignment7.setCategory(CATEGORY_RESOURCE);
651 assignment7.setIssuer("");
652 AttributeValueType configNameAttributeValue7 = new AttributeValueType();
653 configNameAttributeValue7.setDataType(STRING_DATATYPE);
654 configNameAttributeValue7.getContent().add(value);
655 assignment7.setExpression(new ObjectFactory().createAttributeValue(configNameAttributeValue7));