diff options
author | vempo <vitaliy.emporopulo@amdocs.com> | 2018-01-30 21:35:14 +0200 |
---|---|---|
committer | Avi Gaffa <avi.gaffa@amdocs.com> | 2018-02-01 11:13:57 +0000 |
commit | ca297aeb432b3d718bf09f0bac7b9f051c26e66d (patch) | |
tree | 1cf23878b79423e1446d2b68ccdd923d3c07f876 /openecomp-be | |
parent | ab88e0fdb4250730588bea07f357c4fd721f1425 (diff) |
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 <vitaliy.emporopulo@amdocs.com>
Diffstat (limited to 'openecomp-be')
26 files changed, 39 insertions, 176 deletions
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/application-config-rest/application-config-rest-services/src/main/java/org/openecomp/sdcrests/applicationconfig/rest/services/ApplicationConfigurationImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/application-config-rest/application-config-rest-services/src/main/java/org/openecomp/sdcrests/applicationconfig/rest/services/ApplicationConfigurationImpl.java index 99ef94d166..9a722a237b 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/application-config-rest/application-config-rest-services/src/main/java/org/openecomp/sdcrests/applicationconfig/rest/services/ApplicationConfigurationImpl.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/application-config-rest/application-config-rest-services/src/main/java/org/openecomp/sdcrests/applicationconfig/rest/services/ApplicationConfigurationImpl.java @@ -24,15 +24,12 @@ import org.openecomp.core.utilities.applicationconfig.dao.type.ApplicationConfig import org.openecomp.core.utilities.applicationconfig.type.ConfigurationData; import org.openecomp.core.utilities.file.FileUtils; import org.openecomp.sdc.applicationconfig.ApplicationConfigManager; -import org.openecomp.sdc.logging.types.LoggerConstants; -import org.openecomp.sdc.logging.types.LoggerServiceName; import org.openecomp.sdcrests.applicationconfig.rest.ApplicationConfiguration; import org.openecomp.sdcrests.applicationconfig.rest.mapping.MapApplicationConfigEntityToApplicationConfigDto; import org.openecomp.sdcrests.applicationconfig.rest.mapping.MapConfigurationDataToConfigurationDataDto; import org.openecomp.sdcrests.applicationconfiguration.types.ApplicationConfigDto; import org.openecomp.sdcrests.applicationconfiguration.types.ConfigurationDataDto; import org.openecomp.sdcrests.wrappers.GenericCollectionWrapper; -import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Service; @@ -55,18 +52,13 @@ public class ApplicationConfigurationImpl implements ApplicationConfiguration { @Override public Response insertToTable(String namespace, String key, InputStream fileContainingSchema) { - MDC.put(LoggerConstants.SERVICE_NAME, - LoggerServiceName.Insert_To_ApplicationConfig_Table.toString()); String value = new String(FileUtils.toByteArray(fileContainingSchema)); - applicationConfigManager.insertIntoTable(namespace, key, value); return Response.ok().build(); } @Override public Response getFromTable(String namespace, String key) { - MDC.put(LoggerConstants.SERVICE_NAME, - LoggerServiceName.Get_From_ApplicationConfig_Table.toString()); ConfigurationData value = applicationConfigManager.getFromTable(namespace, key); ConfigurationDataDto valueDto = new MapConfigurationDataToConfigurationDataDto() .applyMapping(value, ConfigurationDataDto.class); @@ -75,8 +67,6 @@ public class ApplicationConfigurationImpl implements ApplicationConfiguration { @Override public Response getListOfConfigurationByNamespaceFromTable(String namespace) { - MDC.put(LoggerConstants.SERVICE_NAME, LoggerServiceName - .Get_List_From_ApplicationConfig_Table_By_Namespace.toString()); Collection<ApplicationConfigEntity> applicationConfigEntities = applicationConfigManager.getListOfConfigurationByNamespace(namespace); GenericCollectionWrapper<ApplicationConfigDto> applicationConfigWrapper = diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/validation-rest-services/src/main/java/org/openecomp/sdcrests/validation/rest/services/ValidationImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/validation-rest-services/src/main/java/org/openecomp/sdcrests/validation/rest/services/ValidationImpl.java index 3a17aafda3..559adca4f4 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/validation-rest-services/src/main/java/org/openecomp/sdcrests/validation/rest/services/ValidationImpl.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/validation-rest/validation-rest-services/src/main/java/org/openecomp/sdcrests/validation/rest/services/ValidationImpl.java @@ -21,18 +21,11 @@ package org.openecomp.sdcrests.validation.rest.services; -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.LoggerErrorDescription; -import org.openecomp.sdc.logging.types.LoggerServiceName; -import org.openecomp.sdc.logging.types.LoggerTragetServiceName; import org.openecomp.sdc.validation.UploadValidationManager; import org.openecomp.sdc.validation.types.ValidationFileResponse; import org.openecomp.sdcrests.validation.rest.Validation; import org.openecomp.sdcrests.validation.rest.mapping.MapValidationFileResponseToValidationFileResponseDto; import org.openecomp.sdcrests.validation.types.ValidationFileResponseDto; -import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Service; @@ -51,9 +44,7 @@ public class ValidationImpl implements Validation { @Override public Response validateFile(String type, InputStream fileToValidate) { - MDC.put(LoggerConstants.SERVICE_NAME, - LoggerServiceName.Validate.toString()); - ValidationFileResponse validationFileResponse = null; + ValidationFileResponse validationFileResponse; try { validationFileResponse = uploadValidationManager.validateFile(type, fileToValidate); } catch (IOException exception) { diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLimitRequestDtoToLimitEntity.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLimitRequestDtoToLimitEntity.java index f575145887..8fd1b72939 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLimitRequestDtoToLimitEntity.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-services/src/main/java/org/openecomp/sdcrests/vendorlicense/rest/mapping/MapLimitRequestDtoToLimitEntity.java @@ -2,11 +2,8 @@ package org.openecomp.sdcrests.vendorlicense.rest.mapping; import org.openecomp.sdc.common.errors.CoreException; import org.openecomp.sdc.common.errors.ErrorCode; -import org.openecomp.sdc.datatypes.error.ErrorLevel; import org.openecomp.sdc.logging.api.Logger; import org.openecomp.sdc.logging.api.LoggerFactory; -import org.openecomp.sdc.logging.types.LoggerConstants; -import org.openecomp.sdc.logging.types.LoggerServiceName; import org.openecomp.sdc.vendorlicense.dao.types.AggregationFunction; import org.openecomp.sdc.vendorlicense.dao.types.LimitEntity; import org.openecomp.sdc.vendorlicense.dao.types.LimitType; diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapComponentDependencyModelRequestToEntity.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapComponentDependencyModelRequestToEntity.java index d1027ce75e..b0e0bbbfef 100644 --- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapComponentDependencyModelRequestToEntity.java +++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapComponentDependencyModelRequestToEntity.java @@ -3,11 +3,8 @@ package org.openecomp.sdcrests.vsp.rest.mapping; import org.openecomp.sdc.common.errors.CoreException; import org.openecomp.sdc.common.errors.ErrorCode; -import org.openecomp.sdc.datatypes.error.ErrorLevel; import org.openecomp.sdc.logging.api.Logger; import org.openecomp.sdc.logging.api.LoggerFactory; -import org.openecomp.sdc.logging.types.LoggerConstants; -import org.openecomp.sdc.logging.types.LoggerTragetServiceName; import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentDependencyModelEntity; import org.openecomp.sdc.vendorsoftwareproduct.errors.ComponentDependencyModelErrorBuilder; import org.openecomp.sdcrests.mapping.MappingBase; diff --git a/openecomp-be/backend/openecomp-sdc-application-config-manager/src/main/java/org/openecomp/sdc/applicationconfig/impl/ApplicationConfigManagerImpl.java b/openecomp-be/backend/openecomp-sdc-application-config-manager/src/main/java/org/openecomp/sdc/applicationconfig/impl/ApplicationConfigManagerImpl.java index 777739983d..50b0100522 100644 --- a/openecomp-be/backend/openecomp-sdc-application-config-manager/src/main/java/org/openecomp/sdc/applicationconfig/impl/ApplicationConfigManagerImpl.java +++ b/openecomp-be/backend/openecomp-sdc-application-config-manager/src/main/java/org/openecomp/sdc/applicationconfig/impl/ApplicationConfigManagerImpl.java @@ -28,13 +28,8 @@ import org.openecomp.sdc.applicationconfig.ApplicationConfigManager; import org.openecomp.sdc.common.errors.CoreException; import org.openecomp.sdc.common.errors.ErrorCategory; import org.openecomp.sdc.common.errors.ErrorCode; -import org.openecomp.sdc.datatypes.error.ErrorLevel; import org.openecomp.sdc.logging.api.Logger; import org.openecomp.sdc.logging.api.LoggerFactory; -import org.openecomp.sdc.logging.types.LoggerConstants; -import org.openecomp.sdc.logging.types.LoggerErrorCode; -import org.openecomp.sdc.logging.types.LoggerErrorDescription; -import org.openecomp.sdc.logging.types.LoggerTragetServiceName; import java.util.Collection; @@ -43,7 +38,7 @@ import java.util.Collection; */ public class ApplicationConfigManagerImpl implements ApplicationConfigManager { - private final Logger log = (Logger) LoggerFactory.getLogger(this.getClass().getName()); + private final Logger log = LoggerFactory.getLogger(this.getClass().getName()); private static final String SCHEMA_GENERATOR_INITIALIZATION_ERROR = "SCHEMA_GENERATOR_INITIALIZATION_ERROR"; diff --git a/openecomp-be/backend/openecomp-sdc-validation-manager/src/main/java/org/openecomp/sdc/validation/impl/UploadValidationManagerImpl.java b/openecomp-be/backend/openecomp-sdc-validation-manager/src/main/java/org/openecomp/sdc/validation/impl/UploadValidationManagerImpl.java index ac2d912e24..42c77b96d8 100644 --- a/openecomp-be/backend/openecomp-sdc-validation-manager/src/main/java/org/openecomp/sdc/validation/impl/UploadValidationManagerImpl.java +++ b/openecomp-be/backend/openecomp-sdc-validation-manager/src/main/java/org/openecomp/sdc/validation/impl/UploadValidationManagerImpl.java @@ -30,19 +30,13 @@ import org.openecomp.sdc.common.errors.ErrorCategory; import org.openecomp.sdc.common.errors.ErrorCode; import org.openecomp.sdc.common.errors.Messages; import org.openecomp.sdc.common.utils.SdcCommon; -import org.openecomp.sdc.datatypes.error.ErrorLevel; import org.openecomp.sdc.datatypes.error.ErrorMessage; import org.openecomp.sdc.heat.datatypes.structure.ValidationStructureList; import org.openecomp.sdc.heat.services.tree.HeatTreeManager; import org.openecomp.sdc.heat.services.tree.HeatTreeManagerUtil; -import org.openecomp.sdc.logging.types.LoggerConstants; -import org.openecomp.sdc.logging.types.LoggerErrorCode; -import org.openecomp.sdc.logging.types.LoggerErrorDescription; -import org.openecomp.sdc.logging.types.LoggerTragetServiceName; import org.openecomp.sdc.validation.UploadValidationManager; import org.openecomp.sdc.validation.types.ValidationFileResponse; import org.openecomp.sdc.validation.util.ValidationManagerUtil; -import org.slf4j.MDC; import java.io.ByteArrayInputStream; import java.io.File; @@ -94,7 +88,6 @@ public class UploadValidationManagerImpl implements UploadValidationManager { } if (CollectionUtils.isNotEmpty(folderList)) { - MDC.put(LoggerConstants.ERROR_DESCRIPTION, LoggerErrorDescription.INVALID_ZIP); throw new CoreException((new ErrorCode.ErrorCodeBuilder()) .withMessage(Messages.ZIP_SHOULD_NOT_CONTAIN_FOLDERS.getErrorMessage()) .withId(Messages.ZIP_SHOULD_NOT_CONTAIN_FOLDERS.getErrorMessage()) @@ -125,7 +118,7 @@ public class UploadValidationManagerImpl implements UploadValidationManager { HeatTreeManager tree; ValidationStructureList validationStructureList = new ValidationStructureList(); - if (type.toLowerCase().equals("heat")) { + if (type.equalsIgnoreCase("heat")) { FileContentHandler content = getFileContent(fileToValidate); if (!content.containsFile(SdcCommon.MANIFEST_NAME)) { throw new CoreException((new ErrorCode.ErrorCodeBuilder()) diff --git a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/main/java/org/openecomp/sdc/vendorlicense/impl/VendorLicenseManagerImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/main/java/org/openecomp/sdc/vendorlicense/impl/VendorLicenseManagerImpl.java index dface94dfc..5553b784f6 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/main/java/org/openecomp/sdc/vendorlicense/impl/VendorLicenseManagerImpl.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-license-manager/src/main/java/org/openecomp/sdc/vendorlicense/impl/VendorLicenseManagerImpl.java @@ -21,12 +21,6 @@ import org.openecomp.core.util.UniqueValueUtil; import org.openecomp.core.utilities.CommonMethods; import org.openecomp.sdc.common.errors.CoreException; import org.openecomp.sdc.common.errors.ErrorCode; -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.LoggerErrorDescription; -import org.openecomp.sdc.logging.types.LoggerServiceName; -import org.openecomp.sdc.logging.types.LoggerTragetServiceName; import org.openecomp.sdc.vendorlicense.VendorLicenseConstants; import org.openecomp.sdc.vendorlicense.VendorLicenseManager; import org.openecomp.sdc.vendorlicense.dao.EntitlementPoolDao; @@ -65,12 +59,6 @@ public class VendorLicenseManagerImpl implements VendorLicenseManager { private EntitlementPoolDao entitlementPoolDao; private LicenseKeyGroupDao licenseKeyGroupDao; private LimitDao limitDao; - private static final String VLM_ID = "VLM id"; - private static final String EP_LKGID = "EP/LKGId"; - private static final String VLM_ID_LKG_ID = "VLM id, LKG id"; - private static final String VLM_ID_LA_ID = "VLM id, LA id"; - private static final String VLM_ID_FG_ID = "VLM id, FG id"; - private static final String VLM_ID_EP_ID = "VLM id, EP id"; private static final String EP_POOL_START_TIME = "T00:00:00Z"; private static final String EP_POOL_EXPIRY_TIME = "T23:59:59Z"; private static final DateTimeFormatter FORMATTER diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/utils/VendorSoftwareProductUtils.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/utils/VendorSoftwareProductUtils.java index 44bca4032e..2964b72f5d 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/utils/VendorSoftwareProductUtils.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/utils/VendorSoftwareProductUtils.java @@ -27,11 +27,8 @@ import org.openecomp.sdc.datatypes.error.ErrorLevel; import org.openecomp.sdc.datatypes.error.ErrorMessage; import org.openecomp.sdc.logging.api.Logger; import org.openecomp.sdc.logging.api.LoggerFactory; -import org.openecomp.sdc.logging.types.LoggerConstants; -import org.openecomp.sdc.logging.types.LoggerErrorDescription; import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentMonitoringUploadEntity; import org.openecomp.sdc.vendorsoftwareproduct.types.OrchestrationTemplateActionResponse; -import org.slf4j.MDC; import java.io.File; import java.util.ArrayList; @@ -72,7 +69,6 @@ public class VendorSoftwareProductUtils { */ public static void validateContentZipData(FileContentHandler contentMap, Map<String, List<ErrorMessage>> errors) { - MDC.put(LoggerConstants.ERROR_DESCRIPTION, LoggerErrorDescription.INVALID_ZIP); if (contentMap.getFileList().isEmpty()) { ErrorMessage.ErrorMessageUtil.addMessage(SdcCommon.UPLOAD_FILE, errors) .add(new ErrorMessage(ErrorLevel.ERROR, Messages.INVALID_ZIP_FILE.getErrorMessage())); diff --git a/openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/utils/CommonUtil.java b/openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/utils/CommonUtil.java index 72485d7162..25c89e1270 100644 --- a/openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/utils/CommonUtil.java +++ b/openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/utils/CommonUtil.java @@ -31,9 +31,6 @@ import org.openecomp.sdc.common.errors.CoreException; import org.openecomp.sdc.common.errors.ErrorCategory; import org.openecomp.sdc.common.errors.ErrorCode; import org.openecomp.sdc.common.errors.Messages; -import org.openecomp.sdc.logging.types.LoggerConstants; -import org.openecomp.sdc.logging.types.LoggerErrorDescription; -import org.slf4j.MDC; import java.io.ByteArrayInputStream; import java.io.File; @@ -49,6 +46,10 @@ import java.util.zip.ZipInputStream; public class CommonUtil { + private CommonUtil() { + // prevent instantiation + } + public static FileContentHandler validateAndUploadFileContent(OnboardingTypesEnum type, byte[] uploadedFileData) throws IOException { @@ -113,7 +114,6 @@ public class CommonUtil { private static void validateNoFolders(List<String> folderList) { if (CollectionUtils.isNotEmpty(folderList)) { - MDC.put(LoggerConstants.ERROR_DESCRIPTION, LoggerErrorDescription.INVALID_ZIP); throw new CoreException((new ErrorCode.ErrorCodeBuilder()) .withMessage(Messages.ZIP_SHOULD_NOT_CONTAIN_FOLDERS.getErrorMessage()) .withId(Messages.ZIP_SHOULD_NOT_CONTAIN_FOLDERS.getErrorMessage()) @@ -151,6 +151,6 @@ public class CommonUtil { public static boolean isFileOriginFromZip(String fileOrigin){ return Objects.nonNull(fileOrigin) - && fileOrigin.toLowerCase().equals(OnboardingTypesEnum.ZIP.toString()); + && fileOrigin.equalsIgnoreCase(OnboardingTypesEnum.ZIP.toString()); } } diff --git a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-core/src/main/java/org/openecomp/sdc/healing/impl/HealingManagerImpl.java b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-core/src/main/java/org/openecomp/sdc/healing/impl/HealingManagerImpl.java index f737052139..9db9ea44b8 100644 --- a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-core/src/main/java/org/openecomp/sdc/healing/impl/HealingManagerImpl.java +++ b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-core/src/main/java/org/openecomp/sdc/healing/impl/HealingManagerImpl.java @@ -25,17 +25,12 @@ import org.openecomp.core.utilities.file.FileUtils; import org.openecomp.core.utilities.json.JsonUtil; import org.openecomp.sdc.common.errors.Messages; import org.openecomp.sdc.common.session.SessionContextProviderFactory; -import org.openecomp.sdc.datatypes.error.ErrorLevel; import org.openecomp.sdc.datatypes.model.ItemType; import org.openecomp.sdc.healing.api.HealingManager; import org.openecomp.sdc.healing.dao.HealingDao; import org.openecomp.sdc.healing.interfaces.Healer; import org.openecomp.sdc.healing.types.HealCode; import org.openecomp.sdc.healing.types.HealerType; -import org.openecomp.sdc.logging.types.LoggerConstants; -import org.openecomp.sdc.logging.types.LoggerErrorCode; -import org.openecomp.sdc.logging.types.LoggerErrorDescription; -import org.openecomp.sdc.logging.types.LoggerTragetServiceName; import org.openecomp.sdc.versioning.VersioningManager; import org.openecomp.sdc.versioning.dao.types.Version; import org.openecomp.sdc.versioning.dao.types.VersionStatus; @@ -211,9 +206,7 @@ public class HealingManagerImpl implements HealingManager { private boolean isPrivateHealingNeededByFlag(String itemId, String version, String user) { Optional<Boolean> userHealingFlag = getHealingFlag(itemId, version, user); - return userHealingFlag.isPresent() - ? userHealingFlag.get() - : isPublicHealingNeededByFlag(itemId, version); + return userHealingFlag.orElseGet(() -> isPublicHealingNeededByFlag(itemId, version)); } private boolean isPublicHealingNeededByFlag(String itemId, String versionId) { diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/types/EnrichedServiceArtifactEntity.java b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/types/EnrichedServiceArtifactEntity.java index a909e047a2..334e8368e6 100644 --- a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/types/EnrichedServiceArtifactEntity.java +++ b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/types/EnrichedServiceArtifactEntity.java @@ -23,11 +23,6 @@ import com.datastax.driver.mapping.annotations.PartitionKey; import com.datastax.driver.mapping.annotations.Table; import com.google.common.io.ByteStreams; import org.openecomp.sdc.common.errors.SdcRuntimeException; -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.LoggerErrorDescription; -import org.openecomp.sdc.logging.types.LoggerTragetServiceName; import org.openecomp.sdc.versioning.dao.types.Version; import java.io.IOException; diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/types/EnrichedServiceTemplateEntity.java b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/types/EnrichedServiceTemplateEntity.java index 2207d3f747..fdbd58bb3b 100644 --- a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/types/EnrichedServiceTemplateEntity.java +++ b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/types/EnrichedServiceTemplateEntity.java @@ -23,11 +23,6 @@ import com.datastax.driver.mapping.annotations.PartitionKey; import com.datastax.driver.mapping.annotations.Table; import com.google.common.io.ByteStreams; import org.openecomp.sdc.common.errors.SdcRuntimeException; -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.LoggerErrorDescription; -import org.openecomp.sdc.logging.types.LoggerTragetServiceName; import org.openecomp.sdc.versioning.dao.types.Version; import java.io.IOException; diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/types/ServiceArtifactEntity.java b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/types/ServiceArtifactEntity.java index 608f4aff0f..6a976e1779 100644 --- a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/types/ServiceArtifactEntity.java +++ b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/types/ServiceArtifactEntity.java @@ -23,11 +23,6 @@ import com.datastax.driver.mapping.annotations.PartitionKey; import com.datastax.driver.mapping.annotations.Table; import com.google.common.io.ByteStreams; import org.openecomp.sdc.common.errors.SdcRuntimeException; -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.LoggerErrorDescription; -import org.openecomp.sdc.logging.types.LoggerTragetServiceName; import org.openecomp.sdc.versioning.dao.types.Version; import java.io.IOException; diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/types/ServiceTemplateEntity.java b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/types/ServiceTemplateEntity.java index 08ecc5d989..ab2280a818 100644 --- a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/types/ServiceTemplateEntity.java +++ b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-api/src/main/java/org/openecomp/core/model/types/ServiceTemplateEntity.java @@ -23,11 +23,6 @@ import com.datastax.driver.mapping.annotations.PartitionKey; import com.datastax.driver.mapping.annotations.Table; import com.google.common.io.ByteStreams; import org.openecomp.sdc.common.errors.SdcRuntimeException; -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.LoggerErrorDescription; -import org.openecomp.sdc.logging.types.LoggerTragetServiceName; import org.openecomp.sdc.versioning.dao.types.Version; import java.io.IOException; 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<String> supportedCapabilities = new ArrayList<>(); - private static List<String> 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<String> SUPPORTED_CAPABILITIES = Arrays.asList("host", "os", "endpoint", "scalable"); + private static final List<String> SUPPORTED_REQUIREMENTS = Collections.singletonList("link"); /** * Add service template to tosca service model. @@ -123,7 +119,7 @@ public class GeneratorUtils { for (Map.Entry<String, RequirementDefinition> 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<String, CapabilityDefinition> capabilityDefinitionEntry = iterator.next(); //Expected Capability is of the format <capabilityId>_<componentName> String capabilityKey = capabilityDefinitionEntry.getKey().split("_")[0]; - if (!supportedCapabilities.contains(capabilityKey)) { + if (!SUPPORTED_CAPABILITIES.contains(capabilityKey)) { iterator.remove(); } } diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/util/HeatValidationService.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/util/HeatValidationService.java index 43df8ebb5f..932e60a991 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/util/HeatValidationService.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/util/HeatValidationService.java @@ -28,8 +28,6 @@ import org.openecomp.sdc.heat.datatypes.model.Parameter; import org.openecomp.sdc.heat.datatypes.model.Resource; import org.openecomp.sdc.logging.api.Logger; import org.openecomp.sdc.logging.api.LoggerFactory; -import org.openecomp.sdc.logging.types.LoggerConstants; -import org.openecomp.sdc.logging.types.LoggerErrorCode; import org.openecomp.sdc.logging.types.LoggerErrorDescription; import org.openecomp.sdc.logging.types.LoggerTragetServiceName; import org.openecomp.sdc.tosca.services.YamlUtil; @@ -49,7 +47,6 @@ import java.util.Set; public class HeatValidationService { private static final Logger LOGGER = LoggerFactory.getLogger(HeatValidator.class); - private static final String NESTED_FILE = "nested file"; private static final String NO_CONTENT_IN_FILE_MSG = "The file ' %s ' has no content"; private HeatValidationService(){ @@ -268,9 +265,8 @@ public class HeatValidationService { Collection<Resource> nestedResources = nestedHeatOrchestrationTemplate.getResources() == null ? null : nestedHeatOrchestrationTemplate.getResources().values(); - boolean isNestedLoopExist = addNestedFilesInLoopAndCheckIfNestedLoopExist(nestedResources, + return addNestedFilesInLoopAndCheckIfNestedLoopExist(nestedResources, callingFileName, filesInLoop, globalContext); - return isNestedLoopExist; } private static boolean addNestedFilesInLoopAndCheckIfNestedLoopExist( Collection<Resource> nestedResources,String callingFileName, diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/HeatValidator.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/HeatValidator.java index 9d4d48ad3d..4df4c7efae 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/HeatValidator.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/HeatValidator.java @@ -38,8 +38,6 @@ import org.openecomp.sdc.heat.services.HeatStructureUtil; import org.openecomp.sdc.heat.services.manifest.ManifestUtil; import org.openecomp.sdc.logging.api.Logger; import org.openecomp.sdc.logging.api.LoggerFactory; -import org.openecomp.sdc.logging.types.LoggerConstants; -import org.openecomp.sdc.logging.types.LoggerErrorCode; import org.openecomp.sdc.logging.types.LoggerErrorDescription; import org.openecomp.sdc.logging.types.LoggerTragetServiceName; import org.openecomp.sdc.tosca.services.YamlUtil; @@ -153,9 +151,8 @@ public class HeatValidator implements Validator { private static void extractResourceProperty(String fileName, Set<String> resourcesNames, GlobalValidationContext globalContext, Resource value) { - Resource resource = value; - Collection<Object> resourcePropertiesValues = - resource.getProperties() == null ? null : resource.getProperties() + Collection<Object> resourcePropertiesValues = + value.getProperties() == null ? null : value.getProperties() .values(); if (CollectionUtils.isNotEmpty(resourcePropertiesValues)) { for (Object propertyValue : resourcePropertiesValues) { @@ -417,8 +414,7 @@ public class HeatValidator implements Validator { heatOrchestrationTemplate, GlobalValidationContext globalContext) { - Map<String, Parameter> parametersMap = heatOrchestrationTemplate.getParameters() == null ? null - : heatOrchestrationTemplate.getParameters(); + Map<String, Parameter> parametersMap = heatOrchestrationTemplate.getParameters(); if (parametersMap != null && MapUtils.isNotEmpty(parametersMap)) { for (Map.Entry<String, Parameter> parameterEntry : parametersMap.entrySet()) { diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/ManifestValidator.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/ManifestValidator.java index d35d3cabd8..0b1e37ba06 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/ManifestValidator.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/ManifestValidator.java @@ -27,8 +27,6 @@ import org.openecomp.sdc.heat.datatypes.manifest.FileData; import org.openecomp.sdc.heat.datatypes.manifest.ManifestContent; import org.openecomp.sdc.logging.api.Logger; import org.openecomp.sdc.logging.api.LoggerFactory; -import org.openecomp.sdc.logging.types.LoggerConstants; -import org.openecomp.sdc.logging.types.LoggerErrorCode; import org.openecomp.sdc.logging.types.LoggerErrorDescription; import org.openecomp.sdc.logging.types.LoggerTragetServiceName; import org.openecomp.sdc.validation.Validator; diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-sdk/src/main/java/org/openecomp/sdc/validation/util/ValidationUtil.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-sdk/src/main/java/org/openecomp/sdc/validation/util/ValidationUtil.java index 77e82dc15f..db1d9eac88 100644 --- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-sdk/src/main/java/org/openecomp/sdc/validation/util/ValidationUtil.java +++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-sdk/src/main/java/org/openecomp/sdc/validation/util/ValidationUtil.java @@ -18,8 +18,6 @@ import org.openecomp.sdc.heat.datatypes.model.ResourceReferenceFunctions; import org.openecomp.sdc.heat.services.HeatStructureUtil; import org.openecomp.sdc.logging.api.Logger; import org.openecomp.sdc.logging.api.LoggerFactory; -import org.openecomp.sdc.logging.types.LoggerConstants; -import org.openecomp.sdc.logging.types.LoggerErrorCode; import org.openecomp.sdc.logging.types.LoggerErrorDescription; import org.openecomp.sdc.logging.types.LoggerTragetServiceName; import org.openecomp.sdc.tosca.services.YamlUtil; diff --git a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/XmlArtifact.java b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/XmlArtifact.java index d484bf46b9..ec2ebf4173 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/XmlArtifact.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-license-lib/openecomp-sdc-vendor-license-core/src/main/java/org/openecomp/sdc/vendorlicense/licenseartifacts/impl/types/XmlArtifact.java @@ -22,20 +22,15 @@ package org.openecomp.sdc.vendorlicense.licenseartifacts.impl.types; import com.fasterxml.jackson.dataformat.xml.XmlMapper; import org.openecomp.sdc.common.errors.CoreException; -import org.openecomp.sdc.datatypes.error.ErrorLevel; import org.openecomp.sdc.logging.api.Logger; import org.openecomp.sdc.logging.api.LoggerFactory; -import org.openecomp.sdc.logging.types.LoggerConstants; -import org.openecomp.sdc.logging.types.LoggerErrorCode; -import org.openecomp.sdc.logging.types.LoggerErrorDescription; -import org.openecomp.sdc.logging.types.LoggerTragetServiceName; import org.openecomp.sdc.vendorlicense.VendorLicenseConstants; import org.openecomp.sdc.vendorlicense.errors.JsonErrorBuilder; public abstract class XmlArtifact { XmlMapper xmlMapper = new XmlMapper(); - private final Logger log = (Logger) LoggerFactory.getLogger(this.getClass().getName()); + private final Logger log = LoggerFactory.getLogger(this.getClass().getName()); abstract void initMapper(); @@ -46,14 +41,13 @@ public abstract class XmlArtifact { */ public String toXml() { initMapper(); - String xml = ""; + String xml; try { xml = xmlMapper.writeValueAsString(this); } catch (com.fasterxml.jackson.core.JsonProcessingException exception) { log.debug("",exception); throw new CoreException(new JsonErrorBuilder(exception.getMessage()).build()); - } return xml.replaceAll(VendorLicenseConstants.VENDOR_LICENSE_MODEL_ARTIFACT_REGEX_REMOVE, ""); diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/ManualVspDataCollectionService.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/ManualVspDataCollectionService.java index 96c56c50e8..086aa8252a 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/ManualVspDataCollectionService.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/ManualVspDataCollectionService.java @@ -3,7 +3,6 @@ package org.openecomp.sdc.vendorsoftwareproduct.services; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang.StringUtils; import org.openecomp.core.utilities.json.JsonUtil; -import org.openecomp.sdc.datatypes.error.ErrorLevel; import org.openecomp.sdc.generator.datatypes.tosca.ComputeFlavor; import org.openecomp.sdc.generator.datatypes.tosca.DeploymentFlavorModel; import org.openecomp.sdc.generator.datatypes.tosca.LicenseFlavor; @@ -11,9 +10,6 @@ import org.openecomp.sdc.generator.datatypes.tosca.MultiFlavorVfcImage; import org.openecomp.sdc.generator.datatypes.tosca.VendorInfo; import org.openecomp.sdc.logging.api.Logger; import org.openecomp.sdc.logging.api.LoggerFactory; -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.vendorlicense.dao.types.FeatureGroupEntity; import org.openecomp.sdc.vendorlicense.dao.types.FeatureGroupModel; import org.openecomp.sdc.vendorlicense.facade.VendorLicenseFacade; @@ -72,7 +68,7 @@ public class ManualVspDataCollectionService { private static final VendorLicenseFacade vendorLicenseFacade = VendorLicenseFacadeFactory.getInstance().createInterface(); - private final Logger log = (Logger) LoggerFactory.getLogger(this.getClass().getName()); + private final Logger log = LoggerFactory.getLogger(this.getClass().getName()); /** * Gets vendor name for the vsp. @@ -299,7 +295,7 @@ public class ManualVspDataCollectionService { private Optional<ComputeFlavor> getComputeFlavor(String vspId, Version version, String componentId, String computeFlavorId) { ComputeFlavor computeFlavor = null; - ComputeEntity computeQuestionnaire = null; + ComputeEntity computeQuestionnaire; try { computeQuestionnaire = computeDao.getQuestionnaireData(vspId, version, componentId, computeFlavorId); diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/composition/CompositionDataExtractorImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/composition/CompositionDataExtractorImpl.java index c10a153114..413c9c0adf 100644 --- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/composition/CompositionDataExtractorImpl.java +++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/composition/CompositionDataExtractorImpl.java @@ -24,13 +24,8 @@ import com.fasterxml.jackson.databind.ObjectMapper; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.MapUtils; import org.openecomp.sdc.common.errors.CoreException; -import org.openecomp.sdc.datatypes.error.ErrorLevel; import org.openecomp.sdc.logging.api.Logger; import org.openecomp.sdc.logging.api.LoggerFactory; -import org.openecomp.sdc.logging.types.LoggerConstants; -import org.openecomp.sdc.logging.types.LoggerErrorCode; -import org.openecomp.sdc.logging.types.LoggerErrorDescription; -import org.openecomp.sdc.logging.types.LoggerTragetServiceName; import org.openecomp.sdc.tosca.datatypes.ToscaCapabilityType; import org.openecomp.sdc.tosca.datatypes.ToscaFunctions; import org.openecomp.sdc.tosca.datatypes.ToscaNodeType; @@ -314,7 +309,7 @@ public class CompositionDataExtractorImpl implements CompositionDataExtractor { List<ServiceTemplate> toscaServiceTemplates = toscaServiceModel.getServiceTemplates().entrySet() .stream() .filter(map -> map.getKey().equals(mainTemplate)) - .map(map -> map.getValue()) + .map(Map.Entry::getValue) .collect(Collectors.toList()); ServiceTemplate serviceTemplate = toscaServiceTemplates.get(0); @@ -420,7 +415,7 @@ public class CompositionDataExtractorImpl implements CompositionDataExtractor { network.setName(networkId); Optional<Boolean> networkDhcpValue = getNetworkDhcpValue(serviceTemplate, networkNodeTemplates.get(networkId)); - network.setDhcp(networkDhcpValue.isPresent() ? networkDhcpValue.get() : true); + network.setDhcp(networkDhcpValue.orElse(true)); networks.add(network); } return networks; diff --git a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/VersioningUtil.java b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/VersioningUtil.java index c4479d7105..7411edec08 100644 --- a/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/VersioningUtil.java +++ b/openecomp-be/lib/openecomp-sdc-versioning-lib/openecomp-sdc-versioning-api/src/main/java/org/openecomp/sdc/versioning/VersioningUtil.java @@ -39,6 +39,10 @@ import java.util.stream.Collectors; */ public class VersioningUtil { + private VersioningUtil() { + // prevent instantiation + } + /** * Validate entity existence. * @@ -51,10 +55,6 @@ public class VersioningUtil { T inputEntity, String firstClassCitizenType) { if (retrievedEntity == null) { - //MdcDataErrorMessage.createErrorMessageAndUpdateMDC(LoggerServiceName - // .getServiceName(LoggerServiceName.Submit_Entity), - // LoggerConstants.TARGET_ENTITY_DB, LoggerTragetServiceName.SUBMIT_ENTITY, - // ErrorLevel.ERROR.name(), null, LoggerErrorDescription.SUBMIT_ENTITY); throw new CoreException(new VersionableSubEntityNotFoundErrorBuilder( inputEntity.getEntityType(), inputEntity.getId(), @@ -88,11 +88,7 @@ public class VersioningUtil { } } - if (nonExistingIds.size() > 0) { - //MdcDataErrorMessage.createErrorMessageAndUpdateMDC - // (LoggerServiceName.getServiceName(LoggerServiceName.Submit_Entity), - // LoggerConstants.TARGET_ENTITY_DB, LoggerTragetServiceName.SUBMIT_ENTITY, - // ErrorLevel.ERROR.name(), null, LoggerErrorDescription.SUBMIT_ENTITY); + if (!nonExistingIds.isEmpty()) { if (nonExistingIds.size() == 1) { throw new CoreException(new VersionableSubEntityNotFoundErrorBuilder( entity.getEntityType(), @@ -130,12 +126,8 @@ public class VersioningUtil { .filter(entityId -> !retrievedContainedEntityIds.contains(entityId)) .collect(Collectors.toList()); - if (nonExistingIds.size() > 0) { + if (!nonExistingIds.isEmpty()) { if (nonExistingIds.size() == 1) { - //MdcDataErrorMessage.createErrorMessageAndUpdateMDC(LoggerServiceName - // .getServiceName(LoggerServiceName.Submit_Entity), LoggerConstants.TARGET_ENTITY_DB, - // LoggerTragetServiceName.ENTIT, ErrorLevel.ERROR.name(), - // null, LoggerErrorDescription.SUBMIT_ENTITY); throw new CoreException(new VersionableSubEntityNotFoundErrorBuilder( containedEntityType, nonExistingIds.get(0), @@ -143,10 +135,6 @@ public class VersioningUtil { containingEntity.getId(), containingEntity.getVersion()).build()); } - //MdcDataErrorMessage.createErrorMessageAndUpdateMDC(LoggerServiceName - // .getServiceName(LoggerServiceName.Submit_Entity), - // LoggerConstants.TARGET_ENTITY_DB, LoggerTragetServiceName.SUBMIT_ENTITY, - // ErrorLevel.ERROR.name(), null, LoggerErrorDescription.SUBMIT_ENTITY); throw new CoreException(new VersionableSubEntityNotFoundErrorBuilder( containedEntityType, nonExistingIds, diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/DataModelUtil.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/DataModelUtil.java index ed28eda06b..fd89faeb85 100644 --- a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/DataModelUtil.java +++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/DataModelUtil.java @@ -24,13 +24,8 @@ import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.MapUtils; import org.openecomp.core.utilities.CommonMethods; import org.openecomp.sdc.common.errors.CoreException; -import org.openecomp.sdc.datatypes.error.ErrorLevel; import org.openecomp.sdc.logging.api.Logger; import org.openecomp.sdc.logging.api.LoggerFactory; -import org.openecomp.sdc.logging.types.LoggerConstants; -import org.openecomp.sdc.logging.types.LoggerErrorCode; -import org.openecomp.sdc.logging.types.LoggerErrorDescription; -import org.openecomp.sdc.logging.types.LoggerTragetServiceName; import org.openecomp.sdc.tosca.datatypes.ToscaCapabilityType; import org.openecomp.sdc.tosca.datatypes.ToscaFunctions; import org.openecomp.sdc.tosca.datatypes.ToscaRelationshipType; @@ -78,6 +73,10 @@ import java.util.Optional; */ public class DataModelUtil { + private DataModelUtil() { + // prevent instantiation + } + /** * Add substitution mapping. */ diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/impl/ToscaAnalyzerServiceImpl.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/impl/ToscaAnalyzerServiceImpl.java index 6d9d16fadc..9d9e4a42fd 100644 --- a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/impl/ToscaAnalyzerServiceImpl.java +++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/impl/ToscaAnalyzerServiceImpl.java @@ -21,11 +21,6 @@ import org.apache.commons.collections4.MapUtils; import org.apache.commons.lang3.StringUtils; import org.openecomp.core.utilities.CommonMethods; import org.openecomp.sdc.common.errors.CoreException; -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.LoggerErrorDescription; -import org.openecomp.sdc.logging.types.LoggerTragetServiceName; import org.openecomp.sdc.tosca.datatypes.ToscaElementTypes; import org.openecomp.sdc.tosca.datatypes.ToscaNodeType; import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel; @@ -226,13 +221,10 @@ public class ToscaAnalyzerServiceImpl implements ToscaAnalyzerService { public Optional<NodeType> fetchNodeType(String nodeTypeKey, Collection<ServiceTemplate> serviceTemplates) { Optional<Map<String, NodeType>> nodeTypeMap = serviceTemplates.stream() - .map(st -> st.getNode_types()) + .map(ServiceTemplate::getNode_types) .filter(nodeTypes -> Objects.nonNull(nodeTypes) && nodeTypes.containsKey(nodeTypeKey)) .findFirst(); - if (nodeTypeMap.isPresent()) { - return Optional.ofNullable(nodeTypeMap.get().get(nodeTypeKey)); - } - return Optional.empty(); + return nodeTypeMap.map(stringNodeTypeMap -> stringNodeTypeMap.get(nodeTypeKey)); } @Override diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/impl/ToscaFileOutputServiceCsarImpl.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/impl/ToscaFileOutputServiceCsarImpl.java index f0a12e6c10..eaf1e20227 100644 --- a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/impl/ToscaFileOutputServiceCsarImpl.java +++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/impl/ToscaFileOutputServiceCsarImpl.java @@ -20,13 +20,8 @@ import org.apache.commons.io.IOUtils; import org.openecomp.core.utilities.file.FileContentHandler; import org.openecomp.core.utilities.file.FileUtils; import org.openecomp.sdc.common.errors.CoreException; -import org.openecomp.sdc.datatypes.error.ErrorLevel; import org.openecomp.sdc.logging.api.Logger; import org.openecomp.sdc.logging.api.LoggerFactory; -import org.openecomp.sdc.logging.types.LoggerConstants; -import org.openecomp.sdc.logging.types.LoggerErrorCode; -import org.openecomp.sdc.logging.types.LoggerErrorDescription; -import org.openecomp.sdc.logging.types.LoggerTragetServiceName; import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel; import org.openecomp.sdc.tosca.datatypes.model.ServiceTemplate; import org.openecomp.sdc.tosca.exceptions.CsarCreationErrorBuilder; |