summaryrefslogtreecommitdiffstats
path: root/models-provider/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'models-provider/src/main/java')
-rw-r--r--models-provider/src/main/java/org/onap/policy/models/provider/PolicyModelsProvider.java49
-rw-r--r--models-provider/src/main/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderImpl.java29
-rw-r--r--models-provider/src/main/java/org/onap/policy/models/provider/impl/DummyPolicyModelsProviderImpl.java32
3 files changed, 58 insertions, 52 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 9bc49837e..103d761df 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
@@ -20,18 +20,21 @@
package org.onap.policy.models.provider;
+import java.util.Map;
+
import lombok.NonNull;
import org.onap.policy.models.base.PfConceptKey;
import org.onap.policy.models.base.PfModelException;
-import org.onap.policy.models.pap.concepts.PdpGroups;
-import org.onap.policy.models.tosca.legacy.concepts.LegacyGuardPolicy;
+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;
/**
- * This interface describes the operations that are provided to users and components for reading
- * objects from and writing objects to the database.
+ * This interface describes the operations that are provided to users and components for reading objects from and
+ * writing objects to the database.
*
* @author Liam Fallon (liam.fallon@est.tech)
*/
@@ -46,9 +49,8 @@ public interface PolicyModelsProvider extends AutoCloseable {
/**
* Get policy types.
*
- * @param policyTypeKey the policy type key for the policy types to be retrieved. A null key
- * name returns all policy types. A null key version returns all versions of the policy
- * type name specified in the key.
+ * @param policyTypeKey the policy type key for the policy types to be retrieved. A null key name returns all policy
+ * types. A null key version returns all versions of the policy type name specified in the key.
* @return the policy types found
* @throws PfModelException on errors getting policy types
*/
@@ -57,8 +59,7 @@ public interface PolicyModelsProvider extends AutoCloseable {
/**
* Create policy types.
*
- * @param serviceTemplate the service template containing the definition of the policy types to
- * be created
+ * @param serviceTemplate the service template containing the definition of the policy types to be created
* @return the TOSCA service template containing the created policy types
* @throws PfModelException on errors creating policy types
*/
@@ -68,8 +69,7 @@ public interface PolicyModelsProvider extends AutoCloseable {
/**
* Create policy types.
*
- * @param serviceTemplate the service template containing the definition of the policy types to
- * be modified
+ * @param serviceTemplate the service template containing the definition of the policy types to be modified
* @return the TOSCA service template containing the modified policy types
* @throws PfModelException on errors updating policy types
*/
@@ -79,8 +79,8 @@ public interface PolicyModelsProvider extends AutoCloseable {
/**
* Delete policy types.
*
- * @param policyTypeKey the policy type key for the policy types to be deleted, if the version
- * of the key is null, all versions of the policy type are deleted.
+ * @param policyTypeKey the policy type key for the policy types to be deleted, if the version of the key is null,
+ * all versions of the policy type are deleted.
* @return the TOSCA service template containing the policy types that were deleted
* @throws PfModelException on errors deleting policy types
*/
@@ -89,8 +89,8 @@ public interface PolicyModelsProvider extends AutoCloseable {
/**
* Get policies.
*
- * @param policyKey the policy key for the policies to be retrieved. The parent name and version
- * must be specified. A null local name returns all policies for a parent policy type.
+ * @param policyKey the policy key for the policies to be retrieved. The parent name and version must be specified.
+ * A null local name returns all policies for a parent policy type.
* @return the policies found
* @throws PfModelException on errors getting policies
*/
@@ -99,8 +99,7 @@ public interface PolicyModelsProvider extends AutoCloseable {
/**
* Create policies.
*
- * @param serviceTemplate the service template containing the definitions of the new policies to
- * be created.
+ * @param serviceTemplate the service template containing the definitions of the new policies to be created.
* @return the TOSCA service template containing the policy types that were created
* @throws PfModelException on errors creating policies
*/
@@ -111,8 +110,7 @@ public interface PolicyModelsProvider extends AutoCloseable {
/**
* Update policies.
*
- * @param serviceTemplate the service template containing the definitions of the policies to be
- * updated.
+ * @param serviceTemplate the service template containing the definitions of the policies to be updated.
* @return the TOSCA service template containing the policies that were updated
* @throws PfModelException on errors updating policies
*/
@@ -173,7 +171,7 @@ public interface PolicyModelsProvider extends AutoCloseable {
* @return the policies found
* @throws PfModelException on errors getting policies
*/
- public LegacyGuardPolicy getGuardPolicy(@NonNull final String policyId) throws PfModelException;
+ public Map<String, LegacyGuardPolicyOutput> getGuardPolicy(@NonNull final String policyId) throws PfModelException;
/**
* Create legacy guard policy.
@@ -182,8 +180,8 @@ public interface PolicyModelsProvider extends AutoCloseable {
* @return the created policy
* @throws PfModelException on errors creating policies
*/
- public LegacyGuardPolicy createGuardPolicy(@NonNull final LegacyGuardPolicy legacyGuardPolicy)
- throws PfModelException;
+ public Map<String, LegacyGuardPolicyOutput> createGuardPolicy(
+ @NonNull final LegacyGuardPolicyInput legacyGuardPolicy) throws PfModelException;
/**
* Update legacy guard policy.
@@ -192,8 +190,8 @@ public interface PolicyModelsProvider extends AutoCloseable {
* @return the updated policy
* @throws PfModelException on errors updating policies
*/
- public LegacyGuardPolicy updateGuardPolicy(@NonNull final LegacyGuardPolicy legacyGuardPolicy)
- throws PfModelException;
+ public Map<String, LegacyGuardPolicyOutput> updateGuardPolicy(
+ @NonNull final LegacyGuardPolicyInput legacyGuardPolicy) throws PfModelException;
/**
* Delete legacy guard policy.
@@ -202,7 +200,8 @@ public interface PolicyModelsProvider extends AutoCloseable {
* @return the deleted policy
* @throws PfModelException on errors deleting policies
*/
- public LegacyGuardPolicy deleteGuardPolicy(@NonNull final String policyId) throws PfModelException;
+ public Map<String, LegacyGuardPolicyOutput> deleteGuardPolicy(@NonNull final String policyId)
+ throws PfModelException;
/**
* Get PDP groups.
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 43f75d2a9..078126243 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
@@ -23,6 +23,7 @@ package org.onap.policy.models.provider.impl;
import java.sql.Connection;
import java.sql.DriverManager;
import java.util.Base64;
+import java.util.Map;
import javax.ws.rs.core.Response;
@@ -35,11 +36,12 @@ import org.onap.policy.models.dao.DaoParameters;
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.pap.concepts.PdpGroups;
-import org.onap.policy.models.pap.provider.PapProvider;
+import org.onap.policy.models.pdp.concepts.PdpGroups;
+import org.onap.policy.models.pdp.provider.PdpProvider;
import org.onap.policy.models.provider.PolicyModelsProvider;
import org.onap.policy.models.provider.PolicyModelsProviderParameters;
-import org.onap.policy.models.tosca.legacy.concepts.LegacyGuardPolicy;
+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;
@@ -214,27 +216,28 @@ public class DatabasePolicyModelsProviderImpl implements PolicyModelsProvider {
}
@Override
- public LegacyGuardPolicy getGuardPolicy(@NonNull final String policyId) throws PfModelException {
+ public Map<String, LegacyGuardPolicyOutput> getGuardPolicy(@NonNull final String policyId) throws PfModelException {
assertInitilized();
return new LegacyProvider().getGuardPolicy(pfDao, policyId);
}
@Override
- public LegacyGuardPolicy createGuardPolicy(@NonNull final LegacyGuardPolicy legacyGuardPolicy)
- throws PfModelException {
+ public Map<String, LegacyGuardPolicyOutput> createGuardPolicy(
+ @NonNull final LegacyGuardPolicyInput legacyGuardPolicy) throws PfModelException {
assertInitilized();
return new LegacyProvider().createGuardPolicy(pfDao, legacyGuardPolicy);
}
@Override
- public LegacyGuardPolicy updateGuardPolicy(@NonNull final LegacyGuardPolicy legacyGuardPolicy)
- throws PfModelException {
+ public Map<String, LegacyGuardPolicyOutput> updateGuardPolicy(
+ @NonNull final LegacyGuardPolicyInput legacyGuardPolicy) throws PfModelException {
assertInitilized();
return new LegacyProvider().updateGuardPolicy(pfDao, legacyGuardPolicy);
}
@Override
- public LegacyGuardPolicy deleteGuardPolicy(@NonNull final String policyId) throws PfModelException {
+ public Map<String, LegacyGuardPolicyOutput> deleteGuardPolicy(@NonNull final String policyId)
+ throws PfModelException {
assertInitilized();
return new LegacyProvider().deleteGuardPolicy(pfDao, policyId);
}
@@ -242,25 +245,25 @@ public class DatabasePolicyModelsProviderImpl implements PolicyModelsProvider {
@Override
public PdpGroups getPdpGroups(@NonNull String pdpGroupFilter) throws PfModelException {
assertInitilized();
- return new PapProvider().getPdpGroups(pfDao, pdpGroupFilter);
+ return new PdpProvider().getPdpGroups(pfDao, pdpGroupFilter);
}
@Override
public PdpGroups createPdpGroups(@NonNull PdpGroups pdpGroups) throws PfModelException {
assertInitilized();
- return new PapProvider().createPdpGroups(pfDao, pdpGroups);
+ return new PdpProvider().createPdpGroups(pfDao, pdpGroups);
}
@Override
public PdpGroups updatePdpGroups(@NonNull PdpGroups pdpGroups) throws PfModelException {
assertInitilized();
- return new PapProvider().updatePdpGroups(pfDao, pdpGroups);
+ return new PdpProvider().updatePdpGroups(pfDao, pdpGroups);
}
@Override
public PdpGroups deletePdpGroups(@NonNull String pdpGroupFilter) throws PfModelException {
assertInitilized();
- return new PapProvider().deletePdpGroups(pfDao, pdpGroupFilter);
+ return new PdpProvider().deletePdpGroups(pfDao, pdpGroupFilter);
}
/**
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 8d833a53d..36fb01c27 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
@@ -23,16 +23,20 @@ package org.onap.policy.models.provider.impl;
import com.google.gson.Gson;
+import java.util.HashMap;
+import java.util.Map;
+
import javax.ws.rs.core.Response;
import lombok.NonNull;
import org.onap.policy.common.utils.resources.ResourceUtils;
import org.onap.policy.models.base.PfConceptKey;
import org.onap.policy.models.base.PfModelException;
import org.onap.policy.models.base.PfModelRuntimeException;
-import org.onap.policy.models.pap.concepts.PdpGroups;
+import org.onap.policy.models.pdp.concepts.PdpGroups;
import org.onap.policy.models.provider.PolicyModelsProvider;
import org.onap.policy.models.provider.PolicyModelsProviderParameters;
-import org.onap.policy.models.tosca.legacy.concepts.LegacyGuardPolicy;
+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.serialization.ToscaServiceTemplateMessageBodyHandler;
@@ -49,8 +53,7 @@ public class DummyPolicyModelsProviderImpl implements PolicyModelsProvider {
*
* @param parameters the parameters for the provider
*/
- public DummyPolicyModelsProviderImpl(@NonNull final PolicyModelsProviderParameters parameters) {
- }
+ public DummyPolicyModelsProviderImpl(@NonNull final PolicyModelsProviderParameters parameters) {}
@Override
public void init() throws PfModelException {
@@ -130,25 +133,26 @@ public class DummyPolicyModelsProviderImpl implements PolicyModelsProvider {
}
@Override
- public LegacyGuardPolicy getGuardPolicy(@NonNull final String policyId) throws PfModelException {
- return new LegacyGuardPolicy();
+ public Map<String, LegacyGuardPolicyOutput> getGuardPolicy(@NonNull final String policyId) throws PfModelException {
+ return new HashMap<>();
}
@Override
- public LegacyGuardPolicy createGuardPolicy(@NonNull final LegacyGuardPolicy legacyGuardPolicy)
- throws PfModelException {
- return legacyGuardPolicy;
+ public Map<String, LegacyGuardPolicyOutput> createGuardPolicy(
+ @NonNull final LegacyGuardPolicyInput legacyGuardPolicy) throws PfModelException {
+ return new HashMap<>();
}
@Override
- public LegacyGuardPolicy updateGuardPolicy(@NonNull final LegacyGuardPolicy legacyGuardPolicy)
- throws PfModelException {
- return legacyGuardPolicy;
+ public Map<String, LegacyGuardPolicyOutput> updateGuardPolicy(
+ @NonNull final LegacyGuardPolicyInput legacyGuardPolicy) throws PfModelException {
+ return new HashMap<>();
}
@Override
- public LegacyGuardPolicy deleteGuardPolicy(@NonNull final String policyId) throws PfModelException {
- return new LegacyGuardPolicy();
+ public Map<String, LegacyGuardPolicyOutput> deleteGuardPolicy(@NonNull final String policyId)
+ throws PfModelException {
+ return new HashMap<>();
}
@Override