From 5c9769c3e3a6d6675c5ec1bd450720791ef2793c Mon Sep 17 00:00:00 2001 From: Michael Lando Date: Mon, 20 Aug 2018 01:27:45 +0300 Subject: fix merge issue restore activity log add clean up to the onboarding back end docker Issue-ID: SDC-1664 Change-Id: Ib7994ca12439bc842650c3cacddb0e4d87215390 Signed-off-by: Michael Lando --- .../vsp/rest/services/ComponentProcessesImpl.java | 22 +++++++++++++--------- .../OrchestrationTemplateCandidateImpl.java | 9 +++++++++ .../rest/services/VendorSoftwareProductsImpl.java | 16 +++++++++++++--- 3 files changed, 35 insertions(+), 12 deletions(-) (limited to 'openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest') 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/services/ComponentProcessesImpl.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/services/ComponentProcessesImpl.java index aaf8a85ae2..5a5f61eed3 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/services/ComponentProcessesImpl.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/services/ComponentProcessesImpl.java @@ -1,26 +1,26 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ +/* + * Copyright © 2016-2018 European Support Limited + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * ============LICENSE_END========================================================= */ package org.openecomp.sdcrests.vsp.rest.services; import org.apache.cxf.jaxrs.ext.multipart.Attachment; +import org.openecomp.sdc.activitylog.ActivityLogManager; +import org.openecomp.sdc.activitylog.ActivityLogManagerFactory; +import org.openecomp.sdc.activitylog.dao.type.ActivityLogEntity; +import org.openecomp.sdc.activitylog.dao.type.ActivityType; import org.openecomp.sdc.vendorsoftwareproduct.ComponentManager; import org.openecomp.sdc.vendorsoftwareproduct.ComponentManagerFactory; import org.openecomp.sdc.vendorsoftwareproduct.ProcessManager; @@ -51,6 +51,8 @@ public class ComponentProcessesImpl implements ComponentProcesses { private ProcessManager processManager = ProcessManagerFactory.getInstance().createInterface(); private ComponentManager componentManager = ComponentManagerFactory.getInstance().createInterface(); + private ActivityLogManager activityLogManager = + ActivityLogManagerFactory.getInstance().createInterface(); @Override public Response list(String vspId, String versionId, String componentId, String user) { @@ -171,6 +173,8 @@ public class ComponentProcessesImpl implements ComponentProcesses { processManager.uploadProcessArtifact(attachment.getObject(InputStream.class), attachment.getContentDisposition().getParameter("filename"), vspId, version, componentId, processId); + activityLogManager.logActivity(new ActivityLogEntity(vspId, version, + ActivityType.Upload_Artifact, user, true, "", "")); return Response.ok().build(); } 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/services/OrchestrationTemplateCandidateImpl.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/services/OrchestrationTemplateCandidateImpl.java index b9827870cb..bdc422d580 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/services/OrchestrationTemplateCandidateImpl.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/services/OrchestrationTemplateCandidateImpl.java @@ -20,6 +20,10 @@ import org.apache.commons.beanutils.BeanUtils; import org.apache.commons.lang3.tuple.Pair; import org.apache.cxf.jaxrs.ext.multipart.Attachment; import org.openecomp.core.validation.errors.ErrorMessagesFormatBuilder; +import org.openecomp.sdc.activitylog.ActivityLogManager; +import org.openecomp.sdc.activitylog.ActivityLogManagerFactory; +import org.openecomp.sdc.activitylog.dao.type.ActivityLogEntity; +import org.openecomp.sdc.activitylog.dao.type.ActivityType; import org.openecomp.sdc.common.errors.Messages; import org.openecomp.sdc.datatypes.error.ErrorLevel; import org.openecomp.sdc.datatypes.error.ErrorMessage; @@ -66,6 +70,8 @@ public class OrchestrationTemplateCandidateImpl implements OrchestrationTemplate OrchestrationTemplateCandidateManagerFactory.getInstance().createInterface(); private VendorSoftwareProductManager vendorSoftwareProductManager = VspManagerFactory .getInstance().createInterface(); + private ActivityLogManager activityLogManager = + ActivityLogManagerFactory.getInstance().createInterface(); @Override public Response upload(String vspId, String versionId, Attachment fileToUpload, String user) { @@ -118,6 +124,9 @@ public class OrchestrationTemplateCandidateImpl implements OrchestrationTemplate Version version = new Version(versionId); OrchestrationTemplateActionResponse response = candidateManager.process(vspId, version); + activityLogManager.logActivity(new ActivityLogEntity(vspId, version, + ActivityType.Upload_Network_Package, user, true, "", "")); + OrchestrationTemplateActionResponseDto responseDto = new OrchestrationTemplateActionResponseDto(); BeanUtils.copyProperties(responseDto, response); 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/services/VendorSoftwareProductsImpl.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/services/VendorSoftwareProductsImpl.java index 14252cb893..f0fcd15939 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/services/VendorSoftwareProductsImpl.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/services/VendorSoftwareProductsImpl.java @@ -19,6 +19,10 @@ package org.openecomp.sdcrests.vsp.rest.services; import org.apache.commons.collections4.MapUtils; import org.openecomp.core.dao.UniqueValueDaoFactory; import org.openecomp.core.util.UniqueValueUtil; +import org.openecomp.sdc.activitylog.ActivityLogManager; +import org.openecomp.sdc.activitylog.ActivityLogManagerFactory; +import org.openecomp.sdc.activitylog.dao.type.ActivityLogEntity; +import org.openecomp.sdc.activitylog.dao.type.ActivityType; import org.openecomp.sdc.common.errors.CoreException; import org.openecomp.sdc.common.errors.ErrorCode; import org.openecomp.sdc.common.errors.Messages; @@ -100,6 +104,8 @@ public class VendorSoftwareProductsImpl implements VendorSoftwareProducts { VersioningManagerFactory.getInstance().createInterface(); private final VendorSoftwareProductManager vendorSoftwareProductManager = VspManagerFactory.getInstance().createInterface(); + private final ActivityLogManager activityLogManager = + ActivityLogManagerFactory.getInstance().createInterface(); private final NotificationPropagationManager notifier = NotificationPropagationManagerFactory.getInstance().createInterface(); private final UniqueValueUtil uniqueValueUtil = new UniqueValueUtil(UniqueValueDaoFactory @@ -161,7 +167,8 @@ public class VendorSoftwareProductsImpl implements VendorSoftwareProducts { ItemCreationDto itemCreationDto = new ItemCreationDto(); itemCreationDto.setItemId(item.getId()); itemCreationDto.setVersion(new MapVersionToDto().applyMapping(version, VersionDto.class)); - + activityLogManager.logActivity(new ActivityLogEntity(vspDetails.getId(), version, + ActivityType.Create, user, true, "", "")); return itemCreationDto; } @@ -493,12 +500,15 @@ public class VendorSoftwareProductsImpl implements VendorSoftwareProducts { Map> compilationErrors = vendorSoftwareProductManager.compile(vspId, version); if (!validationResponse.isValid() || MapUtils.isNotEmpty(compilationErrors)) { - + activityLogManager.logActivity( + new ActivityLogEntity(vspId, version, ActivityType.Submit, user, false, + "Failed on validation before submit", "")); return Optional.of(validationResponse); } versioningManager.submit(vspId, version, message); - + activityLogManager.logActivity( + new ActivityLogEntity(vspId, version, ActivityType.Submit, user, true, "", message)); return Optional.empty(); } -- cgit 1.2.3-korg