2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 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.openecomp.policy.pap.xacml.rest.components;
25 import java.io.IOException;
26 import java.io.PrintWriter;
28 import java.net.URISyntaxException;
29 import java.nio.charset.Charset;
30 import java.nio.charset.StandardCharsets;
31 import java.nio.file.Files;
32 import java.nio.file.Path;
33 import java.nio.file.Paths;
34 import java.util.HashMap;
36 import java.util.StringTokenizer;
38 import oasis.names.tc.xacml._3_0.core.schema.wd_17.AdviceExpressionType;
39 import oasis.names.tc.xacml._3_0.core.schema.wd_17.AdviceExpressionsType;
40 import oasis.names.tc.xacml._3_0.core.schema.wd_17.AllOfType;
41 import oasis.names.tc.xacml._3_0.core.schema.wd_17.AnyOfType;
42 import oasis.names.tc.xacml._3_0.core.schema.wd_17.AttributeAssignmentExpressionType;
43 import oasis.names.tc.xacml._3_0.core.schema.wd_17.AttributeDesignatorType;
44 import oasis.names.tc.xacml._3_0.core.schema.wd_17.AttributeValueType;
45 import oasis.names.tc.xacml._3_0.core.schema.wd_17.EffectType;
46 import oasis.names.tc.xacml._3_0.core.schema.wd_17.MatchType;
47 import oasis.names.tc.xacml._3_0.core.schema.wd_17.ObjectFactory;
48 import oasis.names.tc.xacml._3_0.core.schema.wd_17.PolicyType;
49 import oasis.names.tc.xacml._3_0.core.schema.wd_17.RuleType;
50 import oasis.names.tc.xacml._3_0.core.schema.wd_17.TargetType;
52 import org.apache.commons.io.FilenameUtils;
53 import org.openecomp.policy.pap.xacml.rest.adapters.PolicyRestAdapter;
55 import com.att.research.xacml.std.IdentifierImpl;
57 import org.openecomp.policy.common.logging.eelf.MessageCodes;
58 import org.openecomp.policy.common.logging.eelf.PolicyLogger;
59 import org.openecomp.policy.common.logging.flexlogger.FlexLogger;
60 import org.openecomp.policy.common.logging.flexlogger.Logger;
63 public class CreateBrmsRawPolicy extends Policy {
67 private static final Logger logger = FlexLogger
68 .getLogger(CreateBrmsRawPolicy.class);
70 public static final String JSON_CONFIG = "JSON";
71 public static final String XML_CONFIG = "XML";
72 public static final String PROPERTIES_CONFIG = "PROPERTIES";
73 public static final String OTHER_CONFIG = "OTHER";
75 public CreateBrmsRawPolicy() {
79 public CreateBrmsRawPolicy(PolicyRestAdapter policyAdapter) {
80 this.policyAdapter = policyAdapter;
81 this.policyAdapter.setConfigType(policyAdapter.getConfigType());
85 // Saving the Configurations file at server location for config policy.
86 protected void saveConfigurations(String policyName, String prevPolicyName,
88 final Path gitPath = Paths.get(policyAdapter.getUserGitPath()
90 String policyDir = policyAdapter.getParentPath().toString();
91 int startIndex = policyDir.indexOf(gitPath.toString())
92 + gitPath.toString().length() + 1;
93 policyDir = policyDir.substring(startIndex, policyDir.length());
94 logger.info("print the main domain value" + policyDir);
95 String path = policyDir.replace('\\', '.');
96 if (path.contains("/")) {
97 path = policyDir.replace('/', '.');
98 logger.info("print the path:" + path);
102 String configFileName = getConfigFile(policyName);
105 if (CONFIG_HOME.contains("\\")) {
106 file = new File(CONFIG_HOME + "\\" + path + "."
109 file = new File(CONFIG_HOME + "/" + path + "." + configFileName);
112 // if file doesnt exists, then create it
113 if (!file.exists()) {
114 file.createNewFile();
117 // Getting the previous policy Config Json file to be used for
118 // updating the dictionary tables
119 if (policyAdapter.isEditPolicy()) {
121 String prevConfigFileName = getConfigFile(prevPolicyName);
124 if (CONFIG_HOME.contains("\\")) {
125 oldFile = new File(CONFIG_HOME + "\\" + path + "."
126 + prevConfigFileName);
128 oldFile = new File(CONFIG_HOME + "/" + path + "."
129 + prevConfigFileName);
132 String filepath = oldFile.toString();
134 String prevJsonBody = readFile(filepath, StandardCharsets.UTF_8);
135 policyAdapter.setPrevJsonBody(prevJsonBody);
138 File configHomeDir = new File(CONFIG_HOME);
139 File[] listOfFiles = configHomeDir.listFiles();
140 if (listOfFiles != null) {
141 for (File eachFile : listOfFiles) {
142 if (eachFile.isFile()) {
143 String fileNameWithoutExtension = FilenameUtils
144 .removeExtension(eachFile.getName());
145 String configFileNameWithoutExtension = FilenameUtils
146 .removeExtension(configFileName);
147 if (fileNameWithoutExtension
148 .equals(configFileNameWithoutExtension)) {
156 /*FileWriter fw = new FileWriter(file.getAbsoluteFile());
157 BufferedWriter bw = new BufferedWriter(fw);
160 if (logger.isDebugEnabled()) {
161 logger.debug("Configuration is succesfully saved");
166 if (policyName.endsWith(".xml")) {
167 policyName = policyName.substring(0,
168 policyName.lastIndexOf(".xml"));
170 PrintWriter out = new PrintWriter(CONFIG_HOME + File.separator
171 + path + "." + policyName + ".txt");
172 out.println(jsonBody);
175 } catch (Exception e) {
176 //TODO:EELF Cleanup - Remove logger
177 //logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + e);
178 PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "CreateBrmsRawPolicy", "Exception saving configurations file");
181 } catch (IOException e) {
186 // Utility to read json data from the existing file to a string
187 static String readFile(String path, Charset encoding) throws IOException {
189 byte[] encoded = Files.readAllBytes(Paths.get(path));
190 return new String(encoded, encoding);
194 // Here we are adding the extension for the configurations file based on the
195 // config type selection for saving.
196 private String getConfigFile(String filename) {
197 filename = FilenameUtils.removeExtension(filename);
198 if (filename.endsWith(".txt")) {
199 filename = filename.substring(0, filename.length() - 3);
202 filename = filename + ".txt";
206 // Validations for Config form
207 public boolean validateConfigForm() {
209 // Validating mandatory Fields.
216 public Map<String, String> savePolicies() throws Exception {
218 Map<String, String> successMap = new HashMap<String,String>();
219 if(isPolicyExists()){
220 successMap.put("EXISTS", "This Policy already exist on the PAP");
224 if (!isPreparedToSave()) {
227 // Until here we prepared the data and here calling the method to create
229 Path newPolicyPath = null;
230 newPolicyPath = Paths.get(policyAdapter.getParentPath().toString(),
233 Boolean dbIsUpdated = true;
235 successMap = new HashMap<String, String>();
237 successMap = createPolicy(newPolicyPath,
238 getCorrectPolicyDataObject());
240 //TODO:EELF Cleanup - Remove logger
241 //logger.error("Failed to Update the Database Dictionary Tables.");
242 PolicyLogger.error("Failed to Update the Database Dictionary Tables.");
244 // remove the new json file
245 String jsonBody = policyAdapter.getPrevJsonBody();
246 saveConfigurations(policyName, "", jsonBody);
247 successMap.put("error", "DB UPDATE");
250 if (successMap.containsKey("success")) {
251 Path finalPolicyPath = getFinalPolicyPath();
252 policyAdapter.setFinalPolicyPath(finalPolicyPath.toString());
257 // This is the method for preparing the policy for saving. We have broken it
259 // separately because the fully configured policy is used for multiple
262 public boolean prepareToSave() throws Exception {
264 if (isPreparedToSave()) {
265 // we have already done this
270 String policyID = policyAdapter.getPolicyID();
272 if (policyAdapter.isEditPolicy()) {
273 // version = Integer.parseInt(policyAdapter.getVersion()) + 1;
274 version = policyAdapter.getHighestVersion() + 1;
279 // Create the Instance for pojo, PolicyType object is used in
281 if (policyAdapter.getPolicyType().equals("Config")) {
282 PolicyType policyConfig = new PolicyType();
284 policyConfig.setVersion(Integer.toString(version));
285 policyConfig.setPolicyId(policyID);
286 policyConfig.setTarget(new TargetType());
287 policyAdapter.setData(policyConfig);
290 if (policyAdapter.getData() != null) {
292 // Save off everything
293 // making ready all the required elements to generate the action
295 // Get the uniqueness for policy name.
296 String prevPolicyName = null;
297 if (policyAdapter.isEditPolicy()) {
298 prevPolicyName = "Config_BRMS_Raw_" + policyAdapter.getPolicyName()
299 + "." + policyAdapter.getHighestVersion() + ".xml";
301 //if (!policyAdapter.isEditPolicy()) {
302 Path newFile = getNextFilename(
303 Paths.get(policyAdapter.getParentPath().toString()),
304 (policyAdapter.getPolicyType() + "_BRMS_Raw"),
305 policyAdapter.getPolicyName(), version);
307 if (newFile == null) {
308 //TODO:EELF Cleanup - Remove logger
309 //logger.error("File already exists, cannot create the policy.");
310 PolicyLogger.error("File already exists, cannot create the policy.");
311 setPolicyExists(true);
314 policyName = newFile.getFileName().toString();
317 //String jsonBody = policyAdapter.getJsonBody();
318 String configBody=policyAdapter.getConfigBodyData();
319 saveConfigurations(policyName, prevPolicyName, configBody);
321 // Make sure the filename ends with an extension
322 if (policyName.endsWith(".xml") == false) {
323 policyName = policyName + ".xml";
326 PolicyType configPolicy = (PolicyType) policyAdapter.getData();
328 configPolicy.setDescription(policyAdapter.getPolicyDescription());
330 configPolicy.setRuleCombiningAlgId(policyAdapter
331 .getRuleCombiningAlgId());
333 AllOfType allOfOne = new AllOfType();
334 File policyFilePath = new File(policyAdapter.getParentPath()
335 .toString(), policyName);
336 String policyDir = policyFilePath.getParentFile().getName();
337 String fileName = FilenameUtils.removeExtension(policyName);
338 fileName = policyDir + "." + fileName + ".xml";
339 String name = fileName.substring(fileName.lastIndexOf("\\") + 1,
341 if ((name == null) || (name.equals(""))) {
342 name = fileName.substring(fileName.lastIndexOf("/") + 1,
345 allOfOne.getMatch().add(createMatch("PolicyName", name));
348 AllOfType allOf = new AllOfType();
350 // Match for ECOMPName
351 allOf.getMatch().add(
352 createMatch("ECOMPName", policyAdapter.getEcompName()));
353 allOf.getMatch().add(
354 createMatch("ConfigName", policyAdapter.getConfigName()));
355 // Match for riskType
356 allOf.getMatch().add(
357 createDynamicMatch("RiskType", policyAdapter.getRiskType()));
358 // Match for riskLevel
359 allOf.getMatch().add(
360 createDynamicMatch("RiskLevel", String.valueOf(policyAdapter.getRiskLevel())));
361 // Match for riskguard
362 allOf.getMatch().add(
363 createDynamicMatch("guard", policyAdapter.getGuard()));
365 allOf.getMatch().add(
366 createDynamicMatch("TTLDate", policyAdapter.getTtlDate()));
367 AnyOfType anyOf = new AnyOfType();
368 anyOf.getAllOf().add(allOfOne);
369 anyOf.getAllOf().add(allOf);
371 TargetType target = new TargetType();
372 ((TargetType) target).getAnyOf().add(anyOf);
374 // Adding the target to the policy element
375 configPolicy.setTarget((TargetType) target);
377 RuleType rule = new RuleType();
378 rule.setRuleId(policyAdapter.getRuleID());
380 rule.setEffect(EffectType.PERMIT);
382 // Create Target in Rule
383 AllOfType allOfInRule = new AllOfType();
385 // Creating match for ACCESS in rule target
386 MatchType accessMatch = new MatchType();
387 AttributeValueType accessAttributeValue = new AttributeValueType();
388 accessAttributeValue.setDataType(STRING_DATATYPE);
389 accessAttributeValue.getContent().add("ACCESS");
390 accessMatch.setAttributeValue(accessAttributeValue);
391 AttributeDesignatorType accessAttributeDesignator = new AttributeDesignatorType();
392 URI accessURI = null;
394 accessURI = new URI(ACTION_ID);
395 } catch (URISyntaxException e) {
396 //TODO:EELF Cleanup - Remove logger
397 //logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE
398 //+ e.getStackTrace());
399 PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, "CreateBrmsRawPolicy", "Exception creating ACCESS URI");
401 accessAttributeDesignator.setCategory(CATEGORY_ACTION);
402 accessAttributeDesignator.setDataType(STRING_DATATYPE);
403 accessAttributeDesignator.setAttributeId(new IdentifierImpl(
404 accessURI).stringValue());
405 accessMatch.setAttributeDesignator(accessAttributeDesignator);
406 accessMatch.setMatchId(FUNCTION_STRING_EQUAL_IGNORE);
408 // Creating Config Match in rule Target
409 MatchType configMatch = new MatchType();
410 AttributeValueType configAttributeValue = new AttributeValueType();
411 configAttributeValue.setDataType(STRING_DATATYPE);
413 configAttributeValue.getContent().add("Config");
415 configMatch.setAttributeValue(configAttributeValue);
416 AttributeDesignatorType configAttributeDesignator = new AttributeDesignatorType();
417 URI configURI = null;
419 configURI = new URI(RESOURCE_ID);
420 } catch (URISyntaxException e) {
421 //TODO:EELF Cleanup - Remove logger
422 //logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE
423 //+ e.getStackTrace());
424 PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, "CreateBrmsRawPolicy", "Exception creating Config URI");
427 configAttributeDesignator.setCategory(CATEGORY_RESOURCE);
428 configAttributeDesignator.setDataType(STRING_DATATYPE);
429 configAttributeDesignator.setAttributeId(new IdentifierImpl(
430 configURI).stringValue());
431 configMatch.setAttributeDesignator(configAttributeDesignator);
432 configMatch.setMatchId(FUNCTION_STRING_EQUAL_IGNORE);
434 allOfInRule.getMatch().add(accessMatch);
435 allOfInRule.getMatch().add(configMatch);
437 AnyOfType anyOfInRule = new AnyOfType();
438 anyOfInRule.getAllOf().add(allOfInRule);
440 TargetType targetInRule = new TargetType();
441 targetInRule.getAnyOf().add(anyOfInRule);
443 rule.setTarget(targetInRule);
444 rule.setAdviceExpressions(getAdviceExpressions(version, policyName));
447 .getCombinerParametersOrRuleCombinerParametersOrVariableDefinition()
449 policyAdapter.setPolicyData(configPolicy);
452 //TODO:EELF Cleanup - Remove logger
453 //logger.error("Unsupported data object."
454 //+ policyAdapter.getData().getClass().getCanonicalName());
455 PolicyLogger.error("Unsupported data object."
456 + policyAdapter.getData().getClass().getCanonicalName());
458 setPreparedToSave(true);
462 // Data required for Advice part is setting here.
463 private AdviceExpressionsType getAdviceExpressions(int version,
466 // Policy Config ID Assignment
467 AdviceExpressionsType advices = new AdviceExpressionsType();
468 AdviceExpressionType advice = new AdviceExpressionType();
469 advice.setAdviceId("BRMSRAWID");
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()
480 .createAttributeValue(configNameAttributeValue));
481 advice.getAttributeAssignmentExpression().add(assignment1);
483 // For Config file Url if configurations are provided.
485 final Path gitPath = Paths.get(policyAdapter.getUserGitPath()
487 AttributeAssignmentExpressionType assignment2 = new AttributeAssignmentExpressionType();
488 assignment2.setAttributeId("URLID");
489 assignment2.setCategory(CATEGORY_RESOURCE);
490 assignment2.setIssuer("");
491 AttributeValueType AttributeValue = new AttributeValueType();
492 AttributeValue.setDataType(URI_DATATYPE);
493 String policyDir1 = policyAdapter.getParentPath().toString();
494 int startIndex1 = policyDir1.indexOf(gitPath.toString())
495 + gitPath.toString().length() + 1;
496 policyDir1 = policyDir1.substring(startIndex1, policyDir1.length());
497 logger.info("print the main domain value" + policyDir1);
498 String path = policyDir1.replace('\\', '.');
499 if (path.contains("/")) {
500 path = policyDir1.replace('/', '.');
501 logger.info("print the path:" + path);
503 String content = CONFIG_URL + "/Config/" + path + "."
504 + getConfigFile(policyName);
506 AttributeValue.getContent().add(content);
507 assignment2.setExpression(new ObjectFactory()
508 .createAttributeValue(AttributeValue));
509 advice.getAttributeAssignmentExpression().add(assignment2);
511 // Policy Name Assignment
512 AttributeAssignmentExpressionType assignment3 = new AttributeAssignmentExpressionType();
513 assignment3.setAttributeId("PolicyName");
514 assignment3.setCategory(CATEGORY_RESOURCE);
515 assignment3.setIssuer("");
516 AttributeValueType attributeValue3 = new AttributeValueType();
517 attributeValue3.setDataType(STRING_DATATYPE);
518 String policyDir = policyAdapter.getParentPath().toString();
519 int startIndex = policyDir.indexOf(gitPath.toString())
520 + gitPath.toString().length() + 1;
521 policyDir = policyDir.substring(startIndex, policyDir.length());
522 StringTokenizer tokenizer = null;
523 StringBuffer buffer = new StringBuffer();
524 if (policyDir.contains("\\")) {
525 tokenizer = new StringTokenizer(policyDir, "\\");
527 tokenizer = new StringTokenizer(policyDir, "/");
529 if (tokenizer != null) {
530 while (tokenizer.hasMoreElements()) {
531 String value = tokenizer.nextToken();
532 buffer.append(value);
536 fileName = FilenameUtils.removeExtension(fileName);
537 fileName = buffer.toString() + fileName + ".xml";
538 System.out.println(fileName);
539 String name = fileName.substring(fileName.lastIndexOf("\\") + 1,
541 if ((name == null) || (name.equals(""))) {
542 name = fileName.substring(fileName.lastIndexOf("/") + 1,
545 System.out.println(name);
546 attributeValue3.getContent().add(name);
547 assignment3.setExpression(new ObjectFactory()
548 .createAttributeValue(attributeValue3));
549 advice.getAttributeAssignmentExpression().add(assignment3);
551 // Version Number Assignment
552 AttributeAssignmentExpressionType assignment4 = new AttributeAssignmentExpressionType();
553 assignment4.setAttributeId("VersionNumber");
554 assignment4.setCategory(CATEGORY_RESOURCE);
555 assignment4.setIssuer("");
556 AttributeValueType configNameAttributeValue4 = new AttributeValueType();
557 configNameAttributeValue4.setDataType(STRING_DATATYPE);
558 configNameAttributeValue4.getContent().add(Integer.toString(version));
559 assignment4.setExpression(new ObjectFactory()
560 .createAttributeValue(configNameAttributeValue4));
561 advice.getAttributeAssignmentExpression().add(assignment4);
563 // Ecomp Name Assignment
564 AttributeAssignmentExpressionType assignment5 = new AttributeAssignmentExpressionType();
565 assignment5.setAttributeId("matching:" + this.ECOMPID);
566 assignment5.setCategory(CATEGORY_RESOURCE);
567 assignment5.setIssuer("");
568 AttributeValueType configNameAttributeValue5 = new AttributeValueType();
569 configNameAttributeValue5.setDataType(STRING_DATATYPE);
570 configNameAttributeValue5.getContent().add(policyAdapter.getEcompName());
571 assignment5.setExpression(new ObjectFactory()
572 .createAttributeValue(configNameAttributeValue5));
573 advice.getAttributeAssignmentExpression().add(assignment5);
576 //Config Name Assignment
577 AttributeAssignmentExpressionType assignment6 = new AttributeAssignmentExpressionType();
578 assignment6.setAttributeId("matching:" + this.CONFIGID);
579 assignment6.setCategory(CATEGORY_RESOURCE);
580 assignment6.setIssuer("");
581 AttributeValueType configNameAttributeValue6 = new AttributeValueType();
582 configNameAttributeValue6.setDataType(STRING_DATATYPE);
583 configNameAttributeValue6.getContent().add(policyAdapter.getConfigName());
584 assignment6.setExpression(new ObjectFactory().createAttributeValue(configNameAttributeValue6));
585 advice.getAttributeAssignmentExpression().add(assignment6);
587 Map<String, String> dynamicFieldConfigAttributes = policyAdapter.getDynamicFieldConfigAttributes();
588 for (String keyField : dynamicFieldConfigAttributes.keySet()) {
589 String key = keyField;
590 String value = dynamicFieldConfigAttributes.get(key);
591 AttributeAssignmentExpressionType assignment7 = new AttributeAssignmentExpressionType();
592 assignment7.setAttributeId("key:" + key);
593 assignment7.setCategory(CATEGORY_RESOURCE);
594 assignment7.setIssuer("");
596 AttributeValueType configNameAttributeValue7 = new AttributeValueType();
597 configNameAttributeValue7.setDataType(STRING_DATATYPE);
598 configNameAttributeValue7.getContent().add(value);
599 assignment7.setExpression(new ObjectFactory().createAttributeValue(configNameAttributeValue7));
601 advice.getAttributeAssignmentExpression().add(assignment7);
605 AttributeAssignmentExpressionType assignment8 = new AttributeAssignmentExpressionType();
606 assignment8.setAttributeId("RiskType");
607 assignment8.setCategory(CATEGORY_RESOURCE);
608 assignment8.setIssuer("");
610 AttributeValueType configNameAttributeValue8 = new AttributeValueType();
611 configNameAttributeValue8.setDataType(STRING_DATATYPE);
612 configNameAttributeValue8.getContent().add(policyAdapter.getRiskType());
613 assignment8.setExpression(new ObjectFactory().createAttributeValue(configNameAttributeValue8));
615 advice.getAttributeAssignmentExpression().add(assignment8);
617 AttributeAssignmentExpressionType assignment9 = new AttributeAssignmentExpressionType();
618 assignment9.setAttributeId("RiskLevel");
619 assignment9.setCategory(CATEGORY_RESOURCE);
620 assignment9.setIssuer("");
622 AttributeValueType configNameAttributeValue9 = new AttributeValueType();
623 configNameAttributeValue9.setDataType(STRING_DATATYPE);
624 configNameAttributeValue9.getContent().add(policyAdapter.getRiskLevel());
625 assignment9.setExpression(new ObjectFactory().createAttributeValue(configNameAttributeValue9));
627 advice.getAttributeAssignmentExpression().add(assignment9);
629 AttributeAssignmentExpressionType assignment10 = new AttributeAssignmentExpressionType();
630 assignment10.setAttributeId("guard");
631 assignment10.setCategory(CATEGORY_RESOURCE);
632 assignment10.setIssuer("");
634 AttributeValueType configNameAttributeValue10 = new AttributeValueType();
635 configNameAttributeValue10.setDataType(STRING_DATATYPE);
636 configNameAttributeValue10.getContent().add(policyAdapter.getGuard());
637 assignment10.setExpression(new ObjectFactory().createAttributeValue(configNameAttributeValue10));
639 advice.getAttributeAssignmentExpression().add(assignment10);
641 AttributeAssignmentExpressionType assignment11 = new AttributeAssignmentExpressionType();
642 assignment11.setAttributeId("TTLDate");
643 assignment11.setCategory(CATEGORY_RESOURCE);
644 assignment11.setIssuer("");
646 AttributeValueType configNameAttributeValue11 = new AttributeValueType();
647 configNameAttributeValue11.setDataType(STRING_DATATYPE);
648 configNameAttributeValue11.getContent().add(policyAdapter.getTtlDate());
649 assignment11.setExpression(new ObjectFactory().createAttributeValue(configNameAttributeValue11));
651 advice.getAttributeAssignmentExpression().add(assignment11);
653 advices.getAdviceExpression().add(advice);
658 public Object getCorrectPolicyDataObject() {
659 return policyAdapter.getData();