From b744b4733d1f075f67bafd63e68c8b0d66ea0ff5 Mon Sep 17 00:00:00 2001 From: aishkashyap Date: Thu, 21 Dec 2017 16:10:00 +0530 Subject: Sonar Minor:Remove duplicate literal Remove duplicate literal Sonar Link: https://sonar.onap.org/component_issues/index?id=org.onap.aai.resources%3Aresources#statuses=OPEN|assignees=aishkashyap Location: src/main/java/org/onap/aai/rest/tools/ModelVersionTransformer.java Line No:264 Issue-ID: AAI-578 Change-Id: Idb14c0568c2740dd9257b965b4dce8a7e4b34548 Signed-off-by: aishkashyap Signed-off-by: Venkata Harish K Kajur --- .../java/org/onap/aai/rest/tools/ModelVersionTransformer.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'aai-resources') diff --git a/aai-resources/src/main/java/org/onap/aai/rest/tools/ModelVersionTransformer.java b/aai-resources/src/main/java/org/onap/aai/rest/tools/ModelVersionTransformer.java index 876b65d..dd1dcda 100644 --- a/aai-resources/src/main/java/org/onap/aai/rest/tools/ModelVersionTransformer.java +++ b/aai-resources/src/main/java/org/onap/aai/rest/tools/ModelVersionTransformer.java @@ -80,6 +80,8 @@ public class ModelVersionTransformer extends RESTAPI { private ModelType introspectorFactoryType = ModelType.MOXY; private QueryStyle queryStyle = QueryStyle.TRAVERSAL; protected static String MODEL_ELEMENTS = "model-elements"; + private static final String RELATIONSHIP="relationship"; + /** * POST for model transformation. @@ -261,15 +263,15 @@ public class ModelVersionTransformer extends RESTAPI { Introspector newRelationshipList = newModelElements.getLoader().introspectorFromName("relationship-list"); newModelElement.setValue("relationship-list", newRelationshipList.getUnderlyingObject()); - List oldRelationshipListList = oldRelationshipList.getWrappedListValue("relationship"); - List newRelationshipListList = (List)newRelationshipList.getValue("relationship"); + List oldRelationshipListList = oldRelationshipList.getWrappedListValue(RELATIONSHIP); + List newRelationshipListList = (List)newRelationshipList.getValue(RELATIONSHIP); for (Introspector oldRelationship : oldRelationshipListList) { - Introspector newRelationship = newModelElements.getLoader().introspectorFromName("relationship"); + Introspector newRelationship = newModelElements.getLoader().introspectorFromName(RELATIONSHIP); newRelationshipListList.add(newRelationship.getUnderlyingObject()); - List oldRelationshipData = oldRelationship.getWrappedListValue("relationship-data"); + List oldRelationshipData = oldRelationship.getWrappedListValue(RELATIONSHIP); List newRelationshipData = (List)newRelationship.getValue("relationship-data"); newRelationship.setValue("related-to", "model-ver"); -- cgit 1.2.3-korg