From b87e0242ce1a957740ee988bec3b82e3628adbed Mon Sep 17 00:00:00 2001 From: liamfallon Date: Thu, 17 Dec 2020 12:10:21 +0000 Subject: Add Service Template TOSCA handling Today we can only handle a single service template in the database. We should be able to handle multiple service templates and assign arbitrary policy types and policies to maned and versioned service templates. This review brings in the Java API in models provider for handling service templates in this way and uses a simplistic single-teplate implementation in models-tosca, that will work but still only handles a single service template under the hood. Issue-ID: POLICY-2900 Change-Id: Ia02dea8abe44b7f407e685090a4b8e0360889653 Signed-off-by: liamfallon --- .../tosca/authorative/concepts/ToscaEntity.java | 16 ++- .../concepts/ToscaServiceTemplateComparator.java | 34 +++++ .../concepts/ToscaServiceTemplateFilter.java | 63 ++++++++ .../concepts/ToscaServiceTemplates.java | 40 ++++++ .../provider/AuthorativeToscaProvider.java | 159 ++++++++++++++------- 5 files changed, 256 insertions(+), 56 deletions(-) create mode 100644 models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaServiceTemplateComparator.java create mode 100644 models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaServiceTemplateFilter.java create mode 100644 models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaServiceTemplates.java (limited to 'models-tosca/src/main') diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaEntity.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaEntity.java index 10d3b7a14..5c1167c7d 100644 --- a/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaEntity.java +++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaEntity.java @@ -32,6 +32,7 @@ import javax.ws.rs.core.Response; import lombok.Data; import lombok.NoArgsConstructor; import lombok.NonNull; +import org.onap.policy.models.base.PfKey; import org.onap.policy.models.base.PfModelRuntimeException; import org.onap.policy.models.base.PfNameVersion; @@ -43,8 +44,8 @@ import org.onap.policy.models.base.PfNameVersion; @Data @NoArgsConstructor public class ToscaEntity implements PfNameVersion { - private String name; - private String version; + private String name = PfKey.NULL_KEY_NAME; + private String version = PfKey.NULL_KEY_VERSION; @ApiModelProperty(name = "derived_from") @SerializedName("derived_from") @@ -81,6 +82,16 @@ public class ToscaEntity implements PfNameVersion { return new ToscaEntityKey(name, version); } + @Override + public String getDefinedName() { + return (PfKey.NULL_KEY_NAME.equals(name) ? null : name); + } + + @Override + public String getDefinedVersion() { + return (PfKey.NULL_KEY_VERSION.equals(version) ? null : version); + } + /** * Convert a list of maps of TOSCA entities into a regular map. * @@ -129,5 +140,4 @@ public class ToscaEntity implements PfNameVersion { return entityMap; } - } diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaServiceTemplateComparator.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaServiceTemplateComparator.java new file mode 100644 index 000000000..015c10bdd --- /dev/null +++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaServiceTemplateComparator.java @@ -0,0 +1,34 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2020 Nordix Foundation. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.models.tosca.authorative.concepts; + +import java.util.Comparator; + +/** + * Compare two ToscaServiceTemplate objects. + */ +public class ToscaServiceTemplateComparator implements Comparator { + + @Override + public int compare(final ToscaServiceTemplate left, final ToscaServiceTemplate right) { + return left.compareNameVersion(left, right); + } +} diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaServiceTemplateFilter.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaServiceTemplateFilter.java new file mode 100644 index 000000000..75b13969d --- /dev/null +++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaServiceTemplateFilter.java @@ -0,0 +1,63 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2020 Nordix Foundation. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.models.tosca.authorative.concepts; + +import java.util.List; +import java.util.stream.Collectors; +import lombok.Builder; +import lombok.Data; +import lombok.NonNull; +import org.onap.policy.models.base.PfObjectFilter; + +/** + * Filter class for searches for {@link ToscaServiceTemplate} instances. If any fields are null, they are ignored. + * + * @author Liam Fallon (liam.fallon@est.tech) + */ +@Builder +@Data +public class ToscaServiceTemplateFilter implements PfObjectFilter { + public static final String LATEST_VERSION = "LATEST"; + + // Regular expression + private String name; + + // Regular Expression, set to LATEST_VERRSION to get the latest version + private String version; + + @Override + public List filter(@NonNull final List originalList) { + + // @formatter:off + List returnList = originalList.stream() + .filter(p -> filterString(p.getName(), name)) + .filter(p -> LATEST_VERSION.equals(version) + || filterString(p.getVersion(), version)) + .collect(Collectors.toList()); + // @formatter:off + + if (LATEST_VERSION.equals(version)) { + return this.latestVersionFilter(returnList, new ToscaServiceTemplateComparator()); + } else { + return returnList; + } + } +} diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaServiceTemplates.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaServiceTemplates.java new file mode 100644 index 000000000..912cfd580 --- /dev/null +++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaServiceTemplates.java @@ -0,0 +1,40 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP Policy Model + * ================================================================================ + * Copyright (C) 2020 Nordix Foundation. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.models.tosca.authorative.concepts; + +import com.google.gson.annotations.SerializedName; +import io.swagger.annotations.ApiModelProperty; +import java.util.List; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * Class to represent a map of TOSCA service templates. + */ +@Data +@EqualsAndHashCode +public class ToscaServiceTemplates { + @ApiModelProperty(name = "service_templates") + @SerializedName("service_templates") + private List serviceTemplates; +} diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/provider/AuthorativeToscaProvider.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/provider/AuthorativeToscaProvider.java index e8f99f742..d20f5d080 100644 --- a/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/provider/AuthorativeToscaProvider.java +++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/provider/AuthorativeToscaProvider.java @@ -39,6 +39,7 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyFilter; import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyType; import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyTypeFilter; import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate; +import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplateFilter; import org.onap.policy.models.tosca.simple.concepts.JpaToscaServiceTemplate; import org.onap.policy.models.tosca.simple.provider.SimpleToscaProvider; import org.onap.policy.models.tosca.utils.ToscaServiceTemplateUtils; @@ -57,28 +58,58 @@ public class AuthorativeToscaProvider { private static final Object providerLockObject = "providerLockObject"; /** - * Get a service template. + * Get service templates. * * @param dao the DAO to use to access the database - * @param name the name of the control loop to get. - * @param version the version of the control loop to get. - * @return the control loops found - * @throws PfModelException on errors getting control loops + * @param name the name of the service template to get. + * @param version the version of the service template to get. + * @return the service templates found + * @throws PfModelException on errors getting service templates */ - public ToscaServiceTemplate getServiceTemplate(@NonNull final PfDao dao, final String name, final String version) - throws PfModelException { + public List getServiceTemplateList(PfDao dao, String name, String version) + throws PfModelException { synchronized (providerLockObject) { - LOGGER.debug("->getServiceTemplate: name={}, version={}", name, version); + LOGGER.debug("->getServiceTemplateList: name={}, version={}", name, version); - ToscaServiceTemplate gotServiceTemplate = new SimpleToscaProvider().getServiceTemplate(dao).toAuthorative(); + List serviceTemplateList = new ArrayList<>(); - LOGGER.debug("<-getServiceTemplate: name={}, version={}, gotServiceTemplate={}", name, version, - gotServiceTemplate); - return gotServiceTemplate; + try { + ToscaServiceTemplate serviceTemplate = + new SimpleToscaProvider().getServiceTemplate(dao).toAuthorative(); + serviceTemplateList.add(serviceTemplate); + } catch (PfModelRuntimeException pfme) { + return handlePfModelRuntimeException(pfme); + } + + LOGGER.debug("<-getServiceTemplateList: name={}, version={}, serviceTemplateList={}", name, version, + serviceTemplateList); + return serviceTemplateList; } } + /** + * Get filtered service templates. + * + * @param pfDao the DAO to use to access the database + * @param filter the filter for the service templates to get + * @return the service templates found + * @throws PfModelException on errors getting service templates + */ + public List getFilteredServiceTemplateList(PfDao pfDao, + @NonNull ToscaServiceTemplateFilter filter) throws PfModelException { + + LOGGER.debug("->getFilteredServiceTemplateList: filter={}", filter); + + List filteredServiceTemplateList = + filter.filter(getServiceTemplateList(pfDao, null, null)); + + LOGGER.debug("<-getFilteredServiceTemplateList: filter={}, filteredServiceTemplateList={}", filter, + filteredServiceTemplateList); + + return filteredServiceTemplateList; + } + /** * Create a service template. * @@ -88,19 +119,41 @@ public class AuthorativeToscaProvider { * @throws PfModelException on errors creating the service template */ public ToscaServiceTemplate createServiceTemplate(@NonNull final PfDao dao, - @NonNull final ToscaServiceTemplate serviceTemplate) throws PfModelException { + @NonNull final ToscaServiceTemplate serviceTemplate) throws PfModelException { synchronized (providerLockObject) { LOGGER.debug("->createServiceTemplate: serviceTemplate={}", serviceTemplate); ToscaServiceTemplate createdServiceTemplate = new SimpleToscaProvider() - .appendToServiceTemplate(dao, new JpaToscaServiceTemplate(serviceTemplate)).toAuthorative(); + .appendToServiceTemplate(dao, new JpaToscaServiceTemplate(serviceTemplate)).toAuthorative(); LOGGER.debug("<-createServiceTemplate: createdServiceTemplate={}", createdServiceTemplate); return createdServiceTemplate; } } + /** + * Update a service template. + * + * @param dao the DAO to use to access the database + * @param serviceTemplate the service template to be updated. + * @return the TOSCA service template that was updated + * @throws PfModelException on errors updating the service template + */ + public ToscaServiceTemplate updateServiceTemplate(@NonNull final PfDao dao, + @NonNull final ToscaServiceTemplate serviceTemplate) throws PfModelException { + + synchronized (providerLockObject) { + LOGGER.debug("->updateServiceTemplate: serviceTemplate={}", serviceTemplate); + + ToscaServiceTemplate updatedServiceTemplate = new SimpleToscaProvider() + .appendToServiceTemplate(dao, new JpaToscaServiceTemplate(serviceTemplate)).toAuthorative(); + + LOGGER.debug("<-updateServiceTemplate: updatedServiceTemplate={}", updatedServiceTemplate); + return updatedServiceTemplate; + } + } + /** * Delete a service template. * @@ -111,16 +164,16 @@ public class AuthorativeToscaProvider { * @throws PfModelException on errors deleting the control loop */ public ToscaServiceTemplate deleteServiceTemplate(@NonNull final PfDao dao, @NonNull final String name, - @NonNull final String version) throws PfModelException { + @NonNull final String version) throws PfModelException { synchronized (providerLockObject) { LOGGER.debug("->deleteServiceTemplate: name={}, version={}", name, version); ToscaServiceTemplate deletedServiceTemplate = - new SimpleToscaProvider().deleteServiceTemplate(dao).toAuthorative(); + new SimpleToscaProvider().deleteServiceTemplate(dao).toAuthorative(); LOGGER.debug("<-deleteServiceTemplate: name={}, version={}, deletedServiceTemplate={}", name, version, - deletedServiceTemplate); + deletedServiceTemplate); return deletedServiceTemplate; } } @@ -135,7 +188,7 @@ public class AuthorativeToscaProvider { * @throws PfModelException on errors getting policy types */ public ToscaServiceTemplate getPolicyTypes(@NonNull final PfDao dao, final String name, final String version) - throws PfModelException { + throws PfModelException { synchronized (providerLockObject) { LOGGER.debug("->getPolicyTypes: name={}, version={}", name, version); @@ -159,7 +212,7 @@ public class AuthorativeToscaProvider { * @throws PfModelException on errors getting policy types */ public List getPolicyTypeList(@NonNull final PfDao dao, final String name, final String version) - throws PfModelException { + throws PfModelException { synchronized (providerLockObject) { LOGGER.debug("->getPolicyTypeList: name={}, version={}", name, version); @@ -168,7 +221,7 @@ public class AuthorativeToscaProvider { try { policyTypeList = new ArrayList<>(new SimpleToscaProvider().getPolicyTypes(dao, name, version) - .toAuthorative().getPolicyTypes().values()); + .toAuthorative().getPolicyTypes().values()); } catch (PfModelRuntimeException pfme) { return handlePfModelRuntimeException(pfme); } @@ -187,7 +240,7 @@ public class AuthorativeToscaProvider { * @throws PfModelException on errors getting policy types */ public ToscaServiceTemplate getFilteredPolicyTypes(@NonNull final PfDao dao, - @NonNull final ToscaPolicyTypeFilter filter) throws PfModelException { + @NonNull final ToscaPolicyTypeFilter filter) throws PfModelException { synchronized (providerLockObject) { LOGGER.debug("->getFilteredPolicyTypes: filter={}", filter); @@ -200,17 +253,17 @@ public class AuthorativeToscaProvider { if (CollectionUtils.isEmpty(filteredPolicyTypes)) { throw new PfModelRuntimeException(Response.Status.NOT_FOUND, - "policy types for filter " + filter.toString() + " do not exist"); + "policy types for filter " + filter.toString() + " do not exist"); } JpaToscaServiceTemplate filteredServiceTemplate = new JpaToscaServiceTemplate(); for (ToscaPolicyType policyType : filteredPolicyTypes) { JpaToscaServiceTemplate cascadedServiceTemplate = simpleToscaProvider - .getCascadedPolicyTypes(dbServiceTemplate, policyType.getName(), policyType.getVersion()); + .getCascadedPolicyTypes(dbServiceTemplate, policyType.getName(), policyType.getVersion()); filteredServiceTemplate = - ToscaServiceTemplateUtils.addFragment(filteredServiceTemplate, cascadedServiceTemplate); + ToscaServiceTemplateUtils.addFragment(filteredServiceTemplate, cascadedServiceTemplate); } ToscaServiceTemplate returnServiceTemplate = filteredServiceTemplate.toAuthorative(); @@ -229,14 +282,14 @@ public class AuthorativeToscaProvider { * @throws PfModelException on errors getting policy types */ public List getFilteredPolicyTypeList(@NonNull final PfDao dao, - @NonNull final ToscaPolicyTypeFilter filter) throws PfModelException { + @NonNull final ToscaPolicyTypeFilter filter) throws PfModelException { LOGGER.debug("->getFilteredPolicyTypeList: filter={}", filter); List filteredPolicyTypeList = filter.filter(getPolicyTypeList(dao, null, null)); LOGGER.debug("<-getFilteredPolicyTypeList: filter={}, filteredPolicyTypeList={}", filter, - filteredPolicyTypeList); + filteredPolicyTypeList); return filteredPolicyTypeList; } @@ -250,13 +303,13 @@ public class AuthorativeToscaProvider { * @throws PfModelException on errors creating policy types */ public ToscaServiceTemplate createPolicyTypes(@NonNull final PfDao dao, - @NonNull final ToscaServiceTemplate serviceTemplate) throws PfModelException { + @NonNull final ToscaServiceTemplate serviceTemplate) throws PfModelException { synchronized (providerLockObject) { LOGGER.debug("->createPolicyTypes: serviceTemplate={}", serviceTemplate); ToscaServiceTemplate createdServiceTemplate = new SimpleToscaProvider() - .createPolicyTypes(dao, new JpaToscaServiceTemplate(serviceTemplate)).toAuthorative(); + .createPolicyTypes(dao, new JpaToscaServiceTemplate(serviceTemplate)).toAuthorative(); LOGGER.debug("<-createPolicyTypes: createdServiceTemplate={}", createdServiceTemplate); return createdServiceTemplate; @@ -272,13 +325,13 @@ public class AuthorativeToscaProvider { * @throws PfModelException on errors updating policy types */ public ToscaServiceTemplate updatePolicyTypes(@NonNull final PfDao dao, - @NonNull final ToscaServiceTemplate serviceTemplate) throws PfModelException { + @NonNull final ToscaServiceTemplate serviceTemplate) throws PfModelException { synchronized (providerLockObject) { LOGGER.debug("->updatePolicyTypes: serviceTemplate={}", serviceTemplate); ToscaServiceTemplate updatedServiceTemplate = new SimpleToscaProvider() - .updatePolicyTypes(dao, new JpaToscaServiceTemplate(serviceTemplate)).toAuthorative(); + .updatePolicyTypes(dao, new JpaToscaServiceTemplate(serviceTemplate)).toAuthorative(); LOGGER.debug("<-updatePolicyTypes: updatedServiceTemplate={}", updatedServiceTemplate); return updatedServiceTemplate; @@ -295,16 +348,16 @@ public class AuthorativeToscaProvider { * @throws PfModelException on errors deleting policy types */ public ToscaServiceTemplate deletePolicyType(@NonNull final PfDao dao, @NonNull final String name, - @NonNull final String version) throws PfModelException { + @NonNull final String version) throws PfModelException { synchronized (providerLockObject) { LOGGER.debug("->deletePolicyType: name={}, version={}", name, version); ToscaServiceTemplate deletedServiceTemplate = - new SimpleToscaProvider().deletePolicyType(dao, new PfConceptKey(name, version)).toAuthorative(); + new SimpleToscaProvider().deletePolicyType(dao, new PfConceptKey(name, version)).toAuthorative(); LOGGER.debug("<-deletePolicyType: name={}, version={}, deletedServiceTemplate={}", name, version, - deletedServiceTemplate); + deletedServiceTemplate); return deletedServiceTemplate; } } @@ -319,16 +372,16 @@ public class AuthorativeToscaProvider { * @throws PfModelException on errors getting policies */ public ToscaServiceTemplate getPolicies(@NonNull final PfDao dao, final String name, final String version) - throws PfModelException { + throws PfModelException { synchronized (providerLockObject) { LOGGER.debug("->getPolicies: name={}, version={}", name, version); ToscaServiceTemplate gotServiceTemplate = - new SimpleToscaProvider().getPolicies(dao, name, version).toAuthorative(); + new SimpleToscaProvider().getPolicies(dao, name, version).toAuthorative(); LOGGER.debug("<-getPolicies: name={}, version={}, gotServiceTemplate={}", name, version, - gotServiceTemplate); + gotServiceTemplate); return gotServiceTemplate; } } @@ -343,7 +396,7 @@ public class AuthorativeToscaProvider { * @throws PfModelException on errors getting policies */ public List getPolicyList(@NonNull final PfDao dao, final String name, final String version) - throws PfModelException { + throws PfModelException { synchronized (providerLockObject) { LOGGER.debug("->getPolicyList: name={}, version={}", name, version); @@ -352,7 +405,7 @@ public class AuthorativeToscaProvider { try { policyList = asConceptList(new SimpleToscaProvider().getPolicies(dao, name, version).toAuthorative() - .getToscaTopologyTemplate().getPolicies()); + .getToscaTopologyTemplate().getPolicies()); } catch (PfModelRuntimeException pfme) { return handlePfModelRuntimeException(pfme); } @@ -371,7 +424,7 @@ public class AuthorativeToscaProvider { * @throws PfModelException on errors getting policies */ public ToscaServiceTemplate getFilteredPolicies(@NonNull final PfDao dao, @NonNull final ToscaPolicyFilter filter) - throws PfModelException { + throws PfModelException { synchronized (providerLockObject) { LOGGER.debug("->getFilteredPolicies: filter={}", filter); @@ -379,25 +432,25 @@ public class AuthorativeToscaProvider { SimpleToscaProvider simpleToscaProvider = new SimpleToscaProvider(); final JpaToscaServiceTemplate dbServiceTemplate = - simpleToscaProvider.getPolicies(dao, filter.getName(), version); + simpleToscaProvider.getPolicies(dao, filter.getName(), version); List filteredPolicies = - dbServiceTemplate.getTopologyTemplate().getPolicies().toAuthorativeList(); + dbServiceTemplate.getTopologyTemplate().getPolicies().toAuthorativeList(); filteredPolicies = filter.filter(filteredPolicies); if (CollectionUtils.isEmpty(filteredPolicies)) { throw new PfModelRuntimeException(Response.Status.NOT_FOUND, - "policies for filter " + filter.toString() + " do not exist"); + "policies for filter " + filter.toString() + " do not exist"); } JpaToscaServiceTemplate filteredServiceTemplate = new JpaToscaServiceTemplate(); for (ToscaPolicy policy : filteredPolicies) { - JpaToscaServiceTemplate cascadedServiceTemplate = - simpleToscaProvider.getCascadedPolicies(dbServiceTemplate, policy.getName(), policy.getVersion()); + JpaToscaServiceTemplate cascadedServiceTemplate = simpleToscaProvider + .getCascadedPolicies(dbServiceTemplate, policy.getName(), policy.getVersion()); filteredServiceTemplate = - ToscaServiceTemplateUtils.addFragment(filteredServiceTemplate, cascadedServiceTemplate); + ToscaServiceTemplateUtils.addFragment(filteredServiceTemplate, cascadedServiceTemplate); } ToscaServiceTemplate returnServiceTemplate = filteredServiceTemplate.toAuthorative(); @@ -416,7 +469,7 @@ public class AuthorativeToscaProvider { * @throws PfModelException on errors getting policies */ public List getFilteredPolicyList(@NonNull final PfDao dao, @NonNull final ToscaPolicyFilter filter) - throws PfModelException { + throws PfModelException { LOGGER.debug("->getFilteredPolicyList: filter={}", filter); String version = ToscaPolicyFilter.LATEST_VERSION.equals(filter.getVersion()) ? null : filter.getVersion(); @@ -436,13 +489,13 @@ public class AuthorativeToscaProvider { * @throws PfModelException on errors creating policies */ public ToscaServiceTemplate createPolicies(@NonNull final PfDao dao, - @NonNull final ToscaServiceTemplate serviceTemplate) throws PfModelException { + @NonNull final ToscaServiceTemplate serviceTemplate) throws PfModelException { synchronized (providerLockObject) { LOGGER.debug("->createPolicies: serviceTemplate={}", serviceTemplate); ToscaServiceTemplate createdServiceTemplate = new SimpleToscaProvider() - .createPolicies(dao, new JpaToscaServiceTemplate(serviceTemplate)).toAuthorative(); + .createPolicies(dao, new JpaToscaServiceTemplate(serviceTemplate)).toAuthorative(); LOGGER.debug("<-createPolicies: createdServiceTemplate={}", createdServiceTemplate); return createdServiceTemplate; @@ -458,13 +511,13 @@ public class AuthorativeToscaProvider { * @throws PfModelException on errors updating policies */ public ToscaServiceTemplate updatePolicies(@NonNull final PfDao dao, - @NonNull final ToscaServiceTemplate serviceTemplate) throws PfModelException { + @NonNull final ToscaServiceTemplate serviceTemplate) throws PfModelException { synchronized (providerLockObject) { LOGGER.debug("->updatePolicies: serviceTemplate={}", serviceTemplate); ToscaServiceTemplate updatedServiceTemplate = new SimpleToscaProvider() - .updatePolicies(dao, new JpaToscaServiceTemplate(serviceTemplate)).toAuthorative(); + .updatePolicies(dao, new JpaToscaServiceTemplate(serviceTemplate)).toAuthorative(); LOGGER.debug("<-updatePolicies: updatedServiceTemplate={}", updatedServiceTemplate); return updatedServiceTemplate; @@ -481,16 +534,16 @@ public class AuthorativeToscaProvider { * @throws PfModelException on errors deleting policies */ public ToscaServiceTemplate deletePolicy(@NonNull final PfDao dao, @NonNull final String name, - @NonNull final String version) throws PfModelException { + @NonNull final String version) throws PfModelException { synchronized (providerLockObject) { LOGGER.debug("->deletePolicy: name={}, version={}", name, version); ToscaServiceTemplate deletedServiceTemplate = - new SimpleToscaProvider().deletePolicy(dao, new PfConceptKey(name, version)).toAuthorative(); + new SimpleToscaProvider().deletePolicy(dao, new PfConceptKey(name, version)).toAuthorative(); LOGGER.debug("<-deletePolicy: name={}, version={}, deletedServiceTemplate={}", name, version, - deletedServiceTemplate); + deletedServiceTemplate); return deletedServiceTemplate; } } -- cgit 1.2.3-korg