Fixed sonar issues - ComponentDependenciesImpl 23/27323/2
authormojahidi <mojahidul.islam@amdocs.com>
Thu, 4 Jan 2018 05:24:05 +0000 (10:54 +0530)
committerVitaly Emporopulo <Vitaliy.Emporopulo@amdocs.com>
Thu, 4 Jan 2018 10:12:13 +0000 (10:12 +0000)
Fixed all sonar issues

Change-Id: Iaed4ea9bc7df52bd100d5d118b7212813ae22b76
Issue-ID: SDC-343
Signed-off-by: mojahidi <mojahidul.islam@amdocs.com>
openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/ComponentDependenciesImpl.java

index 73c2bac..eab5e3e 100644 (file)
@@ -1,3 +1,19 @@
+/*
+ * Copyright © 2016-2017 European Support Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 package org.openecomp.sdcrests.vsp.rest.services;
 
 import org.openecomp.sdc.logging.context.MdcUtil;
@@ -19,24 +35,20 @@ import org.springframework.stereotype.Service;
 
 import javax.inject.Named;
 import javax.ws.rs.core.Response;
-import java.util.ArrayList;
 import java.util.Collection;
-import java.util.List;
 
 @Named
 @Service("componentDependencies")
 @Scope(value = "prototype")
 public class ComponentDependenciesImpl implements ComponentDependencies {
 
-  private ComponentDependencyModelManager componentDependencyModelManager =
+  private final ComponentDependencyModelManager componentDependencyModelManager =
       ComponentDependencyModelManagerFactory.getInstance().createInterface();
 
   @Override
   public Response create(ComponentDependencyModel request, String vspId, String versionId,
                          String user) {
     MdcUtil.initMdc(LoggerServiceName.CREATE_COMPONENT_DEPENDENCY_MODEL.toString());
-    List<ComponentDependencyModelEntity> modelEntities = new
-        ArrayList<ComponentDependencyModelEntity>();
 
     final Version version = new Version(versionId);
 
@@ -68,7 +80,7 @@ public class ComponentDependenciesImpl implements ComponentDependencies {
 
     MapComponentDependencyEntityToDto mapper = new MapComponentDependencyEntityToDto();
     GenericCollectionWrapper<ComponentDependencyResponseDto> results = new GenericCollectionWrapper
-        <ComponentDependencyResponseDto>();
+        <>();
     for (ComponentDependencyModelEntity entity : componentDependencies) {
       results.add(mapper.applyMapping(entity, ComponentDependencyResponseDto.class));
     }