+ initializeExternalComponents();
+ }
+
+ /**
+ * This constructor creates a loop from a loop template.
+ *
+ * @param name The loop name
+ * @param loopTemplate The loop template from which a new loop instance must be created
+ */
+ public Loop(String name, LoopTemplate loopTemplate, ToscaConverterWithDictionarySupport toscaConverter) {
+ this(name, "");
+ this.setLoopTemplate(loopTemplate);
+ this.setModelService(loopTemplate.getModelService());
+ loopTemplate.getLoopElementModelsUsed().forEach(element -> {
+ if (LoopElementModel.MICRO_SERVICE_TYPE.equals(element.getLoopElementModel().getLoopElementType())) {
+ try {
+ this.addMicroServicePolicy((MicroServicePolicy) element.getLoopElementModel()
+ .createPolicyInstance(this, toscaConverter));
+ } catch (IOException e) {
+ logger.error("Exception caught when creating the microservice policy instance of the loop "
+ + "instance", e);
+ }
+ }
+ else if (LoopElementModel.OPERATIONAL_POLICY_TYPE
+ .equals(element.getLoopElementModel().getLoopElementType())) {
+ try {
+ this.addOperationalPolicy((OperationalPolicy) element.getLoopElementModel()
+ .createPolicyInstance(this, toscaConverter));
+ } catch (IOException e) {
+ logger.error("Exception caught when creating the operational policy instance of the loop instance",
+ e);
+ }
+ }
+ });