summaryrefslogtreecommitdiffstats
path: root/models-provider/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'models-provider/src/main')
-rw-r--r--models-provider/src/main/java/org/onap/policy/models/provider/PolicyModelsProvider.java18
-rw-r--r--models-provider/src/main/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderImpl.java21
-rw-r--r--models-provider/src/main/java/org/onap/policy/models/provider/impl/DummyPolicyModelsProviderImpl.java25
3 files changed, 33 insertions, 31 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 103d761df..e390a04f0 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
@@ -30,7 +30,7 @@ import org.onap.policy.models.pdp.concepts.PdpGroups;
import org.onap.policy.models.tosca.legacy.concepts.LegacyGuardPolicyInput;
import org.onap.policy.models.tosca.legacy.concepts.LegacyGuardPolicyOutput;
import org.onap.policy.models.tosca.legacy.concepts.LegacyOperationalPolicy;
-import org.onap.policy.models.tosca.simple.concepts.ToscaServiceTemplate;
+import org.onap.policy.models.tosca.simple.concepts.JpaToscaServiceTemplate;
/**
* This interface describes the operations that are provided to users and components for reading objects from and
@@ -54,7 +54,7 @@ public interface PolicyModelsProvider extends AutoCloseable {
* @return the policy types found
* @throws PfModelException on errors getting policy types
*/
- public ToscaServiceTemplate getPolicyTypes(@NonNull final PfConceptKey policyTypeKey) throws PfModelException;
+ public JpaToscaServiceTemplate getPolicyTypes(@NonNull final PfConceptKey policyTypeKey) throws PfModelException;
/**
* Create policy types.
@@ -63,7 +63,7 @@ public interface PolicyModelsProvider extends AutoCloseable {
* @return the TOSCA service template containing the created policy types
* @throws PfModelException on errors creating policy types
*/
- public ToscaServiceTemplate createPolicyTypes(@NonNull final ToscaServiceTemplate serviceTemplate)
+ public JpaToscaServiceTemplate createPolicyTypes(@NonNull final JpaToscaServiceTemplate serviceTemplate)
throws PfModelException;
/**
@@ -73,7 +73,7 @@ public interface PolicyModelsProvider extends AutoCloseable {
* @return the TOSCA service template containing the modified policy types
* @throws PfModelException on errors updating policy types
*/
- public ToscaServiceTemplate updatePolicyTypes(@NonNull final ToscaServiceTemplate serviceTemplate)
+ public JpaToscaServiceTemplate updatePolicyTypes(@NonNull final JpaToscaServiceTemplate serviceTemplate)
throws PfModelException;
/**
@@ -84,7 +84,7 @@ public interface PolicyModelsProvider extends AutoCloseable {
* @return the TOSCA service template containing the policy types that were deleted
* @throws PfModelException on errors deleting policy types
*/
- public ToscaServiceTemplate deletePolicyTypes(@NonNull final PfConceptKey policyTypeKey) throws PfModelException;
+ public JpaToscaServiceTemplate deletePolicyTypes(@NonNull final PfConceptKey policyTypeKey) throws PfModelException;
/**
* Get policies.
@@ -94,7 +94,7 @@ public interface PolicyModelsProvider extends AutoCloseable {
* @return the policies found
* @throws PfModelException on errors getting policies
*/
- public ToscaServiceTemplate getPolicies(@NonNull final PfConceptKey policyKey) throws PfModelException;
+ public JpaToscaServiceTemplate getPolicies(@NonNull final PfConceptKey policyKey) throws PfModelException;
/**
* Create policies.
@@ -103,7 +103,7 @@ public interface PolicyModelsProvider extends AutoCloseable {
* @return the TOSCA service template containing the policy types that were created
* @throws PfModelException on errors creating policies
*/
- public ToscaServiceTemplate createPolicies(@NonNull final ToscaServiceTemplate serviceTemplate)
+ public JpaToscaServiceTemplate createPolicies(@NonNull final JpaToscaServiceTemplate serviceTemplate)
throws PfModelException;
@@ -114,7 +114,7 @@ public interface PolicyModelsProvider extends AutoCloseable {
* @return the TOSCA service template containing the policies that were updated
* @throws PfModelException on errors updating policies
*/
- public ToscaServiceTemplate updatePolicies(@NonNull final ToscaServiceTemplate serviceTemplate)
+ public JpaToscaServiceTemplate updatePolicies(@NonNull final JpaToscaServiceTemplate serviceTemplate)
throws PfModelException;
/**
@@ -124,7 +124,7 @@ public interface PolicyModelsProvider extends AutoCloseable {
* @return the TOSCA service template containing the policy types that were deleted
* @throws PfModelException on errors deleting policies
*/
- public ToscaServiceTemplate deletePolicies(@NonNull final PfConceptKey policyKey) throws PfModelException;
+ public JpaToscaServiceTemplate deletePolicies(@NonNull final PfConceptKey policyKey) throws PfModelException;
/**
* Get legacy operational policy.
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 078126243..85c4d139c 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
@@ -37,14 +37,14 @@ import org.onap.policy.models.dao.PfDao;
import org.onap.policy.models.dao.PfDaoFactory;
import org.onap.policy.models.dao.impl.DefaultPfDao;
import org.onap.policy.models.pdp.concepts.PdpGroups;
-import org.onap.policy.models.pdp.provider.PdpProvider;
+import org.onap.policy.models.pdp.persistence.provider.PdpProvider;
import org.onap.policy.models.provider.PolicyModelsProvider;
import org.onap.policy.models.provider.PolicyModelsProviderParameters;
import org.onap.policy.models.tosca.legacy.concepts.LegacyGuardPolicyInput;
import org.onap.policy.models.tosca.legacy.concepts.LegacyGuardPolicyOutput;
import org.onap.policy.models.tosca.legacy.concepts.LegacyOperationalPolicy;
import org.onap.policy.models.tosca.legacy.provider.LegacyProvider;
-import org.onap.policy.models.tosca.simple.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;
@@ -138,53 +138,54 @@ public class DatabasePolicyModelsProviderImpl implements PolicyModelsProvider {
}
@Override
- public ToscaServiceTemplate getPolicyTypes(@NonNull final PfConceptKey policyTypeKey) throws PfModelException {
+ public JpaToscaServiceTemplate getPolicyTypes(@NonNull final PfConceptKey policyTypeKey) throws PfModelException {
assertInitilized();
return new SimpleToscaProvider().getPolicyTypes(pfDao, policyTypeKey);
}
@Override
- public ToscaServiceTemplate createPolicyTypes(@NonNull final ToscaServiceTemplate serviceTemplate)
+ public JpaToscaServiceTemplate createPolicyTypes(@NonNull final JpaToscaServiceTemplate serviceTemplate)
throws PfModelException {
assertInitilized();
return new SimpleToscaProvider().createPolicyTypes(pfDao, serviceTemplate);
}
@Override
- public ToscaServiceTemplate updatePolicyTypes(@NonNull final ToscaServiceTemplate serviceTemplate)
+ public JpaToscaServiceTemplate updatePolicyTypes(@NonNull final JpaToscaServiceTemplate serviceTemplate)
throws PfModelException {
assertInitilized();
return new SimpleToscaProvider().updatePolicyTypes(pfDao, serviceTemplate);
}
@Override
- public ToscaServiceTemplate deletePolicyTypes(@NonNull final PfConceptKey policyTypeKey) throws PfModelException {
+ public JpaToscaServiceTemplate deletePolicyTypes(@NonNull final PfConceptKey policyTypeKey)
+ throws PfModelException {
assertInitilized();
return new SimpleToscaProvider().deletePolicyTypes(pfDao, policyTypeKey);
}
@Override
- public ToscaServiceTemplate getPolicies(@NonNull final PfConceptKey policyKey) throws PfModelException {
+ public JpaToscaServiceTemplate getPolicies(@NonNull final PfConceptKey policyKey) throws PfModelException {
assertInitilized();
return new SimpleToscaProvider().getPolicies(pfDao, policyKey);
}
@Override
- public ToscaServiceTemplate createPolicies(@NonNull final ToscaServiceTemplate serviceTemplate)
+ public JpaToscaServiceTemplate createPolicies(@NonNull final JpaToscaServiceTemplate serviceTemplate)
throws PfModelException {
assertInitilized();
return new SimpleToscaProvider().createPolicies(pfDao, serviceTemplate);
}
@Override
- public ToscaServiceTemplate updatePolicies(@NonNull final ToscaServiceTemplate serviceTemplate)
+ public JpaToscaServiceTemplate updatePolicies(@NonNull final JpaToscaServiceTemplate serviceTemplate)
throws PfModelException {
assertInitilized();
return new SimpleToscaProvider().updatePolicies(pfDao, serviceTemplate);
}
@Override
- public ToscaServiceTemplate deletePolicies(@NonNull final PfConceptKey policyKey) throws PfModelException {
+ public JpaToscaServiceTemplate deletePolicies(@NonNull final PfConceptKey policyKey) throws PfModelException {
assertInitilized();
return new SimpleToscaProvider().deletePolicies(pfDao, policyKey);
}
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 36fb01c27..e37b1d632 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
@@ -38,7 +38,7 @@ import org.onap.policy.models.provider.PolicyModelsProviderParameters;
import org.onap.policy.models.tosca.legacy.concepts.LegacyGuardPolicyInput;
import org.onap.policy.models.tosca.legacy.concepts.LegacyGuardPolicyOutput;
import org.onap.policy.models.tosca.legacy.concepts.LegacyOperationalPolicy;
-import org.onap.policy.models.tosca.simple.concepts.ToscaServiceTemplate;
+import org.onap.policy.models.tosca.simple.concepts.JpaToscaServiceTemplate;
import org.onap.policy.models.tosca.simple.serialization.ToscaServiceTemplateMessageBodyHandler;
/**
@@ -66,46 +66,47 @@ public class DummyPolicyModelsProviderImpl implements PolicyModelsProvider {
}
@Override
- public ToscaServiceTemplate getPolicyTypes(@NonNull final PfConceptKey policyTypeKey) throws PfModelException {
+ public JpaToscaServiceTemplate getPolicyTypes(@NonNull final PfConceptKey policyTypeKey) throws PfModelException {
return getDummyResponse("dummyimpl/DummyToscaPolicyTypeGetResponse.json");
}
@Override
- public ToscaServiceTemplate createPolicyTypes(@NonNull final ToscaServiceTemplate serviceTemplate)
+ public JpaToscaServiceTemplate createPolicyTypes(@NonNull final JpaToscaServiceTemplate serviceTemplate)
throws PfModelException {
return serviceTemplate;
}
@Override
- public ToscaServiceTemplate updatePolicyTypes(@NonNull final ToscaServiceTemplate serviceTemplate)
+ public JpaToscaServiceTemplate updatePolicyTypes(@NonNull final JpaToscaServiceTemplate serviceTemplate)
throws PfModelException {
return serviceTemplate;
}
@Override
- public ToscaServiceTemplate deletePolicyTypes(@NonNull final PfConceptKey policyTypeKey) throws PfModelException {
+ public JpaToscaServiceTemplate deletePolicyTypes(@NonNull final PfConceptKey policyTypeKey)
+ throws PfModelException {
return getDummyResponse("dummyimpl/DummyToscaPolicyTypeDeleteResponse.json");
}
@Override
- public ToscaServiceTemplate getPolicies(@NonNull final PfConceptKey policyKey) throws PfModelException {
+ public JpaToscaServiceTemplate getPolicies(@NonNull final PfConceptKey policyKey) throws PfModelException {
return getDummyResponse("dummyimpl/DummyToscaPolicyGetResponse.json");
}
@Override
- public ToscaServiceTemplate createPolicies(@NonNull final ToscaServiceTemplate serviceTemplate)
+ public JpaToscaServiceTemplate createPolicies(@NonNull final JpaToscaServiceTemplate serviceTemplate)
throws PfModelException {
return serviceTemplate;
}
@Override
- public ToscaServiceTemplate updatePolicies(@NonNull final ToscaServiceTemplate serviceTemplate)
+ public JpaToscaServiceTemplate updatePolicies(@NonNull final JpaToscaServiceTemplate serviceTemplate)
throws PfModelException {
return serviceTemplate;
}
@Override
- public ToscaServiceTemplate deletePolicies(@NonNull final PfConceptKey policyKey) throws PfModelException {
+ public JpaToscaServiceTemplate deletePolicies(@NonNull final PfConceptKey policyKey) throws PfModelException {
return getDummyResponse("dummyimpl/DummyToscaPolicyDeleteResponse.json");
}
@@ -181,12 +182,12 @@ public class DummyPolicyModelsProviderImpl implements PolicyModelsProvider {
* @param fileName the file name containing the dummy response
* @return the ToscaServiceTemplate with the dummy response
*/
- protected ToscaServiceTemplate getDummyResponse(@NonNull final String fileName) {
+ protected JpaToscaServiceTemplate getDummyResponse(@NonNull final String fileName) {
Gson gson = new ToscaServiceTemplateMessageBodyHandler().getGson();
- ToscaServiceTemplate serviceTemplate;
+ JpaToscaServiceTemplate serviceTemplate;
try {
- serviceTemplate = gson.fromJson(ResourceUtils.getResourceAsString(fileName), ToscaServiceTemplate.class);
+ serviceTemplate = gson.fromJson(ResourceUtils.getResourceAsString(fileName), JpaToscaServiceTemplate.class);
if (serviceTemplate == null) {
throw new PfModelException(Response.Status.INTERNAL_SERVER_ERROR, "error reading specified file");
}