summaryrefslogtreecommitdiffstats
path: root/models-provider/src/main/java
diff options
context:
space:
mode:
authorliamfallon <liam.fallon@est.tech>2019-05-21 16:11:39 +0000
committerliamfallon <liam.fallon@est.tech>2019-05-21 16:11:39 +0000
commitd5ed712cf50bcf270fed8cd597d78ff4ff9370a0 (patch)
tree2b5e7a828df7aa5316630c45b82cc5d9aa61767f /models-provider/src/main/java
parent3b10bf7dbdc63d0a2424af34ee3c0d18087e6b91 (diff)
Add version on legacy get/delete
Issue-ID: POLICY-1777 Change-Id: I5b07ad1acdb4a614a50cb15978130c19bc5786f7 Signed-off-by: liamfallon <liam.fallon@est.tech>
Diffstat (limited to 'models-provider/src/main/java')
-rw-r--r--models-provider/src/main/java/org/onap/policy/models/provider/PolicyModelsProvider.java21
-rw-r--r--models-provider/src/main/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderImpl.java24
-rw-r--r--models-provider/src/main/java/org/onap/policy/models/provider/impl/DummyPolicyModelsProviderImpl.java12
3 files changed, 35 insertions, 22 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 a7d414533..9b494d1ab 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
@@ -200,11 +200,13 @@ public interface PolicyModelsProvider extends AutoCloseable {
/**
* Get legacy operational policy.
*
- * @param policyId ID of the policy.
+ * @param policyId ID of the policy
+ * @param policyVersion version of the policy, set to null to get the latest policy
* @return the policies found
* @throws PfModelException on errors getting policies
*/
- public LegacyOperationalPolicy getOperationalPolicy(@NonNull final String policyId) throws PfModelException;
+ public LegacyOperationalPolicy getOperationalPolicy(@NonNull final String policyId, final String policyVersion)
+ throws PfModelException;
/**
* Create legacy operational policy.
@@ -230,19 +232,23 @@ public interface PolicyModelsProvider extends AutoCloseable {
* Delete legacy operational policy.
*
* @param policyId ID of the policy.
+ * @param policyVersion version of the policy, set to null to get the latest policy
* @return the deleted policy
* @throws PfModelException on errors deleting policies
*/
- public LegacyOperationalPolicy deleteOperationalPolicy(@NonNull final String policyId) throws PfModelException;
+ public LegacyOperationalPolicy deleteOperationalPolicy(@NonNull final String policyId,
+ @NonNull final String policyVersion) throws PfModelException;
/**
* Get legacy guard policy.
*
- * @param policyId ID of the policy.
+ * @param policyId ID of the policy
+ * @param policyVersion version of the policy, set to null to get the latest policy
* @return the policies found
* @throws PfModelException on errors getting policies
*/
- public Map<String, LegacyGuardPolicyOutput> getGuardPolicy(@NonNull final String policyId) throws PfModelException;
+ public Map<String, LegacyGuardPolicyOutput> getGuardPolicy(@NonNull final String policyId,
+ final String policyVersion) throws PfModelException;
/**
* Create legacy guard policy.
@@ -268,11 +274,12 @@ public interface PolicyModelsProvider extends AutoCloseable {
* Delete legacy guard policy.
*
* @param policyId ID of the policy.
+ * @param policyVersion version of the policy, set to null to get the latest policy
* @return the deleted policy
* @throws PfModelException on errors deleting policies
*/
- public Map<String, LegacyGuardPolicyOutput> deleteGuardPolicy(@NonNull final String policyId)
- throws PfModelException;
+ public Map<String, LegacyGuardPolicyOutput> deleteGuardPolicy(@NonNull final String policyId,
+ @NonNull final String policyVersion) 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 a6e8f325b..af1a6ca3b 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
@@ -231,9 +231,10 @@ public class DatabasePolicyModelsProviderImpl implements PolicyModelsProvider {
}
@Override
- public LegacyOperationalPolicy getOperationalPolicy(@NonNull final String policyId) throws PfModelException {
+ public LegacyOperationalPolicy getOperationalPolicy(@NonNull final String policyId, final String policyVersion)
+ throws PfModelException {
assertInitilized();
- return new LegacyProvider().getOperationalPolicy(pfDao, policyId);
+ return new LegacyProvider().getOperationalPolicy(pfDao, policyId, policyVersion);
}
@Override
@@ -251,15 +252,17 @@ public class DatabasePolicyModelsProviderImpl implements PolicyModelsProvider {
}
@Override
- public LegacyOperationalPolicy deleteOperationalPolicy(@NonNull final String policyId) throws PfModelException {
+ public LegacyOperationalPolicy deleteOperationalPolicy(@NonNull final String policyId,
+ @NonNull final String policyVersion) throws PfModelException {
assertInitilized();
- return new LegacyProvider().deleteOperationalPolicy(pfDao, policyId);
+ return new LegacyProvider().deleteOperationalPolicy(pfDao, policyId, policyVersion);
}
@Override
- public Map<String, LegacyGuardPolicyOutput> getGuardPolicy(@NonNull final String policyId) throws PfModelException {
+ public Map<String, LegacyGuardPolicyOutput> getGuardPolicy(@NonNull final String policyId,
+ final String policyVersion) throws PfModelException {
assertInitilized();
- return new LegacyProvider().getGuardPolicy(pfDao, policyId);
+ return new LegacyProvider().getGuardPolicy(pfDao, policyId, policyVersion);
}
@Override
@@ -277,10 +280,10 @@ public class DatabasePolicyModelsProviderImpl implements PolicyModelsProvider {
}
@Override
- public Map<String, LegacyGuardPolicyOutput> deleteGuardPolicy(@NonNull final String policyId)
- throws PfModelException {
+ public Map<String, LegacyGuardPolicyOutput> deleteGuardPolicy(@NonNull final String policyId,
+ @NonNull final String policyVersion) throws PfModelException {
assertInitilized();
- return new LegacyProvider().deleteGuardPolicy(pfDao, policyId);
+ return new LegacyProvider().deleteGuardPolicy(pfDao, policyId, policyVersion);
}
@Override
@@ -336,8 +339,7 @@ public class DatabasePolicyModelsProviderImpl implements PolicyModelsProvider {
public void updatePdpStatistics(@NonNull final String pdpGroupName, @NonNull final String pdpType,
@NonNull final String pdpInstanceId, @NonNull final PdpStatistics pdpStatistics) throws PfModelException {
assertInitilized();
- new PdpProvider().updatePdpStatistics(pfDao, pdpGroupName, pdpType, pdpInstanceId,
- pdpStatistics);
+ new PdpProvider().updatePdpStatistics(pfDao, pdpGroupName, pdpType, pdpInstanceId, pdpStatistics);
}
/**
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 9b1ca7669..afa4277cb 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
@@ -144,7 +144,8 @@ public class DummyPolicyModelsProviderImpl implements PolicyModelsProvider {
@Override
- public LegacyOperationalPolicy getOperationalPolicy(final String policyId) throws PfModelException {
+ public LegacyOperationalPolicy getOperationalPolicy(final String policyId, final String policyVersion)
+ throws PfModelException {
return new LegacyOperationalPolicy();
}
@@ -161,12 +162,14 @@ public class DummyPolicyModelsProviderImpl implements PolicyModelsProvider {
}
@Override
- public LegacyOperationalPolicy deleteOperationalPolicy(final String policyId) throws PfModelException {
+ public LegacyOperationalPolicy deleteOperationalPolicy(final String policyId, final String policyVersion)
+ throws PfModelException {
return new LegacyOperationalPolicy();
}
@Override
- public Map<String, LegacyGuardPolicyOutput> getGuardPolicy(final String policyId) throws PfModelException {
+ public Map<String, LegacyGuardPolicyOutput> getGuardPolicy(final String policyId, final String policyVersion)
+ throws PfModelException {
return new HashMap<>();
}
@@ -183,7 +186,8 @@ public class DummyPolicyModelsProviderImpl implements PolicyModelsProvider {
}
@Override
- public Map<String, LegacyGuardPolicyOutput> deleteGuardPolicy(final String policyId) throws PfModelException {
+ public Map<String, LegacyGuardPolicyOutput> deleteGuardPolicy(final String policyId, final String policyVersion)
+ throws PfModelException {
return new HashMap<>();
}