diff options
author | vempo <vitaliy.emporopulo@amdocs.com> | 2018-02-21 17:11:42 +0200 |
---|---|---|
committer | Avi Gaffa <avi.gaffa@amdocs.com> | 2018-02-26 12:27:24 +0000 |
commit | 8a5edee1bea30f460e3676b38b5a7853f74784ee (patch) | |
tree | 8a8a078e7d91103b2850b763391a250f4b8632c1 /openecomp-be/backend/openecomp-sdc-vendor-software-product-manager | |
parent | 5d0f58eaab68a38ee5a514f70b10a89db28b0aad (diff) |
Removed audit logging from business code
Change-Id: I676e8bb10ae7caf2e8c7ae490c247e0c929696f2
Issue-ID: SDC-772
Signed-off-by: vempo <vitaliy.emporopulo@amdocs.com>
Diffstat (limited to 'openecomp-be/backend/openecomp-sdc-vendor-software-product-manager')
2 files changed, 15 insertions, 52 deletions
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/process/OrchestrationTemplateProcessCsarHandler.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/process/OrchestrationTemplateProcessCsarHandler.java index 6365b9ef74..4d92ee87c3 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/process/OrchestrationTemplateProcessCsarHandler.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/process/OrchestrationTemplateProcessCsarHandler.java @@ -16,6 +16,14 @@ package org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.process; +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; import org.apache.commons.collections4.MapUtils; import org.openecomp.core.impl.ToscaConverterImpl; import org.openecomp.core.utilities.file.FileContentHandler; @@ -31,7 +39,6 @@ import org.openecomp.sdc.heat.datatypes.structure.ValidationStructureList; import org.openecomp.sdc.heat.services.tree.ToscaTreeManager; import org.openecomp.sdc.logging.api.Logger; import org.openecomp.sdc.logging.api.LoggerFactory; -import org.openecomp.sdc.logging.messages.AuditMessages; import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel; import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentMonitoringUploadEntity; import org.openecomp.sdc.vendorsoftwareproduct.dao.type.OrchestrationTemplateCandidateData; @@ -43,15 +50,6 @@ import org.openecomp.sdc.vendorsoftwareproduct.services.filedatastructuremodule. import org.openecomp.sdc.vendorsoftwareproduct.types.OrchestrationTemplateActionResponse; import org.openecomp.sdc.vendorsoftwareproduct.types.UploadFileResponse; -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Optional; - public class OrchestrationTemplateProcessCsarHandler implements OrchestrationTemplateProcessHandler { private static final Logger LOGGER = LoggerFactory @@ -63,8 +61,6 @@ public class OrchestrationTemplateProcessCsarHandler @Override public OrchestrationTemplateActionResponse process(VspDetails vspDetails, OrchestrationTemplateCandidateData candidateData) { - LOGGER.audit( - AuditMessages.AUDIT_MSG + AuditMessages.CSAR_VALIDATION_STARTED + vspDetails.getId()); UploadFileResponse uploadFileResponse = new UploadFileResponse(); Optional<FileContentHandler> fileContent = OrchestrationUtil diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/process/OrchestrationTemplateProcessZipHandler.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/process/OrchestrationTemplateProcessZipHandler.java index f155e45c06..cb2921795c 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/process/OrchestrationTemplateProcessZipHandler.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/process/OrchestrationTemplateProcessZipHandler.java @@ -16,6 +16,12 @@ package org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.process; +import java.io.ByteArrayInputStream; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.MapUtils; import org.openecomp.core.translator.datatypes.TranslatorOutput; @@ -29,9 +35,6 @@ import org.openecomp.sdc.datatypes.error.ErrorLevel; import org.openecomp.sdc.datatypes.error.ErrorMessage; import org.openecomp.sdc.heat.datatypes.structure.HeatStructureTree; import org.openecomp.sdc.heat.datatypes.structure.ValidationStructureList; -import org.openecomp.sdc.logging.api.Logger; -import org.openecomp.sdc.logging.api.LoggerFactory; -import org.openecomp.sdc.logging.messages.AuditMessages; import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel; import org.openecomp.sdc.translator.services.heattotosca.HeatToToscaUtil; import org.openecomp.sdc.validation.util.ValidationManagerUtil; @@ -49,17 +52,8 @@ import org.openecomp.sdc.vendorsoftwareproduct.types.candidateheat.FilesDataStru import org.openecomp.sdc.vendorsoftwareproduct.utils.VendorSoftwareProductUtils; import org.openecomp.sdc.versioning.dao.types.Version; -import java.io.ByteArrayInputStream; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Optional; - -import static org.openecomp.sdc.logging.messages.AuditMessages.HEAT_VALIDATION_ERROR; - public class OrchestrationTemplateProcessZipHandler implements OrchestrationTemplateProcessHandler { - private static final Logger LOGGER = LoggerFactory.getLogger(OrchestrationTemplateProcessZipHandler.class); + private final CandidateService candidateService = CandidateServiceFactory.getInstance().createInterface(); @@ -68,7 +62,6 @@ public class OrchestrationTemplateProcessZipHandler implements OrchestrationTemp OrchestrationTemplateCandidateData candidateData) { String vspId = vspDetails.getId(); Version version = vspDetails.getVersion(); - LOGGER.audit(AuditMessages.AUDIT_MSG + AuditMessages.HEAT_VALIDATION_STARTED + vspId); OrchestrationTemplateActionResponse response = new OrchestrationTemplateActionResponse(); UploadFileResponse uploadFileResponse = new UploadFileResponse(); Optional<FileContentHandler> fileContent = OrchestrationUtil @@ -76,8 +69,6 @@ public class OrchestrationTemplateProcessZipHandler implements OrchestrationTemp candidateData.getContentData().array()); if (!fileContent.isPresent()) { response.addStructureErrors(uploadFileResponse.getErrors()); - response.getErrors().values().forEach(errorList -> printAuditForErrors(errorList, vspId, - HEAT_VALIDATION_ERROR)); return response; } @@ -89,8 +80,6 @@ public class OrchestrationTemplateProcessZipHandler implements OrchestrationTemp if (CollectionUtils.isNotEmpty(structure.getUnassigned())) { response.addErrorMessageToMap(SdcCommon.UPLOAD_FILE, Messages.FOUND_UNASSIGNED_FILES.getErrorMessage(), ErrorLevel.ERROR); - response.getErrors().values().forEach(errorList -> printAuditForErrors(errorList, vspId, - HEAT_VALIDATION_ERROR)); return response; } @@ -102,8 +91,6 @@ public class OrchestrationTemplateProcessZipHandler implements OrchestrationTemp .fetchZipFileByteArrayInputStream( vspId, candidateData, manifest, OnboardingTypesEnum.ZIP, uploadErrors); if (!zipByteArrayInputStream.isPresent()) { - response.getErrors().values() - .forEach(errorList -> printAuditForErrors(errorList, vspId, HEAT_VALIDATION_ERROR)); return response; } @@ -134,15 +121,6 @@ public class OrchestrationTemplateProcessZipHandler implements OrchestrationTemp .saveUploadData(vspDetails, candidateData, zipByteArrayInputStream.get(), fileContentMap, tree); - response.getErrors().values().forEach(errorList -> printAuditForErrors(errorList, vspId, - HEAT_VALIDATION_ERROR)); - if (MapUtils - .isEmpty(MessageContainerUtil.getMessageByLevel(ErrorLevel.ERROR, response.getErrors()))) { - LOGGER.audit(AuditMessages.AUDIT_MSG + AuditMessages.HEAT_VALIDATION_COMPLETED + vspId); - } - - LOGGER.audit(AuditMessages.AUDIT_MSG + AuditMessages.HEAT_TRANSLATION_STARTED + vspId); - TranslatorOutput translatorOutput = HeatToToscaUtil.loadAndTranslateTemplateData(fileContentMap); @@ -155,7 +133,6 @@ public class OrchestrationTemplateProcessZipHandler implements OrchestrationTemp orchestrationUtil.updateVspComponentDependencies(vspId, version, vspComponentIdNameInfoBeforeProcess, componentDependenciesBeforeDelete); - LOGGER.audit(AuditMessages.AUDIT_MSG + AuditMessages.HEAT_TRANSLATION_COMPLETED + vspId); uploadFileResponse.addStructureErrors(uploadErrors); candidateService.deleteOrchestrationTemplateCandidate(vspId, version); return response; @@ -178,14 +155,4 @@ public class OrchestrationTemplateProcessZipHandler implements OrchestrationTemp return OrchestrationUtil.createHeatTree(fileContentMap, validationErrors); } - - private void printAuditForErrors(List<ErrorMessage> errorList, String vspId, String auditType) { - - errorList.forEach(errorMessage -> { - if (errorMessage.getLevel().equals(ErrorLevel.ERROR)) { - LOGGER.audit( - AuditMessages.AUDIT_MSG + String.format(auditType, errorMessage.getMessage(), vspId)); - } - }); - } } |