Fixed to improve the Maintainability of code
authorroot1 <srinivasa.mohan@huawei.com>
Wed, 13 Dec 2017 08:54:43 +0000 (14:24 +0530)
committerSRINIVAS V <srinivasa.mohan@huawei.com>
Tue, 19 Dec 2017 09:57:16 +0000 (09:57 +0000)
Issue-ID: CCSDK-151
Change-Id: If8bf17dd0e5387855ddbff9198107f334ded59c5
Signed-off-by: SRINIVAS V <srinivasa.mohan@huawei.com>
asdcApi/provider/src/main/java/org/onap/ccsdk/sli/northbound/asdcapi/AsdcApiProvider.java
dataChange/provider/src/main/java/org/onap/ccsdk/sli/northbound/DataChangeClient.java
dataChange/provider/src/main/java/org/onap/ccsdk/sli/northbound/DataChangeProvider.java

index cebcb99..ea57409 100644 (file)
@@ -301,19 +301,20 @@ public Future<RpcResult<VfLicenseModelUpdateOutput>> vfLicenseModelUpdate(VfLice
     }
 
     VfLicenseModelUpdateInputBuilder inputBuilder = new VfLicenseModelUpdateInputBuilder(input);
-    input = inputBuilder.build();
+
+    VfLicenseModelUpdateInput inputVfLic = inputBuilder.build();
 
     String errorMessage = "Success";
     String errorCode = "200";
 
     // If this artifact already exists, reject this update
-    if (artifactVersionExists(input.getArtifactName(), input.getArtifactVersion())) {
+    if (artifactVersionExists(inputVfLic.getArtifactName(), inputVfLic.getArtifactVersion())) {
         errorCode = "409";
         errorMessage = "Artifact version already exists";
     } else {
         // Translate input object into SLI-consumable properties
-        LOG.info("Adding INPUT data for "+SVC_OPERATION+" input: " + input);
-        AsdcApiUtil.toProperties(parms, input);
+        LOG.info("Adding INPUT data for "+SVC_OPERATION+" input: " + inputVfLic);
+        AsdcApiUtil.toProperties(parms, inputVfLic);
 
 
         // Call directed graph
@@ -356,8 +357,8 @@ public Future<RpcResult<VfLicenseModelUpdateOutput>> vfLicenseModelUpdate(VfLice
         LOG.info("ASDC update succeeded");
 
         // Update config tree
-        applyVfLicenseModelUpdate(input);
-        addArtifactVersion(input.getArtifactName(), input.getArtifactVersion());
+        applyVfLicenseModelUpdate(inputVfLic);
+        addArtifactVersion(inputVfLic.getArtifactName(), inputVfLic.getArtifactVersion());
 
     } else {
         LOG.info("ASDC update failed ("+errorCode+" : "+errorMessage);
index 4bf8577..959b2b6 100644 (file)
@@ -42,7 +42,7 @@ public class DataChangeClient {
 
        public boolean hasGraph(String module, String rpc, String version, String mode) throws SvcLogicException
        {
-               return(svcLogicService.hasGraph(module, rpc, version, mode));
+               return svcLogicService.hasGraph(module, rpc, version, mode);
        }
 
        public Properties execute(String module, String rpc, String version, String mode, DataChangeNotificationOutputBuilder serviceData)
@@ -56,22 +56,23 @@ public class DataChangeClient {
        public Properties execute(String module, String rpc, String version, String mode, DataChangeNotificationOutputBuilder serviceData, Properties parms)
                                throws SvcLogicException {
 
-               parms = MdsalHelper.toProperties(parms, serviceData);
+        Properties localProp;
+        localProp = MdsalHelper.toProperties(parms, serviceData);
 
                if (LOG.isDebugEnabled())
                {
                        LOG.debug("Parameters passed to SLI");
 
-                       for (Object key : parms.keySet()) {
+                       for (Object key : localProp.keySet()) {
                                String parmName = (String) key;
-                               String parmValue = parms.getProperty(parmName);
+                               String parmValue = localProp.getProperty(parmName);
 
                                LOG.debug(parmName+" = "+parmValue);
 
                        }
                }
 
-               Properties respProps = svcLogicService.execute(module, rpc, version, mode, parms);
+               Properties respProps = svcLogicService.execute(module, rpc, version, mode, localProp);
 
                if (LOG.isDebugEnabled())
                {
@@ -86,12 +87,12 @@ public class DataChangeClient {
                        }
                }
                if ("failure".equalsIgnoreCase(respProps.getProperty("SvcLogic.status"))) {
-                       return (respProps);
+                       return respProps;
                }
 
                MdsalHelper.toBuilder(respProps, serviceData);
 
-               return (respProps);
+               return respProps;
        }
 
 }
index 2b45cc7..91482d8 100644 (file)
@@ -121,15 +121,13 @@ public class DataChangeProvider implements AutoCloseable, DataChangeService {
                MdsalHelper.toProperties(parms, inputBuilder.build());
 
                // Call SLI sync method
-               Properties respProps = null;
-
                try
                {
                        if (dataChangeClient.hasGraph("DataChange", SVC_OPERATION , null, "sync"))
                        {
                                try
                                {
-                                       respProps = dataChangeClient.execute("DataChange", SVC_OPERATION, null, "sync", serviceDataBuilder, parms);
+                                       dataChangeClient.execute("DataChange", SVC_OPERATION, null, "sync", serviceDataBuilder, parms);
                                }
                                catch (Exception e)
                                {