aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-be/src/main
diff options
context:
space:
mode:
authorfranciscovila <javier.paradela.vila@est.tech>2022-10-07 11:52:30 +0100
committerMichael Morris <michael.morris@est.tech>2022-10-25 13:18:15 +0000
commit5517cab153e2efce298f1da98fd4b41b483cb57f (patch)
treeefe1e9b3db94f155c977d1ac6d2b7e51bdb3cf3c /catalog-be/src/main
parent3d79660270cc259688e0ba20150286c1680c7559 (diff)
Constraint validation - Node Template Interfaces
Validate constraints in node template interfaces Issue-ID: SDC-4207 Signed-off-by: franciscovila <javier.paradela.vila@est.tech> Change-Id: Ibe4a55342067942a2a29f540c896ecc39811220f
Diffstat (limited to 'catalog-be/src/main')
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ArtifactTypeBusinessLogic.java71
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ArtifactsBusinessLogic.java7
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentInterfaceOperationBusinessLogic.java138
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/datamodel/utils/PropertyValueConstraintValidationUtil.java6
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/servlets/TypesFetchServlet.java9
5 files changed, 211 insertions, 20 deletions
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ArtifactTypeBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ArtifactTypeBusinessLogic.java
new file mode 100644
index 0000000000..126571741f
--- /dev/null
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ArtifactTypeBusinessLogic.java
@@ -0,0 +1,71 @@
+/*
+ * -
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2022 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.openecomp.sdc.be.components.impl;
+
+import fj.data.Either;
+import java.util.Map;
+import org.apache.commons.lang3.StringUtils;
+import org.openecomp.sdc.be.model.ArtifactTypeDefinition;
+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.ArtifactTypeOperation;
+import org.openecomp.sdc.be.model.operations.impl.InterfaceLifecycleOperation;
+import org.openecomp.sdc.common.log.wrappers.Logger;
+import org.springframework.beans.factory.annotation.Autowired;
+
+@org.springframework.stereotype.Component("artifactTypeBusinessLogic")
+public class ArtifactTypeBusinessLogic extends BaseBusinessLogic {
+
+ private static final Logger log = Logger.getLogger(ArtifactTypeBusinessLogic.class.getName());
+
+ private final ArtifactTypeOperation artifactTypeOperation;
+
+ @Autowired
+ public ArtifactTypeBusinessLogic(IElementOperation elementDao, IGroupOperation groupOperation,
+ IGroupInstanceOperation groupInstanceOperation, IGroupTypeOperation groupTypeOperation,
+ InterfaceOperation interfaceOperation, InterfaceLifecycleOperation interfaceLifecycleTypeOperation,
+ ArtifactsOperations artifactToscaOperation,
+ ArtifactTypeOperation artifactTypeOperation) {
+ super(elementDao, groupOperation, groupInstanceOperation, groupTypeOperation, interfaceOperation, interfaceLifecycleTypeOperation,
+ artifactToscaOperation);
+ this.artifactTypeOperation = artifactTypeOperation;
+ }
+
+ public ArtifactTypeDefinition getArtifactTypeByUid(String uniqueId) {
+ Either<ArtifactTypeDefinition, StorageOperationStatus> eitherArtifact = artifactTypeOperation.getArtifactTypeByUid(uniqueId);
+ if (eitherArtifact == null || eitherArtifact.isRight()) {
+ return null;
+ }
+ return eitherArtifact.left().value();
+ }
+
+ public Map<String, ArtifactTypeDefinition> getAllToscaArtifactTypes(final String modelName) {
+ if (StringUtils.isNotEmpty(modelName)) {
+ artifactTypeOperation.validateModel(modelName);
+ }
+ return artifactTypeOperation.getAllArtifactTypes(modelName);
+ }
+}
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 eb3561afc0..a978154224 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
@@ -4261,13 +4261,6 @@ public class ArtifactsBusinessLogic extends BaseBusinessLogic {
return ConfigurationManager.getConfigurationManager().getConfiguration().getArtifacts();
}
- public Map<String, ArtifactTypeDefinition> getAllToscaArtifacts(final String modelName) {
- if (StringUtils.isNotEmpty(modelName)) {
- artifactTypeOperation.validateModel(modelName);
- }
- return artifactTypeOperation.getAllArtifactTypes(modelName);
- }
-
public enum ArtifactOperationEnum {
CREATE, UPDATE, DELETE, DOWNLOAD, LINK;
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentInterfaceOperationBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentInterfaceOperationBusinessLogic.java
index eb8b35ec60..d194944786 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentInterfaceOperationBusinessLogic.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentInterfaceOperationBusinessLogic.java
@@ -20,26 +20,39 @@
*/
package org.openecomp.sdc.be.components.impl;
+import com.google.common.reflect.TypeToken;
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
import fj.data.Either;
+import java.lang.reflect.Type;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.UUID;
+import java.util.stream.Collectors;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.MapUtils;
import org.openecomp.sdc.be.components.impl.exceptions.BusinessLogicException;
import org.openecomp.sdc.be.components.validation.ComponentValidations;
import org.openecomp.sdc.be.dao.api.ActionStatus;
+import org.openecomp.sdc.be.datamodel.utils.PropertyValueConstraintValidationUtil;
import org.openecomp.sdc.be.datatypes.elements.ArtifactDataDefinition;
+import org.openecomp.sdc.be.datatypes.elements.ListDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.OperationDataDefinition;
+import org.openecomp.sdc.be.datatypes.elements.OperationInputDefinition;
+import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
+import org.openecomp.sdc.be.model.ArtifactTypeDefinition;
import org.openecomp.sdc.be.model.Component;
import org.openecomp.sdc.be.model.ComponentInstance;
import org.openecomp.sdc.be.model.ComponentInstanceInterface;
import org.openecomp.sdc.be.model.ComponentParametersView;
import org.openecomp.sdc.be.model.InterfaceDefinition;
+import org.openecomp.sdc.be.model.PropertyConstraint;
+import org.openecomp.sdc.be.model.PropertyDefinition;
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;
@@ -49,6 +62,8 @@ 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.PropertyOperation;
+import org.openecomp.sdc.be.model.operations.impl.UniqueIdBuilder;
import org.openecomp.sdc.be.user.Role;
import org.openecomp.sdc.common.datastructure.Wrapper;
import org.openecomp.sdc.exception.ResponseFormat;
@@ -60,7 +75,13 @@ import org.springframework.beans.factory.annotation.Autowired;
public class ComponentInterfaceOperationBusinessLogic extends BaseBusinessLogic {
private static final Logger LOGGER = LoggerFactory.getLogger(ComponentInterfaceOperationBusinessLogic.class);
+ private static final String UPDATE_INTERFACE_OPERATION_ON_COMPONENT_INSTANCE =
+ "Update Interface Operation on Component instance";
+ private static final String EXCEPTION_OCCURRED_WHEN_UPDATING_COMPONENT_INSTANCE_INTERFACES =
+ "Exception occurred when updating Component Instance Interfaces {}";
private final ComponentValidations componentValidations;
+ private final PropertyBusinessLogic propertyBusinessLogic;
+ private final ArtifactTypeBusinessLogic artifactTypeBusinessLogic;
@Autowired
public ComponentInterfaceOperationBusinessLogic(final IElementOperation elementDao, final IGroupOperation groupOperation,
@@ -68,10 +89,14 @@ public class ComponentInterfaceOperationBusinessLogic extends BaseBusinessLogic
final IGroupTypeOperation groupTypeOperation, final InterfaceOperation interfaceOperation,
final InterfaceLifecycleOperation interfaceLifecycleTypeOperation,
final ArtifactsOperations artifactToscaOperation,
- final ComponentValidations componentValidations) {
+ final ComponentValidations componentValidations,
+ final PropertyBusinessLogic propertyBusinessLogic,
+ final ArtifactTypeBusinessLogic artifactTypeBusinessLogic) {
super(elementDao, groupOperation, groupInstanceOperation, groupTypeOperation, interfaceOperation, interfaceLifecycleTypeOperation,
artifactToscaOperation);
this.componentValidations = componentValidations;
+ this.propertyBusinessLogic = propertyBusinessLogic;
+ this.artifactTypeBusinessLogic = artifactTypeBusinessLogic;
}
public Optional<ComponentInstance> updateComponentInstanceInterfaceOperation(final String componentId, final String componentInstanceId,
@@ -119,19 +144,33 @@ public class ComponentInterfaceOperationBusinessLogic extends BaseBusinessLogic
errorWrapper.setInnerElement(responseFormat);
return Optional.empty();
}
+
+ final String model = propertyBusinessLogic.getComponentModelByComponentId(componentId);
+ PropertyValueConstraintValidationUtil constraintValidatorUtil = new PropertyValueConstraintValidationUtil();
+ Either<Boolean, ResponseFormat> constraintValidatorResponse =
+ validateOperationInputConstraints(updatedOperationDataDefinition, constraintValidatorUtil, model);
+ if (!isConstraintsValidationSucceed(constraintValidatorResponse, errorWrapper, updatedOperationDataDefinition)) {
+ return Optional.empty();
+ }
+ constraintValidatorResponse = validateOperationArtifactPropertyConstraints(
+ updatedOperationDataDefinition, constraintValidatorUtil, model);
+ if (!isConstraintsValidationSucceed(constraintValidatorResponse, errorWrapper, updatedOperationDataDefinition)) {
+ return Optional.empty();
+ }
+
updateOperationDefinitionImplementation(updatedOperationDataDefinition);
optionalComponentInstanceInterface.get().getOperations().replace(updatedOperationDataDefinition.getName(), updatedOperationDataDefinition);
boolean wasLocked = false;
try {
if (shouldLock) {
- lockComponent(componentId, component, "Update Interface Operation on Component instance");
+ lockComponent(componentId, component, UPDATE_INTERFACE_OPERATION_ON_COMPONENT_INSTANCE);
wasLocked = true;
}
final StorageOperationStatus status = toscaOperationFacade.updateComponentInstanceInterfaces(component, componentInstanceId);
if (status != StorageOperationStatus.OK) {
janusGraphDao.rollback();
responseFormat = componentsUtils.getResponseFormat(ActionStatus.GENERAL_ERROR);
- LOGGER.error("Exception occurred when updating Component Instance Interfaces {}", responseFormat);
+ LOGGER.error(EXCEPTION_OCCURRED_WHEN_UPDATING_COMPONENT_INSTANCE_INTERFACES, responseFormat);
errorWrapper.setInnerElement(responseFormat);
return Optional.empty();
}
@@ -165,6 +204,34 @@ public class ComponentInterfaceOperationBusinessLogic extends BaseBusinessLogic
return componentInstanceOptional;
}
+ private Either<Boolean, ResponseFormat> validateOperationInputConstraints (
+ OperationDataDefinition operationDataDefinition, PropertyValueConstraintValidationUtil constraintValidatorUtil, String model) {
+ return constraintValidatorUtil
+ .validatePropertyConstraints(convertOperationInputsToPropertyDefinitions(operationDataDefinition), applicationDataTypeCache,
+ model);
+ }
+
+ private Either<Boolean, ResponseFormat> validateOperationArtifactPropertyConstraints (
+ OperationDataDefinition operationDataDefinition, PropertyValueConstraintValidationUtil constraintValidatorUtil, String model) {
+ return constraintValidatorUtil
+ .validatePropertyConstraints(convertOperationArtifactPropsToPropertyDefinitions(operationDataDefinition, model), applicationDataTypeCache,
+ model);
+ }
+
+ private boolean isConstraintsValidationSucceed(Either<Boolean, ResponseFormat> constraintValidatorResponse,
+ Wrapper<ResponseFormat> errorWrapper,
+ OperationDataDefinition updatedOperationDataDefinition) {
+ if (constraintValidatorResponse.isRight()) {
+ ResponseFormat responseFormat = constraintValidatorResponse.right().value();
+ LOGGER.error("Failed constraints validation on inputs for interface operation: {} - {}",
+ updatedOperationDataDefinition.getName(),
+ constraintValidatorResponse.right().value());
+ errorWrapper.setInnerElement(responseFormat);
+ return false;
+ }
+ return true;
+ }
+
public Optional<Component> updateResourceInterfaceOperation(final String componentId,
final String user,
final InterfaceDefinition interfaceDefinition,
@@ -209,14 +276,14 @@ public class ComponentInterfaceOperationBusinessLogic extends BaseBusinessLogic
boolean wasLocked = false;
try {
if (shouldLock) {
- lockComponent(componentId, component, "Update Interface Operation on Component instance");
+ lockComponent(componentId, component, UPDATE_INTERFACE_OPERATION_ON_COMPONENT_INSTANCE);
wasLocked = true;
}
final StorageOperationStatus status = toscaOperationFacade.updateComponentInterfaces(component, interfaceDefinitionType);
if (status != StorageOperationStatus.OK) {
janusGraphDao.rollback();
responseFormat = componentsUtils.getResponseFormat(ActionStatus.GENERAL_ERROR);
- LOGGER.error("Exception occurred when updating Component Instance Interfaces {}", responseFormat);
+ LOGGER.error(EXCEPTION_OCCURRED_WHEN_UPDATING_COMPONENT_INSTANCE_INTERFACES, responseFormat);
errorWrapper.setInnerElement(responseFormat);
return Optional.empty();
}
@@ -287,7 +354,7 @@ public class ComponentInterfaceOperationBusinessLogic extends BaseBusinessLogic
boolean wasLocked = false;
try {
if (shouldLock) {
- lockComponent(componentId, component, "Update Interface Operation on Component instance");
+ lockComponent(componentId, component, UPDATE_INTERFACE_OPERATION_ON_COMPONENT_INSTANCE);
wasLocked = true;
}
final Either<InterfaceDefinition, StorageOperationStatus> operationStatusEither =
@@ -295,7 +362,7 @@ public class ComponentInterfaceOperationBusinessLogic extends BaseBusinessLogic
if (operationStatusEither.isRight()) {
janusGraphDao.rollback();
responseFormat = componentsUtils.getResponseFormat(ActionStatus.GENERAL_ERROR);
- LOGGER.error("Exception occurred when updating Component Instance Interfaces {}", responseFormat);
+ LOGGER.error(EXCEPTION_OCCURRED_WHEN_UPDATING_COMPONENT_INSTANCE_INTERFACES, responseFormat);
errorWrapper.setInnerElement(responseFormat);
return Optional.empty();
}
@@ -329,4 +396,61 @@ public class ComponentInterfaceOperationBusinessLogic extends BaseBusinessLogic
artifactInfo.setArtifactName(String.format("'%s'", updatedOperationDataDefinition.getImplementation().getArtifactName()));
updatedOperationDataDefinition.setImplementation(artifactInfo);
}
+
+ private List<PropertyDefinition> convertOperationInputsToPropertyDefinitions(final OperationDataDefinition operationDataDefinition) {
+ List<PropertyDefinition> propertyDefinitions = new ArrayList<>();
+ ListDataDefinition<OperationInputDefinition> inputsDefinitionListData = operationDataDefinition.getInputs();
+ if (null != inputsDefinitionListData && !inputsDefinitionListData.isEmpty()) {
+ List<OperationInputDefinition> inputDefinitionList =
+ inputsDefinitionListData.getListToscaDataDefinition();
+ for (OperationInputDefinition operationInputDefinition : inputDefinitionList) {
+ PropertyDefinition propertyDefinition = new PropertyDefinition();
+ propertyDefinition.setValue(operationInputDefinition.getValue());
+ propertyDefinition.setType(operationInputDefinition.getType());
+ propertyDefinition.setName(operationInputDefinition.getName());
+ propertyDefinition.setDefaultValue(operationInputDefinition.getDefaultValue());
+ propertyDefinition.setInputPath(operationInputDefinition.getInputPath());
+ propertyDefinitions.add(propertyDefinition);
+ }
+ }
+ return propertyDefinitions;
+ }
+
+ private List<PropertyDefinition> convertOperationArtifactPropsToPropertyDefinitions(final OperationDataDefinition operationDataDefinition,
+ final String model) {
+ List<PropertyDefinition> artifactPropertiesToValidateCollection = new ArrayList<>();
+ final ArtifactDataDefinition artifactDataDefinition = operationDataDefinition.getImplementation();
+ if (null != artifactDataDefinition) {
+ final String artifactType = artifactDataDefinition.getArtifactType();
+ final String uniqueId = UniqueIdBuilder.buildArtifactTypeUid(model, artifactType);
+ ArtifactTypeDefinition retrievedArtifact = artifactTypeBusinessLogic.getArtifactTypeByUid(uniqueId);
+ if (retrievedArtifact != null) {
+ List<PropertyDataDefinition> artifactPropertiesList = artifactDataDefinition.getProperties();
+ if (null != artifactPropertiesList && !artifactPropertiesList.isEmpty()) {
+ for (PropertyDataDefinition propertyDataDefinition : artifactPropertiesList) {
+ PropertyDefinition propertyDefinition = new PropertyDefinition();
+ propertyDefinition.setConstraints(deserializePropertyConstraints(propertyDataDefinition.getPropertyConstraints()));
+ propertyDefinition.setValue(propertyDataDefinition.getValue());
+ propertyDefinition.setType(propertyDataDefinition.getType());
+ propertyDefinition.setName(propertyDataDefinition.getName());
+ propertyDefinition.setDefaultValue(propertyDataDefinition.getDefaultValue());
+ propertyDefinition.setInputPath(propertyDataDefinition.getInputPath());
+ artifactPropertiesToValidateCollection.add(propertyDefinition);
+ }
+ }
+ }
+ }
+ return artifactPropertiesToValidateCollection;
+ }
+
+ private List<PropertyConstraint> deserializePropertyConstraints(List<String> constraints) {
+ if (CollectionUtils.isNotEmpty(constraints)) {
+ Type constraintType = new TypeToken<PropertyConstraint>() {
+ }.getType();
+ Gson gson = new GsonBuilder().registerTypeAdapter(constraintType, new PropertyOperation.PropertyConstraintDeserialiser()).create();
+ return constraints.stream().map(c -> (PropertyConstraint) gson.fromJson(c, constraintType)).collect(
+ Collectors.toList());
+ }
+ return null;
+ }
}
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/datamodel/utils/PropertyValueConstraintValidationUtil.java b/catalog-be/src/main/java/org/openecomp/sdc/be/datamodel/utils/PropertyValueConstraintValidationUtil.java
index 4b8d88fa79..37b86db3cf 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/datamodel/utils/PropertyValueConstraintValidationUtil.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/datamodel/utils/PropertyValueConstraintValidationUtil.java
@@ -104,13 +104,15 @@ public class PropertyValueConstraintValidationUtil {
propertyDefinition = getPropertyDefinitionObjectFromInputs(propertyDefinition);
}
if (propertyDefinition != null) {
+ List<PropertyConstraint> propertyConstraints =
+ dataTypeDefinitionCache.get(propertyDefinition.getType()).safeGetConstraints();
if (ToscaType.isPrimitiveType(propertyDefinition.getType())) {
propertyDefinition.setConstraints(org.openecomp.sdc.be.dao.utils.CollectionUtils.merge(propertyDefinition.safeGetConstraints(),
- dataTypeDefinitionCache.get(propertyDefinition.getType()).safeGetConstraints()));
+ propertyConstraints.isEmpty() ? new ArrayList<>() : propertyConstraints));
evaluateConstraintsOnProperty(propertyDefinition);
} else if (ToscaType.isCollectionType(propertyDefinition.getType())) {
propertyDefinition.setConstraints(org.openecomp.sdc.be.dao.utils.CollectionUtils.merge(propertyDefinition.safeGetConstraints(),
- dataTypeDefinitionCache.get(propertyDefinition.getType()).safeGetConstraints()));
+ propertyConstraints.isEmpty() ? new ArrayList<>() : propertyConstraints));
evaluateConstraintsOnProperty(propertyDefinition);
evaluateCollectionTypeProperties(propertyDefinition);
} else {
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/TypesFetchServlet.java b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/TypesFetchServlet.java
index 953fcda1bf..7709721e61 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/TypesFetchServlet.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/TypesFetchServlet.java
@@ -45,6 +45,7 @@ import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import org.apache.commons.collections4.ListUtils;
+import org.openecomp.sdc.be.components.impl.ArtifactTypeBusinessLogic;
import org.openecomp.sdc.be.components.impl.ArtifactsBusinessLogic;
import org.openecomp.sdc.be.components.impl.CapabilitiesBusinessLogic;
import org.openecomp.sdc.be.components.impl.ComponentBusinessLogic;
@@ -91,7 +92,7 @@ public class TypesFetchServlet extends AbstractValidationsServlet {
private final CapabilitiesBusinessLogic capabilitiesBusinessLogic;
private final InterfaceOperationBusinessLogic interfaceOperationBusinessLogic;
private final ResourceBusinessLogic resourceBusinessLogic;
- private final ArtifactsBusinessLogic artifactsBusinessLogic;
+ private final ArtifactTypeBusinessLogic artifactTypeBusinessLogic;
@Inject
public TypesFetchServlet(
@@ -103,7 +104,7 @@ public class TypesFetchServlet extends AbstractValidationsServlet {
CapabilitiesBusinessLogic capabilitiesBusinessLogic,
InterfaceOperationBusinessLogic interfaceOperationBusinessLogic,
ResourceBusinessLogic resourceBusinessLogic,
- ArtifactsBusinessLogic artifactsBusinessLogic
+ ArtifactTypeBusinessLogic artifactTypeBusinessLogic
) {
super(
componentInstanceBL,
@@ -115,7 +116,7 @@ public class TypesFetchServlet extends AbstractValidationsServlet {
this.capabilitiesBusinessLogic = capabilitiesBusinessLogic;
this.interfaceOperationBusinessLogic = interfaceOperationBusinessLogic;
this.resourceBusinessLogic = resourceBusinessLogic;
- this.artifactsBusinessLogic = artifactsBusinessLogic;
+ this.artifactTypeBusinessLogic = artifactTypeBusinessLogic;
}
@GET
@@ -338,7 +339,7 @@ public class TypesFetchServlet extends AbstractValidationsServlet {
public Response getAllToscaArtifactTypes(@Parameter(description = "Model name") @QueryParam("model") String model,
@Context final HttpServletRequest request, @HeaderParam(Constants.USER_ID_HEADER) String creator) {
try {
- return buildOkResponse(getComponentsUtils().getResponseFormat(ActionStatus.OK), artifactsBusinessLogic.getAllToscaArtifacts(model));
+ return buildOkResponse(getComponentsUtils().getResponseFormat(ActionStatus.OK), artifactTypeBusinessLogic.getAllToscaArtifactTypes(model));
} catch (final BusinessException e) {
throw e;
} catch (final Exception e) {