Sonar Minor:Remove duplicate literal 09/26709/2
authoraishkashyap <as00476394@techmahindra.com>
Thu, 21 Dec 2017 10:40:00 +0000 (16:10 +0530)
committerVenkata Harish K Kajur <vk250x@att.com>
Mon, 8 Jan 2018 14:43:45 +0000 (09:43 -0500)
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 <as00476394@techmahindra.com>
Signed-off-by: Venkata Harish K Kajur <vk250x@att.com>
aai-resources/src/main/java/org/onap/aai/rest/tools/ModelVersionTransformer.java

index 876b65d..dd1dcda 100644 (file)
@@ -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<Introspector> oldRelationshipListList = oldRelationshipList.getWrappedListValue("relationship");
-                               List<Object> newRelationshipListList = (List<Object>)newRelationshipList.getValue("relationship");
+                               List<Introspector> oldRelationshipListList = oldRelationshipList.getWrappedListValue(RELATIONSHIP);
+                               List<Object> newRelationshipListList = (List<Object>)newRelationshipList.getValue(RELATIONSHIP);
 
                                for (Introspector oldRelationship : oldRelationshipListList) { 
 
-                                       Introspector newRelationship = newModelElements.getLoader().introspectorFromName("relationship");
+                                       Introspector newRelationship = newModelElements.getLoader().introspectorFromName(RELATIONSHIP);
                                        newRelationshipListList.add(newRelationship.getUnderlyingObject());
 
-                                       List<Introspector> oldRelationshipData = oldRelationship.getWrappedListValue("relationship-data");
+                                       List<Introspector> oldRelationshipData = oldRelationship.getWrappedListValue(RELATIONSHIP);
                                        List<Object> newRelationshipData = (List<Object>)newRelationship.getValue("relationship-data");
 
                                        newRelationship.setValue("related-to", "model-ver");