diff options
author | vasraz <vasyl.razinkov@est.tech> | 2021-08-26 12:17:08 +0100 |
---|---|---|
committer | Vasyl Razinkov <vasyl.razinkov@est.tech> | 2021-08-26 20:22:26 +0000 |
commit | 4701612ba26c4b8c7c7e9fbfa38f582a4b74669f (patch) | |
tree | 8516c4cffec989c90bf31601454625a47d270bdb /catalog-be/src/main/java | |
parent | 69cb5577bc59f8b25b0b267f5ea5e37c6aa20dbd (diff) |
Add types to imports
Change-Id: Ifa1dea17841d8667044aff4e7a9a17b2a75b78e4
Signed-off-by: Vasyl Razinkov <vasyl.razinkov@est.tech>
Issue-ID: SDC-3684
Diffstat (limited to 'catalog-be/src/main/java')
9 files changed, 180 insertions, 109 deletions
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 04a8fc88db..c0188d79c3 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 @@ -25,6 +25,7 @@ import java.util.Map; import java.util.Optional; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.tuple.ImmutablePair; +import org.openecomp.sdc.be.components.impl.CommonImportManager.ElementTypeEnum; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.model.CapabilityTypeDefinition; import org.openecomp.sdc.be.model.Model; @@ -48,20 +49,30 @@ public class CapabilityTypeImportManager { private final ModelOperation modelOperation; @Autowired - public CapabilityTypeImportManager(CapabilityTypeOperation capabilityTypeOperation, CommonImportManager commonImportManager, ModelOperation modelOperation) { + public CapabilityTypeImportManager(CapabilityTypeOperation capabilityTypeOperation, CommonImportManager commonImportManager, + ModelOperation modelOperation) { this.capabilityTypeOperation = capabilityTypeOperation; this.commonImportManager = commonImportManager; this.modelOperation = modelOperation; } - public Either<List<ImmutablePair<CapabilityTypeDefinition, Boolean>>, ResponseFormat> createCapabilityTypes(final String capabilityTypesYml, final String modelName) { - return commonImportManager.createElementTypes(capabilityTypesYml, capabilityTypesFromYml -> createCapabilityTypesFromYml(capabilityTypesYml, modelName), this::upsertCapabilityTypesByDao, - CommonImportManager.ElementTypeEnum.CAPABILITY_TYPE); + public Either<List<ImmutablePair<CapabilityTypeDefinition, Boolean>>, ResponseFormat> createCapabilityTypes(final String capabilityTypesYml, + final String modelName, + final boolean includeToModelDefaultImports) { + final Either<List<ImmutablePair<CapabilityTypeDefinition, Boolean>>, ResponseFormat> elementTypes = commonImportManager.createElementTypes( + capabilityTypesYml, capabilityTypesFromYml -> createCapabilityTypesFromYml(capabilityTypesYml, modelName), + this::upsertCapabilityTypesByDao, ElementTypeEnum.CAPABILITY_TYPE); + if (includeToModelDefaultImports && StringUtils.isNotEmpty(modelName)) { + commonImportManager.addTypesToDefaultImports(capabilityTypesYml, modelName); + } + return elementTypes; } - private Either<List<CapabilityTypeDefinition>, ActionStatus> createCapabilityTypesFromYml(final String capabilityTypesYml, final String modelName) { - final Either<List<CapabilityTypeDefinition>, ActionStatus> capabilityTypes = commonImportManager.createElementTypesFromYml(capabilityTypesYml, this::createCapabilityType); - if (capabilityTypes.isLeft() && StringUtils.isNotEmpty(modelName)){ + private Either<List<CapabilityTypeDefinition>, ActionStatus> createCapabilityTypesFromYml(final String capabilityTypesYml, + final String modelName) { + final Either<List<CapabilityTypeDefinition>, ActionStatus> capabilityTypes = commonImportManager.createElementTypesFromYml(capabilityTypesYml, + this::createCapabilityType); + if (capabilityTypes.isLeft() && StringUtils.isNotEmpty(modelName)) { final Optional<Model> modelOptional = modelOperation.findModelByName(modelName); if (modelOptional.isPresent()) { capabilityTypes.left().value().forEach(capabilityType -> capabilityType.setModel(modelName)); @@ -75,7 +86,8 @@ public class CapabilityTypeImportManager { private Either<List<ImmutablePair<CapabilityTypeDefinition, Boolean>>, ResponseFormat> upsertCapabilityTypesByDao( List<CapabilityTypeDefinition> capabilityTypesToCreate) { return commonImportManager.createElementTypesByDao(capabilityTypesToCreate, capabilityType -> Either.left(ActionStatus.OK), - capabilityType -> new ImmutablePair<>(CommonImportManager.ElementTypeEnum.CAPABILITY_TYPE, UniqueIdBuilder.buildCapabilityTypeUid(capabilityType.getModel(), capabilityType.getType())), + capabilityType -> new ImmutablePair<>(CommonImportManager.ElementTypeEnum.CAPABILITY_TYPE, + UniqueIdBuilder.buildCapabilityTypeUid(capabilityType.getModel(), capabilityType.getType())), capabilityTypeOperation::getCapabilityType, capabilityTypeOperation::addCapabilityType, this::updateCapabilityType); } 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 9a77aad0b2..c0da9eb17b 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 @@ -51,6 +51,7 @@ import org.openecomp.sdc.be.model.PropertyDefinition; import org.openecomp.sdc.be.model.normatives.ToscaTypeMetadata; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.model.operations.api.TypeOperations; +import org.openecomp.sdc.be.model.operations.impl.ModelOperation; import org.openecomp.sdc.be.model.operations.impl.PropertyOperation; import org.openecomp.sdc.common.log.wrappers.Logger; import org.openecomp.sdc.exception.ResponseFormat; @@ -64,11 +65,15 @@ public class CommonImportManager { private static final Logger log = Logger.getLogger(CommonImportManager.class.getName()); private final ComponentsUtils componentsUtils; private final PropertyOperation propertyOperation; + private final ModelOperation modelOperation; @Autowired - public CommonImportManager(ComponentsUtils componentsUtils, PropertyOperation propertyOperation) { + public CommonImportManager(final ComponentsUtils componentsUtils, + final PropertyOperation propertyOperation, + final ModelOperation modelOperation) { this.componentsUtils = componentsUtils; this.propertyOperation = propertyOperation; + this.modelOperation = modelOperation; } public static void setProperties(Map<String, Object> toscaJson, Consumer<List<PropertyDefinition>> consumer) { @@ -529,6 +534,10 @@ public class CommonImportManager { } + public void addTypesToDefaultImports(final String typesYaml, final String modelName) { + modelOperation.addTypesToDefaultImports(typesYaml, modelName); + } + public enum ElementTypeEnum { POLICY_TYPE, GROUP_TYPE, DATA_TYPE, CAPABILITY_TYPE, INTERFACE_LIFECYCLE_TYPE, RELATIONSHIP_TYPE } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/DataTypeImportManager.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/DataTypeImportManager.java index 95ef74e93c..b24d81bcbc 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/DataTypeImportManager.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/DataTypeImportManager.java @@ -37,7 +37,6 @@ import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.DataTypeDefinition; import org.openecomp.sdc.be.model.Model; import org.openecomp.sdc.be.model.PropertyDefinition; -import org.openecomp.sdc.be.model.RelationshipTypeDefinition; import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.model.operations.impl.ModelOperation; import org.openecomp.sdc.be.model.operations.impl.PropertyOperation; @@ -61,14 +60,21 @@ public class DataTypeImportManager { @Resource private ModelOperation modelOperation; - public Either<List<ImmutablePair<DataTypeDefinition, Boolean>>, ResponseFormat> createDataTypes(final String dataTypeYml, final String modelName) { - return commonImportManager - .createElementTypes(dataTypeYml, dataTypesFromYml -> createDataTypesFromYml(dataTypeYml, modelName), this::createDataTypesByDao, ElementTypeEnum.DATA_TYPE); + public Either<List<ImmutablePair<DataTypeDefinition, Boolean>>, ResponseFormat> createDataTypes(final String dataTypeYml, final String modelName, + final boolean includeToModelDefaultImports) { + final var elementTypes = commonImportManager.createElementTypes( + dataTypeYml, dataTypesFromYml -> createDataTypesFromYml(dataTypeYml, modelName), this::createDataTypesByDao, ElementTypeEnum.DATA_TYPE); + + if (includeToModelDefaultImports && StringUtils.isNotEmpty(modelName)) { + commonImportManager.addTypesToDefaultImports(dataTypeYml, modelName); + } + return elementTypes; } - + private Either<List<DataTypeDefinition>, ActionStatus> createDataTypesFromYml(final String dataTypesYml, final String modelName) { - final Either<List<DataTypeDefinition>, ActionStatus> dataTypes = commonImportManager.createElementTypesFromYml(dataTypesYml, this::createDataType); - if (dataTypes.isLeft() && StringUtils.isNotEmpty(modelName)){ + final Either<List<DataTypeDefinition>, ActionStatus> dataTypes = commonImportManager.createElementTypesFromYml(dataTypesYml, + this::createDataType); + if (dataTypes.isLeft() && StringUtils.isNotEmpty(modelName)) { final Optional<Model> modelOptional = modelOperation.findModelByName(modelName); if (modelOptional.isPresent()) { dataTypes.left().value().forEach(dataType -> dataType.setModel(modelName)); @@ -83,7 +89,8 @@ public class DataTypeImportManager { List<DataTypeDefinition> dataTypesToCreate) { return commonImportManager.createElementTypesByDao(dataTypesToCreate, this::validateDataType, dataType -> new ImmutablePair<>(ElementTypeEnum.DATA_TYPE, UniqueIdBuilder.buildDataTypeUid(dataType.getModel(), dataType.getName())), - dataTypeUid -> propertyOperation.getDataTypeByUidWithoutDerived(dataTypeUid, true), dataType -> propertyOperation.addDataType(dataType), + dataTypeUid -> propertyOperation.getDataTypeByUidWithoutDerived(dataTypeUid, true), + dataType -> propertyOperation.addDataType(dataType), (newDataType, oldDataType) -> propertyOperation.updateDataType(newDataType, oldDataType)); } @@ -136,7 +143,8 @@ public class DataTypeImportManager { } String derivedDataType = dataType.getDerivedFromName(); if (derivedDataType != null) { - Either<DataTypeDefinition, StorageOperationStatus> derivedDataTypeByName = propertyOperation.getDataTypeByName(derivedDataType, dataType.getModel()); + Either<DataTypeDefinition, StorageOperationStatus> derivedDataTypeByName = propertyOperation.getDataTypeByName(derivedDataType, + dataType.getModel()); if (derivedDataTypeByName.isRight()) { StorageOperationStatus status = derivedDataTypeByName.right().value(); if (status == StorageOperationStatus.NOT_FOUND) { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/GroupTypeImportManager.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/GroupTypeImportManager.java index e57c46bbe6..e043bc2619 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/GroupTypeImportManager.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/GroupTypeImportManager.java @@ -69,13 +69,20 @@ public class GroupTypeImportManager { this.modelOperation = modelOperation; } - public Either<List<ImmutablePair<GroupTypeDefinition, Boolean>>, ResponseFormat> createGroupTypes(ToscaTypeImportData toscaTypeImportData, String modelName) { - return commonImportManager.createElementTypes(toscaTypeImportData, this::createGroupTypesFromYml, this::upsertGroupTypesByDao, modelName); + public Either<List<ImmutablePair<GroupTypeDefinition, Boolean>>, ResponseFormat> createGroupTypes(ToscaTypeImportData toscaTypeImportData, + String modelName, final boolean includeToModelDefaultImports) { + final Either<List<ImmutablePair<GroupTypeDefinition, Boolean>>, ResponseFormat> elementTypes = commonImportManager.createElementTypes( + toscaTypeImportData, this::createGroupTypesFromYml, this::upsertGroupTypesByDao, modelName); + if (includeToModelDefaultImports && StringUtils.isNotEmpty(modelName)) { + commonImportManager.addTypesToDefaultImports(toscaTypeImportData.getToscaTypesYml(), modelName); + } + return elementTypes; } private Either<List<GroupTypeDefinition>, ActionStatus> createGroupTypesFromYml(String groupTypesYml, String modelName) { - Either<List<GroupTypeDefinition>, ActionStatus> groupTypes = commonImportManager.createElementTypesFromYml(groupTypesYml, this::createGroupType); - if (groupTypes.isLeft() && StringUtils.isNotEmpty(modelName)){ + Either<List<GroupTypeDefinition>, ActionStatus> groupTypes = commonImportManager.createElementTypesFromYml(groupTypesYml, + this::createGroupType); + if (groupTypes.isLeft() && StringUtils.isNotEmpty(modelName)) { final Optional<Model> modelOptional = modelOperation.findModelByName(modelName); if (modelOptional.isPresent()) { groupTypes.left().value().forEach(groupType -> groupType.setModel(modelName)); @@ -90,7 +97,8 @@ public class GroupTypeImportManager { List<GroupTypeDefinition> groupTypesToCreate, String modelName) { return commonImportManager.createElementTypesWithVersionByDao(groupTypesToCreate, this::validateGroupType, groupType -> new ImmutablePair<>(ElementTypeEnum.GROUP_TYPE, UniqueIdBuilder.buildGroupTypeUid(groupType.getModel(), - groupType.getType(), groupType.getVersion(), NodeTypeEnum.GroupType.getName()).toLowerCase()), groupTypeOperation::getLatestGroupTypeByType, + groupType.getType(), groupType.getVersion(), NodeTypeEnum.GroupType.getName()).toLowerCase()), + groupTypeOperation::getLatestGroupTypeByType, groupTypeOperation::addGroupType, this::updateGroupType, modelName); } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/InterfaceLifecycleTypeImportManager.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/InterfaceLifecycleTypeImportManager.java index ef00d9a92d..5cc8985b90 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/InterfaceLifecycleTypeImportManager.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/InterfaceLifecycleTypeImportManager.java @@ -42,7 +42,6 @@ import org.openecomp.sdc.be.model.Operation; 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.ModelOperation; -import org.openecomp.sdc.be.model.operations.impl.UniqueIdBuilder; import org.openecomp.sdc.be.utils.TypeUtils.ToscaTagNamesEnum; import org.openecomp.sdc.common.log.wrappers.Logger; import org.openecomp.sdc.exception.ResponseFormat; @@ -63,14 +62,19 @@ public class InterfaceLifecycleTypeImportManager { @Resource private ModelOperation modelOperation; - public Either<List<InterfaceDefinition>, ResponseFormat> createLifecycleTypes(String interfaceLifecycleTypesYml, final String modelName) { + public Either<List<InterfaceDefinition>, ResponseFormat> createLifecycleTypes(String interfaceLifecycleTypesYml, final String modelName, + final boolean includeToModelDefaultImports) { Either<List<InterfaceDefinition>, ActionStatus> interfaces = createInterfaceTypeFromYml(interfaceLifecycleTypesYml, modelName); if (interfaces.isRight()) { ActionStatus status = interfaces.right().value(); ResponseFormat responseFormat = componentsUtils.getResponseFormatByGroupType(status, null); return Either.right(responseFormat); } - return createInterfacesByDao(interfaces.left().value()); + final Either<List<InterfaceDefinition>, ResponseFormat> elementTypes = createInterfacesByDao(interfaces.left().value()); + if (includeToModelDefaultImports && StringUtils.isNotEmpty(modelName)) { + commonImportManager.addTypesToDefaultImports(interfaceLifecycleTypesYml, modelName); + } + return elementTypes; } private Either<List<InterfaceDefinition>, ActionStatus> createInterfaceTypeFromYml(final String interfaceTypesYml, final String modelName) { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ModelBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ModelBusinessLogic.java index 99349395b9..1d34f39b74 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ModelBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ModelBusinessLogic.java @@ -50,10 +50,10 @@ public class ModelBusinessLogic { this.modelOperation = modelOperation; this.dataTypeImportManager = dataTypeImportManager; } - + public Model createModel(final Model model, final String datatypesYaml) { createModel(model); - dataTypeImportManager.createDataTypes(datatypesYaml, model.getName()); + dataTypeImportManager.createDataTypes(datatypesYaml, model.getName(), false); return model; } @@ -119,4 +119,4 @@ public class ModelBusinessLogic { throw ModelOperationExceptionSupplier.couldNotReadImports().get(); } } -}
\ No newline at end of file +} diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/PolicyTypeImportManager.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/PolicyTypeImportManager.java index a3a2c013eb..54d57800be 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/PolicyTypeImportManager.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/PolicyTypeImportManager.java @@ -69,13 +69,21 @@ public class PolicyTypeImportManager { this.modelOperation = modelOperation; } - public Either<List<ImmutablePair<PolicyTypeDefinition, Boolean>>, ResponseFormat> createPolicyTypes(ToscaTypeImportData toscaTypeImportData, String modelName) { - return commonImportManager.createElementTypes(toscaTypeImportData, this::createPolicyTypesFromYml, this::upsertPolicyTypesByDao, modelName); + public Either<List<ImmutablePair<PolicyTypeDefinition, Boolean>>, ResponseFormat> createPolicyTypes(final ToscaTypeImportData toscaTypeImportData, + final String modelName, + final boolean includeToModelDefaultImports) { + final Either<List<ImmutablePair<PolicyTypeDefinition, Boolean>>, ResponseFormat> elementTypes = commonImportManager.createElementTypes( + toscaTypeImportData, this::createPolicyTypesFromYml, this::upsertPolicyTypesByDao, modelName); + if (includeToModelDefaultImports && StringUtils.isNotEmpty(modelName)) { + commonImportManager.addTypesToDefaultImports(toscaTypeImportData.getToscaTypesYml(), modelName); + } + return elementTypes; } private Either<List<PolicyTypeDefinition>, ActionStatus> createPolicyTypesFromYml(String policyTypesYml, String modelName) { - Either<List<PolicyTypeDefinition>, ActionStatus> policyTypes = commonImportManager.createElementTypesFromYml(policyTypesYml, this::createPolicyType); - if (policyTypes.isLeft() && StringUtils.isNotEmpty(modelName)){ + Either<List<PolicyTypeDefinition>, ActionStatus> policyTypes = commonImportManager.createElementTypesFromYml(policyTypesYml, + this::createPolicyType); + if (policyTypes.isLeft() && StringUtils.isNotEmpty(modelName)) { final Optional<Model> modelOptional = modelOperation.findModelByName(modelName); if (modelOptional.isPresent()) { policyTypes.left().value().forEach(policyType -> policyType.setModel(modelName)); @@ -90,7 +98,8 @@ public class PolicyTypeImportManager { List<PolicyTypeDefinition> policyTypesToCreate, String modelName) { return commonImportManager.createElementTypesWithVersionByDao(policyTypesToCreate, this::validatePolicyType, policyType -> new ImmutablePair<>(ElementTypeEnum.POLICY_TYPE, UniqueIdBuilder.buildPolicyTypeUid(policyType.getModel(), - policyType.getType(), policyType.getVersion(), NodeTypeEnum.PolicyType.getName()).toLowerCase()), policyTypeOperation::getLatestPolicyTypeByType, + policyType.getType(), policyType.getVersion(), NodeTypeEnum.PolicyType.getName()).toLowerCase()), + policyTypeOperation::getLatestPolicyTypeByType, policyTypeOperation::addPolicyType, this::updatePolicyType, modelName); } 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 2165b9f7d1..564eb3a794 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 @@ -52,21 +52,31 @@ public class RelationshipTypeImportManager { this.modelOperation = modelOperation; } - public Either<List<ImmutablePair<RelationshipTypeDefinition, Boolean>>, ResponseFormat> createRelationshipTypes(final String relationshipYml, final String modelName) { - return createRelationshipTypes(relationshipYml, modelName, false); + public Either<List<ImmutablePair<RelationshipTypeDefinition, Boolean>>, ResponseFormat> createRelationshipTypes(final String relationshipYml, + final String modelName, + final boolean includeToModelDefaultImports) { + return createRelationshipTypes(relationshipYml, modelName, false, includeToModelDefaultImports); } private Either<List<ImmutablePair<RelationshipTypeDefinition, Boolean>>, ResponseFormat> createRelationshipTypes(final String relationshipTypeYml, - final String modelName, final boolean inTransaction) { - return commonImportManager + final String modelName, + final boolean inTransaction, + final boolean includeToModelDefaultImports) { + final Either<List<ImmutablePair<RelationshipTypeDefinition, Boolean>>, ResponseFormat> elementTypes = commonImportManager .createElementTypes(relationshipTypeYml, relationshipTypesFromYml -> createRelationshipTypesFromYml(relationshipTypeYml, modelName), relationshipTypesToCreate -> createRelationshipTypesByDao(relationshipTypesToCreate, inTransaction), ElementTypeEnum.RELATIONSHIP_TYPE); + if (includeToModelDefaultImports && StringUtils.isNotEmpty(modelName)) { + commonImportManager.addTypesToDefaultImports(relationshipTypeYml, modelName); + } + return elementTypes; } - private Either<List<RelationshipTypeDefinition>, ActionStatus> createRelationshipTypesFromYml(final String relationshipTypeYml, final String modelName) { - final Either<List<RelationshipTypeDefinition>, ActionStatus> relationshipTypes = commonImportManager.createElementTypesFromYml(relationshipTypeYml, this::createRelationshipType); - if (relationshipTypes.isLeft() && StringUtils.isNotEmpty(modelName)){ + private Either<List<RelationshipTypeDefinition>, ActionStatus> createRelationshipTypesFromYml(final String relationshipTypeYml, + final String modelName) { + final Either<List<RelationshipTypeDefinition>, ActionStatus> relationshipTypes = commonImportManager.createElementTypesFromYml( + relationshipTypeYml, this::createRelationshipType); + if (relationshipTypes.isLeft() && StringUtils.isNotEmpty(modelName)) { final Optional<Model> modelOptional = modelOperation.findModelByName(modelName); if (modelOptional.isPresent()) { relationshipTypes.left().value().forEach(relationshipType -> relationshipType.setModel(modelName)); @@ -80,7 +90,8 @@ public class RelationshipTypeImportManager { private Either<List<ImmutablePair<RelationshipTypeDefinition, Boolean>>, ResponseFormat> createRelationshipTypesByDao( List<RelationshipTypeDefinition> relationshipTypesToCreate, boolean inTransaction) { return commonImportManager.createElementTypesByDao(relationshipTypesToCreate, this::validateRelationshipType, - relationshipType -> new ImmutablePair<>(ElementTypeEnum.RELATIONSHIP_TYPE, UniqueIdBuilder.buildRelationshipTypeUid(relationshipType.getModel(), relationshipType.getType())), + relationshipType -> new ImmutablePair<>(ElementTypeEnum.RELATIONSHIP_TYPE, + UniqueIdBuilder.buildRelationshipTypeUid(relationshipType.getModel(), relationshipType.getType())), relationshipTypeUid -> relationshipTypeOperation.getRelationshipTypeByUid(relationshipTypeUid).right() .map(DaoStatusConverter::convertJanusGraphStatusToStorageStatus), relationshipType -> relationshipTypeOperation.addRelationshipType(relationshipType, inTransaction), diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/TypesUploadServlet.java b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/TypesUploadServlet.java index 79982eaa3a..b8917890d2 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/TypesUploadServlet.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/TypesUploadServlet.java @@ -29,9 +29,7 @@ import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.servers.Server; -import io.swagger.v3.oas.annotations.servers.Servers; import io.swagger.v3.oas.annotations.tags.Tag; -import io.swagger.v3.oas.annotations.tags.Tags; import java.io.File; import java.io.IOException; import java.util.List; @@ -66,6 +64,7 @@ import org.openecomp.sdc.be.components.impl.model.ToscaTypeImportData; import org.openecomp.sdc.be.config.BeEcompErrorManager; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; +import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.impl.ServletUtils; import org.openecomp.sdc.be.model.DataTypeDefinition; @@ -76,11 +75,10 @@ import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.be.model.normatives.ToscaTypeMetadata; import org.openecomp.sdc.be.user.UserBusinessLogic; import org.openecomp.sdc.common.api.Constants; -import org.openecomp.sdc.common.datastructure.FunctionalInterfaces.ConsumerThreeParam; +import org.openecomp.sdc.common.datastructure.FunctionalInterfaces.ConsumerFourParam; import org.openecomp.sdc.common.datastructure.FunctionalInterfaces.ConsumerTwoParam; import org.openecomp.sdc.common.datastructure.Wrapper; import org.openecomp.sdc.common.log.wrappers.Logger; -import org.openecomp.sdc.common.util.ValidationUtils; import org.openecomp.sdc.exception.ResponseFormat; import org.springframework.stereotype.Controller; @@ -88,12 +86,14 @@ import org.springframework.stereotype.Controller; @Path("/v1/catalog/uploadType") @Consumes(MediaType.MULTIPART_FORM_DATA) @Produces(MediaType.APPLICATION_JSON) -@Tags({@Tag(name = "SDCE-2 APIs")}) -@Servers({@Server(url = "/sdc2/rest")}) +@Tag(name = "SDCE-2 APIs") +@Server(url = "/sdc2/rest") @Controller public class TypesUploadServlet extends AbstractValidationsServlet { - public static final String CREATE = "Create "; + private static final String CREATE = "Create "; + private static final String START_HANDLE_REQUEST_OF = "Start handle request of {}"; + private static final String CREATE_FAILED_WITH_EXCEPTION = "create {} failed with exception:"; private static final Logger log = Logger.getLogger(TypesUploadServlet.class); private final CapabilityTypeImportManager capabilityTypeImportManager; private final InterfaceLifecycleTypeImportManager interfaceLifecycleTypeImportManager; @@ -132,11 +132,13 @@ public class TypesUploadServlet extends AbstractValidationsServlet { @PermissionAllowed(AafPermission.PermNames.INTERNAL_ALL_VALUE) public Response uploadCapabilityType(@Parameter(description = "FileInputStream") @FormDataParam("capabilityTypeZip") File file, @Context final HttpServletRequest request, @HeaderParam("USER_ID") String creator, - @Parameter(description = "model") @FormDataParam("model") String modelName) { - final String sanitizedModelName = ValidationUtils.sanitizeInputString(modelName); - ConsumerThreeParam<Wrapper<Response>, String, String> createElementsMethod = (responseWrapper, ymlPayload, model) -> createElementsType(responseWrapper, - () -> capabilityTypeImportManager.createCapabilityTypes(ymlPayload, sanitizedModelName)); - return uploadElementTypeServletLogic(createElementsMethod, file, request, creator, NodeTypeEnum.CapabilityType.name(), sanitizedModelName); + @Parameter(description = "model") @FormDataParam("model") String modelName, + @Parameter(description = "includeToModelImport") @FormDataParam("includeToModelImport") boolean includeToModelDefaultImports) { + ConsumerFourParam<Wrapper<Response>, String, String, Boolean> createElementsMethod = (responseWrapper, ymlPayload, model, includeToModelImport) -> + createElementsType(responseWrapper, () -> capabilityTypeImportManager.createCapabilityTypes(ymlPayload, modelName, + includeToModelDefaultImports)); + return uploadElementTypeServletLogic(createElementsMethod, file, request, creator, NodeTypeEnum.CapabilityType.name(), modelName, + includeToModelDefaultImports); } @POST @@ -150,9 +152,10 @@ public class TypesUploadServlet extends AbstractValidationsServlet { @PermissionAllowed(AafPermission.PermNames.INTERNAL_ALL_VALUE) public Response uploadRelationshipType(@Parameter(description = "FileInputStream") @FormDataParam("relationshipTypeZip") File file, @Context final HttpServletRequest request, @HeaderParam("USER_ID") String creator, - @Parameter(description = "model") @FormDataParam("model") String modelName) { - modelName = ValidationUtils.sanitizeInputString(modelName); - return uploadElementTypeServletLogic(this::createRelationshipTypes, file, request, creator, NodeTypeEnum.RelationshipType.getName(), modelName); + @Parameter(description = "model") @FormDataParam("model") String modelName, + @Parameter(description = "includeToModelImport") @FormDataParam("includeToModelImport") boolean includeToModelDefaultImports) { + return uploadElementTypeServletLogic( + this::createRelationshipTypes, file, request, creator, NodeTypeEnum.RelationshipType.getName(), modelName, includeToModelDefaultImports); } @POST @@ -166,10 +169,11 @@ public class TypesUploadServlet extends AbstractValidationsServlet { @PermissionAllowed(AafPermission.PermNames.INTERNAL_ALL_VALUE) public Response uploadInterfaceLifecycleType(@Parameter(description = "FileInputStream") @FormDataParam("interfaceLifecycleTypeZip") File file, @Context final HttpServletRequest request, @HeaderParam("USER_ID") String creator, - @Parameter(description = "model") @FormDataParam("model") String modelName) { - final String sanitizedModelName = ValidationUtils.sanitizeInputString(modelName); - ConsumerTwoParam<Wrapper<Response>, String> createElementsMethod = (responseWrapper, ymlPayload) -> createElementsType(responseWrapper, - () -> interfaceLifecycleTypeImportManager.createLifecycleTypes(ymlPayload, sanitizedModelName)); + @Parameter(description = "model") @FormDataParam("model") String modelName, + @Parameter(description = "includeToModelImport") @FormDataParam("includeToModelImport") boolean includeToModelDefaultImports) { + ConsumerTwoParam<Wrapper<Response>, String> createElementsMethod = (responseWrapper, ymlPayload) -> + createElementsType(responseWrapper, () -> interfaceLifecycleTypeImportManager.createLifecycleTypes(ymlPayload, modelName, + includeToModelDefaultImports)); return uploadElementTypeServletLogic(createElementsMethod, file, request, creator, "Interface Types"); } @@ -184,8 +188,8 @@ public class TypesUploadServlet extends AbstractValidationsServlet { @PermissionAllowed(AafPermission.PermNames.INTERNAL_ALL_VALUE) public Response uploadCategories(@Parameter(description = "FileInputStream") @FormDataParam("categoriesZip") File file, @Context final HttpServletRequest request, @HeaderParam("USER_ID") String creator) { - ConsumerTwoParam<Wrapper<Response>, String> createElementsMethod = (responseWrapper, ymlPayload) -> createElementsType(responseWrapper, - () -> categoriesImportManager.createCategories(ymlPayload)); + ConsumerTwoParam<Wrapper<Response>, String> createElementsMethod = (responseWrapper, ymlPayload) -> + createElementsType(responseWrapper, () -> categoriesImportManager.createCategories(ymlPayload)); return uploadElementTypeServletLogic(createElementsMethod, file, request, creator, "categories"); } @@ -200,9 +204,10 @@ public class TypesUploadServlet extends AbstractValidationsServlet { @PermissionAllowed(AafPermission.PermNames.INTERNAL_ALL_VALUE) public Response uploadDataTypes(@Parameter(description = "FileInputStream") @FormDataParam("dataTypesZip") File file, @Context final HttpServletRequest request, @HeaderParam("USER_ID") String creator, - @Parameter(description = "model") @FormDataParam("model") String modelName) { - modelName = ValidationUtils.sanitizeInputString(modelName); - return uploadElementTypeServletLogic(this::createDataTypes, file, request, creator, NodeTypeEnum.DataType.getName(), modelName); + @Parameter(description = "model") @FormDataParam("model") String modelName, + @Parameter(description = "includeToModelImport") @FormDataParam("includeToModelImport") boolean includeToModelDefaultImports) { + return uploadElementTypeServletLogic(this::createDataTypes, file, request, creator, NodeTypeEnum.DataType.getName(), modelName, + includeToModelDefaultImports); } @POST @@ -217,10 +222,11 @@ public class TypesUploadServlet extends AbstractValidationsServlet { public Response uploadGroupTypes(@Parameter(description = "toscaTypeMetadata") @FormDataParam("toscaTypeMetadata") String toscaTypesMetaData, @Parameter(description = "model") @FormDataParam("model") String modelName, @Parameter(description = "FileInputStream") @FormDataParam("groupTypesZip") File file, - @Context final HttpServletRequest request, @HeaderParam("USER_ID") String creator) { - modelName = ValidationUtils.sanitizeInputString(modelName); + @Context final HttpServletRequest request, @HeaderParam("USER_ID") String creator, + @Parameter(description = "includeToModelImport") @FormDataParam("includeToModelImport") boolean includeToModelDefaultImports) { Map<String, ToscaTypeMetadata> typesMetadata = getTypesMetadata(toscaTypesMetaData); - return uploadTypesWithMetaData(this::createGroupTypes, typesMetadata, file, request, creator, NodeTypeEnum.GroupType.getName(), modelName); + return uploadTypesWithMetaData(this::createGroupTypes, typesMetadata, file, request, creator, NodeTypeEnum.GroupType.getName(), modelName, + includeToModelDefaultImports); } @POST @@ -235,10 +241,11 @@ public class TypesUploadServlet extends AbstractValidationsServlet { public Response uploadPolicyTypes(@Parameter(description = "toscaTypeMetadata") @FormDataParam("toscaTypeMetadata") String toscaTypesMetaData, @Parameter(description = "model") @FormDataParam("model") String modelName, @Parameter(description = "FileInputStream") @FormDataParam("policyTypesZip") File file, - @Context final HttpServletRequest request, @HeaderParam("USER_ID") String creator) { - modelName = ValidationUtils.sanitizeInputString(modelName); + @Context final HttpServletRequest request, @HeaderParam("USER_ID") String creator, + @Parameter(description = "includeToModelImport") @FormDataParam("includeToModelImport") boolean includeToModelDefaultImports) { Map<String, ToscaTypeMetadata> typesMetadata = getTypesMetadata(toscaTypesMetaData); - return uploadTypesWithMetaData(this::createPolicyTypes, typesMetadata, file, request, creator, NodeTypeEnum.PolicyType.getName(), modelName); + return uploadTypesWithMetaData(this::createPolicyTypes, typesMetadata, file, request, creator, NodeTypeEnum.PolicyType.getName(), modelName, + includeToModelDefaultImports); } private Map<String, ToscaTypeMetadata> getTypesMetadata(String toscaTypesMetaData) { @@ -247,13 +254,13 @@ public class TypesUploadServlet extends AbstractValidationsServlet { } private Response uploadElementTypeServletLogic(ConsumerTwoParam<Wrapper<Response>, String> createElementsMethod, File file, - final HttpServletRequest request, String creator, String elementTypeName) { + final HttpServletRequest request, String creator, String elementTypeName) { init(); String userId = initHeaderParam(creator, request, Constants.USER_ID_HEADER); try { Wrapper<String> yamlStringWrapper = new Wrapper<>(); String url = request.getMethod() + " " + request.getRequestURI(); - log.debug("Start handle request of {}", url); + log.debug(START_HANDLE_REQUEST_OF, url); Wrapper<Response> responseWrapper = doUploadTypeValidations(request, userId, file); if (responseWrapper.isEmpty()) { fillZipContents(yamlStringWrapper, file); @@ -263,30 +270,31 @@ public class TypesUploadServlet extends AbstractValidationsServlet { } return responseWrapper.getInnerElement(); } catch (Exception e) { - log.debug("create {} failed with exception:", elementTypeName, e); + log.debug(CREATE_FAILED_WITH_EXCEPTION, elementTypeName, e); BeEcompErrorManager.getInstance().logBeRestApiGeneralError(CREATE + elementTypeName); return buildErrorResponse(getComponentsUtils().getResponseFormat(ActionStatus.GENERAL_ERROR)); } } - - private Response uploadElementTypeServletLogic(final ConsumerThreeParam<Wrapper<Response>, String, String> createElementsMethod, - final File file, final HttpServletRequest request, final String creator, final String elementTypeName, final String modelName) { + + private Response uploadElementTypeServletLogic(final ConsumerFourParam<Wrapper<Response>, String, String, Boolean> createElementsMethod, + final File file, final HttpServletRequest request, final String creator, + final String elementTypeName, final String modelName, final boolean includeToModelDefaultImports) { init(); final String userId = initHeaderParam(creator, request, Constants.USER_ID_HEADER); try { final Wrapper<String> yamlStringWrapper = new Wrapper<>(); final String url = request.getMethod() + " " + request.getRequestURI(); - log.debug("Start handle request of {}", url); + log.debug(START_HANDLE_REQUEST_OF, url); final Wrapper<Response> responseWrapper = doUploadTypeValidations(request, userId, file); if (responseWrapper.isEmpty()) { fillZipContents(yamlStringWrapper, file); } if (responseWrapper.isEmpty()) { - createElementsMethod.accept(responseWrapper, yamlStringWrapper.getInnerElement(), modelName); + createElementsMethod.accept(responseWrapper, yamlStringWrapper.getInnerElement(), modelName, includeToModelDefaultImports); } return responseWrapper.getInnerElement(); } catch (final Exception e) { - log.debug("create {} failed with exception:", elementTypeName, e); + log.debug(CREATE_FAILED_WITH_EXCEPTION, elementTypeName, e); BeEcompErrorManager.getInstance().logBeRestApiGeneralError(CREATE + elementTypeName); return buildErrorResponse(getComponentsUtils().getResponseFormat(ActionStatus.GENERAL_ERROR)); } @@ -296,7 +304,7 @@ public class TypesUploadServlet extends AbstractValidationsServlet { Wrapper<Response> responseWrapper = new Wrapper<>(); Wrapper<User> userWrapper = new Wrapper<>(); String url = request.getMethod() + " " + request.getRequestURI(); - log.debug("Start handle request of {}", url); + log.debug(START_HANDLE_REQUEST_OF, url); validateUserExist(responseWrapper, userWrapper, userId); if (responseWrapper.isEmpty()) { validateUserRole(responseWrapper, userWrapper.getInnerElement()); @@ -307,9 +315,9 @@ public class TypesUploadServlet extends AbstractValidationsServlet { return responseWrapper; } - private Response uploadTypesWithMetaData(ConsumerThreeParam<Wrapper<Response>, ToscaTypeImportData, String> createElementsMethod, + private Response uploadTypesWithMetaData(ConsumerFourParam<Wrapper<Response>, ToscaTypeImportData, String, Boolean> createElementsMethod, Map<String, ToscaTypeMetadata> typesMetaData, File file, final HttpServletRequest request, - String creator, String elementTypeName, String modelName) { + String creator, String elementTypeName, String modelName, final boolean includeToModelDefaultImports) { init(); String userId = initHeaderParam(creator, request, Constants.USER_ID_HEADER); Wrapper<String> yamlStringWrapper = new Wrapper<>(); @@ -320,11 +328,11 @@ public class TypesUploadServlet extends AbstractValidationsServlet { } if (responseWrapper.isEmpty()) { ToscaTypeImportData toscaTypeImportData = new ToscaTypeImportData(yamlStringWrapper.getInnerElement(), typesMetaData); - createElementsMethod.accept(responseWrapper, toscaTypeImportData, modelName); + createElementsMethod.accept(responseWrapper, toscaTypeImportData, modelName, includeToModelDefaultImports); } return responseWrapper.getInnerElement(); } catch (Exception e) { - log.debug("create {} failed with exception:", elementTypeName, e); + log.debug(CREATE_FAILED_WITH_EXCEPTION, elementTypeName, e); BeEcompErrorManager.getInstance().logBeRestApiGeneralError(CREATE + elementTypeName); return buildErrorResponse(getComponentsUtils().getResponseFormat(ActionStatus.GENERAL_ERROR)); } @@ -349,55 +357,54 @@ public class TypesUploadServlet extends AbstractValidationsServlet { } // data types - private void createDataTypes(Wrapper<Response> responseWrapper, String dataTypesYml, final String modelName) { - final Supplier<Either<List<ImmutablePair<DataTypeDefinition, Boolean>>, ResponseFormat>> generateElementTypeFromYml = () -> dataTypeImportManager - .createDataTypes(dataTypesYml, modelName); + private void createDataTypes(Wrapper<Response> responseWrapper, String dataTypesYml, final String modelName, final boolean includeToModelDefaultImports) { + final Supplier<Either<List<ImmutablePair<DataTypeDefinition, Boolean>>, ResponseFormat>> generateElementTypeFromYml = () -> + dataTypeImportManager.createDataTypes(dataTypesYml, modelName, includeToModelDefaultImports); buildStatusForElementTypeCreate(responseWrapper, generateElementTypeFromYml, ActionStatus.DATA_TYPE_ALREADY_EXIST, NodeTypeEnum.DataType.name()); } // group types - private void createGroupTypes(Wrapper<Response> responseWrapper, ToscaTypeImportData toscaTypeImportData, String modelName) { - final Supplier<Either<List<ImmutablePair<GroupTypeDefinition, Boolean>>, ResponseFormat>> generateElementTypeFromYml = () -> groupTypeImportManager - .createGroupTypes(toscaTypeImportData, modelName); + private void createGroupTypes(Wrapper<Response> responseWrapper, ToscaTypeImportData toscaTypeImportData, String modelName, + final boolean includeToModelDefaultImports) { + final Supplier<Either<List<ImmutablePair<GroupTypeDefinition, Boolean>>, ResponseFormat>> generateElementTypeFromYml = () -> + groupTypeImportManager.createGroupTypes(toscaTypeImportData, modelName, includeToModelDefaultImports); buildStatusForElementTypeCreate(responseWrapper, generateElementTypeFromYml, ActionStatus.GROUP_TYPE_ALREADY_EXIST, NodeTypeEnum.GroupType.name()); } // policy types - private void createPolicyTypes(Wrapper<Response> responseWrapper, ToscaTypeImportData toscaTypeImportData, String modelName) { - final Supplier<Either<List<ImmutablePair<PolicyTypeDefinition, Boolean>>, ResponseFormat>> generateElementTypeFromYml = () -> policyTypeImportManager - .createPolicyTypes(toscaTypeImportData, modelName); + private void createPolicyTypes(Wrapper<Response> responseWrapper, ToscaTypeImportData toscaTypeImportData, String modelName, + final boolean includeToModelDefaultImports) { + final Supplier<Either<List<ImmutablePair<PolicyTypeDefinition, Boolean>>, ResponseFormat>> generateElementTypeFromYml = () -> + policyTypeImportManager.createPolicyTypes(toscaTypeImportData, modelName, includeToModelDefaultImports); buildStatusForElementTypeCreate(responseWrapper, generateElementTypeFromYml, ActionStatus.POLICY_TYPE_ALREADY_EXIST, NodeTypeEnum.PolicyType.name()); } // data types - private <ElementTypeDefinition> void buildStatusForElementTypeCreate(Wrapper<Response> responseWrapper, - Supplier<Either<List<ImmutablePair<ElementTypeDefinition, Boolean>>, ResponseFormat>> generateElementTypeFromYml, - ActionStatus alreadyExistStatus, String elementTypeName) { - Either<List<ImmutablePair<ElementTypeDefinition, Boolean>>, ResponseFormat> eitherResult = generateElementTypeFromYml.get(); + private <T extends ToscaDataDefinition> void buildStatusForElementTypeCreate(Wrapper<Response> responseWrapper, + Supplier<Either<List<ImmutablePair<T, Boolean>>, ResponseFormat>> generateElementTypeFromYml, + ActionStatus alreadyExistStatus, String elementTypeName) { + Either<List<ImmutablePair<T, Boolean>>, ResponseFormat> eitherResult = generateElementTypeFromYml.get(); if (eitherResult.isRight()) { Response response = buildErrorResponse(eitherResult.right().value()); responseWrapper.setInnerElement(response); } else { Object representation; try { - List<ImmutablePair<ElementTypeDefinition, Boolean>> list = eitherResult.left().value(); + List<ImmutablePair<T, Boolean>> list = eitherResult.left().value(); ActionStatus status = ActionStatus.OK; if (list != null) { // Group result by the right value - true or false. - - // I.e., get the number of data types which are new and - - // which are old. - Map<Boolean, List<ImmutablePair<ElementTypeDefinition, Boolean>>> collect = list.stream() - .collect(Collectors.groupingBy(ImmutablePair<ElementTypeDefinition, Boolean>::getRight)); + // I.e., get the number of data types which are new and which are old. + Map<Boolean, List<ImmutablePair<T, Boolean>>> collect = list.stream() + .collect(Collectors.groupingBy(ImmutablePair<T, Boolean>::getRight)); if (collect != null) { Set<Boolean> keySet = collect.keySet(); if (keySet.size() == 1) { Boolean isNew = keySet.iterator().next(); - if (isNew) { + if (Boolean.TRUE.equals(isNew)) { // all data types created at the first time status = ActionStatus.CREATED; } else { @@ -420,9 +427,12 @@ public class TypesUploadServlet extends AbstractValidationsServlet { } // relationship types - private void createRelationshipTypes(final Wrapper<Response> responseWrapper, final String relationshipTypesYml, final String modelName) { + private void createRelationshipTypes(final Wrapper<Response> responseWrapper, + final String relationshipTypesYml, + final String modelName, + final boolean includeToModelDefaultImports) { final Supplier<Either<List<ImmutablePair<RelationshipTypeDefinition, Boolean>>, ResponseFormat>> generateElementTypeFromYml = () -> relationshipTypeImportManager - .createRelationshipTypes(relationshipTypesYml, modelName); + .createRelationshipTypes(relationshipTypesYml, modelName, includeToModelDefaultImports); buildStatusForElementTypeCreate(responseWrapper, generateElementTypeFromYml, ActionStatus.RELATIONSHIP_TYPE_ALREADY_EXIST, NodeTypeEnum.RelationshipType.name()); } |