Merge "Add template and tosca model entities and repositories"
authorSébastien Determe <sebastien.determe@intl.att.com>
Thu, 16 Jan 2020 13:38:31 +0000 (13:38 +0000)
committerGerrit Code Review <gerrit@onap.org>
Thu, 16 Jan 2020 13:38:31 +0000 (13:38 +0000)
1  2 
src/main/java/org/onap/clamp/loop/LoopService.java
src/main/java/org/onap/clamp/policy/operational/OperationalPolicy.java

@@@ -109,22 -103,6 +103,22 @@@ public class LoopService 
  
      private Loop findClosedLoopByName(String loopName) {
          return loopsRepository.findById(loopName)
-             .orElseThrow(() -> new EntityNotFoundException("Couldn't find closed loop named: " + loopName));
+                 .orElseThrow(() -> new EntityNotFoundException("Couldn't find closed loop named: " + loopName));
      }
 +
 +    /**
 +    * Api to refresh the Operational Policy UI window.
 +    * 
 +    * @param loopName The loop Name
 +    * @return The refreshed loop object
 +    */
 +    public Loop refreshOpPolicyJsonRepresentation(String loopName) {
 +        Loop loop = findClosedLoopByName(loopName);
 +        Set<OperationalPolicy> policyList = loop.getOperationalPolicies();
 +        for (OperationalPolicy policy : policyList) {
 +            policy.updateJsonRepresentation();
 +        }
 +        loop.setOperationalPolicies(policyList);
 +        return loopsRepository.save(loop);
 +    }
  }
@@@ -137,9 -145,36 +145,36 @@@ public class OperationalPolicy implemen
          this.configurationsJson = configurationsJson;
      }
  
+     /**
+      * policyModel getter.
+      * 
+      * @return the policyModel
+      */
+     public PolicyModel getPolicyModel() {
+         return policyModel;
+     }
+     /**
+      * policyModel setter.
+      * 
+      * @param policyModel the policyModel to set
+      */
+     public void setPolicyModel(PolicyModel policyModel) {
+         this.policyModel = policyModel;
+     }
+     /**
+      * name setter.
+      * 
+      * @param name the name to set
+      */
+     public void setName(String name) {
+         this.name = name;
+     }
      @Override
      public JsonObject getJsonRepresentation() {
 -         return jsonRepresentation;
 +        return jsonRepresentation;
      }
  
      void setJsonRepresentation(JsonObject jsonRepresentation) {