From: Sébastien Determe Date: Thu, 16 Jan 2020 13:38:31 +0000 (+0000) Subject: Merge "Add template and tosca model entities and repositories" X-Git-Tag: 6.0.0~11^2~242 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=5dfa4b58906921dea2aab38d20d761f460f49964;p=policy%2Fclamp.git Merge "Add template and tosca model entities and repositories" --- 5dfa4b58906921dea2aab38d20d761f460f49964 diff --cc src/main/java/org/onap/clamp/loop/LoopService.java index b18c38490,85e24cd00..e52029662 --- a/src/main/java/org/onap/clamp/loop/LoopService.java +++ b/src/main/java/org/onap/clamp/loop/LoopService.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 policyList = loop.getOperationalPolicies(); + for (OperationalPolicy policy : policyList) { + policy.updateJsonRepresentation(); + } + loop.setOperationalPolicies(policyList); + return loopsRepository.save(loop); + } } diff --cc src/main/java/org/onap/clamp/policy/operational/OperationalPolicy.java index df7e27bf3,e8bf4a655..d9e8a57d6 --- a/src/main/java/org/onap/clamp/policy/operational/OperationalPolicy.java +++ b/src/main/java/org/onap/clamp/policy/operational/OperationalPolicy.java @@@ -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) {