aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java
diff options
context:
space:
mode:
authorsebdet <sebastien.determe@intl.att.com>2020-02-27 11:43:51 -0800
committersebdet <sebastien.determe@intl.att.com>2020-02-27 11:43:51 -0800
commit95fc10c2f7db4ac8279e9eb595380b265e1614e8 (patch)
tree7d8c1f0dbcc94f4bb5e8587c2a59cc01ea0fa756 /src/main/java
parentd4cae4d8115445c4662ab9a1b71cccd8f3ddde20 (diff)
Standardize loop controller
Make all calls from camel to loop controller instead of the service to make things consistent. Issue-ID: CLAMP-647 Change-Id: I68524bd3d5bfbf5dd7a4acf6c59823df06fd4cd9 Signed-off-by: sebdet <sebastien.determe@intl.att.com>
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/org/onap/clamp/loop/LoopController.java23
-rw-r--r--src/main/java/org/onap/clamp/loop/LoopService.java10
2 files changed, 30 insertions, 3 deletions
diff --git a/src/main/java/org/onap/clamp/loop/LoopController.java b/src/main/java/org/onap/clamp/loop/LoopController.java
index 7b037da6d..2ad47a3c1 100644
--- a/src/main/java/org/onap/clamp/loop/LoopController.java
+++ b/src/main/java/org/onap/clamp/loop/LoopController.java
@@ -26,10 +26,8 @@ package org.onap.clamp.loop;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import com.google.gson.reflect.TypeToken;
-
import java.lang.reflect.Type;
import java.util.List;
-
import org.onap.clamp.clds.util.JsonUtils;
import org.onap.clamp.policy.microservice.MicroServicePolicy;
import org.onap.clamp.policy.operational.OperationalPolicy;
@@ -103,6 +101,27 @@ public class LoopController {
}
/**
+ * This method add an operational policy to a loop instance.
+ *
+ * @param loopName The loop name
+ * @param policyType The policy model type
+ * @param policyVersion The policy model version
+ * @return The loop modified
+ */
+ public Loop addOperationalPolicy(String loopName, String policyType, String policyVersion) {
+ return loopService.addOperationalPolicy(loopName,policyType,policyVersion);
+ }
+
+ /**
+ * This method deletes the loop.
+ *
+ * @param loopName The loop Name
+ */
+ public void deleteLoop(String loopName) {
+ loopService.deleteLoop(loopName);
+ }
+
+ /**
* Update one MicroService policy properties.
*
* @param loopName The loop name
diff --git a/src/main/java/org/onap/clamp/loop/LoopService.java b/src/main/java/org/onap/clamp/loop/LoopService.java
index 34be2038e..0be3132b0 100644
--- a/src/main/java/org/onap/clamp/loop/LoopService.java
+++ b/src/main/java/org/onap/clamp/loop/LoopService.java
@@ -102,8 +102,16 @@ public class LoopService {
loopsRepository.save(loop);
}
+ /**
+ * This method add an operational policy to a loop instance.
+ *
+ * @param loopName The loop name
+ * @param policyType The policy model type
+ * @param policyVersion The policy model version
+ * @return The loop modified
+ */
Loop addOperationalPolicy(String loopName, String policyType, String policyVersion) {
- Loop loop = findClosedLoopByName(loopName);
+ Loop loop = getLoop(loopName);
PolicyModel policyModel = policyModelsService.getPolicyModel(policyType, policyVersion);
if (policyModel == null) {
return null;