diff options
author | liamfallon <liam.fallon@est.tech> | 2019-05-23 15:47:57 +0000 |
---|---|---|
committer | liamfallon <liam.fallon@est.tech> | 2019-05-23 15:47:57 +0000 |
commit | d98aa930321c1436e6135394531687ed199594fc (patch) | |
tree | 1ad87c8dfc62433d45ee153be592de272813867b /models-tosca/src/main/java/org/onap | |
parent | 4efebd1bfa2e05ae306229dc156b7484c51599b5 (diff) |
Add logging to model providers
Issue-ID: POLICY-1777
Change-Id: I67bf56a7848bbb0495d9e8c215b665fde5c67f1d
Signed-off-by: liamfallon <liam.fallon@est.tech>
Diffstat (limited to 'models-tosca/src/main/java/org/onap')
3 files changed, 166 insertions, 27 deletions
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 5f8729e08..0fae304c3 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 @@ -40,6 +40,8 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyTypeFilter; import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate; import org.onap.policy.models.tosca.simple.concepts.JpaToscaServiceTemplate; import org.onap.policy.models.tosca.simple.provider.SimpleToscaProvider; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * This class provides the provision of information on TOSCA concepts in the database to callers. @@ -47,6 +49,8 @@ import org.onap.policy.models.tosca.simple.provider.SimpleToscaProvider; * @author Liam Fallon (liam.fallon@est.tech) */ public class AuthorativeToscaProvider { + private static final Logger LOGGER = LoggerFactory.getLogger(AuthorativeToscaProvider.class); + /** * Get policy types. * @@ -59,7 +63,13 @@ public class AuthorativeToscaProvider { public ToscaServiceTemplate getPolicyTypes(@NonNull final PfDao dao, final String name, final String version) throws PfModelException { - return new SimpleToscaProvider().getPolicyTypes(dao, name, version).toAuthorative(); + LOGGER.debug("->getPolicyTypes: name={}, version={}", name, version); + + ToscaServiceTemplate serviceTemplate = + new SimpleToscaProvider().getPolicyTypes(dao, name, version).toAuthorative(); + + LOGGER.debug("<-getPolicyTypes: name={}, version={}, serviceTemplate={}", name, version, serviceTemplate); + return serviceTemplate; } /** @@ -74,8 +84,13 @@ public class AuthorativeToscaProvider { public List<ToscaPolicyType> getPolicyTypeList(@NonNull final PfDao dao, final String name, final String version) throws PfModelException { - return (asConceptList( - new SimpleToscaProvider().getPolicyTypes(dao, name, version).toAuthorative().getPolicyTypes())); + LOGGER.debug("->getPolicyTypeList: name={}, version={}", name, version); + + List<ToscaPolicyType> policyTypeList = asConceptList( + new SimpleToscaProvider().getPolicyTypes(dao, name, version).toAuthorative().getPolicyTypes()); + + LOGGER.debug("<-getPolicyTypeList: name={}, version={}, policyTypeList={}", name, version, policyTypeList); + return policyTypeList; } /** @@ -89,6 +104,8 @@ public class AuthorativeToscaProvider { public ToscaServiceTemplate getFilteredPolicyTypes(@NonNull final PfDao dao, @NonNull final ToscaPolicyTypeFilter filter) throws PfModelException { + LOGGER.debug("->getFilteredPolicyTypes: filter={}", filter); + ToscaServiceTemplate serviceTemplate = new SimpleToscaProvider().getPolicyTypes(dao, null, null).toAuthorative(); @@ -97,6 +114,7 @@ public class AuthorativeToscaProvider { serviceTemplate.setPolicyTypes(asConceptMap(filteredPolicyTypes)); + LOGGER.debug("<-getFilteredPolicyTypes: filter={}, serviceTemplate={}", filter, serviceTemplate); return serviceTemplate; } @@ -111,7 +129,13 @@ public class AuthorativeToscaProvider { public List<ToscaPolicyType> getFilteredPolicyTypeList(@NonNull final PfDao dao, @NonNull final ToscaPolicyTypeFilter filter) throws PfModelException { - return filter.filter(getPolicyTypeList(dao, null, null)); + LOGGER.debug("->getFilteredPolicyTypeList: filter={}", filter); + + List<ToscaPolicyType> filteredPolicyTypeList = filter.filter(getPolicyTypeList(dao, null, null)); + + LOGGER.debug("<-getFilteredPolicyTypeList: filter={}, filteredPolicyTypeList={}", filter, + filteredPolicyTypeList); + return filteredPolicyTypeList; } /** @@ -125,8 +149,13 @@ public class AuthorativeToscaProvider { public ToscaServiceTemplate createPolicyTypes(@NonNull final PfDao dao, @NonNull final ToscaServiceTemplate serviceTemplate) throws PfModelException { - return new SimpleToscaProvider().createPolicyTypes(dao, new JpaToscaServiceTemplate(serviceTemplate)) - .toAuthorative(); + LOGGER.debug("->createPolicyTypes: serviceTemplate={}", serviceTemplate); + + ToscaServiceTemplate createdServiceTempalate = new SimpleToscaProvider() + .createPolicyTypes(dao, new JpaToscaServiceTemplate(serviceTemplate)).toAuthorative(); + + LOGGER.debug("<-createPolicyTypes: createdServiceTempalate={}", createdServiceTempalate); + return createdServiceTempalate; } /** @@ -140,8 +169,13 @@ public class AuthorativeToscaProvider { public ToscaServiceTemplate updatePolicyTypes(@NonNull final PfDao dao, @NonNull final ToscaServiceTemplate serviceTemplate) throws PfModelException { - return new SimpleToscaProvider().updatePolicyTypes(dao, new JpaToscaServiceTemplate(serviceTemplate)) - .toAuthorative(); + LOGGER.debug("->updatePolicyTypes: serviceTempalate={}", serviceTemplate); + + ToscaServiceTemplate updatedServiceTempalate = new SimpleToscaProvider() + .updatePolicyTypes(dao, new JpaToscaServiceTemplate(serviceTemplate)).toAuthorative(); + + LOGGER.debug("<-updatePolicyTypes: updatedServiceTempalate={}", updatedServiceTempalate); + return updatedServiceTempalate; } /** @@ -156,7 +190,14 @@ public class AuthorativeToscaProvider { public ToscaServiceTemplate deletePolicyType(@NonNull final PfDao dao, @NonNull final String name, @NonNull final String version) throws PfModelException { - return new SimpleToscaProvider().deletePolicyType(dao, new PfConceptKey(name, version)).toAuthorative(); + LOGGER.debug("->deletePolicyType: name={}, version={}", name, version); + + ToscaServiceTemplate deletedServiceTempalate = + new SimpleToscaProvider().deletePolicyType(dao, new PfConceptKey(name, version)).toAuthorative(); + + LOGGER.debug("<-deletePolicyType: name={}, version={}, deletedServiceTempalate={}", name, version, + deletedServiceTempalate); + return deletedServiceTempalate; } /** @@ -170,8 +211,13 @@ public class AuthorativeToscaProvider { */ public ToscaServiceTemplate getPolicies(@NonNull final PfDao dao, final String name, final String version) throws PfModelException { + LOGGER.debug("->getPolicies: name={}, version={}", name, version); + + ToscaServiceTemplate gotServiceTempalate = + new SimpleToscaProvider().getPolicies(dao, name, version).toAuthorative(); - return new SimpleToscaProvider().getPolicies(dao, name, version).toAuthorative(); + LOGGER.debug("<-getPolicies: name={}, version={}, gotServiceTempalate={}", name, version, gotServiceTempalate); + return gotServiceTempalate; } /** @@ -185,9 +231,13 @@ public class AuthorativeToscaProvider { */ public List<ToscaPolicy> getPolicyList(@NonNull final PfDao dao, final String name, final String version) throws PfModelException { + LOGGER.debug("->getPolicyList: name={}, version={}", name, version); - return asConceptList(new SimpleToscaProvider().getPolicies(dao, name, version).toAuthorative() - .getToscaTopologyTemplate().getPolicies()); + List<ToscaPolicy> policyList = asConceptList(new SimpleToscaProvider().getPolicies(dao, name, version) + .toAuthorative().getToscaTopologyTemplate().getPolicies()); + + LOGGER.debug("<-getPolicyList: name={}, version={}, policyTypeList={}", name, version, policyList); + return policyList; } /** @@ -201,16 +251,18 @@ public class AuthorativeToscaProvider { public ToscaServiceTemplate getFilteredPolicies(@NonNull final PfDao dao, @NonNull final ToscaPolicyFilter filter) throws PfModelException { + LOGGER.debug("->getFilteredPolicies: filter={}", filter); String version = ToscaPolicyFilter.LATEST_VERSION.equals(filter.getVersion()) ? null : filter.getVersion(); ToscaServiceTemplate serviceTemplate = - new SimpleToscaProvider().getPolicies(dao, filter.getName(), version).toAuthorative(); + new SimpleToscaProvider().getPolicies(dao, filter.getName(), version).toAuthorative(); List<ToscaPolicy> filteredPolicies = asConceptList(serviceTemplate.getToscaTopologyTemplate().getPolicies()); filteredPolicies = filter.filter(filteredPolicies); serviceTemplate.getToscaTopologyTemplate().setPolicies(asConceptMap(filteredPolicies)); + LOGGER.debug("<-getFilteredPolicies: filter={}, serviceTemplate={}", filter, serviceTemplate); return serviceTemplate; } @@ -225,8 +277,13 @@ public class AuthorativeToscaProvider { public List<ToscaPolicy> getFilteredPolicyList(@NonNull final PfDao dao, @NonNull final ToscaPolicyFilter filter) throws PfModelException { + LOGGER.debug("->getFilteredPolicyList: filter={}", filter); String version = ToscaPolicyFilter.LATEST_VERSION.equals(filter.getVersion()) ? null : filter.getVersion(); - return filter.filter(getPolicyList(dao, filter.getName(), version)); + + List<ToscaPolicy> policyList = filter.filter(getPolicyList(dao, filter.getName(), version)); + + LOGGER.debug("<-getFilteredPolicyList: filter={}, policyList={}", filter, policyList); + return policyList; } /** @@ -240,8 +297,13 @@ public class AuthorativeToscaProvider { public ToscaServiceTemplate createPolicies(@NonNull final PfDao dao, @NonNull final ToscaServiceTemplate serviceTemplate) throws PfModelException { - return new SimpleToscaProvider().createPolicies(dao, new JpaToscaServiceTemplate(serviceTemplate)) - .toAuthorative(); + LOGGER.debug("->createPolicies: serviceTempalate={}", serviceTemplate); + + ToscaServiceTemplate createdServiceTempalate = new SimpleToscaProvider() + .createPolicies(dao, new JpaToscaServiceTemplate(serviceTemplate)).toAuthorative(); + + LOGGER.debug("<-createPolicies: createdServiceTempalate={}", createdServiceTempalate); + return createdServiceTempalate; } /** @@ -255,8 +317,13 @@ public class AuthorativeToscaProvider { public ToscaServiceTemplate updatePolicies(@NonNull final PfDao dao, @NonNull final ToscaServiceTemplate serviceTemplate) throws PfModelException { - return new SimpleToscaProvider().updatePolicies(dao, new JpaToscaServiceTemplate(serviceTemplate)) - .toAuthorative(); + LOGGER.debug("->updatePolicies: serviceTempalate={}", serviceTemplate); + + ToscaServiceTemplate updatedServiceTempalate = new SimpleToscaProvider() + .updatePolicies(dao, new JpaToscaServiceTemplate(serviceTemplate)).toAuthorative(); + + LOGGER.debug("<-updatePolicies: updatedServiceTempalate={}", updatedServiceTempalate); + return updatedServiceTempalate; } /** @@ -271,7 +338,14 @@ public class AuthorativeToscaProvider { public ToscaServiceTemplate deletePolicy(@NonNull final PfDao dao, @NonNull final String name, @NonNull final String version) throws PfModelException { - return new SimpleToscaProvider().deletePolicy(dao, new PfConceptKey(name, version)).toAuthorative(); + LOGGER.debug("->deletePolicy: name={}, version={}", name, version); + + ToscaServiceTemplate deletedServiceTempalate = + new SimpleToscaProvider().deletePolicy(dao, new PfConceptKey(name, version)).toAuthorative(); + + LOGGER.debug("<-deletePolicy: name={}, version={}, deletedServiceTempalate={}", name, version, + deletedServiceTempalate); + return deletedServiceTempalate; } /** diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/legacy/provider/LegacyProvider.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/legacy/provider/LegacyProvider.java index 23406b473..9124a2983 100644 --- a/models-tosca/src/main/java/org/onap/policy/models/tosca/legacy/provider/LegacyProvider.java +++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/legacy/provider/LegacyProvider.java @@ -70,8 +70,14 @@ public class LegacyProvider { public LegacyOperationalPolicy getOperationalPolicy(@NonNull final PfDao dao, @NonNull final String policyId, final String policyVersion) throws PfModelException { - return new LegacyOperationalPolicyMapper() + LOGGER.debug("->getOperationalPolicy: policyId={}, policyVersion={}", policyId, policyVersion); + + LegacyOperationalPolicy legacyOperationalPolicy = new LegacyOperationalPolicyMapper() .fromToscaServiceTemplate(getLegacyPolicy(dao, policyId, policyVersion)); + + LOGGER.debug("<-getOperationalPolicy: policyId={}, policyVersion={}, legacyOperationalPolicy={}", policyId, + policyVersion, legacyOperationalPolicy); + return legacyOperationalPolicy; } /** @@ -85,6 +91,8 @@ public class LegacyProvider { public LegacyOperationalPolicy createOperationalPolicy(@NonNull final PfDao dao, @NonNull final LegacyOperationalPolicy legacyOperationalPolicy) throws PfModelException { + LOGGER.debug("->createOperationalPolicy: legacyOperationalPolicy={}", legacyOperationalPolicy); + // We need to find the latest policy and update the major version, if there is no policy with this ID, then // we set it to the first version JpaToscaPolicy newestPolicy = getLatestPolicy(dao, legacyOperationalPolicy.getPolicyId()); @@ -100,7 +108,11 @@ public class LegacyProvider { JpaToscaServiceTemplate outgoingingServiceTemplate = new SimpleToscaProvider().createPolicies(dao, incomingServiceTemplate); - return new LegacyOperationalPolicyMapper().fromToscaServiceTemplate(outgoingingServiceTemplate); + LegacyOperationalPolicy createdLegacyOperationalPolicy = + new LegacyOperationalPolicyMapper().fromToscaServiceTemplate(outgoingingServiceTemplate); + + LOGGER.debug("<-createOperationalPolicy: createdLegacyOperationalPolicy={}", createdLegacyOperationalPolicy); + return createdLegacyOperationalPolicy; } /** @@ -114,12 +126,17 @@ public class LegacyProvider { public LegacyOperationalPolicy updateOperationalPolicy(@NonNull final PfDao dao, @NonNull final LegacyOperationalPolicy legacyOperationalPolicy) throws PfModelException { + LOGGER.debug("->updateOperationalPolicy: legacyOperationalPolicy={}", legacyOperationalPolicy); JpaToscaServiceTemplate incomingServiceTemplate = new LegacyOperationalPolicyMapper().toToscaServiceTemplate(legacyOperationalPolicy); JpaToscaServiceTemplate outgoingingServiceTemplate = new SimpleToscaProvider().updatePolicies(dao, incomingServiceTemplate); - return new LegacyOperationalPolicyMapper().fromToscaServiceTemplate(outgoingingServiceTemplate); + LegacyOperationalPolicy updatedLegacyOperationalPolicy = + new LegacyOperationalPolicyMapper().fromToscaServiceTemplate(outgoingingServiceTemplate); + + LOGGER.debug("<-updateOperationalPolicy: updatedLegacyOperationalPolicy={}", updatedLegacyOperationalPolicy); + return updatedLegacyOperationalPolicy; } /** @@ -134,8 +151,14 @@ public class LegacyProvider { public LegacyOperationalPolicy deleteOperationalPolicy(@NonNull final PfDao dao, @NonNull final String policyId, @NonNull final String policyVersion) throws PfModelException { - return new LegacyOperationalPolicyMapper() + LOGGER.debug("->deleteOperationalPolicy: policyId={}, policyVersion={}", policyId, policyVersion); + + LegacyOperationalPolicy legacyOperationalPolicy = new LegacyOperationalPolicyMapper() .fromToscaServiceTemplate(deleteLegacyPolicy(dao, policyId, policyVersion)); + + LOGGER.debug("<-deleteOperationalPolicy: policyId={}, policyVersion={}, legacyOperationalPolicy={}", policyId, + policyVersion, legacyOperationalPolicy); + return legacyOperationalPolicy; } /** @@ -150,7 +173,14 @@ public class LegacyProvider { public Map<String, LegacyGuardPolicyOutput> getGuardPolicy(@NonNull final PfDao dao, @NonNull final String policyId, final String policyVersion) throws PfModelException { - return new LegacyGuardPolicyMapper().fromToscaServiceTemplate(getLegacyPolicy(dao, policyId, policyVersion)); + LOGGER.debug("->getGuardPolicy: policyId={}, policyVersion={}", policyId, policyVersion); + + Map<String, LegacyGuardPolicyOutput> legacyGuardPolicyMap = + new LegacyGuardPolicyMapper().fromToscaServiceTemplate(getLegacyPolicy(dao, policyId, policyVersion)); + + LOGGER.debug("<-getGuardPolicy: policyId={}, policyVersion={}, legacyGuardPolicyMap={}", policyId, + policyVersion, legacyGuardPolicyMap); + return legacyGuardPolicyMap; } /** @@ -164,12 +194,18 @@ public class LegacyProvider { public Map<String, LegacyGuardPolicyOutput> createGuardPolicy(@NonNull final PfDao dao, @NonNull final LegacyGuardPolicyInput legacyGuardPolicy) throws PfModelException { + LOGGER.debug("->createGuardPolicy: legacyGuardPolicy={}", legacyGuardPolicy); + JpaToscaServiceTemplate incomingServiceTemplate = new LegacyGuardPolicyMapper().toToscaServiceTemplate(legacyGuardPolicy); JpaToscaServiceTemplate outgoingingServiceTemplate = new SimpleToscaProvider().createPolicies(dao, incomingServiceTemplate); - return new LegacyGuardPolicyMapper().fromToscaServiceTemplate(outgoingingServiceTemplate); + Map<String, LegacyGuardPolicyOutput> createdLegacyGuardPolicyMap = + new LegacyGuardPolicyMapper().fromToscaServiceTemplate(outgoingingServiceTemplate); + + LOGGER.debug("<-createGuardPolicy: createdLegacyGuardPolicyMap={}", createdLegacyGuardPolicyMap); + return createdLegacyGuardPolicyMap; } /** @@ -183,12 +219,18 @@ public class LegacyProvider { public Map<String, LegacyGuardPolicyOutput> updateGuardPolicy(@NonNull final PfDao dao, @NonNull final LegacyGuardPolicyInput legacyGuardPolicy) throws PfModelException { + LOGGER.debug("->updateGuardPolicy: legacyGuardPolicy={}", legacyGuardPolicy); + JpaToscaServiceTemplate incomingServiceTemplate = new LegacyGuardPolicyMapper().toToscaServiceTemplate(legacyGuardPolicy); JpaToscaServiceTemplate outgoingingServiceTemplate = new SimpleToscaProvider().updatePolicies(dao, incomingServiceTemplate); - return new LegacyGuardPolicyMapper().fromToscaServiceTemplate(outgoingingServiceTemplate); + Map<String, LegacyGuardPolicyOutput> updatedLegacyGuardPolicyMap = + new LegacyGuardPolicyMapper().fromToscaServiceTemplate(outgoingingServiceTemplate); + + LOGGER.debug("<-updateGuardPolicy: updatedLegacyGuardPolicyMap={}", updatedLegacyGuardPolicyMap); + return updatedLegacyGuardPolicyMap; } @@ -204,7 +246,13 @@ public class LegacyProvider { public Map<String, LegacyGuardPolicyOutput> deleteGuardPolicy(@NonNull final PfDao dao, @NonNull final String policyId, @NonNull final String policyVersion) throws PfModelException { - return new LegacyGuardPolicyMapper().fromToscaServiceTemplate(deleteLegacyPolicy(dao, policyId, policyVersion)); + LOGGER.debug("->deleteGuardPolicy: policyId={}, policyVersion={}", policyId, policyVersion); + Map<String, LegacyGuardPolicyOutput> legacyGuardPolicyMap = new LegacyGuardPolicyMapper() + .fromToscaServiceTemplate(deleteLegacyPolicy(dao, policyId, policyVersion)); + + LOGGER.debug("<-deleteGuardPolicy: policyId={}, policyVersion={}, legacyGuardPolicyMap={}", policyId, + policyVersion, legacyGuardPolicyMap); + return legacyGuardPolicyMap; } /** diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/provider/SimpleToscaProvider.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/provider/SimpleToscaProvider.java index 47e0b67a3..30ab89491 100644 --- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/provider/SimpleToscaProvider.java +++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/provider/SimpleToscaProvider.java @@ -65,6 +65,7 @@ public class SimpleToscaProvider { */ public JpaToscaServiceTemplate getPolicyTypes(@NonNull final PfDao dao, final String name, final String version) throws PfModelException { + LOGGER.debug("->getPolicyTypes: name={}, version={}", name, version); // Create the structure of the TOSCA service template to contain the policy type JpaToscaServiceTemplate serviceTemplate = new JpaToscaServiceTemplate(); @@ -74,6 +75,7 @@ public class SimpleToscaProvider { List<JpaToscaPolicyType> jpaPolicyTypeList = dao.getFiltered(JpaToscaPolicyType.class, name, version); serviceTemplate.getPolicyTypes().getConceptMap().putAll(asConceptMap(jpaPolicyTypeList)); + LOGGER.debug("<-getPolicyTypes: name={}, version={}, serviceTemplate=", name, version, serviceTemplate); return serviceTemplate; } @@ -87,6 +89,7 @@ public class SimpleToscaProvider { */ public JpaToscaServiceTemplate createPolicyTypes(@NonNull final PfDao dao, @NonNull final JpaToscaServiceTemplate serviceTemplate) throws PfModelException { + LOGGER.debug("->createPolicyTypes: serviceTempalate={}", serviceTemplate); ToscaUtils.assertPolicyTypesExist(serviceTemplate); @@ -104,6 +107,7 @@ public class SimpleToscaProvider { JpaToscaServiceTemplate returnServiceTemplate = new JpaToscaServiceTemplate(); returnServiceTemplate.setPolicyTypes(returnPolicyTypes); + LOGGER.debug("<-createPolicyTypes: returnServiceTempalate={}", returnServiceTemplate); return returnServiceTemplate; } @@ -117,6 +121,7 @@ public class SimpleToscaProvider { */ public JpaToscaServiceTemplate updatePolicyTypes(@NonNull final PfDao dao, @NonNull final JpaToscaServiceTemplate serviceTemplate) throws PfModelException { + LOGGER.debug("->updatePolicyTypes: serviceTempalate={}", serviceTemplate); ToscaUtils.assertPolicyTypesExist(serviceTemplate); @@ -134,6 +139,7 @@ public class SimpleToscaProvider { JpaToscaServiceTemplate returnServiceTemplate = new JpaToscaServiceTemplate(); returnServiceTemplate.setPolicyTypes(returnPolicyTypes); + LOGGER.debug("<-updatePolicyTypes: returnServiceTempalate={}", returnServiceTemplate); return returnServiceTemplate; } @@ -148,12 +154,14 @@ public class SimpleToscaProvider { */ public JpaToscaServiceTemplate deletePolicyType(@NonNull final PfDao dao, @NonNull final PfConceptKey policyTypeKey) throws PfModelException { + LOGGER.debug("->deletePolicyType: key={}", policyTypeKey); JpaToscaServiceTemplate serviceTemplate = getPolicyTypes(dao, policyTypeKey.getName(), policyTypeKey.getVersion()); dao.delete(JpaToscaPolicyType.class, policyTypeKey); + LOGGER.debug("<-deletePolicyType: key={}, serviceTempalate=", policyTypeKey, serviceTemplate); return serviceTemplate; } @@ -168,6 +176,7 @@ public class SimpleToscaProvider { */ public JpaToscaServiceTemplate getPolicies(@NonNull final PfDao dao, final String name, final String version) throws PfModelException { + LOGGER.debug("->getPolicies: name={}, version={}", name, version); // Create the structure of the TOSCA service template to contain the policy type JpaToscaServiceTemplate serviceTemplate = new JpaToscaServiceTemplate(); @@ -177,6 +186,8 @@ public class SimpleToscaProvider { // Add the policy type to the TOSCA service template List<JpaToscaPolicy> jpaPolicyList = dao.getFiltered(JpaToscaPolicy.class, name, version); serviceTemplate.getTopologyTemplate().getPolicies().getConceptMap().putAll(asConceptMap(jpaPolicyList)); + + LOGGER.debug("<-getPolicies: name={}, version={}, serviceTemplate=", name, version, serviceTemplate); return serviceTemplate; } @@ -190,6 +201,7 @@ public class SimpleToscaProvider { */ public JpaToscaServiceTemplate createPolicies(@NonNull final PfDao dao, @NonNull final JpaToscaServiceTemplate serviceTemplate) throws PfModelException { + LOGGER.debug("->createPolicies: serviceTempalate={}", serviceTemplate); ToscaUtils.assertPoliciesExist(serviceTemplate); @@ -208,6 +220,7 @@ public class SimpleToscaProvider { serviceTemplate.getTopologyTemplate().setPolicies(returnPolicies); + LOGGER.debug("<-createPolicies: serviceTemplate={}", serviceTemplate); return serviceTemplate; } @@ -221,6 +234,7 @@ public class SimpleToscaProvider { */ public JpaToscaServiceTemplate updatePolicies(@NonNull final PfDao dao, @NonNull final JpaToscaServiceTemplate serviceTemplate) throws PfModelException { + LOGGER.debug("->updatePolicies: serviceTempalate={}", serviceTemplate); ToscaUtils.assertPoliciesExist(serviceTemplate); @@ -239,6 +253,7 @@ public class SimpleToscaProvider { serviceTemplate.getTopologyTemplate().setPolicies(returnPolicies); + LOGGER.debug("<-updatePolicies: serviceTemplate={}", serviceTemplate); return serviceTemplate; } @@ -252,11 +267,13 @@ public class SimpleToscaProvider { */ public JpaToscaServiceTemplate deletePolicy(@NonNull final PfDao dao, @NonNull final PfConceptKey policyKey) throws PfModelException { + LOGGER.debug("->deletePolicy: key={}", policyKey); JpaToscaServiceTemplate serviceTemplate = getPolicies(dao, policyKey.getName(), policyKey.getVersion()); dao.delete(JpaToscaPolicy.class, policyKey); + LOGGER.debug("<-deletePolicy: key={}, serviceTempalate=", policyKey, serviceTemplate); return serviceTemplate; } |