aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/onap/clamp/clds/client/req/policy/PolicyClient.java21
1 files changed, 7 insertions, 14 deletions
diff --git a/src/main/java/org/onap/clamp/clds/client/req/policy/PolicyClient.java b/src/main/java/org/onap/clamp/clds/client/req/policy/PolicyClient.java
index 965c90f89..c88489190 100644
--- a/src/main/java/org/onap/clamp/clds/client/req/policy/PolicyClient.java
+++ b/src/main/java/org/onap/clamp/clds/client/req/policy/PolicyClient.java
@@ -434,18 +434,7 @@ public class PolicyClient {
* @return The response message from Policy
*/
public String deleteMicrosService(ModelProperties prop) {
- String deletePolicyResponse = "";
- try {
- String policyNamePrefix = refProp.getStringValue(POLICY_MS_NAME_PREFIX_PROPERTY_NAME);
- if (checkPolicyExists(prop, policyNamePrefix, null)) {
- String policyType = refProp.getStringValue(POLICY_MSTYPE_PROPERTY_NAME);
- deletePolicyResponse = deletePolicy(prop, policyType, null);
- }
- } catch (Exception e) {
- logger.error("Exception occurred during policy communication", e);
- throw new PolicyClientException("Exception while communicating with Policy", e);
- }
- return deletePolicyResponse;
+ return findAndDelete(prop, POLICY_MS_NAME_PREFIX_PROPERTY_NAME, POLICY_MSTYPE_PROPERTY_NAME);
}
/**
@@ -488,11 +477,15 @@ public class PolicyClient {
* @return The response message from policy
*/
public String deleteBrms(ModelProperties prop) {
+ return findAndDelete(prop, POLICY_OP_NAME_PREFIX_PROPERTY_NAME, POLICY_OP_TYPE_PROPERTY_NAME);
+ }
+
+ private String findAndDelete(ModelProperties prop, String policyPrefixProperty, String policyTypeProperty) {
String deletePolicyResponse = "";
try {
- String policyNamePrefix = refProp.getStringValue(POLICY_OP_NAME_PREFIX_PROPERTY_NAME);
+ String policyNamePrefix = refProp.getStringValue(policyPrefixProperty);
if (checkPolicyExists(prop, policyNamePrefix, null)) {
- String policyType = refProp.getStringValue(POLICY_OP_TYPE_PROPERTY_NAME);
+ String policyType = refProp.getStringValue(policyTypeProperty);
deletePolicyResponse = deletePolicy(prop, policyType, null);
}
} catch (Exception e) {