diff options
author | sebdet <sebastien.determe@intl.att.com> | 2020-02-27 11:43:51 -0800 |
---|---|---|
committer | sebdet <sebastien.determe@intl.att.com> | 2020-02-27 11:43:51 -0800 |
commit | 95fc10c2f7db4ac8279e9eb595380b265e1614e8 (patch) | |
tree | 7d8c1f0dbcc94f4bb5e8587c2a59cc01ea0fa756 | |
parent | d4cae4d8115445c4662ab9a1b71cccd8f3ddde20 (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>
-rw-r--r-- | src/main/java/org/onap/clamp/loop/LoopController.java | 23 | ||||
-rw-r--r-- | src/main/java/org/onap/clamp/loop/LoopService.java | 10 | ||||
-rw-r--r-- | src/main/resources/clds/camel/rest/clamp-api-v2.xml | 4 |
3 files changed, 32 insertions, 5 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; diff --git a/src/main/resources/clds/camel/rest/clamp-api-v2.xml b/src/main/resources/clds/camel/rest/clamp-api-v2.xml index 280b808c3..3bcfc06bb 100644 --- a/src/main/resources/clds/camel/rest/clamp-api-v2.xml +++ b/src/main/resources/clds/camel/rest/clamp-api-v2.xml @@ -502,7 +502,7 @@ </split> </split> <to - uri="bean:org.onap.clamp.loop.log.LoopService?method=deleteLoop(${header.loopName})" /> + uri="bean:org.onap.clamp.loop.log.LoopController?method=deleteLoop(${header.loopName})" /> <log loggingLevel="INFO" message="DELETE request successfully executed for loop: ${header.loopName}" /> <to @@ -585,7 +585,7 @@ uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('ADD OperationalPolicy request','INFO',${exchangeProperty[loopObject]})" /> <doTry> <to - uri="bean:org.onap.clamp.loop.LoopService?method=addOperationalPolicy(${loopName},${policyType},${policyVersion})" /> + uri="bean:org.onap.clamp.loop.LoopController?method=addOperationalPolicy(${loopName},${policyType},${policyVersion})" /> <to uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('ADD OperationalPolicy request successfully executed','INFO',${exchangeProperty[loopObject]})" /> |