diff options
author | Divesh Mirchandani <Divesh.Mirchandani@amdocs.com> | 2017-09-14 19:14:21 +0530 |
---|---|---|
committer | Divesh Mirchandani <Divesh.Mirchandani@amdocs.com> | 2017-09-18 17:26:38 +0530 |
commit | 396cb378ab8940b1adb8ba1adc656d0b4ad66f99 (patch) | |
tree | b4f6ddc8e7cdfe39bfcbdc75cff7e85c284c5b65 /openecomp-be/tools/migration/1702_to_1707_zusammen/src | |
parent | 27f5c2b105676eebb477714fd7323467151965d2 (diff) |
Fixed SONAR issues
Fixed blocker, critical, major & minor SONAR issues.
Issue-ID: SDC-343
Change-Id: I72e5a3a7fa7d7407a92f98f77e4334827f70f926
Signed-off-by: dd4616 <Divesh.Mirchandani@amdocs.com>
Diffstat (limited to 'openecomp-be/tools/migration/1702_to_1707_zusammen/src')
9 files changed, 23 insertions, 63 deletions
diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/MigrationMain.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/MigrationMain.java index e0f3e016fe..1711e41a65 100644 --- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/MigrationMain.java +++ b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/MigrationMain.java @@ -70,7 +70,7 @@ public class MigrationMain { private static Logger logger = LoggerFactory.getLogger(MigrationMain.class); private static int status = 0; - public static Map<String, VersionInfoEntity> versionInfoMap = new HashMap<>(); + private static Map<String, VersionInfoEntity> versionInfoMap = new HashMap<>(); public static void main(String[] args) { CassandraElementRepository cassandraElementRepository = new CassandraElementRepository(); @@ -116,8 +116,7 @@ public class MigrationMain { convertVsp(context, itemCassandraDao, versionCassandraDao, cassandraElementRepository); printMessage(logger, "Converted VSPs\n"); } catch (Exception e) { - printMessage(logger, "Could not perform migration for VSPs ,the error is :"); - e.printStackTrace(); + logger.debug(e.getMessage(), e); status = -1; } @@ -125,9 +124,7 @@ public class MigrationMain { convertOrchestrationTemplateCandidate(context, cassandraElementRepository); printMessage(logger, "Converted OrchestrationTemplateCandidates\n"); } catch (Exception e) { - printMessage(logger, - "Could not perform migration for OrchestrationTemplateCandidates ,the error is :"); - e.printStackTrace(); + logger.debug(e.getMessage(), e); status = -1; } @@ -136,61 +133,49 @@ public class MigrationMain { convertComponent(context, cassandraElementRepository); printMessage(logger, "Converted Components\n"); } catch (Exception e) { - printMessage(logger, - "Could not perform migration for Components ,the error is :"); - e.printStackTrace(); + logger.debug(e.getMessage(), e); status = -1; } try { convertNic(context, cassandraElementRepository); printMessage(logger, "Converted Nics\n"); } catch (Exception e) { - printMessage(logger, "Could not perform migration for Nics ,the error is :"); - e.printStackTrace(); + logger.debug(e.getMessage(), e); status = -1; } try { convertNetwork(context, cassandraElementRepository); printMessage(logger, "Converted Networks\n"); } catch (Exception e) { - printMessage(logger, - "Could not perform migration for Networks ,the error is :"); - e.printStackTrace(); + logger.debug(e.getMessage(), e); status = -1; } try { convertMibs(context, cassandraElementRepository); printMessage(logger, "Converted MIBs\n"); } catch (Exception e) { - printMessage(logger, "Could not perform migration for MIBs,the error is :"); - e.printStackTrace(); + logger.debug(e.getMessage(), e); status = -1; } try { convertServiceArtifact(context, cassandraElementRepository); printMessage(logger, "Converted Service Artifacts\n"); } catch (Exception e) { - printMessage(logger, - "Could not perform migration for Service Artifacts,the error is :"); - e.printStackTrace(); + logger.debug(e.getMessage(), e); status = -1; } try { convertServiceTemplate(context, cassandraElementRepository); printMessage(logger, "Converted Service Templates\n"); } catch (Exception e) { - printMessage(logger, - "Could not perform migration for Service Templates,the error is :"); - e.printStackTrace(); + logger.debug(e.getMessage(), e); status = -1; } try { convertProcesses(context, cassandraElementRepository); printMessage(logger, "Converted Processes\n"); } catch (Exception e) { - printMessage(logger, - "Could not perform migration for Processes,the error is :"); - e.printStackTrace(); + logger.debug(e.getMessage(), e); status = -1; } @@ -199,40 +184,35 @@ public class MigrationMain { convertVlm(context, itemCassandraDao, versionCassandraDao, cassandraElementRepository); printMessage(logger, "Converted VLMs\n"); } catch (Exception e) { - printMessage(logger, "Could not perform migration for VLMs,the error is :"); - e.printStackTrace(); + logger.debug(e.getMessage(), e); status = -1; } try { convertLKG(context, cassandraElementRepository); printMessage(logger, "Converted LKGs\n"); } catch (Exception e) { - printMessage(logger, "Could not perform migration for LKGs,the error is :"); - e.printStackTrace(); + logger.debug(e.getMessage(), e); status = -1; } try { convertFeatureGroup(context, cassandraElementRepository); printMessage(logger, "Converted Feature Groups\n"); } catch (Exception e) { - printMessage(logger, "Could not perform migration for Feature Groups,the error is :"); - e.printStackTrace(); + logger.debug(e.getMessage(), e); status = -1; } try { convertEP(context, cassandraElementRepository); printMessage(logger, "Converted EPs\n"); } catch (Exception e) { - printMessage(logger, "Could not perform migration for EPs,the error is :"); - e.printStackTrace(); + logger.debug(e.getMessage(), e); status = -1; } try { convertLicenseAgreement(context, cassandraElementRepository); printMessage(logger, "Converted License Agreements\n"); } catch (Exception e) { - printMessage(logger, "Could not perform migration for License Agreements,the error is :"); - e.printStackTrace(); + logger.debug(e.getMessage(), e); status = -1; } } @@ -482,5 +462,8 @@ public class MigrationMain { .getViewableVersions().contains(versionId)); } - + public static Map<String, VersionInfoEntity> getVersionInfoMap() + { + return versionInfoMap; + } } diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/OrchestrationTemplateCandidateConvertor.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/OrchestrationTemplateCandidateConvertor.java index c6778544fd..e6ceb360bd 100644 --- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/OrchestrationTemplateCandidateConvertor.java +++ b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/OrchestrationTemplateCandidateConvertor.java @@ -1,25 +1,17 @@ package org.openecomp.core.migration.convertors; import com.amdocs.zusammen.datatypes.item.ElementContext; -import com.amdocs.zusammen.datatypes.item.Info; -import com.amdocs.zusammen.datatypes.item.ItemVersionData; import com.amdocs.zusammen.plugin.statestore.cassandra.dao.types.ElementEntityContext; import com.amdocs.zusammen.sdk.collaboration.types.CollaborationElement; import org.openecomp.core.migration.MigrationMain; -import org.openecomp.core.migration.loaders.VspInformation; import org.openecomp.core.migration.store.ElementHandler; import org.openecomp.sdc.logging.api.Logger; import org.openecomp.sdc.logging.api.LoggerFactory; -import org.openecomp.sdc.vendorlicense.dao.types.VendorLicenseModelEntity; -import org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen.ElementPropertyName; -import org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen.ElementType; import org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen.StructureElement; import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity; import org.openecomp.sdc.vendorsoftwareproduct.dao.type.OrchestrationTemplateCandidateDataEntity; -import java.util.HashSet; import java.util.List; -import java.util.Set; public class OrchestrationTemplateCandidateConvertor { diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/VlmConvertor.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/VlmConvertor.java index 2e5fac830e..2e483747ed 100644 --- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/VlmConvertor.java +++ b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/VlmConvertor.java @@ -5,9 +5,7 @@ import com.amdocs.zusammen.datatypes.item.Info; import com.amdocs.zusammen.datatypes.item.ItemVersionData; import com.amdocs.zusammen.plugin.statestore.cassandra.dao.types.ElementEntityContext; import com.amdocs.zusammen.sdk.collaboration.types.CollaborationElement; -import org.openecomp.core.migration.loaders.VspInformation; import org.openecomp.core.migration.store.ElementHandler; -import org.openecomp.sdc.vendorlicense.dao.impl.zusammen.VendorLicenseModelDaoZusammenImpl; import org.openecomp.sdc.vendorlicense.dao.types.VendorLicenseModelEntity; import org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen.StructureElement; diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/VspServiceArtifactConvertor.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/VspServiceArtifactConvertor.java index 76e35b56c4..15b8ad729a 100644 --- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/VspServiceArtifactConvertor.java +++ b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/VspServiceArtifactConvertor.java @@ -7,11 +7,8 @@ import com.amdocs.zusammen.sdk.collaboration.types.CollaborationElement; import org.openecomp.core.migration.store.ElementHandler; import org.openecomp.core.model.types.ServiceArtifact; import org.openecomp.core.utilities.file.FileUtils; -import org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen.ElementPropertyName; -import org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen.ElementType; import org.openecomp.sdc.model.impl.zusammen.StructureElement; - import java.util.HashSet; import java.util.List; import java.util.Set; diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/OrchestrationTemplateCandidateCassandraLoader.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/OrchestrationTemplateCandidateCassandraLoader.java index b8c173843d..09da455847 100644 --- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/OrchestrationTemplateCandidateCassandraLoader.java +++ b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/OrchestrationTemplateCandidateCassandraLoader.java @@ -25,7 +25,6 @@ import com.datastax.driver.mapping.annotations.Accessor; import com.datastax.driver.mapping.annotations.Query; import org.openecomp.core.nosqldb.api.NoSqlDb; import org.openecomp.core.nosqldb.factory.NoSqlDbFactory; -import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity; import org.openecomp.sdc.vendorsoftwareproduct.dao.type.OrchestrationTemplateCandidateDataEntity; import java.util.Collection; diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/VendorSoftwareProductInfoLoader.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/VendorSoftwareProductInfoLoader.java index bac4b6e440..26fc23cf5d 100644 --- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/VendorSoftwareProductInfoLoader.java +++ b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/VendorSoftwareProductInfoLoader.java @@ -20,21 +20,14 @@ package org.openecomp.core.migration.loaders; -import com.datastax.driver.core.ResultSet; -import com.datastax.driver.core.UDTValue; import com.datastax.driver.mapping.Mapper; import com.datastax.driver.mapping.Result; import com.datastax.driver.mapping.UDTMapper; import com.datastax.driver.mapping.annotations.Accessor; import com.datastax.driver.mapping.annotations.Query; -import org.openecomp.core.dao.impl.CassandraBaseDao; import org.openecomp.core.nosqldb.api.NoSqlDb; import org.openecomp.core.nosqldb.factory.NoSqlDbFactory; -import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDao; -import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails; -import org.openecomp.sdc.versioning.VersioningManagerFactory; import org.openecomp.sdc.versioning.dao.types.Version; -import org.openecomp.sdc.versioning.types.VersionableEntityMetadata; import java.util.Collection; diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/VersionInfoCassandraLoader.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/VersionInfoCassandraLoader.java index 2a6efd22f3..725298b195 100644 --- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/VersionInfoCassandraLoader.java +++ b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/VersionInfoCassandraLoader.java @@ -24,10 +24,8 @@ import com.datastax.driver.mapping.Mapper; import com.datastax.driver.mapping.Result; import com.datastax.driver.mapping.annotations.Accessor; import com.datastax.driver.mapping.annotations.Query; -import org.openecomp.core.dao.impl.CassandraBaseDao; import org.openecomp.core.nosqldb.api.NoSqlDb; import org.openecomp.core.nosqldb.factory.NoSqlDbFactory; -import org.openecomp.sdc.versioning.dao.VersionInfoDao; import org.openecomp.sdc.versioning.dao.types.VersionInfoEntity; import java.util.Collection; diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/store/ElementHandler.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/store/ElementHandler.java index 34e7d79001..548a8d989b 100644 --- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/store/ElementHandler.java +++ b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/store/ElementHandler.java @@ -104,7 +104,7 @@ public class ElementHandler { private static Id getVersionId(String itemId, Version versionId) { VersionInfoEntity versionInfo = - MigrationMain.versionInfoMap.get(itemId); + MigrationMain.getVersionInfoMap().get(itemId); if (versionInfo == null) { return new Id(versionId.toString()); } @@ -121,7 +121,7 @@ public class ElementHandler { private static boolean isActiveVersion(String itemId, Version versionId) { VersionInfoEntity versionInfo = - MigrationMain.versionInfoMap.get(itemId); + MigrationMain.getVersionInfoMap().get(itemId); return versionInfo != null && versionInfo.getActiveVersion().equals(versionId); } diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/store/ItemHandler.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/store/ItemHandler.java index 97f5aaf265..801984ab24 100644 --- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/store/ItemHandler.java +++ b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/store/ItemHandler.java @@ -94,7 +94,7 @@ public class ItemHandler { private static Id getVersionId(String itemId, Version versionId) { VersionInfoEntity versionInfo = - MigrationMain.versionInfoMap.get(itemId); + MigrationMain.getVersionInfoMap().get(itemId); if (versionInfo == null) { return new Id(versionId.toString()); } @@ -110,7 +110,7 @@ public class ItemHandler { } private static boolean isActiveVersion(String itemId, Version versionId) { VersionInfoEntity versionInfo = - MigrationMain.versionInfoMap.get(itemId); + MigrationMain.getVersionInfoMap().get(itemId); if (versionInfo == null) { return false; } |