+ private JsonObject generateJsonRepresentation(PolicyModel policyModel) {
+ JsonObject jsonReturned = new JsonObject();
+ if (policyModel == null) {
+ return new JsonObject();
+ }
+ try {
+ if (isLegacy()) {
+ // Op policy Legacy case
+ LegacyOperationalPolicy.preloadConfiguration(jsonReturned, loop);
+ this.setJsonRepresentation(
+ OperationalPolicyRepresentationBuilder.generateOperationalPolicySchema(loop.getModelService()));
+ } else {
+ // Generic Case
+ this.setJsonRepresentation(JsonUtils.GSON
+ .fromJson(new ToscaYamlToJsonConvertor().parseToscaYaml(policyModel.getPolicyModelTosca(),
+ policyModel.getPolicyModelType()), JsonObject.class));
+ }
+ } catch (JsonSyntaxException | IOException | NullPointerException e) {
+ logger.error("Unable to generate the operational policy Schema ... ", e);
+ this.setJsonRepresentation(new JsonObject());
+ }
+ return jsonReturned;