+ 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);
+ jsonReturned =
+ OperationalPolicyRepresentationBuilder.generateOperationalPolicySchema(loop.getModelService());
+ } else {
+ // Generic Case
+ jsonReturned = Policy.generateJsonRepresentationFromToscaModel(policyModel.getPolicyModelTosca(),
+ policyModel.getPolicyModelType());
+ }
+ } catch (UnknownComponentException | IOException | NullPointerException e) {
+ logger.error("Unable to generate the operational policy Schema ... ", e);
+ }
+ return jsonReturned;