+ /**
+ * Create an operational policy from a loop element model.
+ *
+ * @param loop The parent loop
+ * @param service The loop service
+ * @param loopElementModel The loop element model
+ * @param toscaConverter The tosca converter that must be used to create the Json representation
+ */
+ public OperationalPolicy(Loop loop, Service service, LoopElementModel loopElementModel,
+ ToscaConverterWithDictionarySupport toscaConverter) {
+ this(Policy.generatePolicyName("OPERATIONAL", service.getName(), service.getVersion(),
+ loopElementModel.getPolicyModels().first().getPolicyAcronym() + '_'
+ + loopElementModel.getPolicyModels().first().getVersion(),
+ RandomStringUtils.randomAlphanumeric(3)), new JsonObject(),
+ new JsonObject(), loopElementModel.getPolicyModels().first(), loopElementModel, null, null);
+ this.setLoop(loop);
+ this.updateJsonRepresentation(toscaConverter, service);
+ }
+
+ /**
+ * Create an operational policy from a policy model.
+ *
+ * @param loop The parent loop
+ * @param service The loop service
+ * @param policyModel The policy model
+ * @param toscaConverter The tosca converter that must be used to create the Json representation
+ * @throws IOException In case of issues with the legacy files (generated from resource files
+ */
+ public OperationalPolicy(Loop loop, Service service, PolicyModel policyModel,
+ ToscaConverterWithDictionarySupport toscaConverter) throws IOException {
+ this(Policy.generatePolicyName("OPERATIONAL", service.getName(), service.getVersion(),
+ policyModel.getPolicyAcronym() + '_' + policyModel.getVersion(),
+ RandomStringUtils.randomAlphanumeric(3)),
+ new JsonObject(),
+ new JsonObject(), policyModel, null, null, null);
+ this.setLoop(loop);
+ this.updateJsonRepresentation(toscaConverter, service);