aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/org
diff options
context:
space:
mode:
authorsebdet <sebastien.determe@intl.att.com>2020-04-23 03:01:37 +0200
committersebdet <sebastien.determe@intl.att.com>2020-04-23 03:31:47 +0200
commitab9bc444f84f2cbb89747543657de3a54e4554b8 (patch)
tree71170f3205afacc8a894bdbb1b1f240e6dc65511 /src/main/java/org
parentd187e9e689fe39cbabe9cb82ea6959e49ff64354 (diff)
Fix entityId bug
A user defined entry has been added to the entity id by default, so that json editor falls back to that value when re-editing the policies Issue-ID: CLAMP-829 Signed-off-by: sebdet <sebastien.determe@intl.att.com> Change-Id: I593163f87df9f97a19964428bf2016154dc9576d
Diffstat (limited to 'src/main/java/org')
-rw-r--r--src/main/java/org/onap/clamp/policy/operational/OperationalPolicyRepresentationBuilder.java11
1 files changed, 11 insertions, 0 deletions
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 787698ada..b1aa4ad18 100644
--- a/src/main/java/org/onap/clamp/policy/operational/OperationalPolicyRepresentationBuilder.java
+++ b/src/main/java/org/onap/clamp/policy/operational/OperationalPolicyRepresentationBuilder.java
@@ -128,6 +128,15 @@ public class OperationalPolicyRepresentationBuilder {
return vnfSchemaArray;
}
+ private static JsonArray createBlankEntry() {
+ JsonArray result = new JsonArray();
+ JsonObject blankObject = new JsonObject();
+ blankObject.addProperty("title", "User defined");
+ blankObject.add("properties", new JsonObject());
+ result.add(blankObject);
+ return result;
+ }
+
private static JsonArray createVfModuleSchema(Service modelService, boolean generateType) {
JsonArray vfModuleOneOfSchemaArray = new JsonArray();
JsonObject modelVfModules = modelService.getResourceByType("VFModule");
@@ -180,6 +189,8 @@ public class OperationalPolicyRepresentationBuilder {
*/
public static JsonArray createAnyOfArray(Service modelJson, boolean generateType) {
JsonArray targetOneOfStructure = new JsonArray();
+ // First entry must be user defined
+ targetOneOfStructure.addAll(createBlankEntry());
targetOneOfStructure.addAll(createVnfSchema(modelJson, generateType));
targetOneOfStructure.addAll(createVfModuleSchema(modelJson, generateType));
return targetOneOfStructure;