From ca297aeb432b3d718bf09f0bac7b9f051c26e66d Mon Sep 17 00:00:00 2001 From: vempo Date: Tue, 30 Jan 2018 21:35:14 +0200 Subject: Removed log constants Removed constants associated with audit/metrics logging. Deleted unused code. Some other safe cleanup and refactoring. Change-Id: Idfda72e1fb27ca695a74f2a09cb46381c9caed1a Issue-ID: SDC-772 Signed-off-by: vempo --- .../sdc/generator/core/utils/GeneratorUtils.java | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) (limited to 'openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-core') diff --git a/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-core/src/main/java/org/openecomp/sdc/generator/core/utils/GeneratorUtils.java b/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-core/src/main/java/org/openecomp/sdc/generator/core/utils/GeneratorUtils.java index 1bd5e0bb0f..168cc1ff30 100644 --- a/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-core/src/main/java/org/openecomp/sdc/generator/core/utils/GeneratorUtils.java +++ b/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-core/src/main/java/org/openecomp/sdc/generator/core/utils/GeneratorUtils.java @@ -1,9 +1,5 @@ package org.openecomp.sdc.generator.core.utils; -import org.openecomp.sdc.datatypes.error.ErrorLevel; -import org.openecomp.sdc.logging.types.LoggerConstants; -import org.openecomp.sdc.logging.types.LoggerErrorCode; -import org.openecomp.sdc.logging.types.LoggerTragetServiceName; import org.openecomp.sdc.tosca.datatypes.ToscaElementTypes; import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel; import org.openecomp.sdc.tosca.datatypes.model.CapabilityDefinition; @@ -20,6 +16,7 @@ import org.openecomp.sdc.tosca.services.impl.ToscaAnalyzerServiceImpl; import java.util.ArrayList; import java.util.Arrays; +import java.util.Collections; import java.util.HashMap; import java.util.Iterator; import java.util.List; @@ -32,14 +29,13 @@ import static org.openecomp.sdc.tosca.services.DataModelUtil.addSubstitutionNode */ public class GeneratorUtils { - private static List supportedCapabilities = new ArrayList<>(); - private static List supportedRequirements = new ArrayList<>(); - static { - //TODO : Read from configuration - supportedCapabilities.addAll(Arrays.asList("host", "os", "endpoint", "scalable")); - supportedRequirements.addAll(Arrays.asList("link")); + private GeneratorUtils() { + // prevent instantiation } + //TODO : Read from configuration + private static final List SUPPORTED_CAPABILITIES = Arrays.asList("host", "os", "endpoint", "scalable"); + private static final List SUPPORTED_REQUIREMENTS = Collections.singletonList("link"); /** * Add service template to tosca service model. @@ -123,7 +119,7 @@ public class GeneratorUtils { for (Map.Entry requirementDefinitionEntry : requirementDefinitionMap.entrySet()) { String requirementKey = requirementDefinitionEntry.getKey(); - if (!supportedRequirements.contains(requirementKey)) { + if (!SUPPORTED_REQUIREMENTS.contains(requirementKey)) { iterator.remove(); } } @@ -147,7 +143,7 @@ public class GeneratorUtils { Map.Entry capabilityDefinitionEntry = iterator.next(); //Expected Capability is of the format _ String capabilityKey = capabilityDefinitionEntry.getKey().split("_")[0]; - if (!supportedCapabilities.contains(capabilityKey)) { + if (!SUPPORTED_CAPABILITIES.contains(capabilityKey)) { iterator.remove(); } } -- cgit 1.2.3-korg