+ /**
+ * The constructor that creates the json representation from the policyTosca
+ * using the ToscaYamlToJsonConvertor.
+ *
+ * @param name The name of the MicroService
+ * @param policyModel The policy model of the MicroService
+ * @param shared The flag indicate whether the MicroService is shared
+ */
+ public MicroServicePolicy(String name, PolicyModel policyModel, Boolean shared, LoopElementModel loopElementModel) {
+ this.name = name;
+ this.setPolicyModel(policyModel);
+ this.shared = shared;
+ try {
+ this.setJsonRepresentation(Policy.generateJsonRepresentationFromToscaModel(policyModel.getPolicyModelTosca(),policyModel.getPolicyModelType()));
+ } catch (UnknownComponentException | NullPointerException | IOException e) {
+ logger.error("Unable to generate the microservice policy Schema ... ", e);
+ this.setJsonRepresentation(new JsonObject());
+ }
+ this.setLoopElementModel(loopElementModel);
+ }
+
+ /**
+ * The constructor that does not make use of ToscaYamlToJsonConvertor but take
+ * the jsonRepresentation instead.
+ *
+ * @param name The name of the MicroService
+ * @param policyModel The policy model type of the MicroService
+ * @param shared The flag indicate whether the MicroService is
+ * shared
+ * @param jsonRepresentation The UI representation in json format
+ * @param loopElementModel The loop element model from which this instance should be created
+ * @param pdpGroup The Pdp Group info
+ * @param pdpSubgroup The Pdp Subgrouop info
+ */
+ public MicroServicePolicy(String name, PolicyModel policyModel, Boolean shared,
+ JsonObject jsonRepresentation, LoopElementModel loopElementModel, String pdpGroup, String pdpSubgroup) {