diff options
author | Jim Hahn <jrh3@att.com> | 2021-02-08 18:31:06 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2021-02-08 18:31:06 +0000 |
commit | 5f0183ff4608e1c87436967dbc8760fe9a1febaf (patch) | |
tree | 2ebe1db7f44331709030561a617206291093aaca /models-provider/src/main/java | |
parent | 296a26edcc3102602b494d1be9c23e0265b09f66 (diff) | |
parent | ed54f1f94a43e9fc5e353eb2c7111dcc552be18e (diff) |
Merge "Make filters on TOSCA entities generic"
Diffstat (limited to 'models-provider/src/main/java')
3 files changed, 45 insertions, 45 deletions
diff --git a/models-provider/src/main/java/org/onap/policy/models/provider/PolicyModelsProvider.java b/models-provider/src/main/java/org/onap/policy/models/provider/PolicyModelsProvider.java index e0cb44cb6..3bf81adf7 100644 --- a/models-provider/src/main/java/org/onap/policy/models/provider/PolicyModelsProvider.java +++ b/models-provider/src/main/java/org/onap/policy/models/provider/PolicyModelsProvider.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2019-2020 Nordix Foundation. + * Copyright (C) 2019-2021 Nordix Foundation. * Modifications Copyright (C) 2020 Bell Canada. All rights reserved. * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved. * ================================================================================ @@ -34,12 +34,11 @@ import org.onap.policy.models.pdp.concepts.PdpPolicyStatus; import org.onap.policy.models.pdp.concepts.PdpStatistics; import org.onap.policy.models.pdp.concepts.PdpSubGroup; import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifierOptVersion; +import org.onap.policy.models.tosca.authorative.concepts.ToscaEntityFilter; import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy; -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.authorative.concepts.ToscaTypedEntityFilter; /** * This interface describes the operations that are provided to users and components for reading objects from and @@ -76,8 +75,8 @@ public interface PolicyModelsProvider extends AutoCloseable { * @return the service templates found * @throws PfModelException on errors getting service templates */ - public List<ToscaServiceTemplate> getFilteredServiceTemplateList(@NonNull final ToscaServiceTemplateFilter filter) - throws PfModelException; + public List<ToscaServiceTemplate> getFilteredServiceTemplateList( + @NonNull final ToscaEntityFilter<ToscaServiceTemplate> filter) throws PfModelException; /** * Create service template. @@ -137,7 +136,7 @@ public interface PolicyModelsProvider extends AutoCloseable { * @return the policy types found * @throws PfModelException on errors getting policy types */ - public ToscaServiceTemplate getFilteredPolicyTypes(@NonNull final ToscaPolicyTypeFilter filter) + public ToscaServiceTemplate getFilteredPolicyTypes(@NonNull final ToscaEntityFilter<ToscaPolicyType> filter) throws PfModelException; /** @@ -147,7 +146,7 @@ public interface PolicyModelsProvider extends AutoCloseable { * @return the policy types found * @throws PfModelException on errors getting policy types */ - public List<ToscaPolicyType> getFilteredPolicyTypeList(@NonNull final ToscaPolicyTypeFilter filter) + public List<ToscaPolicyType> getFilteredPolicyTypeList(@NonNull final ToscaEntityFilter<ToscaPolicyType> filter) throws PfModelException; /** @@ -208,7 +207,8 @@ public interface PolicyModelsProvider extends AutoCloseable { * @return the policies found * @throws PfModelException on errors getting policies */ - public ToscaServiceTemplate getFilteredPolicies(@NonNull final ToscaPolicyFilter filter) throws PfModelException; + public ToscaServiceTemplate getFilteredPolicies(@NonNull final ToscaTypedEntityFilter<ToscaPolicy> filter) + throws PfModelException; /** * Get filtered policies. @@ -217,7 +217,8 @@ public interface PolicyModelsProvider extends AutoCloseable { * @return the policies found * @throws PfModelException on errors getting policies */ - public List<ToscaPolicy> getFilteredPolicyList(@NonNull final ToscaPolicyFilter filter) throws PfModelException; + public List<ToscaPolicy> getFilteredPolicyList(@NonNull final ToscaTypedEntityFilter<ToscaPolicy> filter) + throws PfModelException; /** * Create policies. @@ -378,8 +379,7 @@ public interface PolicyModelsProvider extends AutoCloseable { * @return the deployments found * @throws PfModelException on errors getting PDP groups */ - public List<PdpPolicyStatus> getAllPolicyStatus() - throws PfModelException; + public List<PdpPolicyStatus> getAllPolicyStatus() throws PfModelException; /** * Gets all deployments for a policy. @@ -388,18 +388,16 @@ public interface PolicyModelsProvider extends AutoCloseable { * @throws PfModelException on errors getting PDP groups */ public List<PdpPolicyStatus> getAllPolicyStatus(@NonNull ToscaConceptIdentifierOptVersion policy) - throws PfModelException; + throws PfModelException; /** * Gets the policy deployments for a PDP group. * - * @param groupName the name of the PDP group of interest, null to get results for all - * PDP groups + * @param groupName the name of the PDP group of interest, null to get results for all PDP groups * @return the deployments found * @throws PfModelException on errors getting PDP groups */ - public List<PdpPolicyStatus> getGroupPolicyStatus(@NonNull final String groupName) - throws PfModelException; + public List<PdpPolicyStatus> getGroupPolicyStatus(@NonNull final String groupName) throws PfModelException; /** * Creates, updates, and deletes collections of policy status. @@ -408,6 +406,6 @@ public interface PolicyModelsProvider extends AutoCloseable { * @param updateObjs the objects to update * @param deleteObjs the objects to delete */ - public void cudPolicyStatus(Collection<PdpPolicyStatus> createObjs, - Collection<PdpPolicyStatus> updateObjs, Collection<PdpPolicyStatus> deleteObjs); + public void cudPolicyStatus(Collection<PdpPolicyStatus> createObjs, Collection<PdpPolicyStatus> updateObjs, + Collection<PdpPolicyStatus> deleteObjs); } diff --git a/models-provider/src/main/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderImpl.java b/models-provider/src/main/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderImpl.java index 3094efc27..8c7c5122b 100644 --- a/models-provider/src/main/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderImpl.java +++ b/models-provider/src/main/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderImpl.java @@ -41,12 +41,11 @@ import org.onap.policy.models.provider.PolicyModelsProvider; import org.onap.policy.models.provider.PolicyModelsProviderParameters; import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifierOptVersion; +import org.onap.policy.models.tosca.authorative.concepts.ToscaEntityFilter; import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy; -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.authorative.concepts.ToscaTypedEntityFilter; import org.onap.policy.models.tosca.authorative.provider.AuthorativeToscaProvider; /** @@ -74,8 +73,8 @@ public class DatabasePolicyModelsProviderImpl extends AbstractModelsProvider imp @Override - public List<ToscaServiceTemplate> getFilteredServiceTemplateList(@NonNull ToscaServiceTemplateFilter filter) - throws PfModelException { + public List<ToscaServiceTemplate> getFilteredServiceTemplateList( + @NonNull ToscaEntityFilter<ToscaServiceTemplate> filter) throws PfModelException { assertInitialized(); return new AuthorativeToscaProvider().getFilteredServiceTemplateList(getPfDao(), filter); } @@ -115,13 +114,14 @@ public class DatabasePolicyModelsProviderImpl extends AbstractModelsProvider imp } @Override - public ToscaServiceTemplate getFilteredPolicyTypes(@NonNull ToscaPolicyTypeFilter filter) throws PfModelException { + public ToscaServiceTemplate getFilteredPolicyTypes(@NonNull ToscaEntityFilter<ToscaPolicyType> filter) + throws PfModelException { assertInitialized(); return new AuthorativeToscaProvider().getFilteredPolicyTypes(getPfDao(), filter); } @Override - public List<ToscaPolicyType> getFilteredPolicyTypeList(@NonNull ToscaPolicyTypeFilter filter) + public List<ToscaPolicyType> getFilteredPolicyTypeList(@NonNull ToscaEntityFilter<ToscaPolicyType> filter) throws PfModelException { assertInitialized(); return new AuthorativeToscaProvider().getFilteredPolicyTypeList(getPfDao(), filter); @@ -165,13 +165,15 @@ public class DatabasePolicyModelsProviderImpl extends AbstractModelsProvider imp } @Override - public ToscaServiceTemplate getFilteredPolicies(@NonNull ToscaPolicyFilter filter) throws PfModelException { + public ToscaServiceTemplate getFilteredPolicies(@NonNull ToscaTypedEntityFilter<ToscaPolicy> filter) + throws PfModelException { assertInitialized(); return new AuthorativeToscaProvider().getFilteredPolicies(getPfDao(), filter); } @Override - public List<ToscaPolicy> getFilteredPolicyList(@NonNull ToscaPolicyFilter filter) throws PfModelException { + public List<ToscaPolicy> getFilteredPolicyList(@NonNull ToscaTypedEntityFilter<ToscaPolicy> filter) + throws PfModelException { assertInitialized(); return new AuthorativeToscaProvider().getFilteredPolicyList(getPfDao(), filter); } @@ -288,21 +290,20 @@ public class DatabasePolicyModelsProviderImpl extends AbstractModelsProvider imp @Override public List<PdpPolicyStatus> getAllPolicyStatus(@NonNull ToscaConceptIdentifierOptVersion policy) - throws PfModelException { + throws PfModelException { assertInitialized(); return new PdpProvider().getAllPolicyStatus(getPfDao(), policy); } @Override - public List<PdpPolicyStatus> getGroupPolicyStatus(@NonNull String groupName) - throws PfModelException { + public List<PdpPolicyStatus> getGroupPolicyStatus(@NonNull String groupName) throws PfModelException { assertInitialized(); return new PdpProvider().getGroupPolicyStatus(getPfDao(), groupName); } @Override - public void cudPolicyStatus(Collection<PdpPolicyStatus> createObjs, - Collection<PdpPolicyStatus> updateObjs, Collection<PdpPolicyStatus> deleteObjs) { + public void cudPolicyStatus(Collection<PdpPolicyStatus> createObjs, Collection<PdpPolicyStatus> updateObjs, + Collection<PdpPolicyStatus> deleteObjs) { assertInitialized(); new PdpProvider().cudPolicyStatus(getPfDao(), createObjs, updateObjs, deleteObjs); } diff --git a/models-provider/src/main/java/org/onap/policy/models/provider/impl/DummyPolicyModelsProviderImpl.java b/models-provider/src/main/java/org/onap/policy/models/provider/impl/DummyPolicyModelsProviderImpl.java index 0a9ea723f..1b91f07c6 100644 --- a/models-provider/src/main/java/org/onap/policy/models/provider/impl/DummyPolicyModelsProviderImpl.java +++ b/models-provider/src/main/java/org/onap/policy/models/provider/impl/DummyPolicyModelsProviderImpl.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2019-2020 Nordix Foundation. + * Copyright (C) 2019-2021 Nordix Foundation. * Copyright (C) 2019, 2021 AT&T Intellectual Property. All rights reserved. * Modifications Copyright (C) 2020 Bell Canada. All rights reserved. * ================================================================================ @@ -41,12 +41,11 @@ import org.onap.policy.models.pdp.concepts.PdpSubGroup; import org.onap.policy.models.provider.PolicyModelsProvider; import org.onap.policy.models.provider.PolicyModelsProviderParameters; import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifierOptVersion; +import org.onap.policy.models.tosca.authorative.concepts.ToscaEntityFilter; import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy; -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.authorative.concepts.ToscaTypedEntityFilter; /** * This class provides a dummy implementation of the Policy Models Provider for the ONAP Policy Framework. @@ -81,8 +80,8 @@ public class DummyPolicyModelsProviderImpl implements PolicyModelsProvider { } @Override - public List<ToscaServiceTemplate> getFilteredServiceTemplateList(@NonNull ToscaServiceTemplateFilter filter) - throws PfModelException { + public List<ToscaServiceTemplate> getFilteredServiceTemplateList( + @NonNull ToscaEntityFilter<ToscaServiceTemplate> filter) throws PfModelException { return new ArrayList<>(); } @@ -115,12 +114,13 @@ public class DummyPolicyModelsProviderImpl implements PolicyModelsProvider { } @Override - public ToscaServiceTemplate getFilteredPolicyTypes(ToscaPolicyTypeFilter filter) throws PfModelException { + public ToscaServiceTemplate getFilteredPolicyTypes(ToscaEntityFilter<ToscaPolicyType> filter) + throws PfModelException { return getDummyResponse("dummyimpl/DummyToscaPolicyTypeGetResponse.json"); } @Override - public List<ToscaPolicyType> getFilteredPolicyTypeList(ToscaPolicyTypeFilter filter) { + public List<ToscaPolicyType> getFilteredPolicyTypeList(ToscaEntityFilter<ToscaPolicyType> filter) { return new ArrayList<>(); } @@ -150,12 +150,13 @@ public class DummyPolicyModelsProviderImpl implements PolicyModelsProvider { } @Override - public ToscaServiceTemplate getFilteredPolicies(ToscaPolicyFilter filter) throws PfModelException { + public ToscaServiceTemplate getFilteredPolicies(ToscaTypedEntityFilter<ToscaPolicy> filter) + throws PfModelException { return getDummyResponse("dummyimpl/DummyToscaPolicyGetResponse.json"); } @Override - public List<ToscaPolicy> getFilteredPolicyList(ToscaPolicyFilter filter) throws PfModelException { + public List<ToscaPolicy> getFilteredPolicyList(ToscaTypedEntityFilter<ToscaPolicy> filter) throws PfModelException { return new ArrayList<>(); } @@ -249,7 +250,7 @@ public class DummyPolicyModelsProviderImpl implements PolicyModelsProvider { @Override public List<PdpPolicyStatus> getAllPolicyStatus(@NonNull ToscaConceptIdentifierOptVersion policy) - throws PfModelException { + throws PfModelException { // Not implemented return new ArrayList<>(); } @@ -262,7 +263,7 @@ public class DummyPolicyModelsProviderImpl implements PolicyModelsProvider { @Override public void cudPolicyStatus(Collection<PdpPolicyStatus> createObjs, Collection<PdpPolicyStatus> updateObjs, - Collection<PdpPolicyStatus> deleteObjs) { + Collection<PdpPolicyStatus> deleteObjs) { // Not implemented } |