diff options
author | Sébastien Determe <sebastien.determe@intl.att.com> | 2020-04-21 12:27:17 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2020-04-21 12:27:17 +0000 |
commit | 8b9918e7e3b1398ece5470f36be1d9dd13e29bee (patch) | |
tree | 8d2607bf1a90a8b32bc2e3e65832453d9d030348 /src/main | |
parent | dcfbed79c6da8b9c737c979b9a0410d37142499d (diff) | |
parent | c65613938d30565d4dc913fbf2d48002390119d3 (diff) |
Merge "Prevent adding same type of Op policy"
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/org/onap/clamp/loop/LoopService.java | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/main/java/org/onap/clamp/loop/LoopService.java b/src/main/java/org/onap/clamp/loop/LoopService.java index ca3681b62..3f568a331 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<OperationalPolicy> 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; } |