diff options
author | Gaurav Agrawal <gaurav.agrawal@huawei.com> | 2017-09-07 20:32:21 +0530 |
---|---|---|
committer | Gaurav Agrawal <gaurav.agrawal@huawei.com> | 2017-09-07 20:32:21 +0530 |
commit | 18dfdf213489b19958f2d0944aeee58e80f8cb95 (patch) | |
tree | d6aa5b095719b2b60b9dfd2d01eef8854aa7145b /generic-resource-api | |
parent | 5a4c97563b86ce83f90d26479d386724165b95e6 (diff) |
Some minor refinements/fixes
Minor refinements to generic-resource-api like sonar issue fix, removal of redundant typecast etc.
Change-Id: Ibb52f280847478e589640afb428088f379fab5b3
Issue-Id: SDNC-45
Signed-off-by: Gaurav Agrawal <gaurav.agrawal@huawei.com>
Diffstat (limited to 'generic-resource-api')
3 files changed, 17 insertions, 15 deletions
diff --git a/generic-resource-api/provider/src/main/java/org/onap/sdnc/northbound/GenericResourceApiProvider.java b/generic-resource-api/provider/src/main/java/org/onap/sdnc/northbound/GenericResourceApiProvider.java index 54fb69ba..f0659342 100644 --- a/generic-resource-api/provider/src/main/java/org/onap/sdnc/northbound/GenericResourceApiProvider.java +++ b/generic-resource-api/provider/src/main/java/org/onap/sdnc/northbound/GenericResourceApiProvider.java @@ -317,8 +317,8 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC log.error("Caught Exception reading MD-SAL ("+type+") for ["+siid+"] " ,e); } - if (data.isPresent()) { - ServiceData serviceData = (ServiceData) data.get().getServiceData(); + if (data != null && data.isPresent()) { + ServiceData serviceData = data.get().getServiceData(); if (serviceData != null) { log.info("Read MD-SAL ("+type+") data for ["+siid+"] ServiceData: " + serviceData); serviceDataBuilder.setSdncRequestHeader(serviceData.getSdncRequestHeader()); @@ -360,8 +360,8 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC log.error("Caught Exception reading MD-SAL ("+type+") for ["+preload_name+","+preload_type+"] " ,e); } - if ( data.isPresent()) { - PreloadData preloadData = (PreloadData) data.get().getPreloadData(); + if (data != null && data.isPresent()) { + PreloadData preloadData = data.get().getPreloadData(); if (preloadData != null) { log.info("Read MD-SAL ("+type+") data for ["+preload_name+","+preload_type+"] PreloadData: " + preloadData); preloadDataBuilder.setVnfTopologyInformation(preloadData.getVnfTopologyInformation()); @@ -477,7 +477,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC ServiceTopologyOperationInput input) { final String SVC_OPERATION = "service-topology-operation"; - ServiceData serviceData = null; + ServiceData serviceData; ServiceStatusBuilder serviceStatusBuilder = new ServiceStatusBuilder(); Properties parms = new Properties(); @@ -663,7 +663,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC VnfTopologyOperationInput input) { final String SVC_OPERATION = "vnf-topology-operation"; - ServiceData serviceData = null; + ServiceData serviceData; ServiceStatusBuilder serviceStatusBuilder = new ServiceStatusBuilder(); Properties parms = new Properties(); @@ -907,7 +907,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC VfModuleTopologyOperationInput input) { final String SVC_OPERATION = "vf-module-topology-operation"; - ServiceData serviceData = null; + ServiceData serviceData; ServiceStatusBuilder serviceStatusBuilder = new ServiceStatusBuilder(); Properties parms = new Properties(); @@ -1153,7 +1153,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC NetworkTopologyOperationInput input) { final String SVC_OPERATION = "network-topology-operation"; - ServiceData serviceData = null; + ServiceData serviceData; ServiceStatusBuilder serviceStatusBuilder = new ServiceStatusBuilder(); Properties parms = new Properties(); @@ -1353,7 +1353,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC ContrailRouteTopologyOperationInput input) { final String SVC_OPERATION = "contrail-route-topology-operation"; - ServiceData serviceData = null; + ServiceData serviceData; ServiceStatusBuilder serviceStatusBuilder = new ServiceStatusBuilder(); Properties parms = new Properties(); @@ -1529,7 +1529,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC SecurityZoneTopologyOperationInput input) { final String SVC_OPERATION = "security-zone-topology-operation"; - ServiceData serviceData = null; + ServiceData serviceData; ServiceStatusBuilder serviceStatusBuilder = new ServiceStatusBuilder(); Properties parms = new Properties(); diff --git a/generic-resource-api/provider/src/main/java/org/opendaylight/yang/gen/v1/org/onap/sdnc/northbound/generic/resource/api/provider/impl/rev170824/GENERICRESOURCEAPIProviderModule.java b/generic-resource-api/provider/src/main/java/org/opendaylight/yang/gen/v1/org/onap/sdnc/northbound/generic/resource/api/provider/impl/rev170824/GENERICRESOURCEAPIProviderModule.java index 443891ba..2314c260 100644 --- a/generic-resource-api/provider/src/main/java/org/opendaylight/yang/gen/v1/org/onap/sdnc/northbound/generic/resource/api/provider/impl/rev170824/GENERICRESOURCEAPIProviderModule.java +++ b/generic-resource-api/provider/src/main/java/org/opendaylight/yang/gen/v1/org/onap/sdnc/northbound/generic/resource/api/provider/impl/rev170824/GENERICRESOURCEAPIProviderModule.java @@ -1,13 +1,15 @@ package org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.api.provider.impl.rev170824; import org.onap.sdnc.northbound.GenericResourceApiProvider; +import org.opendaylight.controller.config.api.DependencyResolver; +import org.opendaylight.controller.config.api.ModuleIdentifier; -public class GENERICRESOURCEAPIProviderModule extends org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.api.provider.impl.rev170824.AbstractGENERICRESOURCEAPIProviderModule { - public GENERICRESOURCEAPIProviderModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) { +public class GENERICRESOURCEAPIProviderModule extends AbstractGENERICRESOURCEAPIProviderModule { + public GENERICRESOURCEAPIProviderModule(ModuleIdentifier identifier, DependencyResolver dependencyResolver) { super(identifier, dependencyResolver); } - public GENERICRESOURCEAPIProviderModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.api.provider.impl.rev170824.GENERICRESOURCEAPIProviderModule oldModule, java.lang.AutoCloseable oldInstance) { + public GENERICRESOURCEAPIProviderModule(ModuleIdentifier identifier, DependencyResolver dependencyResolver, GENERICRESOURCEAPIProviderModule oldModule, AutoCloseable oldInstance) { super(identifier, dependencyResolver, oldModule, oldInstance); } @@ -17,7 +19,7 @@ public class GENERICRESOURCEAPIProviderModule extends org.opendaylight.yang.gen. } @Override - public java.lang.AutoCloseable createInstance() { + public AutoCloseable createInstance() { final GenericResourceApiProvider provider = new GenericResourceApiProvider(getDataBrokerDependency() , getNotificationPublishAdapterDependency() , getRpcRegistryDependency()); diff --git a/generic-resource-api/provider/src/main/java/org/opendaylight/yang/gen/v1/org/onap/sdnc/northbound/generic/resource/api/provider/impl/rev170824/GENERICRESOURCEAPIProviderModuleFactory.java b/generic-resource-api/provider/src/main/java/org/opendaylight/yang/gen/v1/org/onap/sdnc/northbound/generic/resource/api/provider/impl/rev170824/GENERICRESOURCEAPIProviderModuleFactory.java index 0d10dd87..ca96122d 100644 --- a/generic-resource-api/provider/src/main/java/org/opendaylight/yang/gen/v1/org/onap/sdnc/northbound/generic/resource/api/provider/impl/rev170824/GENERICRESOURCEAPIProviderModuleFactory.java +++ b/generic-resource-api/provider/src/main/java/org/opendaylight/yang/gen/v1/org/onap/sdnc/northbound/generic/resource/api/provider/impl/rev170824/GENERICRESOURCEAPIProviderModuleFactory.java @@ -8,6 +8,6 @@ * Do not modify this file unless it is present under src/main directory */ package org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.api.provider.impl.rev170824; -public class GENERICRESOURCEAPIProviderModuleFactory extends org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.api.provider.impl.rev170824.AbstractGENERICRESOURCEAPIProviderModuleFactory { +public class GENERICRESOURCEAPIProviderModuleFactory extends AbstractGENERICRESOURCEAPIProviderModuleFactory { } |