diff options
Diffstat (limited to 'catalog-be/src/main')
42 files changed, 751 insertions, 370 deletions
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/csar/CsarArtifactsAndGroupsBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/csar/CsarArtifactsAndGroupsBusinessLogic.java index 7469a0531a..f94cd38670 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/csar/CsarArtifactsAndGroupsBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/csar/CsarArtifactsAndGroupsBusinessLogic.java @@ -32,6 +32,7 @@ import org.openecomp.sdc.be.components.impl.ArtifactsBusinessLogic.ArtifactOpera import org.openecomp.sdc.be.components.impl.ArtifactsBusinessLogic.ArtifactOperationInfo; import org.openecomp.sdc.be.components.impl.BaseBusinessLogic; import org.openecomp.sdc.be.components.impl.CsarValidationUtils; +import org.openecomp.sdc.be.components.impl.GroupBusinessLogic; import org.openecomp.sdc.be.components.impl.ImportUtils; import org.openecomp.sdc.be.components.impl.ImportUtils.ResultStatusEnum; import org.openecomp.sdc.be.config.BeEcompErrorManager; @@ -48,7 +49,14 @@ import org.openecomp.sdc.be.info.ArtifactTemplateInfo; import org.openecomp.sdc.be.info.MergedArtifactInfo; import org.openecomp.sdc.be.model.*; import org.openecomp.sdc.be.model.heat.HeatParameterType; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ArtifactsOperations; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.InterfaceOperation; +import org.openecomp.sdc.be.model.operations.api.IElementOperation; +import org.openecomp.sdc.be.model.operations.api.IGroupInstanceOperation; +import org.openecomp.sdc.be.model.operations.api.IGroupOperation; +import org.openecomp.sdc.be.model.operations.api.IGroupTypeOperation; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; +import org.openecomp.sdc.be.model.operations.impl.InterfaceLifecycleOperation; import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum; import org.openecomp.sdc.be.servlets.RepresentationUtils; import org.openecomp.sdc.be.tosca.CsarUtils; @@ -73,16 +81,31 @@ import static org.openecomp.sdc.be.tosca.CsarUtils.ARTIFACTS_PATH; public class CsarArtifactsAndGroupsBusinessLogic extends BaseBusinessLogic { private static final Logger log = Logger.getLogger(CsarArtifactsAndGroupsBusinessLogic.class.getName()); - public static final String ARTIFACT_FILE_IS_NOT_IN_EXPECTED_FORMATR_FILE_NAME = "Artifact file is not in expected formatr, fileName {}"; - public static final String ARTIFACT_FILE_IS_NOT_IN_EXPECTED_FORMAT_FILE_NAME = "Artifact file is not in expected format, fileName {}"; - public static final String ARTIFACT_FILE_IS_NOT_IN_EXPECTED_FORMATR_FILE_NAME1 = "Artifact file is not in expected formatr, fileName "; - public static final String ARTIFACT_FILE_IS_NOT_IN_EXPECTED_FORMAT_FILE_NAME1 = "Artifact file is not in expected format, fileName "; - public static final String ARTIFACT_INTERNALS_ARE_INVALID = "Artifact internals are invalid"; - public static final String ARTIFACT_WITH_NAME_AND_TYPE_ALREADY_EXIST_WITH_TYPE = "Artifact with name {} and type {} already exist with type {}"; + private static final String ARTIFACT_FILE_IS_NOT_IN_EXPECTED_FORMATR_FILE_NAME = "Artifact file is not in expected formatr, fileName {}"; + private static final String ARTIFACT_FILE_IS_NOT_IN_EXPECTED_FORMAT_FILE_NAME = "Artifact file is not in expected format, fileName {}"; + private static final String ARTIFACT_FILE_IS_NOT_IN_EXPECTED_FORMATR_FILE_NAME1 = "Artifact file is not in expected formatr, fileName "; + private static final String ARTIFACT_FILE_IS_NOT_IN_EXPECTED_FORMAT_FILE_NAME1 = "Artifact file is not in expected format, fileName "; + private static final String ARTIFACT_INTERNALS_ARE_INVALID = "Artifact internals are invalid"; + private static final String ARTIFACT_WITH_NAME_AND_TYPE_ALREADY_EXIST_WITH_TYPE = "Artifact with name {} and type {} already exist with type {}"; private final Gson gson = new Gson(); private static final Pattern pattern = Pattern.compile("\\..(.*?)\\.."); + protected final ArtifactsBusinessLogic artifactsBusinessLogic; + private final GroupBusinessLogic groupBusinessLogic; + @Autowired - protected ArtifactsBusinessLogic artifactsBusinessLogic; + public CsarArtifactsAndGroupsBusinessLogic(IElementOperation elementDao, + IGroupOperation groupOperation, + IGroupInstanceOperation groupInstanceOperation, + IGroupTypeOperation groupTypeOperation, + GroupBusinessLogic groupBusinessLogic, + InterfaceOperation interfaceOperation, + InterfaceLifecycleOperation interfaceLifecycleTypeOperation, + ArtifactsBusinessLogic artifactsBusinessLogic, ArtifactsOperations artifactToscaOperation) { + super(elementDao, groupOperation, groupInstanceOperation, groupTypeOperation, + interfaceOperation, interfaceLifecycleTypeOperation, artifactToscaOperation); + this.artifactsBusinessLogic = artifactsBusinessLogic; + this.groupBusinessLogic = groupBusinessLogic; + } public Either<Resource, ResponseFormat> createResourceArtifactsFromCsar(CsarInfo csarInfo, Resource resource, String artifactsMetaFile, String artifactsMetaFileName, List<ArtifactDefinition> createdArtifacts, diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/csar/CsarBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/csar/CsarBusinessLogic.java index addd9d2407..af914e9019 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/csar/CsarBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/csar/CsarBusinessLogic.java @@ -25,6 +25,7 @@ import fj.data.Either; import org.apache.commons.lang3.tuple.ImmutablePair; import org.openecomp.sdc.be.components.impl.BaseBusinessLogic; import org.openecomp.sdc.be.components.impl.CsarValidationUtils; +import org.openecomp.sdc.be.components.impl.GroupBusinessLogic; import org.openecomp.sdc.be.components.impl.exceptions.ByActionStatusComponentException; import org.openecomp.sdc.be.components.impl.exceptions.ByResponseFormatComponentException; import org.openecomp.sdc.be.config.BeEcompErrorManager; @@ -33,9 +34,16 @@ import org.openecomp.sdc.be.model.NodeTypeInfo; import org.openecomp.sdc.be.model.ParsedToscaYamlInfo; import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.User; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ArtifactsOperations; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.InterfaceOperation; import org.openecomp.sdc.be.model.operations.StorageException; +import org.openecomp.sdc.be.model.operations.api.IElementOperation; +import org.openecomp.sdc.be.model.operations.api.IGroupInstanceOperation; +import org.openecomp.sdc.be.model.operations.api.IGroupOperation; +import org.openecomp.sdc.be.model.operations.api.IGroupTypeOperation; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.model.operations.impl.CsarOperation; +import org.openecomp.sdc.be.model.operations.impl.InterfaceLifecycleOperation; import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum; import org.openecomp.sdc.common.log.wrappers.Logger; import org.openecomp.sdc.exception.ResponseFormat; @@ -51,12 +59,25 @@ public class CsarBusinessLogic extends BaseBusinessLogic { private static final String CREATING_RESOURCE_FROM_CSAR_FETCHING_CSAR_WITH_ID = "Creating resource from CSAR: fetching CSAR with id "; private static final String FAILED = " failed"; - @Autowired + private final YamlTemplateParsingHandler yamlHandler; private CsarOperation csarOperation; @Autowired - private YamlTemplateParsingHandler yamlHandler; + public CsarBusinessLogic(IElementOperation elementDao, + IGroupOperation groupOperation, + IGroupInstanceOperation groupInstanceOperation, + IGroupTypeOperation groupTypeOperation, + GroupBusinessLogic groupBusinessLogic, + InterfaceOperation interfaceOperation, + InterfaceLifecycleOperation interfaceLifecycleTypeOperation, + YamlTemplateParsingHandler yamlHandler, + ArtifactsOperations artifactToscaOperation) { + super(elementDao, groupOperation, groupInstanceOperation, groupTypeOperation, + interfaceOperation, interfaceLifecycleTypeOperation, artifactToscaOperation); + this.yamlHandler = yamlHandler; + } + @Autowired public void setCsarOperation(CsarOperation csarOperation) { this.csarOperation = csarOperation; } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/DmaapConsumer.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/DmaapConsumer.java index 0c05dd1974..6388083a57 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/DmaapConsumer.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/DmaapConsumer.java @@ -39,21 +39,22 @@ import java.util.function.Consumer; */ @Service public class DmaapConsumer { + private static final Logger logger = Logger.getLogger(DmaapClientFactory.class.getName()); private final ExecutorFactory executorFactory; private final DmaapClientFactory dmaapClientFactory; - private static final Logger logger = Logger.getLogger(DmaapClientFactory.class.getName()); - - @Autowired - private DmaapHealth dmaapHealth; + private final DmaapHealth dmaapHealth; /** * Allows to create an object of type DmaapConsumer * @param executorFactory * @param dmaapClientFactory + * @param dmaapHealth */ @Autowired - public DmaapConsumer(ExecutorFactory executorFactory, DmaapClientFactory dmaapClientFactory) { + public DmaapConsumer(ExecutorFactory executorFactory, DmaapClientFactory dmaapClientFactory, + DmaapHealth dmaapHealth) { this.executorFactory = executorFactory; this.dmaapClientFactory = dmaapClientFactory; + this.dmaapHealth = dmaapHealth; } /** diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/ServiceDistributionArtifactsBuilder.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/ServiceDistributionArtifactsBuilder.java index 04c4d11679..de695d6501 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/ServiceDistributionArtifactsBuilder.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/ServiceDistributionArtifactsBuilder.java @@ -56,8 +56,12 @@ public class ServiceDistributionArtifactsBuilder { @javax.annotation.Resource IArtifactOperation artifactOperation; + private final ToscaOperationFacade toscaOperationFacade; + @Autowired - ToscaOperationFacade toscaOperationFacade; + public ServiceDistributionArtifactsBuilder(ToscaOperationFacade toscaOperationFacade) { + this.toscaOperationFacade = toscaOperationFacade; + } public InterfaceLifecycleOperation getInterfaceLifecycleOperation() { return interfaceLifecycleOperation; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/health/HealthCheckBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/health/HealthCheckBusinessLogic.java index 00efd80200..857fd1bdd7 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/health/HealthCheckBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/health/HealthCheckBusinessLogic.java @@ -87,11 +87,15 @@ public class HealthCheckBusinessLogic { private DmaapHealth dmaapHealth; @Resource private CassandraHealthCheck cassandraHealthCheck; - @Autowired - private SwitchoverDetector switchoverDetector; + private final SwitchoverDetector switchoverDetector; private volatile List<HealthCheckInfo> prevBeHealthCheckInfos = null; private ScheduledFuture<?> scheduledFuture = null; + @Autowired + public HealthCheckBusinessLogic(SwitchoverDetector switchoverDetector) { + this.switchoverDetector = switchoverDetector; + } + @PostConstruct public void init() { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/AdditionalInformationBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/AdditionalInformationBusinessLogic.java index 19e696c07a..f0ccffa633 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/AdditionalInformationBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/AdditionalInformationBusinessLogic.java @@ -30,10 +30,16 @@ import org.openecomp.sdc.be.datatypes.elements.AdditionalInfoParameterInfo; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; import org.openecomp.sdc.be.impl.WebAppContextWrapper; import org.openecomp.sdc.be.model.AdditionalInformationDefinition; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ArtifactsOperations; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.InterfaceOperation; import org.openecomp.sdc.be.model.operations.api.IAdditionalInformationOperation; import org.openecomp.sdc.be.model.operations.api.IElementOperation; +import org.openecomp.sdc.be.model.operations.api.IGroupInstanceOperation; +import org.openecomp.sdc.be.model.operations.api.IGroupOperation; +import org.openecomp.sdc.be.model.operations.api.IGroupTypeOperation; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.model.operations.impl.DaoStatusConverter; +import org.openecomp.sdc.be.model.operations.impl.InterfaceLifecycleOperation; import org.openecomp.sdc.be.model.operations.utils.ComponentValidationUtils; import org.openecomp.sdc.be.model.tosca.converters.StringConvertor; import org.openecomp.sdc.be.model.tosca.validators.StringValidator; @@ -41,6 +47,7 @@ import org.openecomp.sdc.common.api.Constants; import org.openecomp.sdc.common.log.wrappers.Logger; import org.openecomp.sdc.common.util.ValidationUtils; import org.openecomp.sdc.exception.ResponseFormat; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.springframework.web.context.WebApplicationContext; @@ -61,8 +68,21 @@ public class AdditionalInformationBusinessLogic extends BaseBusinessLogic { private static final Logger log = Logger.getLogger(AdditionalInformationBusinessLogic.class.getName()); private static final String FAILED_TO_LOCK_COMPONENT_ERROR = "Failed to lock component {} error - {}"; - @javax.annotation.Resource - private IAdditionalInformationOperation additionalInformationOperation = null; + private final IAdditionalInformationOperation additionalInformationOperation; + + @Autowired + public AdditionalInformationBusinessLogic(IElementOperation elementDao, + IGroupOperation groupOperation, + IGroupInstanceOperation groupInstanceOperation, + IGroupTypeOperation groupTypeOperation, + InterfaceOperation interfaceOperation, + InterfaceLifecycleOperation interfaceLifecycleTypeOperation, + IAdditionalInformationOperation additionalInformationOperation, + ArtifactsOperations artifactToscaOperation) { + super(elementDao, groupOperation, groupInstanceOperation, groupTypeOperation, + interfaceOperation, interfaceLifecycleTypeOperation, artifactToscaOperation); + this.additionalInformationOperation = additionalInformationOperation; + } protected static IElementOperation getElementDao(Class<IElementOperation> class1, ServletContext context) { WebAppContextWrapper webApplicationContextWrapper = (WebAppContextWrapper) context.getAttribute(Constants.WEB_APPLICATION_CONTEXT_WRAPPER_ATTR); 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 dcc6eee01a..3d149f79e6 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 @@ -22,7 +22,6 @@ package org.openecomp.sdc.be.components.impl; -import com.google.common.annotations.VisibleForTesting; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import fj.data.Either; @@ -73,13 +72,19 @@ import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.Service; import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.be.model.heat.HeatParameterType; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ArtifactsOperations; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.InterfaceOperation; import org.openecomp.sdc.be.model.jsonjanusgraph.operations.NodeTemplateOperation; import org.openecomp.sdc.be.model.operations.api.IElementOperation; +import org.openecomp.sdc.be.model.operations.api.IGroupInstanceOperation; +import org.openecomp.sdc.be.model.operations.api.IGroupOperation; +import org.openecomp.sdc.be.model.operations.api.IGroupTypeOperation; import org.openecomp.sdc.be.model.operations.api.IHeatParametersOperation; import org.openecomp.sdc.be.model.operations.api.IInterfaceLifecycleOperation; import org.openecomp.sdc.be.model.operations.api.IUserAdminOperation; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.model.operations.impl.DaoStatusConverter; +import org.openecomp.sdc.be.model.operations.impl.InterfaceLifecycleOperation; import org.openecomp.sdc.be.model.operations.impl.UniqueIdBuilder; import org.openecomp.sdc.be.resources.data.ComponentMetadataData; import org.openecomp.sdc.be.resources.data.ESArtifactData; @@ -154,21 +159,21 @@ public class ArtifactsBusinessLogic extends BaseBusinessLogic { private static final String ARTIFACT_PLACEHOLDER_FILE_EXTENSION = "fileExtension"; private static final Logger log = Logger.getLogger(ArtifactsBusinessLogic.class); - public static final String FAILED_UPDATE_GROUPS = "Failed to update groups of the component {}. "; - public static final String FAILED_UPDATE_ARTIFACT = "Failed to delete or update the artifact {}. Parent uniqueId is {}"; - public static final String FAILED_SAVE_ARTIFACT = "Failed to save the artifact."; - public static final String UPDATE_ARTIFACT_LOCK = "Update Artifact - lock "; - public static final String FAILED_DOWNLOAD_ARTIFACT = "Download artifact {} failed"; - public static final String FAILED_UPLOAD_ARTIFACT_TO_COMPONENT = "Failed to upload artifact to component with type {} and uuid {}. Status is {}. "; - public static final String FAILED_UPLOAD_ARTIFACT_TO_INSTANCE = "Failed to upload artifact to component instance {} of component with type {} and uuid {}. Status is {}. "; - public static final String FAILED_FETCH_COMPONENT = "Could not fetch component with type {} and uuid {}. Status is {}. "; - public static final String NULL_PARAMETER = "One of the function parameteres is null"; + private static final String FAILED_UPDATE_GROUPS = "Failed to update groups of the component {}. "; + private static final String FAILED_UPDATE_ARTIFACT = "Failed to delete or update the artifact {}. Parent uniqueId is {}"; + private static final String FAILED_SAVE_ARTIFACT = "Failed to save the artifact."; + private static final String UPDATE_ARTIFACT_LOCK = "Update Artifact - lock "; + private static final String FAILED_DOWNLOAD_ARTIFACT = "Download artifact {} failed"; + private static final String FAILED_UPLOAD_ARTIFACT_TO_COMPONENT = "Failed to upload artifact to component with type {} and uuid {}. Status is {}. "; + private static final String FAILED_UPLOAD_ARTIFACT_TO_INSTANCE = "Failed to upload artifact to component instance {} of component with type {} and uuid {}. Status is {}. "; + private static final String FAILED_FETCH_COMPONENT = "Could not fetch component with type {} and uuid {}. Status is {}. "; + private static final String NULL_PARAMETER = "One of the function parameteres is null"; public static final String COMPONENT_INSTANCE_NOT_FOUND = "Component instance {} was not found for component {}"; - public static final String ROLLBACK = "all changes rollback"; - public static final String COMMIT = "all changes committed"; - public static final String ARTIFACT_SAVED = "Artifact saved into ES - {}"; - public static final String UPDATE_ARTIFACT = "Update Artifact"; - public static final String FOUND_DEPLOYMENT_ARTIFACT = "Found deployment artifact {}"; + private static final String ROLLBACK = "all changes rollback"; + private static final String COMMIT = "all changes committed"; + private static final String ARTIFACT_SAVED = "Artifact saved into ES - {}"; + private static final String UPDATE_ARTIFACT = "Update Artifact"; + private static final String FOUND_DEPLOYMENT_ARTIFACT = "Found deployment artifact {}"; private Gson gson = new GsonBuilder().setPrettyPrinting().create(); @javax.annotation.Resource @@ -180,37 +185,34 @@ public class ArtifactsBusinessLogic extends BaseBusinessLogic { private IElementOperation elementOperation; @javax.annotation.Resource - private ResourceBusinessLogic resourceBusinessLogic; - - @javax.annotation.Resource - private ServiceBusinessLogic serviceBusinessLogic; - - @javax.annotation.Resource private UserBusinessLogic userAdminManager; @javax.annotation.Resource private IHeatParametersOperation heatParametersOperation; - @Autowired - private ArtifactCassandraDao artifactCassandraDao; - - @Autowired - private ToscaExportHandler toscaExportUtils; - - @Autowired - private CsarUtils csarUtils; - - @Autowired - private LifecycleBusinessLogic lifecycleBusinessLogic; - - @Autowired - private IUserBusinessLogic userBusinessLogic; - - @Autowired + private final ArtifactCassandraDao artifactCassandraDao; + private final ToscaExportHandler toscaExportUtils; + private final CsarUtils csarUtils; + private final LifecycleBusinessLogic lifecycleBusinessLogic; + private final IUserBusinessLogic userBusinessLogic; + private final ArtifactsResolver artifactsResolver; private NodeTemplateOperation nodeTemplateOperation; @Autowired - private ArtifactsResolver artifactsResolver; + public ArtifactsBusinessLogic(ArtifactCassandraDao artifactCassandraDao, ToscaExportHandler toscaExportUtils, + CsarUtils csarUtils, LifecycleBusinessLogic lifecycleBusinessLogic, IUserBusinessLogic userBusinessLogic, + ArtifactsResolver artifactsResolver, IElementOperation elementDao, IGroupOperation groupOperation, + IGroupInstanceOperation groupInstanceOperation, IGroupTypeOperation groupTypeOperation, InterfaceOperation interfaceOperation, + InterfaceLifecycleOperation interfaceLifecycleTypeOperation, ArtifactsOperations artifactToscaOperation) { + super(elementDao, groupOperation, groupInstanceOperation, groupTypeOperation, + interfaceOperation, interfaceLifecycleTypeOperation, artifactToscaOperation); + this.artifactCassandraDao = artifactCassandraDao; + this.toscaExportUtils = toscaExportUtils; + this.csarUtils = csarUtils; + this.lifecycleBusinessLogic = lifecycleBusinessLogic; + this.userBusinessLogic = userBusinessLogic; + this.artifactsResolver = artifactsResolver; + } public enum ArtifactOperationEnum { CREATE, UPDATE, DELETE, DOWNLOAD, LINK; @@ -5630,7 +5632,7 @@ public class ArtifactsBusinessLogic extends BaseBusinessLogic { return gson.toJson(json); } - @VisibleForTesting + @Autowired void setNodeTemplateOperation(NodeTemplateOperation nodeTemplateOperation) { this.nodeTemplateOperation = nodeTemplateOperation; } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/AttributeBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/AttributeBusinessLogic.java index ef0cd463db..c20a2b3b28 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/AttributeBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/AttributeBusinessLogic.java @@ -27,10 +27,18 @@ import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; import org.openecomp.sdc.be.model.DataTypeDefinition; import org.openecomp.sdc.be.model.PropertyDefinition; import org.openecomp.sdc.be.model.Resource; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ArtifactsOperations; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.InterfaceOperation; +import org.openecomp.sdc.be.model.operations.api.IElementOperation; +import org.openecomp.sdc.be.model.operations.api.IGroupInstanceOperation; +import org.openecomp.sdc.be.model.operations.api.IGroupOperation; +import org.openecomp.sdc.be.model.operations.api.IGroupTypeOperation; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; +import org.openecomp.sdc.be.model.operations.impl.InterfaceLifecycleOperation; import org.openecomp.sdc.be.model.operations.utils.ComponentValidationUtils; import org.openecomp.sdc.common.log.wrappers.Logger; import org.openecomp.sdc.exception.ResponseFormat; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import java.util.List; @@ -54,6 +62,18 @@ public class AttributeBusinessLogic extends BaseBusinessLogic { private static final Logger log = Logger.getLogger(AttributeBusinessLogic.class.getName()); private static final String FAILED_TO_LOCK_COMPONENT_ERROR = "Failed to lock component {}. Error - {}"; + @Autowired + public AttributeBusinessLogic(IElementOperation elementDao, + IGroupOperation groupOperation, + IGroupInstanceOperation groupInstanceOperation, + IGroupTypeOperation groupTypeOperation, + InterfaceOperation interfaceOperation, + InterfaceLifecycleOperation interfaceLifecycleTypeOperation, + ArtifactsOperations artifactToscaOperation) { + super(elementDao, groupOperation, groupInstanceOperation, groupTypeOperation, + interfaceOperation, interfaceLifecycleTypeOperation, artifactToscaOperation); + } + /** * Created attribute on the resource with resourceId * diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/BaseBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/BaseBusinessLogic.java index 8a4b761a5a..a764c89db2 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/BaseBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/BaseBusinessLogic.java @@ -91,116 +91,101 @@ public abstract class BaseBusinessLogic { private static final String FAILED_TO_LOCK_COMPONENT_ERROR = "Failed to lock component {} error - {}"; - private static final Logger log = Logger.getLogger(BaseBusinessLogic.class.getName()); + private static final Logger log = Logger.getLogger(BaseBusinessLogic.class.getName()); private static final String EMPTY_VALUE = null; private static final String SCHEMA_DOESN_T_EXISTS_FOR_PROPERTY_OF_TYPE = "Schema doesn't exists for property of type {}"; private static final String PROPERTY_IN_SCHEMA_DEFINITION_INSIDE_PROPERTY_OF_TYPE_DOESN_T_EXIST = "Property in Schema Definition inside property of type {} doesn't exist"; private static final String ADD_PROPERTY_VALUE = "Add property value"; private static final String THE_VALUE_OF_PROPERTY_FROM_TYPE_IS_INVALID = "The value {} of property from type {} is invalid"; - @Autowired + protected final IGroupTypeOperation groupTypeOperation; + protected final InterfaceOperation interfaceOperation; + protected final IElementOperation elementDao; protected ComponentsUtils componentsUtils; - - @Autowired protected IUserBusinessLogic userAdmin; - - @Autowired protected IGraphLockOperation graphLockOperation; - - @Autowired protected JanusGraphDao janusGraphDao; - - @Autowired protected JanusGraphGenericDao janusGraphGenericDao; - - @Autowired - protected IElementOperation elementDao; - - @Autowired - protected IGroupOperation groupOperation; - - @Autowired - IGroupInstanceOperation groupInstanceOperation; - - @Autowired - protected IGroupTypeOperation groupTypeOperation; - - @Autowired - protected GroupBusinessLogic groupBusinessLogic; - - @Autowired - PolicyTypeOperation policyTypeOperation; - - @javax.annotation.Resource - protected ArtifactsOperations artifactToscaOperation; - - @Autowired protected PropertyOperation propertyOperation; - - @Autowired protected ApplicationDataTypeCache applicationDataTypeCache; - - @Autowired protected ToscaOperationFacade toscaOperationFacade; - - @Autowired protected ApplicationDataTypeCache dataTypeCache; - - @Autowired - protected InterfaceOperation interfaceOperation; - - @Autowired - protected InterfaceOperationBusinessLogic interfaceOperationBusinessLogic; - - @Autowired - protected InterfaceLifecycleOperation interfaceLifecycleTypeOperation; - - @javax.annotation.Resource + final IGroupOperation groupOperation; + final IGroupInstanceOperation groupInstanceOperation; + final InterfaceLifecycleOperation interfaceLifecycleTypeOperation; + PolicyTypeOperation policyTypeOperation; + protected final ArtifactsOperations artifactToscaOperation; private UserValidations userValidations; DataTypeValidatorConverter dataTypeValidatorConverter = DataTypeValidatorConverter.getInstance(); + public BaseBusinessLogic(IElementOperation elementDao, IGroupOperation groupOperation, + IGroupInstanceOperation groupInstanceOperation, IGroupTypeOperation groupTypeOperation, InterfaceOperation interfaceOperation, + InterfaceLifecycleOperation interfaceLifecycleTypeOperation, ArtifactsOperations artifactToscaOperation) { + this.elementDao = elementDao; + this.groupOperation = groupOperation; + this.groupInstanceOperation = groupInstanceOperation; + this.groupTypeOperation = groupTypeOperation; + this.interfaceOperation = interfaceOperation; + this.interfaceLifecycleTypeOperation = interfaceLifecycleTypeOperation; + this.artifactToscaOperation = artifactToscaOperation; + } + @Autowired public void setUserAdmin(UserBusinessLogic userAdmin) { this.userAdmin = userAdmin; } + @Autowired public void setUserValidations(UserValidations userValidations) { this.userValidations = userValidations; } + @Autowired public void setComponentsUtils(ComponentsUtils componentsUtils) { this.componentsUtils = componentsUtils; } + @Autowired + public void setJanusGraphDao(JanusGraphDao janusGraphDao) { + this.janusGraphDao = janusGraphDao; + } + + @Autowired + public void setApplicationDataTypeCache(ApplicationDataTypeCache applicationDataTypeCache) { + this.applicationDataTypeCache = applicationDataTypeCache; + } + + @Autowired + public void setJanusGraphGenericDao(JanusGraphGenericDao janusGraphGenericDao) { + this.janusGraphGenericDao = janusGraphGenericDao; + } + + @Autowired public void setGraphLockOperation(IGraphLockOperation graphLockOperation) { this.graphLockOperation = graphLockOperation; } + @Autowired public void setToscaOperationFacade(ToscaOperationFacade toscaOperationFacade) { this.toscaOperationFacade = toscaOperationFacade; } - public void setPolicyTypeOperation(PolicyTypeOperation policyTypeOperation) { + @Autowired + void setPolicyTypeOperation(PolicyTypeOperation policyTypeOperation) { this.policyTypeOperation = policyTypeOperation; } + @Autowired public void setDataTypeCache(ApplicationDataTypeCache dataTypeCache) { this.dataTypeCache = dataTypeCache; } + @Autowired public void setPropertyOperation(PropertyOperation propertyOperation) { this.propertyOperation = propertyOperation; } - public void setInterfaceOperation(InterfaceOperation interfaceOperation) { - this.interfaceOperation = interfaceOperation; - } - public void setInterfaceOperationBusinessLogic(InterfaceOperationBusinessLogic interfaceOperationBusinessLogic) { - this.interfaceOperationBusinessLogic = interfaceOperationBusinessLogic; - } - - User validateUserNotEmpty(User user, String ecompErrorContext) { return userValidations.validateUserNotEmpty(user, ecompErrorContext); } @@ -213,11 +198,6 @@ public abstract class BaseBusinessLogic { userValidations.validateUserExist(userId, ecompErrorContext); } - public void setGroupTypeOperation(IGroupTypeOperation groupTypeOperation) { - this.groupTypeOperation = groupTypeOperation; - } - - Either<User, ActionStatus> validateUserExistsActionStatus(String userId, String ecompErrorContext) { return userValidations.validateUserExistsActionStatus(userId, ecompErrorContext); } @@ -429,10 +409,6 @@ public abstract class BaseBusinessLogic { return null; } - // For UT - public void setJanusGraphGenericDao(JanusGraphDao janusGraphDao) { - this.janusGraphDao = janusGraphDao; - } protected Either<Map<String, DataTypeDefinition>, ResponseFormat> getAllDataTypes(ApplicationDataTypeCache applicationDataTypeCache) { Either<Map<String, DataTypeDefinition>, JanusGraphOperationStatus> allDataTypes = applicationDataTypeCache.getAll(); diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CapabilitiesBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CapabilitiesBusinessLogic.java index 425458f518..63aa08063a 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CapabilitiesBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CapabilitiesBusinessLogic.java @@ -33,10 +33,17 @@ import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.ComponentInstanceProperty; import org.openecomp.sdc.be.model.ComponentParametersView; import org.openecomp.sdc.be.model.User; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ArtifactsOperations; import org.openecomp.sdc.be.model.jsonjanusgraph.operations.CapabilitiesOperation; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.InterfaceOperation; import org.openecomp.sdc.be.model.jsonjanusgraph.utils.ModelConverter; import org.openecomp.sdc.be.model.operations.api.ICapabilityTypeOperation; +import org.openecomp.sdc.be.model.operations.api.IElementOperation; +import org.openecomp.sdc.be.model.operations.api.IGroupInstanceOperation; +import org.openecomp.sdc.be.model.operations.api.IGroupOperation; +import org.openecomp.sdc.be.model.operations.api.IGroupTypeOperation; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; +import org.openecomp.sdc.be.model.operations.impl.InterfaceLifecycleOperation; import org.openecomp.sdc.be.model.operations.impl.UniqueIdBuilder; import org.openecomp.sdc.exception.ResponseFormat; import org.slf4j.Logger; @@ -62,17 +69,32 @@ public class CapabilitiesBusinessLogic extends BaseBusinessLogic { private static final String GET_CAPABILITIES = "getCapabilities"; private static final String EXCEPTION_OCCURRED_DURING_CAPABILITIES = "Exception occurred during {}. Response is {}"; - @Autowired + private final ICapabilityTypeOperation capabilityTypeOperation; + private CapabilitiesOperation capabilitiesOperation; - @Autowired private CapabilitiesValidation capabilitiesValidation; + @Autowired - private ICapabilityTypeOperation capabilityTypeOperation; + public CapabilitiesBusinessLogic(IElementOperation elementDao, + IGroupOperation groupOperation, + IGroupInstanceOperation groupInstanceOperation, + IGroupTypeOperation groupTypeOperation, + GroupBusinessLogic groupBusinessLogic, + InterfaceOperation interfaceOperation, + InterfaceLifecycleOperation interfaceLifecycleTypeOperation, + ICapabilityTypeOperation capabilityTypeOperation, + ArtifactsOperations artifactToscaOperation) { + super(elementDao, groupOperation, groupInstanceOperation, groupTypeOperation, + interfaceOperation, interfaceLifecycleTypeOperation, artifactToscaOperation); + this.capabilityTypeOperation = capabilityTypeOperation; + } + @Autowired public void setCapabilitiesValidation(CapabilitiesValidation capabilitiesValidation) { this.capabilitiesValidation = capabilitiesValidation; } + @Autowired public void setCapabilitiesOperation(CapabilitiesOperation capabilitiesOperation) { this.capabilitiesOperation = capabilitiesOperation; } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CapabilityTypeImportManager.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CapabilityTypeImportManager.java index b54a8050ce..ebe79f57f8 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CapabilityTypeImportManager.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CapabilityTypeImportManager.java @@ -30,6 +30,7 @@ import org.openecomp.sdc.be.model.utils.TypeCompareUtils; import org.openecomp.sdc.be.utils.TypeUtils; import org.openecomp.sdc.common.log.wrappers.Logger; import org.openecomp.sdc.exception.ResponseFormat; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import java.util.List; @@ -42,10 +43,10 @@ public class CapabilityTypeImportManager { private final CapabilityTypeOperation capabilityTypeOperation; private final CommonImportManager commonImportManager; + @Autowired public CapabilityTypeImportManager(CapabilityTypeOperation capabilityTypeOperation, CommonImportManager commonImportManager) { this.capabilityTypeOperation = capabilityTypeOperation; this.commonImportManager = commonImportManager; - } public Either<List<ImmutablePair<CapabilityTypeDefinition, Boolean>>, ResponseFormat> createCapabilityTypes(String capabilityTypesYml) { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CommonImportManager.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CommonImportManager.java index 1de92e2e15..4dd012fcf7 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CommonImportManager.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CommonImportManager.java @@ -39,6 +39,7 @@ import org.openecomp.sdc.be.model.operations.api.TypeOperations; import org.openecomp.sdc.be.model.operations.impl.PropertyOperation; import org.openecomp.sdc.common.log.wrappers.Logger; import org.openecomp.sdc.exception.ResponseFormat; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.yaml.snakeyaml.Yaml; @@ -59,6 +60,7 @@ public class CommonImportManager { private final ComponentsUtils componentsUtils; private final PropertyOperation propertyOperation; + @Autowired public CommonImportManager(ComponentsUtils componentsUtils, PropertyOperation propertyOperation) { this.componentsUtils = componentsUtils; this.propertyOperation = propertyOperation; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentBusinessLogic.java index ccccd58ce7..785b545d7e 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentBusinessLogic.java @@ -66,7 +66,14 @@ import org.openecomp.sdc.be.model.Operation; import org.openecomp.sdc.be.model.PropertyDefinition; import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.User; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ArtifactsOperations; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.InterfaceOperation; +import org.openecomp.sdc.be.model.operations.api.IElementOperation; +import org.openecomp.sdc.be.model.operations.api.IGroupInstanceOperation; +import org.openecomp.sdc.be.model.operations.api.IGroupOperation; +import org.openecomp.sdc.be.model.operations.api.IGroupTypeOperation; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; +import org.openecomp.sdc.be.model.operations.impl.InterfaceLifecycleOperation; import org.openecomp.sdc.be.model.tosca.ToscaPropertyType; import org.openecomp.sdc.be.resources.data.ComponentMetadataData; import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum; @@ -84,15 +91,28 @@ import org.springframework.beans.factory.annotation.Autowired; public abstract class ComponentBusinessLogic extends BaseBusinessLogic { - @Autowired - protected ArtifactsBusinessLogic artifactsBusinessLogic; + protected final ArtifactsBusinessLogic artifactsBusinessLogic; + + protected final GroupBusinessLogic groupBusinessLogic; - @Autowired private GenericTypeBusinessLogic genericTypeBusinessLogic; - @Autowired - private ComponentInstanceBusinessLogic componentInstanceBusinessLogic; + public ComponentBusinessLogic(IElementOperation elementDao, + IGroupOperation groupOperation, + IGroupInstanceOperation groupInstanceOperation, + IGroupTypeOperation groupTypeOperation, + GroupBusinessLogic groupBusinessLogic, + InterfaceOperation interfaceOperation, + InterfaceLifecycleOperation interfaceLifecycleTypeOperation, + ArtifactsBusinessLogic artifactsBusinessLogic, + ArtifactsOperations artifactToscaOperation) { + super(elementDao, groupOperation, groupInstanceOperation, groupTypeOperation, + interfaceOperation, interfaceLifecycleTypeOperation, artifactToscaOperation); + this.artifactsBusinessLogic = artifactsBusinessLogic; + this.groupBusinessLogic = groupBusinessLogic; + } + @Autowired public void setGenericTypeBusinessLogic(GenericTypeBusinessLogic genericTypeBusinessLogic) { this.genericTypeBusinessLogic = genericTypeBusinessLogic; } 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 eebbb0a2bf..fd2af0bb7c 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 @@ -76,13 +76,20 @@ import org.openecomp.sdc.be.model.RequirementDefinition; import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.Service; import org.openecomp.sdc.be.model.User; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ArtifactsOperations; import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ForwardingPathOperation; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.InterfaceOperation; import org.openecomp.sdc.be.model.jsonjanusgraph.operations.NodeFilterOperation; import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.jsonjanusgraph.utils.ModelConverter; import org.openecomp.sdc.be.model.operations.api.IComponentInstanceOperation; +import org.openecomp.sdc.be.model.operations.api.IElementOperation; +import org.openecomp.sdc.be.model.operations.api.IGroupInstanceOperation; +import org.openecomp.sdc.be.model.operations.api.IGroupOperation; +import org.openecomp.sdc.be.model.operations.api.IGroupTypeOperation; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.model.operations.impl.DaoStatusConverter; +import org.openecomp.sdc.be.model.operations.impl.InterfaceLifecycleOperation; import org.openecomp.sdc.be.model.operations.impl.UniqueIdBuilder; import org.openecomp.sdc.be.model.operations.utils.ComponentValidationUtils; import org.openecomp.sdc.be.model.tosca.ToscaPropertyType; @@ -122,38 +129,46 @@ public class ComponentInstanceBusinessLogic extends BaseBusinessLogic { private static final Logger log = Logger.getLogger(ComponentInstanceBusinessLogic.class.getName()); private static final String VF_MODULE = "org.openecomp.groups.VfModule"; - public static final String TRY_TO_CREATE_ENTRY_ON_GRAPH = "Try to create entry on graph"; + private static final String TRY_TO_CREATE_ENTRY_ON_GRAPH = "Try to create entry on graph"; private static final String CLOUD_SPECIFIC_FIXED_KEY_WORD = "cloudtech"; private static final String[][] CLOUD_SPECIFIC_KEY_WORDS = {{"k8s", "azure", "aws"}, /* cloud specific technology */ {"charts", "day0", "configtemplate"} /*cloud specific sub type*/}; - public static final String FAILED_TO_CREATE_ENTRY_ON_GRAPH_FOR_COMPONENT_INSTANCE = "Failed to create entry on graph for component instance {}"; - public static final String ENTITY_ON_GRAPH_IS_CREATED = "Entity on graph is created."; - public static final String INVALID_COMPONENT_TYPE = "invalid component type"; - public static final String FAILED_TO_RETRIEVE_COMPONENT_COMPONENT_ID = "Failed to retrieve component, component id {}"; - public static final String FAILED_TO_LOCK_SERVICE = "Failed to lock service {}"; - public static final String CREATE_OR_UPDATE_PROPERTY_VALUE = "CreateOrUpdatePropertyValue"; - public static final String FAILED_TO_COPY_COMP_INSTANCE_TO_CANVAS = "Failed to copy the component instance to the canvas"; - public static final String COPY_COMPONENT_INSTANCE_OK = "Copy component instance OK"; + private static final String FAILED_TO_CREATE_ENTRY_ON_GRAPH_FOR_COMPONENT_INSTANCE = "Failed to create entry on graph for component instance {}"; + private static final String ENTITY_ON_GRAPH_IS_CREATED = "Entity on graph is created."; + private static final String INVALID_COMPONENT_TYPE = "invalid component type"; + private static final String FAILED_TO_RETRIEVE_COMPONENT_COMPONENT_ID = "Failed to retrieve component, component id {}"; + private static final String FAILED_TO_LOCK_SERVICE = "Failed to lock service {}"; + private static final String CREATE_OR_UPDATE_PROPERTY_VALUE = "CreateOrUpdatePropertyValue"; + private static final String FAILED_TO_COPY_COMP_INSTANCE_TO_CANVAS = "Failed to copy the component instance to the canvas"; + private static final String COPY_COMPONENT_INSTANCE_OK = "Copy component instance OK"; + + private final IComponentInstanceOperation componentInstanceOperation; + private final ArtifactsBusinessLogic artifactBusinessLogic; + private final ComponentInstanceMergeDataBusinessLogic compInstMergeDataBL; + private final ComponentInstanceChangeOperationOrchestrator onChangeInstanceOperationOrchestrator; + private final ForwardingPathOperation forwardingPathOperation; + private final NodeFilterOperation serviceFilterOperation; @Autowired - private IComponentInstanceOperation componentInstanceOperation; - - @Autowired - private ArtifactsBusinessLogic artifactBusinessLogic; - - @Autowired - private ComponentInstanceMergeDataBusinessLogic compInstMergeDataBL; - - @Autowired - private ComponentInstanceChangeOperationOrchestrator onChangeInstanceOperationOrchestrator; - - @Autowired - private ForwardingPathOperation forwardingPathOperation; - - @Autowired - private NodeFilterOperation serviceFilterOperation; - - public ComponentInstanceBusinessLogic() { + public ComponentInstanceBusinessLogic(IElementOperation elementDao, + IGroupOperation groupOperation, + IGroupInstanceOperation groupInstanceOperation, + IGroupTypeOperation groupTypeOperation, + InterfaceOperation interfaceOperation, + InterfaceLifecycleOperation interfaceLifecycleTypeOperation, + IComponentInstanceOperation componentInstanceOperation, ArtifactsBusinessLogic artifactBusinessLogic, + ComponentInstanceMergeDataBusinessLogic compInstMergeDataBL, + ComponentInstanceChangeOperationOrchestrator onChangeInstanceOperationOrchestrator, + ForwardingPathOperation forwardingPathOperation, NodeFilterOperation serviceFilterOperation, + ArtifactsOperations artifactToscaOperation) { + super(elementDao, groupOperation, groupInstanceOperation, groupTypeOperation, + interfaceOperation, interfaceLifecycleTypeOperation, artifactToscaOperation); + this.componentInstanceOperation = componentInstanceOperation; + this.artifactBusinessLogic = artifactBusinessLogic; + this.compInstMergeDataBL = compInstMergeDataBL; + this.onChangeInstanceOperationOrchestrator = onChangeInstanceOperationOrchestrator; + this.forwardingPathOperation = forwardingPathOperation; + this.serviceFilterOperation = serviceFilterOperation; } public Either<ComponentInstance, ResponseFormat> createComponentInstance(String containerComponentParam, diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CompositionBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CompositionBusinessLogic.java index 4e7f86aed6..ba256d4c84 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CompositionBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CompositionBusinessLogic.java @@ -46,8 +46,7 @@ import java.util.stream.Collectors; */ @Component("compositionBusinessLogic") public class CompositionBusinessLogic { - @Autowired - private ComponentInstanceBusinessLogic componentInstanceBusinessLogic; + private final ComponentInstanceBusinessLogic componentInstanceBusinessLogic; private static final int VFC_CANVAS_ELEMENT_SIZE = 50; private static final int CP_CANVAS_ELEMENT_SIZE = 21; @@ -56,6 +55,11 @@ public class CompositionBusinessLogic { private static final int SPACE_BETWEEN_ELEMENTS = VFC_CANVAS_ELEMENT_SIZE * 4; private static final double CP_RADIUS_FACTOR = 0.4; + @Autowired + public CompositionBusinessLogic(ComponentInstanceBusinessLogic componentInstanceBusinessLogic) { + this.componentInstanceBusinessLogic = componentInstanceBusinessLogic; + } + enum RelativePosition { LEFT, RIGHT, UP, DOWN }; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ConsumerBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ConsumerBusinessLogic.java index 213c4b67db..5c7c35a6b5 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ConsumerBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ConsumerBusinessLogic.java @@ -26,14 +26,22 @@ import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; import org.openecomp.sdc.be.model.ConsumerDefinition; import org.openecomp.sdc.be.model.User; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ArtifactsOperations; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.InterfaceOperation; +import org.openecomp.sdc.be.model.operations.api.IElementOperation; +import org.openecomp.sdc.be.model.operations.api.IGroupInstanceOperation; +import org.openecomp.sdc.be.model.operations.api.IGroupOperation; +import org.openecomp.sdc.be.model.operations.api.IGroupTypeOperation; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.model.operations.impl.ConsumerOperation; +import org.openecomp.sdc.be.model.operations.impl.InterfaceLifecycleOperation; import org.openecomp.sdc.be.resources.data.ConsumerData; import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum; import org.openecomp.sdc.be.user.Role; import org.openecomp.sdc.common.log.wrappers.Logger; import org.openecomp.sdc.common.util.ValidationUtils; import org.openecomp.sdc.exception.ResponseFormat; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import java.util.Date; @@ -44,13 +52,25 @@ public class ConsumerBusinessLogic extends BaseBusinessLogic { private static final String CONSUMER_NAME = "Consumer name"; private static final String CONSUMER_SALT = "Consumer salt"; private static final String CONSUMER_PW = "Consumer password"; - public static final String AUDIT_BEFORE_SENDING_RESPONSE = "audit before sending response"; + private static final String AUDIT_BEFORE_SENDING_RESPONSE = "audit before sending response"; @javax.annotation.Resource private ConsumerOperation consumerOperation; private static final Logger log = Logger.getLogger(ConsumerBusinessLogic.class.getName()); + @Autowired + public ConsumerBusinessLogic(IElementOperation elementDao, + IGroupOperation groupOperation, + IGroupInstanceOperation groupInstanceOperation, + IGroupTypeOperation groupTypeOperation, + InterfaceOperation interfaceOperation, + InterfaceLifecycleOperation interfaceLifecycleTypeOperation, + ArtifactsOperations artifactToscaOperation) { + super(elementDao, groupOperation, groupInstanceOperation, groupTypeOperation, + interfaceOperation, interfaceLifecycleTypeOperation, artifactToscaOperation); + } + public Either<ConsumerDefinition, ResponseFormat> createConsumer(User user, ConsumerDefinition consumer) { Either<User, ResponseFormat> userValidation = validateUser(user, consumer, AuditingActionEnum.ADD_ECOMP_USER_CREDENTIALS); diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CsarValidationUtils.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CsarValidationUtils.java index dbfe7d8b71..d29a2c4458 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CsarValidationUtils.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/CsarValidationUtils.java @@ -47,24 +47,24 @@ public class CsarValidationUtils { private static final String CSAR_VERSION = "CSAR-Version"; private static final String CREATED_BY = "Created-By"; private static final String NEW_LINE_DELM = "\n"; - public static final String TOSCA_METADATA = "TOSCA-Metadata"; - public static final String TOSCA_FILE = "TOSCA.meta"; - public static final String DEL_PATTERN = "([/\\\\]+)"; - public static final String TOSCA_METADATA_PATH_PATTERN = TOSCA_METADATA + + private static final String TOSCA_METADATA = "TOSCA-Metadata"; + private static final String TOSCA_FILE = "TOSCA.meta"; + private static final String DEL_PATTERN = "([/\\\\]+)"; + private static final String TOSCA_METADATA_PATH_PATTERN = TOSCA_METADATA + // Artifact Group (i.e Deployment/Informational) DEL_PATTERN + TOSCA_FILE; - public static final String TOSCA_META_ENTRY_DEFINITIONS = "Entry-Definitions"; + private static final String TOSCA_META_ENTRY_DEFINITIONS = "Entry-Definitions"; private static final String[] TOSCA_METADATA_FIELDS = { TOSCA_META_FILE_VERSION, CSAR_VERSION, CREATED_BY, TOSCA_META_ENTRY_DEFINITIONS }; - public static final String ARTIFACTS_METADATA_FILE = "HEAT.meta"; - public static final String TOSCA_CSAR_EXTENSION = ".csar"; - public static final String TOSCA_METADATA_TOSCA_META_FILE_IS_NOT_IN_EXPECTED_KEY_VALUE_FORM_IN_CSAR_CSAR_ID = "TOSCA-Metadata/TOSCA.meta file is not in expected key-value form in csar, csar ID {}"; - public static final String TOSCA_METADATA_TOSCA_META_FILE_NOT_IN_EXPECTED_KEY_VALUE_FORM_IN_CSAR_WITH_ID = "TOSCA-Metadata/TOSCA.meta file not in expected key-value form in CSAR with id "; - public static final String CSAR_INTERNALS_ARE_INVALID = "CSAR internals are invalid"; - public static final String ENTRY_DEFINITIONS_ENTRY_NOT_FOUND_IN_TOSCA_METADATA_TOSCA_META_FILE_CSAR_ID = "Entry-Definitions entry not found in TOSCA-Metadata/TOSCA.meta file, csar ID {}"; - public static final String FILE_NOT_FOUND_IN_CSAR_WITH_ID = " file not found in CSAR with id "; - public static final String CSAR_STRUCTURE_IS_INVALID = "CSAR structure is invalid"; - public static final String ENTRY_DEFINITIONS = "Entry-Definitions "; + private static final String ARTIFACTS_METADATA_FILE = "HEAT.meta"; + private static final String TOSCA_CSAR_EXTENSION = ".csar"; + private static final String TOSCA_METADATA_TOSCA_META_FILE_IS_NOT_IN_EXPECTED_KEY_VALUE_FORM_IN_CSAR_CSAR_ID = "TOSCA-Metadata/TOSCA.meta file is not in expected key-value form in csar, csar ID {}"; + private static final String TOSCA_METADATA_TOSCA_META_FILE_NOT_IN_EXPECTED_KEY_VALUE_FORM_IN_CSAR_WITH_ID = "TOSCA-Metadata/TOSCA.meta file not in expected key-value form in CSAR with id "; + private static final String CSAR_INTERNALS_ARE_INVALID = "CSAR internals are invalid"; + private static final String ENTRY_DEFINITIONS_ENTRY_NOT_FOUND_IN_TOSCA_METADATA_TOSCA_META_FILE_CSAR_ID = "Entry-Definitions entry not found in TOSCA-Metadata/TOSCA.meta file, csar ID {}"; + private static final String FILE_NOT_FOUND_IN_CSAR_WITH_ID = " file not found in CSAR with id "; + private static final String CSAR_STRUCTURE_IS_INVALID = "CSAR structure is invalid"; + private static final String ENTRY_DEFINITIONS = "Entry-Definitions "; private static final Pattern floatPattern = Pattern.compile("^\\d{1}[.]\\d{1}$"); /** diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/DataTypeBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/DataTypeBusinessLogic.java index e020876b3b..5af7cf660b 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/DataTypeBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/DataTypeBusinessLogic.java @@ -24,7 +24,15 @@ import fj.data.Either; import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.ComponentParametersView; import org.openecomp.sdc.be.model.DataTypeDefinition; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ArtifactsOperations; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.InterfaceOperation; +import org.openecomp.sdc.be.model.operations.api.IElementOperation; +import org.openecomp.sdc.be.model.operations.api.IGroupInstanceOperation; +import org.openecomp.sdc.be.model.operations.api.IGroupOperation; +import org.openecomp.sdc.be.model.operations.api.IGroupTypeOperation; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; +import org.openecomp.sdc.be.model.operations.impl.InterfaceLifecycleOperation; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.util.CollectionUtils; import java.util.ArrayList; @@ -34,6 +42,18 @@ import java.util.Optional; @org.springframework.stereotype.Component("dataTypeBusinessLogic") public class DataTypeBusinessLogic extends BaseBusinessLogic { + @Autowired + public DataTypeBusinessLogic(IElementOperation elementDao, + IGroupOperation groupOperation, + IGroupInstanceOperation groupInstanceOperation, + IGroupTypeOperation groupTypeOperation, + InterfaceOperation interfaceOperation, + InterfaceLifecycleOperation interfaceLifecycleTypeOperation, + ArtifactsOperations artifactToscaOperation) { + super(elementDao, groupOperation, groupInstanceOperation, groupTypeOperation, + interfaceOperation, interfaceLifecycleTypeOperation, artifactToscaOperation); + } + /** * Get a list of data types that the Component has. * diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/DistributionMonitoringBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/DistributionMonitoringBusinessLogic.java index 4cf7c44e85..5d9a06cc4c 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/DistributionMonitoringBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/DistributionMonitoringBusinessLogic.java @@ -28,6 +28,13 @@ import org.openecomp.sdc.be.info.DistributionStatusInfo; import org.openecomp.sdc.be.info.DistributionStatusListResponse; import org.openecomp.sdc.be.info.DistributionStatusOfServiceInfo; import org.openecomp.sdc.be.info.DistributionStatusOfServiceListResponce; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ArtifactsOperations; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.InterfaceOperation; +import org.openecomp.sdc.be.model.operations.api.IElementOperation; +import org.openecomp.sdc.be.model.operations.api.IGroupInstanceOperation; +import org.openecomp.sdc.be.model.operations.api.IGroupOperation; +import org.openecomp.sdc.be.model.operations.api.IGroupTypeOperation; +import org.openecomp.sdc.be.model.operations.impl.InterfaceLifecycleOperation; import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum; import org.openecomp.sdc.be.resources.data.auditing.AuditingGenericEvent; import org.openecomp.sdc.be.resources.data.auditing.DistributionStatusEvent; @@ -52,11 +59,20 @@ public class DistributionMonitoringBusinessLogic extends BaseBusinessLogic { private static final Logger log = Logger.getLogger(ArtifactsBusinessLogic.class.getName()); + private final AuditCassandraDao cassandraDao; @Autowired - private AuditCassandraDao cassandraDao; - - public DistributionMonitoringBusinessLogic() { + public DistributionMonitoringBusinessLogic(IElementOperation elementDao, + IGroupOperation groupOperation, + IGroupInstanceOperation groupInstanceOperation, + IGroupTypeOperation groupTypeOperation, + InterfaceOperation interfaceOperation, + InterfaceLifecycleOperation interfaceLifecycleTypeOperation, + AuditCassandraDao cassandraDao, + ArtifactsOperations artifactToscaOperation) { + super(elementDao, groupOperation, groupInstanceOperation, groupTypeOperation, + interfaceOperation, interfaceLifecycleTypeOperation, artifactToscaOperation); + this.cassandraDao = cassandraDao; } public Either<DistributionStatusListResponse, ResponseFormat> getListOfDistributionStatus(String did, String userId) { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ElementBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ElementBusinessLogic.java index 91d7fa6034..ca2e4a8078 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ElementBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ElementBusinessLogic.java @@ -46,9 +46,15 @@ import org.openecomp.sdc.be.model.catalog.CatalogComponent; import org.openecomp.sdc.be.model.category.CategoryDefinition; import org.openecomp.sdc.be.model.category.GroupingDefinition; import org.openecomp.sdc.be.model.category.SubCategoryDefinition; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ArtifactsOperations; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.InterfaceOperation; import org.openecomp.sdc.be.model.operations.api.IElementOperation; +import org.openecomp.sdc.be.model.operations.api.IGroupInstanceOperation; +import org.openecomp.sdc.be.model.operations.api.IGroupOperation; +import org.openecomp.sdc.be.model.operations.api.IGroupTypeOperation; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.model.operations.impl.DaoStatusConverter; +import org.openecomp.sdc.be.model.operations.impl.InterfaceLifecycleOperation; import org.openecomp.sdc.be.model.operations.impl.UniqueIdBuilder; import org.openecomp.sdc.be.resources.data.ComponentMetadataData; import org.openecomp.sdc.be.resources.data.ResourceMetadataData; @@ -68,6 +74,7 @@ import java.nio.charset.StandardCharsets; import java.util.*; import java.util.function.Predicate; import java.util.stream.Collectors; +import org.springframework.beans.factory.annotation.Autowired; import static org.apache.commons.lang.BooleanUtils.isTrue; @@ -81,11 +88,24 @@ public class ElementBusinessLogic extends BaseBusinessLogic { private static final String COMPONENT_TYPE_IS_INVALID = "Component type {} is invalid"; private static final String VALIDATION_OF_USER_ROLE_FAILED_USER_ID = "Validation of user role failed, userId {}"; - @javax.annotation.Resource - private IElementOperation elementOperation; - - @javax.annotation.Resource - private UserBusinessLogic userAdminManager; + private final IElementOperation elementOperation; + private final UserBusinessLogic userAdminManager; + + @Autowired + public ElementBusinessLogic(IElementOperation elementDao, + IGroupOperation groupOperation, + IGroupInstanceOperation groupInstanceOperation, + IGroupTypeOperation groupTypeOperation, + GroupBusinessLogic groupBusinessLogic, + InterfaceOperation interfaceOperation, + InterfaceLifecycleOperation interfaceLifecycleTypeOperation, + ArtifactsOperations artifactToscaOperation, IElementOperation elementOperation, + UserBusinessLogic userAdminManager) { + super(elementDao, groupOperation, groupInstanceOperation, groupTypeOperation, + interfaceOperation, interfaceLifecycleTypeOperation, artifactToscaOperation); + this.elementOperation = elementOperation; + this.userAdminManager = userAdminManager; + } /** * @@ -1261,8 +1281,7 @@ public class ElementBusinessLogic extends BaseBusinessLogic { Class categoryClazz = categoryType == NodeTypeEnum.ServiceNewCategory ? CategoryData.class : SubCategoryData.class; Map<String, Object> props = new HashMap<>(); props.put(GraphPropertiesDictionary.NORMALIZED_NAME.getProperty(), ValidationUtils.normalizeCategoryName4Uniqueness(categoryName)); - Either<List<GraphNode>, JanusGraphOperationStatus> getCategory = janusGraphGenericDao - .getByCriteria(categoryType, props, categoryClazz); + Either<List<GraphNode>, JanusGraphOperationStatus> getCategory = janusGraphGenericDao.getByCriteria(categoryType, props, categoryClazz); if (getCategory.isRight()) { return Either.right(StorageOperationStatus.CATEGORY_NOT_FOUND); } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/GenericArtifactBrowserBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/GenericArtifactBrowserBusinessLogic.java index fed1eb7fe9..d95045b87b 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/GenericArtifactBrowserBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/GenericArtifactBrowserBusinessLogic.java @@ -34,13 +34,30 @@ import org.onap.sdc.gab.GABServiceImpl; import org.onap.sdc.gab.model.GABQuery; import org.onap.sdc.gab.model.GABResult; import org.onap.sdc.gab.model.GABResults; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ArtifactsOperations; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.InterfaceOperation; +import org.openecomp.sdc.be.model.operations.api.IElementOperation; +import org.openecomp.sdc.be.model.operations.api.IGroupInstanceOperation; +import org.openecomp.sdc.be.model.operations.api.IGroupOperation; +import org.openecomp.sdc.be.model.operations.api.IGroupTypeOperation; +import org.openecomp.sdc.be.model.operations.impl.InterfaceLifecycleOperation; +import org.springframework.beans.factory.annotation.Autowired; @org.springframework.stereotype.Component public class GenericArtifactBrowserBusinessLogic extends BaseBusinessLogic { private GABService gabService; - public GenericArtifactBrowserBusinessLogic() { + @Autowired + public GenericArtifactBrowserBusinessLogic(IElementOperation elementDao, + IGroupOperation groupOperation, + IGroupInstanceOperation groupInstanceOperation, + IGroupTypeOperation groupTypeOperation, + InterfaceOperation interfaceOperation, + InterfaceLifecycleOperation interfaceLifecycleTypeOperation, + ArtifactsOperations artifactToscaOperation) { + super(elementDao, groupOperation, groupInstanceOperation, groupTypeOperation, + interfaceOperation, interfaceLifecycleTypeOperation, artifactToscaOperation); gabService = new GABServiceImpl(); } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/GroupBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/GroupBusinessLogic.java index 7c5a596319..1f906aefac 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/GroupBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/GroupBusinessLogic.java @@ -31,7 +31,6 @@ import org.apache.commons.lang3.math.NumberUtils; import org.apache.commons.lang3.tuple.ImmutablePair; import org.openecomp.sdc.be.components.impl.exceptions.ByActionStatusComponentException; import org.openecomp.sdc.be.components.impl.exceptions.ByResponseFormatComponentException; -import org.openecomp.sdc.be.components.impl.exceptions.ComponentException; import org.openecomp.sdc.be.components.impl.lock.LockingTransactional; import org.openecomp.sdc.be.components.impl.policy.PolicyTargetsUpdateHandler; import org.openecomp.sdc.be.components.utils.Utils; @@ -54,10 +53,17 @@ import org.openecomp.sdc.be.info.GroupDefinitionInfo; import org.openecomp.sdc.be.model.*; import org.openecomp.sdc.be.model.PropertyDefinition.GroupInstancePropertyValueUpdateBehavior; import org.openecomp.sdc.be.model.PropertyDefinition.PropertyNames; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ArtifactsOperations; import org.openecomp.sdc.be.model.jsonjanusgraph.operations.GroupsOperation; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.InterfaceOperation; import org.openecomp.sdc.be.model.jsonjanusgraph.operations.TopologyTemplateOperation; +import org.openecomp.sdc.be.model.operations.api.IElementOperation; +import org.openecomp.sdc.be.model.operations.api.IGroupInstanceOperation; +import org.openecomp.sdc.be.model.operations.api.IGroupOperation; +import org.openecomp.sdc.be.model.operations.api.IGroupTypeOperation; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.model.operations.impl.DaoStatusConverter; +import org.openecomp.sdc.be.model.operations.impl.InterfaceLifecycleOperation; import org.openecomp.sdc.be.model.operations.impl.UniqueIdBuilder; import org.openecomp.sdc.common.api.Constants; import org.openecomp.sdc.common.log.wrappers.Logger; @@ -92,15 +98,29 @@ public class GroupBusinessLogic extends BaseBusinessLogic { private static final String DELETE_GROUP = "DeleteGroup"; private static final Logger log = Logger.getLogger(GroupBusinessLogic.class); - @Autowired - private AccessValidations accessValidations; + + private final AccessValidations accessValidations; + private final PolicyTargetsUpdateHandler policyTargetsUpdateHandler; @javax.annotation.Resource - @Autowired - private GroupsOperation groupsOperation; + private final GroupsOperation groupsOperation; + @Autowired - PolicyTargetsUpdateHandler policyTargetsUpdateHandler; + public GroupBusinessLogic(IElementOperation elementDao, + IGroupOperation groupOperation, + IGroupInstanceOperation groupInstanceOperation, + IGroupTypeOperation groupTypeOperation, + InterfaceOperation interfaceOperation, + InterfaceLifecycleOperation interfaceLifecycleTypeOperation, AccessValidations accessValidations, + GroupsOperation groupsOperation, PolicyTargetsUpdateHandler policyTargetsUpdateHandler, + ArtifactsOperations artifactToscaOperation) { + super(elementDao, groupOperation, groupInstanceOperation, groupTypeOperation, + interfaceOperation, interfaceLifecycleTypeOperation, artifactToscaOperation); + this.accessValidations = accessValidations; + this.groupsOperation = groupsOperation; + this.policyTargetsUpdateHandler = policyTargetsUpdateHandler; + } private String getComponentTypeForResponse(org.openecomp.sdc.be.model.Component component) { String componentTypeForResponse = "SERVICE"; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ImportUtils.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ImportUtils.java index 726c038e2b..7001c0c05f 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ImportUtils.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ImportUtils.java @@ -43,6 +43,7 @@ import org.openecomp.sdc.common.log.wrappers.Logger; import org.openecomp.sdc.exception.ResponseFormat; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.config.YamlProcessor; +import org.springframework.stereotype.Component; import org.yaml.snakeyaml.DumperOptions; import org.yaml.snakeyaml.Yaml; import org.yaml.snakeyaml.constructor.Constructor; @@ -60,23 +61,22 @@ import static org.apache.commons.collections.CollectionUtils.isEmpty; import static org.openecomp.sdc.be.components.impl.ResourceImportManager.PROPERTY_NAME_PATTERN_IGNORE_LENGTH; import static org.openecomp.sdc.be.datatypes.elements.Annotation.setAnnotationsName; - +@Component public final class ImportUtils { - private static final CustomResolver customResolver = new CustomResolver(); private static final Yaml strictYamlLoader = new YamlLoader().getStrictYamlLoader(); - @Autowired protected static ComponentsUtils componentsUtils; - @Autowired - private ExceptionUtils exceptionUtils; - private static final Logger log = Logger.getLogger(ImportUtils.class); private ImportUtils() { + } + @Autowired + public static void setComponentsUtils(ComponentsUtils componentsUtils) { + ImportUtils.componentsUtils = componentsUtils; } private static class CustomResolver extends Resolver { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/InputsBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/InputsBusinessLogic.java index 8aec0cdfe2..bce60066f5 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/InputsBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/InputsBusinessLogic.java @@ -60,13 +60,21 @@ import org.openecomp.sdc.be.model.ComponentParametersView; import org.openecomp.sdc.be.model.DataTypeDefinition; import org.openecomp.sdc.be.model.InputDefinition; import org.openecomp.sdc.be.model.PropertyDefinition; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ArtifactsOperations; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.InterfaceOperation; +import org.openecomp.sdc.be.model.operations.api.IElementOperation; +import org.openecomp.sdc.be.model.operations.api.IGroupInstanceOperation; +import org.openecomp.sdc.be.model.operations.api.IGroupOperation; +import org.openecomp.sdc.be.model.operations.api.IGroupTypeOperation; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.model.operations.impl.DaoStatusConverter; +import org.openecomp.sdc.be.model.operations.impl.InterfaceLifecycleOperation; import org.openecomp.sdc.be.model.operations.impl.UniqueIdBuilder; import org.openecomp.sdc.be.model.tosca.ToscaPropertyType; import org.openecomp.sdc.be.model.tosca.converters.PropertyValueConverter; import org.openecomp.sdc.common.log.wrappers.Logger; import org.openecomp.sdc.exception.ResponseFormat; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @Component("inputsBusinessLogic") @@ -82,12 +90,26 @@ public class InputsBusinessLogic extends BaseBusinessLogic { private static final String GOING_TO_EXECUTE_ROLLBACK_ON_CREATE_GROUP = "Going to execute rollback on create group."; private static final String GOING_TO_EXECUTE_COMMIT_ON_CREATE_GROUP = "Going to execute commit on create group."; - @Inject - private PropertyDeclarationOrchestrator propertyDeclarationOrchestrator; - @Inject - private ComponentInstanceBusinessLogic componentInstanceBusinessLogic; - @Inject - private DataTypeBusinessLogic dataTypeBusinessLogic; + private final PropertyDeclarationOrchestrator propertyDeclarationOrchestrator; + private final ComponentInstanceBusinessLogic componentInstanceBusinessLogic; + private final DataTypeBusinessLogic dataTypeBusinessLogic; + + @Autowired + public InputsBusinessLogic(IElementOperation elementDao, + IGroupOperation groupOperation, + IGroupInstanceOperation groupInstanceOperation, + IGroupTypeOperation groupTypeOperation, + InterfaceOperation interfaceOperation, + InterfaceLifecycleOperation interfaceLifecycleTypeOperation, + PropertyDeclarationOrchestrator propertyDeclarationOrchestrator, + ComponentInstanceBusinessLogic componentInstanceBusinessLogic, DataTypeBusinessLogic dataTypeBusinessLogic, + ArtifactsOperations artifactToscaOperation) { + super(elementDao, groupOperation, groupInstanceOperation, groupTypeOperation, + interfaceOperation, interfaceLifecycleTypeOperation, artifactToscaOperation); + this.propertyDeclarationOrchestrator = propertyDeclarationOrchestrator; + this.componentInstanceBusinessLogic = componentInstanceBusinessLogic; + this.dataTypeBusinessLogic = dataTypeBusinessLogic; + } /** * associate inputs to a given component with paging diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/InterfaceOperationBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/InterfaceOperationBusinessLogic.java index 7815b81755..add5df225c 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/InterfaceOperationBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/InterfaceOperationBusinessLogic.java @@ -61,7 +61,14 @@ import org.openecomp.sdc.be.model.InputDefinition; import org.openecomp.sdc.be.model.InterfaceDefinition; import org.openecomp.sdc.be.model.Operation; import org.openecomp.sdc.be.model.User; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ArtifactsOperations; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.InterfaceOperation; +import org.openecomp.sdc.be.model.operations.api.IElementOperation; +import org.openecomp.sdc.be.model.operations.api.IGroupInstanceOperation; +import org.openecomp.sdc.be.model.operations.api.IGroupOperation; +import org.openecomp.sdc.be.model.operations.api.IGroupTypeOperation; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; +import org.openecomp.sdc.be.model.operations.impl.InterfaceLifecycleOperation; import org.openecomp.sdc.common.api.ArtifactGroupTypeEnum; import org.openecomp.sdc.common.api.ArtifactTypeEnum; import org.openecomp.sdc.exception.ResponseFormat; @@ -81,11 +88,22 @@ public class InterfaceOperationBusinessLogic extends BaseBusinessLogic { private static final String CREATE_INTERFACE_OPERATION = "createInterfaceOperation"; private static final String UPDATE_INTERFACE_OPERATION = "updateInterfaceOperation"; - @Autowired - private ArtifactCassandraDao artifactCassandraDao; + private final ArtifactCassandraDao artifactCassandraDao; + private final InterfaceOperationValidation interfaceOperationValidation; @Autowired - private InterfaceOperationValidation interfaceOperationValidation; + public InterfaceOperationBusinessLogic(IElementOperation elementDao, + IGroupOperation groupOperation, + IGroupInstanceOperation groupInstanceOperation, + IGroupTypeOperation groupTypeOperation, + InterfaceOperation interfaceOperation, + InterfaceLifecycleOperation interfaceLifecycleTypeOperation, ArtifactCassandraDao artifactCassandraDao, + InterfaceOperationValidation interfaceOperationValidation, ArtifactsOperations artifactToscaOperation) { + super(elementDao, groupOperation, groupInstanceOperation, groupTypeOperation, + interfaceOperation, interfaceLifecycleTypeOperation, artifactToscaOperation); + this.artifactCassandraDao = artifactCassandraDao; + this.interfaceOperationValidation = interfaceOperationValidation; + } public Either<List<InterfaceDefinition>, ResponseFormat> deleteInterfaceOperation(String componentId, String interfaceId, List<String> operationsToDelete, User user, boolean lock) { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/NodeFilterUploadCreator.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/NodeFilterUploadCreator.java index 444ac0b0cf..e622a3037a 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/NodeFilterUploadCreator.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/NodeFilterUploadCreator.java @@ -29,7 +29,6 @@ import org.openecomp.sdc.be.utils.TypeUtils; public class NodeFilterUploadCreator { - public UploadNodeFilterInfo createNodeFilterData(Object obj) { if (!(obj instanceof Map)) { return null; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/PolicyBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/PolicyBusinessLogic.java index 452cd3809b..17233d6663 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/PolicyBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/PolicyBusinessLogic.java @@ -52,10 +52,18 @@ import org.openecomp.sdc.be.model.ComponentParametersView; import org.openecomp.sdc.be.model.PolicyDefinition; import org.openecomp.sdc.be.model.PolicyTypeDefinition; import org.openecomp.sdc.be.model.Resource; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ArtifactsOperations; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.InterfaceOperation; +import org.openecomp.sdc.be.model.operations.api.IElementOperation; +import org.openecomp.sdc.be.model.operations.api.IGroupInstanceOperation; +import org.openecomp.sdc.be.model.operations.api.IGroupOperation; +import org.openecomp.sdc.be.model.operations.api.IGroupTypeOperation; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; +import org.openecomp.sdc.be.model.operations.impl.InterfaceLifecycleOperation; import org.openecomp.sdc.common.datastructure.Wrapper; import org.openecomp.sdc.common.log.wrappers.Logger; import org.openecomp.sdc.exception.ResponseFormat; +import org.springframework.beans.factory.annotation.Autowired; /** * Provides specified business logic to create, retrieve, update, delete a policy @@ -65,20 +73,23 @@ public class PolicyBusinessLogic extends BaseBusinessLogic { private static final String FAILED_TO_VALIDATE_COMPONENT = "#{} - failed to validate the component {} before policy processing. "; private static final String DECLARE_PROPERTIES_TO_POLICIES = "declare properties to policies"; - private static final String EXECUTE_ROLLBACK = "execute rollback"; - private static final String EXECUTE_COMMIT = "execute commit"; private static final Logger log = Logger.getLogger(PolicyBusinessLogic.class); - @Inject private PropertyDeclarationOrchestrator propertyDeclarationOrchestrator; - public PolicyBusinessLogic() { - } - - public PolicyBusinessLogic(PropertyDeclarationOrchestrator propertyDeclarationOrchestrator) { - this.propertyDeclarationOrchestrator = propertyDeclarationOrchestrator; + @Autowired + public PolicyBusinessLogic(IElementOperation elementDao, + IGroupOperation groupOperation, + IGroupInstanceOperation groupInstanceOperation, + IGroupTypeOperation groupTypeOperation, + InterfaceOperation interfaceOperation, + InterfaceLifecycleOperation interfaceLifecycleTypeOperation, + ArtifactsOperations artifactToscaOperation) { + super(elementDao, groupOperation, groupInstanceOperation, groupTypeOperation, + interfaceOperation, interfaceLifecycleTypeOperation, artifactToscaOperation); } + @Autowired public void setPropertyDeclarationOrchestrator(PropertyDeclarationOrchestrator propertyDeclarationOrchestrator) { this.propertyDeclarationOrchestrator = propertyDeclarationOrchestrator; } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ProductBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ProductBusinessLogic.java index 81c4af8b98..8f3d17b74d 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ProductBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ProductBusinessLogic.java @@ -35,7 +35,14 @@ import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.be.model.category.CategoryDefinition; import org.openecomp.sdc.be.model.category.GroupingDefinition; import org.openecomp.sdc.be.model.category.SubCategoryDefinition; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ArtifactsOperations; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.InterfaceOperation; +import org.openecomp.sdc.be.model.operations.api.IElementOperation; +import org.openecomp.sdc.be.model.operations.api.IGroupInstanceOperation; +import org.openecomp.sdc.be.model.operations.api.IGroupOperation; +import org.openecomp.sdc.be.model.operations.api.IGroupTypeOperation; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; +import org.openecomp.sdc.be.model.operations.impl.InterfaceLifecycleOperation; import org.openecomp.sdc.be.model.operations.impl.UniqueIdBuilder; import org.openecomp.sdc.be.model.operations.utils.ComponentValidationUtils; import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum; @@ -61,10 +68,23 @@ public class ProductBusinessLogic extends ComponentBusinessLogic { private static List<Role> updateRoles; private static List<Role> contactsRoles; + private final ComponentInstanceBusinessLogic componentInstanceBusinessLogic; + @Autowired - private ComponentInstanceBusinessLogic componentInstanceBusinessLogic; + public ProductBusinessLogic(IElementOperation elementDao, + IGroupOperation groupOperation, + IGroupInstanceOperation groupInstanceOperation, + IGroupTypeOperation groupTypeOperation, + GroupBusinessLogic groupBusinessLogic, + InterfaceOperation interfaceOperation, + InterfaceLifecycleOperation interfaceLifecycleTypeOperation, + ArtifactsBusinessLogic artifactsBusinessLogic, + ComponentInstanceBusinessLogic componentInstanceBusinessLogic, + ArtifactsOperations artifactToscaOperation) { + super(elementDao, groupOperation, groupInstanceOperation, groupTypeOperation, groupBusinessLogic, + interfaceOperation, interfaceLifecycleTypeOperation, artifactsBusinessLogic, artifactToscaOperation); + this.componentInstanceBusinessLogic = componentInstanceBusinessLogic; - public ProductBusinessLogic() { creationRoles = new ArrayList<>(); updateRoles = new ArrayList<>(); contactsRoles = new ArrayList<>(); @@ -76,7 +96,6 @@ public class ProductBusinessLogic extends ComponentBusinessLogic { contactsRoles.add(Role.PRODUCT_MANAGER); } - public Either<Product, ResponseFormat> createProduct(Product product, User user) { AuditingActionEnum actionEnum = AuditingActionEnum.CREATE_RESOURCE; ComponentTypeEnum typeEnum = ComponentTypeEnum.PRODUCT; diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/PropertyBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/PropertyBusinessLogic.java index f3a40ad9f7..950971ef0b 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/PropertyBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/PropertyBusinessLogic.java @@ -49,8 +49,14 @@ import org.openecomp.sdc.be.model.DataTypeDefinition; import org.openecomp.sdc.be.model.IComplexDefaultValue; import org.openecomp.sdc.be.model.InterfaceDefinition; import org.openecomp.sdc.be.model.PropertyDefinition; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ArtifactsOperations; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.InterfaceOperation; import org.openecomp.sdc.be.model.operations.api.IElementOperation; +import org.openecomp.sdc.be.model.operations.api.IGroupInstanceOperation; +import org.openecomp.sdc.be.model.operations.api.IGroupOperation; +import org.openecomp.sdc.be.model.operations.api.IGroupTypeOperation; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; +import org.openecomp.sdc.be.model.operations.impl.InterfaceLifecycleOperation; import org.openecomp.sdc.be.model.operations.utils.ComponentValidationUtils; import org.openecomp.sdc.be.model.tosca.ToscaPropertyType; import org.openecomp.sdc.be.model.tosca.converters.PropertyValueConverter; @@ -59,6 +65,7 @@ import org.openecomp.sdc.be.resources.data.EntryData; import org.openecomp.sdc.common.api.Constants; import org.openecomp.sdc.common.log.wrappers.Logger; import org.openecomp.sdc.exception.ResponseFormat; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.context.WebApplicationContext; @org.springframework.stereotype.Component("propertyBusinessLogic") @@ -70,6 +77,18 @@ public class PropertyBusinessLogic extends BaseBusinessLogic { private static final String EMPTY_VALUE = null; + @Autowired + public PropertyBusinessLogic(IElementOperation elementDao, + IGroupOperation groupOperation, + IGroupInstanceOperation groupInstanceOperation, + IGroupTypeOperation groupTypeOperation, + InterfaceOperation interfaceOperation, + InterfaceLifecycleOperation interfaceLifecycleTypeOperation, + ArtifactsOperations artifactToscaOperation) { + super(elementDao, groupOperation, groupInstanceOperation, groupTypeOperation, + interfaceOperation, interfaceLifecycleTypeOperation, artifactToscaOperation); + } + protected static IElementOperation getElementDao(Class<IElementOperation> class1, ServletContext context) { WebAppContextWrapper webApplicationContextWrapper = (WebAppContextWrapper) context.getAttribute(Constants.WEB_APPLICATION_CONTEXT_WRAPPER_ATTR); diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/RelationshipTypeBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/RelationshipTypeBusinessLogic.java index 695d82f5d9..5ca6255db8 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/RelationshipTypeBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/RelationshipTypeBusinessLogic.java @@ -32,11 +32,15 @@ import org.springframework.stereotype.Component; @Component("relationshipTypeBusinessLogic") public class RelationshipTypeBusinessLogic { - @Autowired - private RelationshipTypeOperation relationshipTypeOperation; + private final RelationshipTypeOperation relationshipTypeOperation; + protected final ComponentsUtils componentsUtils; @Autowired - protected ComponentsUtils componentsUtils; + public RelationshipTypeBusinessLogic(RelationshipTypeOperation relationshipTypeOperation, + ComponentsUtils componentsUtils) { + this.relationshipTypeOperation = relationshipTypeOperation; + this.componentsUtils = componentsUtils; + } public Either<Map<String, RelationshipTypeDefinition>, ResponseFormat> getAllRelationshipTypes() { Either<Map<String, RelationshipTypeDefinition>, JanusGraphOperationStatus> allRelationshipTypes = diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/RelationshipTypeImportManager.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/RelationshipTypeImportManager.java index 19dd0f41a3..a2da4cca2f 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/RelationshipTypeImportManager.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/RelationshipTypeImportManager.java @@ -29,6 +29,7 @@ import org.openecomp.sdc.be.model.operations.impl.DaoStatusConverter; import org.openecomp.sdc.be.model.operations.impl.RelationshipTypeOperation; import org.openecomp.sdc.be.utils.TypeUtils; import org.openecomp.sdc.exception.ResponseFormat; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @Component("relationshipTypeImportManager") @@ -36,12 +37,14 @@ public class RelationshipTypeImportManager { private final RelationshipTypeOperation relationshipTypeOperation; private final CommonImportManager commonImportManager; - private ComponentsUtils componentsUtils; + private final ComponentsUtils componentsUtils; + @Autowired public RelationshipTypeImportManager(RelationshipTypeOperation relationshipTypeOperation, - CommonImportManager commonImportManager) { + CommonImportManager commonImportManager, ComponentsUtils componentsUtils) { this.relationshipTypeOperation = relationshipTypeOperation; this.commonImportManager = commonImportManager; + this.componentsUtils = componentsUtils; } public Either<List<ImmutablePair<RelationshipTypeDefinition, Boolean>>, ResponseFormat> createRelationshipTypes( diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/RequirementBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/RequirementBusinessLogic.java index c2d9c95cf7..067b5db97c 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/RequirementBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/RequirementBusinessLogic.java @@ -25,8 +25,15 @@ import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; import org.openecomp.sdc.be.model.ComponentParametersView; import org.openecomp.sdc.be.model.RequirementDefinition; import org.openecomp.sdc.be.model.User; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ArtifactsOperations; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.InterfaceOperation; import org.openecomp.sdc.be.model.jsonjanusgraph.operations.RequirementOperation; +import org.openecomp.sdc.be.model.operations.api.IElementOperation; +import org.openecomp.sdc.be.model.operations.api.IGroupInstanceOperation; +import org.openecomp.sdc.be.model.operations.api.IGroupOperation; +import org.openecomp.sdc.be.model.operations.api.IGroupTypeOperation; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; +import org.openecomp.sdc.be.model.operations.impl.InterfaceLifecycleOperation; import org.openecomp.sdc.exception.ResponseFormat; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -53,16 +60,27 @@ public class RequirementBusinessLogic extends BaseBusinessLogic { private static final String EXCEPTION_OCCURRED_DURING_REQUIREMENTS = "Exception occurred during {}. Response is {}"; - @Autowired private RequirementOperation requirementOperation; - @Autowired private RequirementValidation requirementValidation; + @Autowired + public RequirementBusinessLogic(IElementOperation elementDao, + IGroupOperation groupOperation, + IGroupInstanceOperation groupInstanceOperation, + IGroupTypeOperation groupTypeOperation, + InterfaceOperation interfaceOperation, + InterfaceLifecycleOperation interfaceLifecycleTypeOperation, + ArtifactsOperations artifactToscaOperation) { + super(elementDao, groupOperation, groupInstanceOperation, groupTypeOperation, + interfaceOperation, interfaceLifecycleTypeOperation, artifactToscaOperation); + } + @Autowired public void setRequirementOperation(RequirementOperation requirementOperation) { this.requirementOperation = requirementOperation; } + @Autowired public void setRequirementValidation(RequirementValidation requirementValidation) { this.requirementValidation = requirementValidation; } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogic.java index 0118a7943d..5355ad95df 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogic.java @@ -22,7 +22,6 @@ package org.openecomp.sdc.be.components.impl; - import static java.util.stream.Collectors.joining; import static java.util.stream.Collectors.toList; import static java.util.stream.Collectors.toMap; @@ -127,13 +126,19 @@ import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.be.model.cache.ApplicationDataTypeCache; import org.openecomp.sdc.be.model.category.CategoryDefinition; import org.openecomp.sdc.be.model.category.SubCategoryDefinition; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ArtifactsOperations; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.InterfaceOperation; import org.openecomp.sdc.be.model.jsonjanusgraph.utils.ModelConverter; import org.openecomp.sdc.be.model.operations.StorageException; import org.openecomp.sdc.be.model.operations.api.ICapabilityTypeOperation; import org.openecomp.sdc.be.model.operations.api.IElementOperation; +import org.openecomp.sdc.be.model.operations.api.IGroupInstanceOperation; +import org.openecomp.sdc.be.model.operations.api.IGroupOperation; +import org.openecomp.sdc.be.model.operations.api.IGroupTypeOperation; import org.openecomp.sdc.be.model.operations.api.IInterfaceLifecycleOperation; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.model.operations.impl.DaoStatusConverter; +import org.openecomp.sdc.be.model.operations.impl.InterfaceLifecycleOperation; import org.openecomp.sdc.be.model.operations.impl.UniqueIdBuilder; import org.openecomp.sdc.be.model.operations.utils.ComponentValidationUtils; import org.openecomp.sdc.be.model.tosca.ToscaPropertyType; @@ -156,6 +161,7 @@ import org.openecomp.sdc.common.util.GeneralUtility; import org.openecomp.sdc.common.util.ValidationUtils; import org.openecomp.sdc.exception.ResponseFormat; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Lazy; import org.springframework.web.context.WebApplicationContext; import org.yaml.snakeyaml.DumperOptions; import org.yaml.snakeyaml.Yaml; @@ -178,54 +184,53 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { private static final String COMPONENT_INSTANCE_WITH_NAME = "component instance with name "; private static final String COMPONENT_INSTANCE_WITH_NAME_IN_RESOURCE = "component instance with name {} in resource {} "; - - @Autowired - private ICapabilityTypeOperation capabilityTypeOperation = null; - - @Autowired - private IInterfaceLifecycleOperation interfaceTypeOperation = null; - - @Autowired + private ICapabilityTypeOperation capabilityTypeOperation; + private IInterfaceLifecycleOperation interfaceTypeOperation; private LifecycleBusinessLogic lifecycleBusinessLogic; - @Autowired - private ComponentInstanceBusinessLogic componentInstanceBusinessLogic; - - @Autowired - private ResourceImportManager resourceImportManager; + private final ComponentInstanceBusinessLogic componentInstanceBusinessLogic; + private final ResourceImportManager resourceImportManager; + private final InputsBusinessLogic inputsBusinessLogic; + private final CompositionBusinessLogic compositionBusinessLogic; + private final ResourceDataMergeBusinessLogic resourceDataMergeBusinessLogic; + private final CsarArtifactsAndGroupsBusinessLogic csarArtifactsAndGroupsBusinessLogic; + private final MergeInstanceUtils mergeInstanceUtils; + private final UiComponentDataConverter uiComponentDataConverter; + private final CsarBusinessLogic csarBusinessLogic; @Autowired - private InputsBusinessLogic inputsBusinessLogic; - - @Autowired - private CompositionBusinessLogic compositionBusinessLogic; - - @Autowired - private ResourceDataMergeBusinessLogic resourceDataMergeBusinessLogic; - - @Autowired - private CsarArtifactsAndGroupsBusinessLogic csarArtifactsAndGroupsBusinessLogic; - - @Autowired - private MergeInstanceUtils mergeInstanceUtils; - - @Autowired - private UiComponentDataConverter uiComponentDataConverter; - - @Autowired - private CsarBusinessLogic csarBusinessLogic; - - /** - * Default constructor - */ - public ResourceBusinessLogic() { - log.debug("ResourceBusinessLogic started"); + public ResourceBusinessLogic(IElementOperation elementDao, + IGroupOperation groupOperation, + IGroupInstanceOperation groupInstanceOperation, + IGroupTypeOperation groupTypeOperation, + GroupBusinessLogic groupBusinessLogic, + InterfaceOperation interfaceOperation, + InterfaceLifecycleOperation interfaceLifecycleTypeOperation, + ArtifactsBusinessLogic artifactsBusinessLogic, + ComponentInstanceBusinessLogic componentInstanceBusinessLogic, @Lazy ResourceImportManager resourceImportManager, + InputsBusinessLogic inputsBusinessLogic, CompositionBusinessLogic compositionBusinessLogic, + ResourceDataMergeBusinessLogic resourceDataMergeBusinessLogic, + CsarArtifactsAndGroupsBusinessLogic csarArtifactsAndGroupsBusinessLogic, MergeInstanceUtils mergeInstanceUtils, + UiComponentDataConverter uiComponentDataConverter, CsarBusinessLogic csarBusinessLogic, + ArtifactsOperations artifactToscaOperation) { + super(elementDao, groupOperation, groupInstanceOperation, groupTypeOperation, groupBusinessLogic, + interfaceOperation, interfaceLifecycleTypeOperation, artifactsBusinessLogic, artifactToscaOperation); + this.componentInstanceBusinessLogic = componentInstanceBusinessLogic; + this.resourceImportManager = resourceImportManager; + this.inputsBusinessLogic = inputsBusinessLogic; + this.compositionBusinessLogic = compositionBusinessLogic; + this.resourceDataMergeBusinessLogic = resourceDataMergeBusinessLogic; + this.csarArtifactsAndGroupsBusinessLogic = csarArtifactsAndGroupsBusinessLogic; + this.mergeInstanceUtils = mergeInstanceUtils; + this.uiComponentDataConverter = uiComponentDataConverter; + this.csarBusinessLogic = csarBusinessLogic; } public LifecycleBusinessLogic getLifecycleBusinessLogic() { return lifecycleBusinessLogic; } + @Autowired public void setLifecycleManager(LifecycleBusinessLogic lifecycleBusinessLogic) { this.lifecycleBusinessLogic = lifecycleBusinessLogic; } @@ -234,14 +239,11 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { return elementDao; } - public void setElementDao(IElementOperation elementDao) { - this.elementDao = elementDao; - } - public IUserBusinessLogic getUserAdmin() { return this.userAdmin; } + @Autowired public void setUserAdmin(UserBusinessLogic userAdmin) { this.userAdmin = userAdmin; } @@ -250,26 +252,21 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { return this.componentsUtils; } + @Autowired public void setComponentsUtils(ComponentsUtils componentsUtils) { this.componentsUtils = componentsUtils; } - public ArtifactsBusinessLogic getArtifactsManager() { - return artifactsBusinessLogic; - } - - public void setArtifactsManager(ArtifactsBusinessLogic artifactsManager) { - this.artifactsBusinessLogic = artifactsManager; - } - public ApplicationDataTypeCache getApplicationDataTypeCache() { return applicationDataTypeCache; } + @Autowired public void setApplicationDataTypeCache(ApplicationDataTypeCache applicationDataTypeCache) { this.applicationDataTypeCache = applicationDataTypeCache; } + @Autowired public void setInterfaceTypeOperation(IInterfaceLifecycleOperation interfaceTypeOperation) { this.interfaceTypeOperation = interfaceTypeOperation; } @@ -4877,6 +4874,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { return capabilityTypeOperation; } + @Autowired public void setCapabilityTypeOperation(ICapabilityTypeOperation capabilityTypeOperation) { this.capabilityTypeOperation = capabilityTypeOperation; } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceImportManager.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceImportManager.java index dbb421b6a0..8dbf1ceff4 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceImportManager.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceImportManager.java @@ -73,32 +73,29 @@ import java.util.stream.Collectors; @Component("resourceImportManager") public class ResourceImportManager { + static final Pattern PROPERTY_NAME_PATTERN_IGNORE_LENGTH = Pattern.compile("[\\w\\-\\_\\d\\:]+"); private ServletContext servletContext; - @Autowired private AuditingManager auditingManager; - - @Autowired private ResourceBusinessLogic resourceBusinessLogic; - - @Autowired private IGraphLockOperation graphLockOperation; - - @Autowired - protected ComponentsUtils componentsUtils; - - public static final Pattern PROPERTY_NAME_PATTERN_IGNORE_LENGTH = Pattern - .compile("[\\w\\-\\_\\d\\:]+"); - @Autowired - protected CapabilityTypeOperation capabilityTypeOperation; - @Autowired protected ToscaOperationFacade toscaOperationFacade; + protected final ComponentsUtils componentsUtils; + private final CapabilityTypeOperation capabilityTypeOperation; + private ResponseFormatManager responseFormatManager; private static final Logger log = Logger.getLogger(ResourceImportManager.class); + @Autowired + public ResourceImportManager(ComponentsUtils componentsUtils, CapabilityTypeOperation capabilityTypeOperation) { + this.componentsUtils = componentsUtils; + this.capabilityTypeOperation = capabilityTypeOperation; + } + + @Autowired public void setToscaOperationFacade(ToscaOperationFacade toscaOperationFacade) { this.toscaOperationFacade = toscaOperationFacade; } @@ -979,6 +976,7 @@ public class ResourceImportManager { return resourceBusinessLogic; } + @Autowired public void setResourceBusinessLogic(ResourceBusinessLogic resourceBusinessLogic) { this.resourceBusinessLogic = resourceBusinessLogic; } @@ -987,6 +985,7 @@ public class ResourceImportManager { return graphLockOperation; } + @Autowired public void setGraphLockOperation(IGraphLockOperation graphLockOperation) { this.graphLockOperation = graphLockOperation; } @@ -995,6 +994,7 @@ public class ResourceImportManager { this.servletContext = servletContext; } + @Autowired public void setAuditingManager(AuditingManager auditingManager) { this.auditingManager = auditingManager; } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceBusinessLogic.java index 7f4ec46714..fc0380a108 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ServiceBusinessLogic.java @@ -117,11 +117,16 @@ import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.Service; import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.be.model.category.CategoryDefinition; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ArtifactsOperations; import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ForwardingPathOperation; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.InterfaceOperation; import org.openecomp.sdc.be.model.jsonjanusgraph.operations.NodeFilterOperation; -import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; import org.openecomp.sdc.be.model.operations.api.IElementOperation; +import org.openecomp.sdc.be.model.operations.api.IGroupInstanceOperation; +import org.openecomp.sdc.be.model.operations.api.IGroupOperation; +import org.openecomp.sdc.be.model.operations.api.IGroupTypeOperation; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; +import org.openecomp.sdc.be.model.operations.impl.InterfaceLifecycleOperation; import org.openecomp.sdc.be.model.operations.impl.UniqueIdBuilder; import org.openecomp.sdc.be.model.operations.utils.ComponentValidationUtils; import org.openecomp.sdc.be.model.tosca.ToscaFunctions; @@ -158,34 +163,49 @@ import javax.servlet.http.HttpServletRequest; @org.springframework.stereotype.Component("serviceBusinessLogic") public class ServiceBusinessLogic extends ComponentBusinessLogic { - private static final String CHANGE_SERVICE_DISTRIBUTION = "Change Service Distribution"; - private static final String THE_SERVICE_WITH_SYSTEM_NAME_LOCKED = "The service with system name {} locked. "; - private static final String FAILED_TO_LOCK_SERVICE_RESPONSE_IS = "Failed to lock service {}. Response is {}. "; - private static final String AUDIT_BEFORE_SENDING_RESPONSE = "audit before sending response"; - private static final Logger log = Logger.getLogger(ServiceBusinessLogic.class); - private static final String INITIAL_VERSION = "0.1"; - private static final String STATUS_SUCCESS_200 = "200"; - private static final String STATUS_DEPLOYED = "DEPLOYED"; + private static final String CHANGE_SERVICE_DISTRIBUTION = "Change Service Distribution"; + private static final String THE_SERVICE_WITH_SYSTEM_NAME_LOCKED = "The service with system name {} locked. "; + private static final String FAILED_TO_LOCK_SERVICE_RESPONSE_IS = "Failed to lock service {}. Response is {}. "; + private static final String AUDIT_BEFORE_SENDING_RESPONSE = "audit before sending response"; + private static final Logger log = Logger.getLogger(ServiceBusinessLogic.class); + private static final String INITIAL_VERSION = "0.1"; + private static final String STATUS_SUCCESS_200 = "200"; + private static final String STATUS_DEPLOYED = "DEPLOYED"; - @Autowired - private IDistributionEngine distributionEngine; - @Autowired + private ForwardingPathOperation forwardingPathOperation; private AuditCassandraDao auditCassandraDao; - @Autowired - private ComponentInstanceBusinessLogic componentInstanceBusinessLogic; - @Autowired - private ServiceDistributionValidation serviceDistributionValidation; + + private final IDistributionEngine distributionEngine; + private final ComponentInstanceBusinessLogic componentInstanceBusinessLogic; + private final ServiceDistributionValidation serviceDistributionValidation; + private final ForwardingPathValidator forwardingPathValidator; + private final UiComponentDataConverter uiComponentDataConverter; + private final NodeFilterOperation serviceFilterOperation; + private final NodeFilterValidator serviceFilterValidator; @Autowired - private ForwardingPathOperation forwardingPathOperation; - @Autowired - private ForwardingPathValidator forwardingPathValidator; - @Autowired - private UiComponentDataConverter uiComponentDataConverter; - @Autowired - private NodeFilterOperation serviceFilterOperation; - @Autowired - private NodeFilterValidator serviceFilterValidator; + public ServiceBusinessLogic(IElementOperation elementDao, + IGroupOperation groupOperation, + IGroupInstanceOperation groupInstanceOperation, + IGroupTypeOperation groupTypeOperation, + GroupBusinessLogic groupBusinessLogic, + InterfaceOperation interfaceOperation, + InterfaceLifecycleOperation interfaceLifecycleTypeOperation, + ArtifactsBusinessLogic artifactsBusinessLogic, + IDistributionEngine distributionEngine, ComponentInstanceBusinessLogic componentInstanceBusinessLogic, + ServiceDistributionValidation serviceDistributionValidation, ForwardingPathValidator forwardingPathValidator, + UiComponentDataConverter uiComponentDataConverter, NodeFilterOperation serviceFilterOperation, + NodeFilterValidator serviceFilterValidator, ArtifactsOperations artifactToscaOperation) { + super(elementDao, groupOperation, groupInstanceOperation, groupTypeOperation, groupBusinessLogic, + interfaceOperation, interfaceLifecycleTypeOperation, artifactsBusinessLogic, artifactToscaOperation); + this.distributionEngine = distributionEngine; + this.componentInstanceBusinessLogic = componentInstanceBusinessLogic; + this.serviceDistributionValidation = serviceDistributionValidation; + this.forwardingPathValidator = forwardingPathValidator; + this.uiComponentDataConverter = uiComponentDataConverter; + this.serviceFilterOperation = serviceFilterOperation; + this.serviceFilterValidator = serviceFilterValidator; + } public Either<Service, ResponseFormat> changeServiceDistributionState(String serviceId, String state, LifecycleChangeInfoWithAction commentObj, User user) { @@ -1023,10 +1043,7 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic { return Either.right(responseFormat); } - public void setElementDao(IElementOperation elementDao) { - this.elementDao = elementDao; - } - + @Autowired public void setCassandraAuditingDao(AuditCassandraDao auditingDao) { this.auditCassandraDao = auditingDao; } @@ -1035,10 +1052,6 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic { return artifactsBusinessLogic; } - public void setArtifactBl(ArtifactsBusinessLogic artifactBl) { - this.artifactsBusinessLogic = artifactBl; - } - public Either<Service, ResponseFormat> updateServiceMetadata(String serviceId, Service serviceUpdate, User user) { user = validateUser(user, "updateServiceMetadata", serviceUpdate, null, false); // validate user role @@ -2438,14 +2451,12 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic { return Either.left(componentInstances); } + @Autowired public void setForwardingPathOperation(ForwardingPathOperation forwardingPathOperation) { this.forwardingPathOperation = forwardingPathOperation; } - @Override - public void setToscaOperationFacade(ToscaOperationFacade toscaOperationFacade) { - this.toscaOperationFacade = toscaOperationFacade; - }/** + /** * updates group instance with new property values in case of successful update of group instance related component instance will be updated with new modification time and related service will be updated with new last update date * */ @@ -2939,4 +2950,8 @@ public class ServiceBusinessLogic extends ComponentBusinessLogic { } return Either.left(serviceFilterResult); } + + + + } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/generic/GenericTypeBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/generic/GenericTypeBusinessLogic.java index 6b3be5921e..840fd03e0d 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/generic/GenericTypeBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/generic/GenericTypeBusinessLogic.java @@ -45,11 +45,14 @@ public class GenericTypeBusinessLogic { private final static Logger log = Logger.getLogger(GenericTypeBusinessLogic.class); - @Autowired - private ComponentsUtils componentsUtils; + private final ComponentsUtils componentsUtils; + private final ToscaOperationFacade toscaOperationFacade; @Autowired - private ToscaOperationFacade toscaOperationFacade; + public GenericTypeBusinessLogic(ComponentsUtils componentsUtils, ToscaOperationFacade toscaOperationFacade) { + this.componentsUtils = componentsUtils; + this.toscaOperationFacade = toscaOperationFacade; + } /** * @param component the component of which to fetch its generic type diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/CertificationChangeTransition.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/CertificationChangeTransition.java index 5826ef1254..409fad22b4 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/CertificationChangeTransition.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/CertificationChangeTransition.java @@ -59,7 +59,6 @@ public class CertificationChangeTransition extends LifeCycleTransition { private LifecycleStateEnum nextState; private LifeCycleTransitionEnum name; private AuditingActionEnum auditingAction; - private ArtifactsBusinessLogic artifactsManager; private NodeTemplateOperation nodeTemplateOperation; public CertificationChangeTransition(LifeCycleTransitionEnum name, ComponentsUtils componentUtils, ToscaElementLifecycleOperation lifecycleOperation, ToscaOperationFacade toscaOperationFacade, JanusGraphDao janusGraphDao) { @@ -103,14 +102,6 @@ public class CertificationChangeTransition extends LifeCycleTransition { return auditingAction; } - public ArtifactsBusinessLogic getArtifactsManager() { - return artifactsManager; - } - - public void setArtifactsManager(ArtifactsBusinessLogic artifactsManager) { - this.artifactsManager = artifactsManager; - } - public NodeTemplateOperation getNodeTemplateOperation() { return nodeTemplateOperation; } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/LifecycleBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/LifecycleBusinessLogic.java index c7376d352b..91f4f5680a 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/LifecycleBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/LifecycleBusinessLogic.java @@ -57,6 +57,7 @@ import org.springframework.beans.factory.annotation.Autowired; import javax.annotation.PostConstruct; import java.util.HashMap; import java.util.Map; +import org.springframework.context.annotation.Lazy; @org.springframework.stereotype.Component("lifecycleBusinessLogic") public class LifecycleBusinessLogic { @@ -67,9 +68,6 @@ public class LifecycleBusinessLogic { private IGraphLockOperation graphLockOperation = null; @Autowired - private ArtifactsBusinessLogic artifactsBusinessLogic; - - @Autowired private JanusGraphDao janusGraphDao; @Autowired @@ -82,19 +80,20 @@ public class LifecycleBusinessLogic { @javax.annotation.Resource private ToscaElementLifecycleOperation lifecycleOperation; - @javax.annotation.Resource - ArtifactsBusinessLogic artifactsManager; @javax.annotation.Resource private ServiceDistributionArtifactsBuilder serviceDistributionArtifactsBuilder; - @javax.annotation.Resource + @Autowired + @Lazy private ServiceBusinessLogic serviceBusinessLogic; - @javax.annotation.Resource + @Autowired + @Lazy private ResourceBusinessLogic resourceBusinessLogic; - @javax.annotation.Resource + @Autowired + @Lazy private ProductBusinessLogic productBusinessLogic; @Autowired @@ -131,7 +130,6 @@ public class LifecycleBusinessLogic { UndoCheckoutTransition undoCheckoutOp = new UndoCheckoutTransition(componentUtils, lifecycleOperation, toscaOperationFacade, janusGraphDao); - undoCheckoutOp.setArtifactsBusinessLogic(artifactsBusinessLogic); stateTransitions.put(undoCheckoutOp.getName().name(), undoCheckoutOp); LifeCycleTransition checkinOp = new CheckinTransition(componentUtils, lifecycleOperation, toscaOperationFacade, @@ -156,7 +154,6 @@ public class LifecycleBusinessLogic { CertificationChangeTransition successCertification = new CertificationChangeTransition(LifeCycleTransitionEnum.CERTIFY, componentUtils, lifecycleOperation, toscaOperationFacade, janusGraphDao); - successCertification.setArtifactsManager(artifactsBusinessLogic); successCertification.setNodeTemplateOperation(nodeTemplateOperation); stateTransitions.put(successCertification.getName().name(), successCertification); } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/UndoCheckoutTransition.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/UndoCheckoutTransition.java index ff4746dcc3..5342367a09 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/UndoCheckoutTransition.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/lifecycle/UndoCheckoutTransition.java @@ -21,7 +21,6 @@ package org.openecomp.sdc.be.components.lifecycle; import fj.data.Either; -import org.openecomp.sdc.be.components.impl.ArtifactsBusinessLogic; import org.openecomp.sdc.be.components.impl.ComponentBusinessLogic; import org.openecomp.sdc.be.config.BeEcompErrorManager; import org.openecomp.sdc.be.dao.api.ActionStatus; @@ -46,7 +45,6 @@ import java.util.Arrays; public class UndoCheckoutTransition extends LifeCycleTransition { private static final Logger log = Logger.getLogger(CheckoutTransition.class); - private ArtifactsBusinessLogic artifactsManager; public UndoCheckoutTransition(ComponentsUtils componentUtils, ToscaElementLifecycleOperation lifecycleOperation, ToscaOperationFacade toscaOperationFacade, JanusGraphDao janusGraphDao) { super(componentUtils, lifecycleOperation, toscaOperationFacade, janusGraphDao); @@ -70,14 +68,6 @@ public class UndoCheckoutTransition extends LifeCycleTransition { return AuditingActionEnum.UNDO_CHECKOUT_RESOURCE; } - public ArtifactsBusinessLogic getArtifactsBusinessLogic() { - return artifactsManager; - } - - public void setArtifactsBusinessLogic(ArtifactsBusinessLogic artifactsBusinessLogic) { - this.artifactsManager = artifactsBusinessLogic; - } - @Override public Either<Boolean, ResponseFormat> validateBeforeTransition(Component component, ComponentTypeEnum componentType, User modifier, User owner, LifecycleStateEnum oldState, LifecycleChangeInfoWithAction lifecycleChangeInfo) { String componentName = component.getComponentMetadataDefinition().getMetadataDataDefinition().getName(); diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceMergeDataBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceMergeDataBusinessLogic.java index 6c9f86fc20..a9e3aa4cbf 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceMergeDataBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/merge/instance/ComponentInstanceMergeDataBusinessLogic.java @@ -35,6 +35,8 @@ import org.openecomp.sdc.exception.ResponseFormat; import org.springframework.beans.factory.annotation.Autowired; import java.util.List; +import org.springframework.context.annotation.Lazy; + /** * Created by chaya on 9/12/2017. */ @@ -44,6 +46,7 @@ public class ComponentInstanceMergeDataBusinessLogic { private static final Logger log = Logger.getLogger(ComponentInstanceMergeDataBusinessLogic.class); @Autowired + @Lazy private List<ComponentInstanceMergeInterface> componentInstancesMergeBLs; @Autowired diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/scheduledtasks/ComponentsCleanBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/scheduledtasks/ComponentsCleanBusinessLogic.java index 06f37db6f3..03dcf76619 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/scheduledtasks/ComponentsCleanBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/scheduledtasks/ComponentsCleanBusinessLogic.java @@ -16,6 +16,8 @@ * See the License for the specific language governing permissions and * limitations under the License. * ============LICENSE_END========================================================= + * Modifications copyright (c) 2019 Nokia + * ================================================================================ */ package org.openecomp.sdc.be.components.scheduledtasks; @@ -24,11 +26,19 @@ import com.google.common.annotations.VisibleForTesting; import fj.data.Either; import org.openecomp.sdc.be.components.impl.BaseBusinessLogic; import org.openecomp.sdc.be.components.impl.ComponentBusinessLogic; +import org.openecomp.sdc.be.components.impl.GroupBusinessLogic; import org.openecomp.sdc.be.components.impl.ResourceBusinessLogic; import org.openecomp.sdc.be.components.impl.ServiceBusinessLogic; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ArtifactsOperations; +import org.openecomp.sdc.be.model.jsonjanusgraph.operations.InterfaceOperation; +import org.openecomp.sdc.be.model.operations.api.IElementOperation; +import org.openecomp.sdc.be.model.operations.api.IGroupInstanceOperation; +import org.openecomp.sdc.be.model.operations.api.IGroupOperation; +import org.openecomp.sdc.be.model.operations.api.IGroupTypeOperation; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; +import org.openecomp.sdc.be.model.operations.impl.InterfaceLifecycleOperation; import org.openecomp.sdc.common.log.wrappers.Logger; import org.openecomp.sdc.exception.ResponseFormat; import org.springframework.beans.factory.annotation.Autowired; @@ -41,17 +51,29 @@ import java.util.Map; @Component("componentsCleanBusinessLogic") public class ComponentsCleanBusinessLogic extends BaseBusinessLogic { - @Autowired - private ResourceBusinessLogic resourceBusinessLogic; - - @Autowired - private ServiceBusinessLogic serviceBusinessLogic; + private final ResourceBusinessLogic resourceBusinessLogic; + private final ServiceBusinessLogic serviceBusinessLogic; @VisibleForTesting - public static final String DELETE_LOCKER = "DELETE_LOCKER"; + static final String DELETE_LOCKER = "DELETE_LOCKER"; private static final Logger log = Logger.getLogger(ComponentsCleanBusinessLogic.class.getName()); + @Autowired + public ComponentsCleanBusinessLogic(IElementOperation elementDao, + IGroupOperation groupOperation, + IGroupInstanceOperation groupInstanceOperation, + IGroupTypeOperation groupTypeOperation, + InterfaceOperation interfaceOperation, + InterfaceLifecycleOperation interfaceLifecycleTypeOperation, ResourceBusinessLogic resourceBusinessLogic, + ServiceBusinessLogic serviceBusinessLogic, + ArtifactsOperations artifactToscaOperation) { + super(elementDao, groupOperation, groupInstanceOperation, groupTypeOperation, + interfaceOperation, interfaceLifecycleTypeOperation, artifactToscaOperation); + this.resourceBusinessLogic = resourceBusinessLogic; + this.serviceBusinessLogic = serviceBusinessLogic; + } + public Map<NodeTypeEnum, Either<List<String>, ResponseFormat>> cleanComponents(List<NodeTypeEnum> componentsToClean){ return cleanComponents(componentsToClean, false); } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/impl/ComponentsUtils.java b/catalog-be/src/main/java/org/openecomp/sdc/be/impl/ComponentsUtils.java index 0d9e21a66a..3c3a3dbef7 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/impl/ComponentsUtils.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/impl/ComponentsUtils.java @@ -72,6 +72,7 @@ import javax.servlet.http.HttpServletRequest; import java.lang.reflect.Type; import java.util.Collections; import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; @org.springframework.stereotype.Component("componentUtils") public class ComponentsUtils { @@ -84,6 +85,7 @@ public class ComponentsUtils { private final AuditingManager auditingManager; private final ResponseFormatManager responseFormatManager; + @Autowired public ComponentsUtils(AuditingManager auditingManager) { this.auditingManager = auditingManager; this.responseFormatManager = ResponseFormatManager.getInstance(); |