diff options
Diffstat (limited to 'catalog-be/src/main')
5 files changed, 49 insertions, 82 deletions
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/auditing/impl/AuditResourceEventFactoryMananger.java b/catalog-be/src/main/java/org/openecomp/sdc/be/auditing/impl/AuditResourceEventFactoryMananger.java index 3400016ff0..25ce6e46a7 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/auditing/impl/AuditResourceEventFactoryMananger.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/auditing/impl/AuditResourceEventFactoryMananger.java @@ -52,11 +52,6 @@ public class AuditResourceEventFactoryMananger { resourceType, resourceName, invariantUuid, modifier, artifactData, comment, did); break; -// case DOWNLOAD_ARTIFACT: -// factory = new AuditDownloadArtifactExternalApiEventFactory(commonFields, String resourceType, String resourceName, -// String consumerId, String resourceUrl, ResourceAuditData prevParams, ResourceAuditData currParams, -// String invariantUuid, User modifier, String artifactData); -// break; case DISTRIBUTION_STATE_CHANGE_REQUEST: factory = new AuditDistStateChangeRequestResourceAdminEventFactory(commonFields, prevParams, currParams, resourceType, resourceName, invariantUuid, diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ArtifactsBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ArtifactsBusinessLogic.java index c8fc13d31e..b7c4b924c2 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ArtifactsBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ArtifactsBusinessLogic.java @@ -421,10 +421,6 @@ public class ArtifactsBusinessLogic extends BaseBusinessLogic { private Either<Either<ArtifactDefinition, Operation>, ResponseFormat> doAction(String componentId, ComponentTypeEnum componentType, ArtifactOperationInfo operation, String artifactId, ArtifactDefinition artifactInfo, String origMd5, String originData, String interfaceName, String operationName, AuditingActionEnum auditingAction, User user, org.openecomp.sdc.be.model.Component parent, boolean shouldLock, boolean inTransaction, boolean needUpdateGroup) { - /*if (interfaceName != null && operationName != null) { - interfaceName = interfaceName.toLowerCase(); - operationName = operationName.toLowerCase(); - }*/ switch (operation.getArtifactOperationEnum()) { case DOWNLOAD: if (artifactGenerationRequired(parent, artifactInfo)) { @@ -1190,10 +1186,8 @@ public class ArtifactsBusinessLogic extends BaseBusinessLogic { return Either.right(validateGroupType.right().value()); } } - // TODO TEMP !!! NodeTypeEnum parentType = convertParentType(componentType); - // TODO TEMP !!! boolean isCreate = ArtifactOperationEnum.isCreateOrLink(operation.getArtifactOperationEnum()); if (isDeploymentArtifact(artifactInfo)) { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogic.java index 81b7c6a9c1..0ff00913e0 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogic.java @@ -20,23 +20,8 @@ package org.openecomp.sdc.be.components.impl; -import static org.openecomp.sdc.be.components.property.GetInputUtils.isGetInputValueForInput; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Objects; -import java.util.Optional; -import java.util.Set; -import java.util.UUID; -import java.util.function.BiConsumer; -import java.util.stream.Collectors; - +import com.google.common.collect.Sets; +import fj.data.Either; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.MapUtils; import org.apache.commons.lang.StringUtils; @@ -102,9 +87,22 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; -import com.google.common.collect.Sets; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Objects; +import java.util.Optional; +import java.util.Set; +import java.util.UUID; +import java.util.function.BiConsumer; +import java.util.stream.Collectors; -import fj.data.Either; +import static org.openecomp.sdc.be.components.property.GetInputUtils.isGetInputValueForInput; @org.springframework.stereotype.Component public class ComponentInstanceBusinessLogic extends BaseBusinessLogic { @@ -884,12 +882,7 @@ public class ComponentInstanceBusinessLogic extends BaseBusinessLogic { if (lockComponent.isRight()) { return Either.right(lockComponent.right().value()); } - // validate resource - /* - * if (!ComponentValidationUtils.canWorkOnComponent(containerComponentId, serviceOperation, userId)) { log.info( "Restricted operation for user " + userId + " on service " + containerComponentId); return Either.right(componentsUtils - * .getResponseFormat(ActionStatus.RESTRICTED_OPERATION)); } // lock resource StorageOperationStatus lockStatus = graphLockOperation.lockComponent( containerComponentId, NodeTypeEnum.Service); if (lockStatus != StorageOperationStatus.OK) { - * log.debug("Failed to lock service {}", containerComponentId); resultOp = Either.right(componentsUtils .getResponseFormat(componentsUtils .convertFromStorageResponse(lockStatus))); return resultOp; } - */ + Either<ComponentInstance, ResponseFormat> resultOp = null; try { resultOp = deleteComponentInstance(containerComponent, componentInstanceId, containerComponentType); @@ -904,9 +897,6 @@ public class ComponentInstanceBusinessLogic extends BaseBusinessLogic { return deleteEither; } finally { - /* - * if (resultOp == null || resultOp.isRight()) { titanGenericDao.rollback(); } else { titanGenericDao.commit(); } graphLockOperation.unlockComponent(containerComponentId, NodeTypeEnum.Service); - */ unlockComponent(resultOp, containerComponent); } } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/CheckoutTransition.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/CheckoutTransition.java index 3d1ba33df2..5d7470e79b 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/CheckoutTransition.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/CheckoutTransition.java @@ -20,9 +20,7 @@ package org.openecomp.sdc.be.components.lifecycle; -import java.util.Arrays; -import java.util.List; - +import fj.data.Either; import org.openecomp.sdc.be.components.impl.ComponentBusinessLogic; import org.openecomp.sdc.be.config.BeEcompErrorManager; import org.openecomp.sdc.be.dao.api.ActionStatus; @@ -49,7 +47,8 @@ import org.openecomp.sdc.exception.ResponseFormat; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import fj.data.Either; +import java.util.Arrays; +import java.util.List; public class CheckoutTransition extends LifeCycleTransition { @@ -167,12 +166,6 @@ public class CheckoutTransition extends LifeCycleTransition { return userValidationResponse; } - // Disabled as of 1604 patch after discussing with Ella/Eli/Michael - - /* - * if (componentType == ComponentTypeEnum.PRODUCT){ Either<Boolean, ResponseFormat> productContactsEither = productContactsValidation((Product)component, modifier); if (productContactsEither.isRight()){ return productContactsEither; } } - */ - // check resource is not locked by another user if (oldState.equals(LifecycleStateEnum.NOT_CERTIFIED_CHECKOUT)) { ResponseFormat error = componentUtils.getResponseFormat(ActionStatus.COMPONENT_IN_CHECKOUT_STATE, componentName, componentType.name().toLowerCase(), owner.getFirstName(), owner.getLastName(), owner.getUserId()); diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/ArtifactExternalServlet.java b/catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/ArtifactExternalServlet.java index 80642c1e93..0c31539baa 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/ArtifactExternalServlet.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/externalapi/servlet/ArtifactExternalServlet.java @@ -20,27 +20,15 @@ package org.openecomp.sdc.be.externalapi.servlet; -import java.io.ByteArrayInputStream; -import java.io.InputStream; -import java.util.EnumMap; -import java.util.HashMap; -import java.util.Map; - -import javax.inject.Singleton; -import javax.servlet.ServletContext; -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.DELETE; -import javax.ws.rs.GET; -import javax.ws.rs.HeaderParam; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.core.Context; -import javax.ws.rs.core.HttpHeaders; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; - +import com.jcabi.aspects.Loggable; +import fj.data.Either; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import io.swagger.annotations.ApiResponse; +import io.swagger.annotations.ApiResponses; import org.openecomp.sdc.be.components.impl.ArtifactsBusinessLogic; import org.openecomp.sdc.be.components.impl.ArtifactsBusinessLogic.ArtifactOperationEnum; import org.openecomp.sdc.be.config.BeEcompErrorManager; @@ -57,16 +45,25 @@ import org.openecomp.sdc.exception.ResponseFormat; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.jcabi.aspects.Loggable; - -import fj.data.Either; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; +import javax.inject.Singleton; +import javax.servlet.ServletContext; +import javax.servlet.http.HttpServletRequest; +import javax.ws.rs.DELETE; +import javax.ws.rs.GET; +import javax.ws.rs.HeaderParam; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.HttpHeaders; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; +import java.io.ByteArrayInputStream; +import java.io.InputStream; +import java.util.EnumMap; +import java.util.HashMap; +import java.util.Map; /** * This Servlet serves external users operations on artifacts. * @@ -568,8 +565,6 @@ public class ArtifactExternalServlet extends AbstractValidationsServlet { @Path("/{assetType}/{uuid}/artifacts/{artifactUUID}") @Produces(MediaType.APPLICATION_JSON) @ApiOperation(value = "deletes an artifact of a resource or service", httpMethod = "DELETE", notes = "deletes an artifact of a resource or service", response = Response.class) - /*@ApiResponses(value = { @ApiResponse(code = 200, message = "Artifact Deleted"), @ApiResponse(code = 401, message = "Authorization required"), @ApiResponse(code = 403, message = "Restricted operation"), - @ApiResponse(code = 404, message = "Asset not found") })*/ @ApiResponses(value = { @ApiResponse(code = 200, message = "Artifact deleted", response = ArtifactDefinition.class), @ApiResponse(code = 400, message = "Missing 'X-ECOMP-InstanceID' HTTP header - POL5001"), |