X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fonap%2Fclamp%2Floop%2FLoopService.java;h=3f568a331e147eb6af15a0facd11b60a6f443b8a;hb=8b9918e7e3b1398ece5470f36be1d9dd13e29bee;hp=ca3681b6201c70e2fc59dec3080e5ba1ecdb0feb;hpb=dcfbed79c6da8b9c737c979b9a0410d37142499d;p=clamp.git diff --git a/src/main/java/org/onap/clamp/loop/LoopService.java b/src/main/java/org/onap/clamp/loop/LoopService.java index ca3681b6..3f568a33 100644 --- a/src/main/java/org/onap/clamp/loop/LoopService.java +++ b/src/main/java/org/onap/clamp/loop/LoopService.java @@ -118,6 +118,12 @@ public class LoopService { Loop addOperationalPolicy(String loopName, String policyType, String policyVersion) throws IOException { Loop loop = getLoop(loopName); PolicyModel policyModel = policyModelsService.getPolicyModel(policyType, policyVersion); + Set opPolicySet = loop.getOperationalPolicies(); + for (OperationalPolicy opPolicy : opPolicySet) { + if (opPolicy.getPolicyModel().equals(policyModel)) { + throw new IllegalArgumentException("This type of Operational Policy is already added to the loop. Please choose another one."); + } + } if (policyModel == null) { return null; }