From 49ab84a916e96fde4fc39258fa10f8b5ce775f48 Mon Sep 17 00:00:00 2001 From: sebdet Date: Fri, 13 Mar 2020 15:27:41 -0700 Subject: Fix the legacy policies Fix the legacy policies not displayed in the UI properly due to the new PolicyModal dialog. Issue-ID: CLAMP-779 Signed-off-by: sebdet Change-Id: I8070d8c57e43c9a386e09475f0d377f91104aef1 --- .../java/org/onap/clamp/policy/operational/OperationalPolicy.java | 3 ++- .../policy/operational/OperationalPolicyRepresentationBuilder.java | 6 ++---- 2 files changed, 4 insertions(+), 5 deletions(-) (limited to 'src/main/java/org') diff --git a/src/main/java/org/onap/clamp/policy/operational/OperationalPolicy.java b/src/main/java/org/onap/clamp/policy/operational/OperationalPolicy.java index 355a889e..528d695c 100644 --- a/src/main/java/org/onap/clamp/policy/operational/OperationalPolicy.java +++ b/src/main/java/org/onap/clamp/policy/operational/OperationalPolicy.java @@ -152,6 +152,7 @@ public class OperationalPolicy extends Policy implements Serializable { /** * This method can generate a Json representation (json schema) for an operational policy. * This is mainly to support a legacy case and a generic case. + * For the legacy case the operational policy given is modified (configurationJson). * * @param operationalPolicy The operational policy * @param toscaConverter The tosca converter @@ -166,7 +167,7 @@ public class OperationalPolicy extends Policy implements Serializable { } if (operationalPolicy.isLegacy()) { // Op policy Legacy case - LegacyOperationalPolicy.preloadConfiguration(jsonReturned, operationalPolicy.loop); + LegacyOperationalPolicy.preloadConfiguration(operationalPolicy.getConfigurationsJson(), operationalPolicy.loop); jsonReturned = OperationalPolicyRepresentationBuilder .generateOperationalPolicySchema(operationalPolicy.loop.getModelService()); } diff --git a/src/main/java/org/onap/clamp/policy/operational/OperationalPolicyRepresentationBuilder.java b/src/main/java/org/onap/clamp/policy/operational/OperationalPolicyRepresentationBuilder.java index 0298cfde..c88c1b98 100644 --- a/src/main/java/org/onap/clamp/policy/operational/OperationalPolicyRepresentationBuilder.java +++ b/src/main/java/org/onap/clamp/policy/operational/OperationalPolicyRepresentationBuilder.java @@ -52,15 +52,13 @@ public class OperationalPolicyRepresentationBuilder { JsonObject jsonSchema = JsonUtils.GSON.fromJson( ResourceFileUtil.getResourceAsString("clds/json-schema/operational_policies/operational_policy.json"), JsonObject.class); - jsonSchema.get("schema").getAsJsonObject().get("items").getAsJsonObject().get("properties").getAsJsonObject() - .get("configurationsJson").getAsJsonObject().get("properties").getAsJsonObject() + jsonSchema.get("properties").getAsJsonObject() .get("operational_policy").getAsJsonObject().get("properties").getAsJsonObject().get("policies") .getAsJsonObject().get("items").getAsJsonObject().get("properties").getAsJsonObject().get("target") .getAsJsonObject().get("anyOf").getAsJsonArray().addAll(createAnyOfArray(modelJson)); // update CDS recipe and payload information to schema - JsonArray actors = jsonSchema.get("schema").getAsJsonObject().get("items").getAsJsonObject().get("properties") - .getAsJsonObject().get("configurationsJson").getAsJsonObject().get("properties").getAsJsonObject() + JsonArray actors = jsonSchema.get("properties").getAsJsonObject() .get("operational_policy").getAsJsonObject().get("properties").getAsJsonObject().get("policies") .getAsJsonObject().get("items").getAsJsonObject().get("properties").getAsJsonObject().get("actor") .getAsJsonObject().get("anyOf").getAsJsonArray(); -- cgit 1.2.3-korg