Fix Sonar issues

Change-Id: I487f54714f87e993b9fa4a3b43de7a65692922d5
Issue-ID: SDC-1925
Signed-off-by: Sonsino, Ofir (os0695) <os0695@intl.att.com>
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/java/org/openecomp/core/dao/impl/UniqueValueDaoFactoryImpl.java b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/java/org/openecomp/core/dao/impl/UniqueValueDaoFactoryImpl.java
index b717fcb..ac47de9 100644
--- a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/java/org/openecomp/core/dao/impl/UniqueValueDaoFactoryImpl.java
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/java/org/openecomp/core/dao/impl/UniqueValueDaoFactoryImpl.java
@@ -24,10 +24,10 @@
 import org.openecomp.core.dao.UniqueValueDaoFactory;
 
 public class UniqueValueDaoFactoryImpl extends UniqueValueDaoFactory {
-  private static UniqueValueDao INSTANCE = new UniqueValueCassandraDaoImpl();
+  private static UniqueValueDao instance = new UniqueValueCassandraDaoImpl();
 
   @Override
   public UniqueValueDao createInterface() {
-    return INSTANCE;
+    return instance;
   }
 }
diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/services/ServiceTemplateReaderServiceImpl.java b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/services/ServiceTemplateReaderServiceImpl.java
index 8621e73..b691d83 100644
--- a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/services/ServiceTemplateReaderServiceImpl.java
+++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/services/ServiceTemplateReaderServiceImpl.java
@@ -20,10 +20,9 @@
   @Override
   public Map<String, Object> readServiceTemplate(byte[] serviceTemplateContent) {
 
-    Map<String, Object> readSt =
+    return
         new YamlUtil().yamlToObject(new String(serviceTemplateContent), Map.class);
 
-    return readSt;
   }
 
   @Override
diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/commands/CommandsHolder.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/commands/CommandsHolder.java
index e5def6f..8e32779 100644
--- a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/commands/CommandsHolder.java
+++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/commands/CommandsHolder.java
@@ -27,6 +27,9 @@
                 Option.builder(COMMAND_OPTION).hasArg().argName("command").desc("command name, mandatory").build());
         registerCommands();
     }
+    
+    private CommandsHolder() {
+    }
 
     private static void registerCommands() {
         new SetHealingFlag().register();
@@ -40,9 +43,6 @@
         new SetHealingFlagByItemVersionCommand().register();
     }
 
-    private CommandsHolder() {
-    }
-
     public static Optional<Command> getCommand(String[] args) {
         CommandLine cmd = parseArgs(args);
         return cmd == null || !cmd.hasOption(COMMAND_OPTION) || cmd.getOptionValue(COMMAND_OPTION) == null
diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/commands/HealAll.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/commands/HealAll.java
index 8e0bb0e..f55f1e8 100644
--- a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/commands/HealAll.java
+++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/commands/HealAll.java
@@ -16,7 +16,6 @@
 import org.apache.commons.cli.CommandLine;
 import org.apache.commons.cli.Option;
 import org.apache.commons.collections.CollectionUtils;
-import org.openecomp.core.tools.concurrent.ItemHealingTask;
 import org.openecomp.core.tools.exceptions.HealingRuntimeException;
 import org.openecomp.core.tools.loaders.VersionInfoCassandraLoader;
 import org.openecomp.sdc.healing.api.HealingManager;
@@ -34,7 +33,6 @@
 
     private static final int DEFAULT_THREAD_NUMBER = 100;
     private static final String THREAD_NUM_OPTION = "t";
-    private static List<ItemHealingTask> tasks = new ArrayList<>();
     private VendorSoftwareProductManager vspManager;
     private HealingManager healingManager;
 
@@ -83,27 +81,7 @@
     }
 
     private static void executeAllTasks(ExecutorService executor, BufferedWriter log) {
-        List<Future<String>> futureTasks;
-        try {
-            futureTasks = executor.invokeAll(tasks);
-            futureTasks.forEach(future -> {
-                try {
-                    log.write(future.get());
-                    log.newLine();
-                } catch (Exception e) {
-                    writeToLog(e.getMessage(), log);
-                }
-            });
-        } catch (InterruptedException e) {
-            Thread.currentThread().interrupt();
-            writeToLog("migration tasks failed with message: " + e.getMessage(), log);
-            throw new HealingRuntimeException(e);
-        }
 
-        boolean isThreadOpen = true;
-        while (isThreadOpen) {
-            isThreadOpen = futureTasks.stream().anyMatch(future -> !future.isDone());
-        }
     }
 
 
@@ -133,8 +111,7 @@
     }
 
     private void addTaskToTasks(VersionInfoEntity versionInfoEntity) {
-        tasks.add(new ItemHealingTask(versionInfoEntity.getEntityId(), resolveVersion(versionInfoEntity).toString(),
-                vspManager, healingManager));
+        
     }
 
 }
diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/commands/SetHealingFlagByItemVersionCommand.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/commands/SetHealingFlagByItemVersionCommand.java
index db90652..ce2f9ac 100644
--- a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/commands/SetHealingFlagByItemVersionCommand.java
+++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/commands/SetHealingFlagByItemVersionCommand.java
@@ -37,11 +37,13 @@
     private static final String ITEM_ID_OPTION = "i";
     private static final String VERSION_ID_OPTION = "v";
     private static final String PROJECT_OPTION = "o";
+    private static final String ITEM_ID = "item_id";
+    private static final String VERSION_ID = "version_id";
 
     SetHealingFlagByItemVersionCommand() {
-        options.addOption(Option.builder(ITEM_ID_OPTION).hasArg().argName("item_id")
+        options.addOption(Option.builder(ITEM_ID_OPTION).hasArg().argName(ITEM_ID)
                                 .desc("id of the item to reset healing flag, mandatory").build());
-        options.addOption(Option.builder(VERSION_ID_OPTION).hasArg().argName("version_id")
+        options.addOption(Option.builder(VERSION_ID_OPTION).hasArg().argName(VERSION_ID)
                                 .desc("id of the version to delete from public, mandatory").build());
         options.addOption(Option.builder(PROJECT_OPTION).hasArg().argName("old_project_version")
                                 .desc("old project version, mandatory").build());
@@ -62,10 +64,10 @@
         ResultSet listItemVersion = versionCassandraLoader.listItemVersion();
 
         List<HealingEntity> healingEntities = listItemVersion.all().stream().filter(
-                entry -> (entry.getString("item_id").equals(itemId)
-                && entry.getString("version_id").equals(versionId))).map(entry ->
-                new HealingEntity(entry.getString("space"), entry.getString("item_id"),
-                entry.getString("version_id"), true, projectVersion)).collect(Collectors.toList());
+                entry -> (entry.getString(ITEM_ID).equals(itemId)
+                && entry.getString(VERSION_ID).equals(versionId))).map(entry ->
+                new HealingEntity(entry.getString("space"), entry.getString(ITEM_ID),
+                entry.getString(VERSION_ID), true, projectVersion)).collect(Collectors.toList());
 
         HealingHandler healingHandler = new HealingHandler();
         healingHandler.populateHealingTable(healingEntities);
diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/concurrent/ItemHealingTask.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/concurrent/ItemHealingTask.java
deleted file mode 100644
index 878390f..0000000
--- a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/concurrent/ItemHealingTask.java
+++ /dev/null
@@ -1,55 +0,0 @@
-package org.openecomp.core.tools.concurrent;
-
-import org.openecomp.sdc.healing.api.HealingManager;
-import org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductManager;
-import org.openecomp.sdc.versioning.dao.types.Version;
-
-import java.util.concurrent.Callable;
-
-/**
- * Created by ayalaben on 11/7/2017
- */
-public class ItemHealingTask implements Callable<String> {
-
-  private String itemId;
-  private Version version;
-  private VendorSoftwareProductManager vspManager;
-  private HealingManager healingManager;
-
-  public String getItemId() {
-    return itemId;
-  }
-
-  public String getVersionId() {
-//    return version.getId();
-    return null;
-  }
-
-
-  public ItemHealingTask(String itemId, String versionId,
-                         VendorSoftwareProductManager vspManager,
-                         HealingManager healingManager) {
-//    this.itemId = itemId;
-//    this.version = new Version(versionId);
-    this.vspManager = vspManager;
-    this.healingManager = healingManager;
-
-  }
-
-  @Override
-  public String call() throws Exception {
-//    VspDetails vspDetails = vspManager.getVsp(itemId, version);
-//
-//    try {
-//      healingManager.healItemVersion(itemId, version, ItemType.vsp, true);
-//    } catch (Exception e) {
-//      return (String
-//          .format("healing failed on vsp: %s with id: %s, versionId: %s, with message: %s",
-//              vspDetails.getName(), itemId, version.getId(), e.getMessage()));
-//    }
-//
-//    return String.format("healed vsp: %s, with id: %s, versionId: %s",
-//        vspDetails.getName(), itemId, version.getId());
-    return null;
-  }
-}
diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/importinfo/ImportSingleTable.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/importinfo/ImportSingleTable.java
index d36b41f..146e173 100644
--- a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/importinfo/ImportSingleTable.java
+++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/importinfo/ImportSingleTable.java
@@ -32,6 +32,8 @@
     private static final String INSERT_INTO = "INSERT INTO ";
     private static final String VALUES = " VALUES ";
     private static final Map<String, PreparedStatement> statementsCache = new HashMap<>();
+    
+    public static final ImmutableMap<String, Name> dataTypesMap;
 
     public void importFile(Path file) {
         try {
@@ -141,7 +143,6 @@
         return sb.toString();
     }
 
-    public static final ImmutableMap<String, Name> dataTypesMap;
 
     static {
         Builder<String, Name> builder = ImmutableMap.builder();