From 95fc10c2f7db4ac8279e9eb595380b265e1614e8 Mon Sep 17 00:00:00 2001 From: sebdet Date: Thu, 27 Feb 2020 11:43:51 -0800 Subject: 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 --- .../java/org/onap/clamp/loop/LoopController.java | 23 ++++++++++++++++++++-- src/main/java/org/onap/clamp/loop/LoopService.java | 10 +++++++++- 2 files changed, 30 insertions(+), 3 deletions(-) (limited to 'src/main/java/org/onap') 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; @@ -102,6 +100,27 @@ public class LoopController { return loopService.updateAndSaveGlobalPropertiesJson(loopName, globalProperties); } + /** + * 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. * 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; -- cgit 1.2.3-korg