+ /**
+ * 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,policyModel,shared,JsonUtils.GSON_JPA_MODEL
+ .fromJson(new ToscaYamlToJsonConvertor().parseToscaYaml(policyModel.getPolicyModelTosca(),
+ policyModel.getPolicyModelType()), JsonObject.class),loopElementModel, null, null);
+ }
+
+ private JsonObject createJsonFromPolicyTosca() {
+ Map<String, Object> map = new Yaml().load(this.getPolicyModel().getPolicyModelTosca());
+ JSONObject jsonObject = new JSONObject(map);
+ return new Gson().fromJson(jsonObject.toString(), JsonObject.class);
+ }
+
+ /**
+ * 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) {