diff options
author | pramod.jamkhedkar <pramod@research.att.com> | 2020-05-18 11:27:50 -0400 |
---|---|---|
committer | pramod.jamkhedkar <pramod@research.att.com> | 2020-05-19 10:34:32 -0400 |
commit | cac1b44880610e19ae831d3f3656b8b835389db0 (patch) | |
tree | a0b9b0d017031ddfede913f07e148c1fcf461f01 /applications/guard/src/main/java | |
parent | 50c786ff425de405252cccddea7ff776942ef671 (diff) |
Change CLC granularity to CL level.
Change CLC granularity from target level to CL level. Remove the target
matching for the db query at PIP level.
Issue-ID: POLICY-2573
Change-Id: If9ba1a4d22c3b8bc5dfce0632f7037ad085f6ea6
Signed-off-by: pramod.jamkhedkar <pramod@research.att.com>
Diffstat (limited to 'applications/guard/src/main/java')
-rw-r--r-- | applications/guard/src/main/java/org/onap/policy/xacml/pdp/application/guard/CoordinationGuardTranslator.java | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/applications/guard/src/main/java/org/onap/policy/xacml/pdp/application/guard/CoordinationGuardTranslator.java b/applications/guard/src/main/java/org/onap/policy/xacml/pdp/application/guard/CoordinationGuardTranslator.java index 2c7ad587..b20c8cce 100644 --- a/applications/guard/src/main/java/org/onap/policy/xacml/pdp/application/guard/CoordinationGuardTranslator.java +++ b/applications/guard/src/main/java/org/onap/policy/xacml/pdp/application/guard/CoordinationGuardTranslator.java @@ -42,6 +42,7 @@ import java.util.stream.Stream; import org.apache.commons.io.IOUtils; import org.onap.policy.common.utils.coder.CoderException; import org.onap.policy.common.utils.coder.StandardYamlCoder; +import org.onap.policy.common.utils.resources.ResourceUtils; import org.onap.policy.models.decisions.concepts.DecisionRequest; import org.onap.policy.models.decisions.concepts.DecisionResponse; import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy; @@ -157,15 +158,16 @@ public class CoordinationGuardTranslator implements ToscaPolicyTranslator { /* * Replace function placeholders with appropriate values */ - try (Stream<String> stream = Files.lines(Paths.get(xacmlProtoFilename))) { - return stream.map(s -> s.replace("UNIQUE_ID", uniqueId)) - .map(s -> s.replace("CONTROL_LOOP_ONE", cLOne)) - .map(s -> s.replace("CONTROL_LOOP_TWO", cLTwo)) - .collect(Collectors.joining(XacmlPolicyUtils.LINE_SEPARATOR)); - } catch (IOException e) { - throw new ToscaPolicyConversionException( - "Error while generating XACML policy for coordination directive", e); + String policyXml = ResourceUtils.getResourceAsString(xacmlProtoFilename); + if (policyXml == null) { + throw new ToscaPolicyConversionException("Error while generating XACML policy for coordination directive"); } + policyXml = policyXml.replace("UNIQUE_ID", uniqueId); + policyXml = policyXml.replace("CONTROL_LOOP_ONE", cLOne); + policyXml = policyXml.replace("CONTROL_LOOP_TWO", cLTwo); + + return policyXml; + } } |