From 8a43a894dbf9d3f3f1d19277ac295fd7026f4925 Mon Sep 17 00:00:00 2001 From: ramverma Date: Tue, 23 Jul 2019 11:03:52 +0000 Subject: Update PolicyDecoderCsarPdpx to match policy/api Lifecycle API's for creating policies & policy types in policy/api expects ToscaServiceTemplate as input instead of ToscaPolicy or ToscaPolicyType. Hence, changing the return type of decoder to generate & return ToscaServiceTemplate instead of ToscaPolicy. Change-Id: I4fb92738e15ee7e2868741f7ca50cf09429d8cde Issue-ID: POLICY-1888 Signed-off-by: ramverma --- .../reception/decoding/pdpx/PolicyDecoderCsarPdpx.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'plugins/reception-plugins/src/main/java') diff --git a/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/decoding/pdpx/PolicyDecoderCsarPdpx.java b/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/decoding/pdpx/PolicyDecoderCsarPdpx.java index 165d105a..8bbdaffe 100644 --- a/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/decoding/pdpx/PolicyDecoderCsarPdpx.java +++ b/plugins/reception-plugins/src/main/java/org/onap/policy/distribution/reception/decoding/pdpx/PolicyDecoderCsarPdpx.java @@ -34,7 +34,7 @@ import org.onap.policy.distribution.model.Csar; import org.onap.policy.distribution.model.PolicyInput; import org.onap.policy.distribution.reception.decoding.PolicyDecoder; import org.onap.policy.distribution.reception.decoding.PolicyDecodingException; -import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy; +import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate; import org.onap.sdc.tosca.parser.api.ISdcCsarHelper; import org.onap.sdc.tosca.parser.impl.SdcToscaParserFactory; import org.onap.sdc.toscaparser.api.NodeTemplate; @@ -44,15 +44,15 @@ import org.slf4j.LoggerFactory; /** * Decodes PDP-X policies from a CSAR file. */ -public class PolicyDecoderCsarPdpx implements PolicyDecoder { +public class PolicyDecoderCsarPdpx implements PolicyDecoder { private static final Logger LOGGER = LoggerFactory.getLogger(PolicyDecoderCsarPdpx.class); private final Gson gson = new GsonBuilder().serializeNulls().disableHtmlEscaping().create(); private PolicyDecoderCsarPdpxConfigurationParameterGroup decoderParameters; @Override - public Collection decode(final Csar csar) throws PolicyDecodingException { - final List policies = new ArrayList<>(); + public Collection decode(final Csar csar) throws PolicyDecodingException { + final List policies = new ArrayList<>(); final ISdcCsarHelper sdcCsarHelper = parseCsar(csar); final List lnodeVf = sdcCsarHelper.getServiceVfList(); LOGGER.debug("the size of Vf = {}", lnodeVf.size()); @@ -63,7 +63,7 @@ public class PolicyDecoderCsarPdpx implements PolicyDecoder { for (final NodeTemplate node : lnodeVf) { final Content content = extractFromNode.extractInfo(node); if (content != null) { - final ToscaPolicy policy = new ToscaPolicy(); + final ToscaServiceTemplate policy = new ToscaServiceTemplate(); final String policyName = decoderParameters.getPolicyNamePrefix() + "." + content.getIdentity(); // policy.setOnapName(decoderParameters.getOnapName()); policy.setName(policyName); -- cgit 1.2.3-korg