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);
+ }
}
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) {