Add info in the SVG
[clamp.git] / src / main / java / org / onap / clamp / loop / LoopService.java
index ca3681b..5f08228 100644 (file)
@@ -118,6 +118,13 @@ 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;
         }