From 092b32fa67275b56879c8d879ee0b5fc369f9761 Mon Sep 17 00:00:00 2001 From: MichaelMorris Date: Fri, 3 Feb 2023 16:48:46 +0000 Subject: Dont add to additional_types on import failure Signed-off-by: MichaelMorris Issue-ID: SDC-4369 Change-Id: Iaf4a03293ecdb097981bde126aa7376ba237f20d --- .../openecomp/sdc/be/components/impl/CapabilityTypeImportManager.java | 2 +- .../org/openecomp/sdc/be/components/impl/DataTypeImportManager.java | 4 ++-- .../org/openecomp/sdc/be/components/impl/GroupTypeImportManager.java | 2 +- .../org/openecomp/sdc/be/components/impl/PolicyTypeImportManager.java | 2 +- .../sdc/be/components/impl/RelationshipTypeImportManager.java | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) (limited to 'catalog-be/src/main/java') 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 48b9c58d93..f44b018354 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 @@ -62,7 +62,7 @@ public class CapabilityTypeImportManager { final Either>, ResponseFormat> elementTypes = commonImportManager.createElementTypes( capabilityTypesYml, capabilityTypesFromYml -> createCapabilityTypesFromYml(capabilityTypesYml, modelName), this::upsertCapabilityTypesByDao, ElementTypeEnum.CAPABILITY_TYPE); - if (includeToModelDefaultImports && StringUtils.isNotEmpty(modelName)) { + if (elementTypes.isLeft() && includeToModelDefaultImports && StringUtils.isNotEmpty(modelName)) { commonImportManager.addTypesToDefaultImports(ElementTypeEnum.CAPABILITY_TYPE, capabilityTypesYml, modelName); } return elementTypes; 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 3ebd0bee5b..b14bee9233 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 @@ -68,10 +68,10 @@ public class DataTypeImportManager { final Either>, ResponseFormat> elementTypes = commonImportManager.createElementTypes( dataTypeYml, dataTypesFromYml -> createDataTypesFromYml(dataTypeYml, modelName, !includeToModelDefaultImports), this::createDataTypesByDao, ElementTypeEnum.DATA_TYPE); - if (includeToModelDefaultImports && StringUtils.isNotEmpty(modelName)) { + if (elementTypes.isLeft() && includeToModelDefaultImports && StringUtils.isNotEmpty(modelName)) { commonImportManager.addTypesToDefaultImports(ElementTypeEnum.DATA_TYPE, dataTypeYml, modelName); } - if (!includeToModelDefaultImports && StringUtils.isNotEmpty(modelName) && elementTypes.isLeft()) { + if (elementTypes.isLeft() && !includeToModelDefaultImports && StringUtils.isNotEmpty(modelName)) { commonImportManager.updateTypesInAdditionalTypesImport(ElementTypeEnum.DATA_TYPE, dataTypeYml, modelName); } return elementTypes; 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 7ed833ac1d..890647f3c1 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 @@ -76,7 +76,7 @@ public class GroupTypeImportManager { final boolean includeToModelDefaultImports) { final Either>, ResponseFormat> elementTypes = commonImportManager.createElementTypes( toscaTypeImportData, this::createGroupTypesFromYml, this::upsertGroupTypesByDao, modelName); - if (includeToModelDefaultImports && StringUtils.isNotEmpty(modelName)) { + if (elementTypes.isLeft() && includeToModelDefaultImports && StringUtils.isNotEmpty(modelName)) { commonImportManager.addTypesToDefaultImports(ElementTypeEnum.GROUP_TYPE, toscaTypeImportData.getToscaTypesYml(), modelName); } return elementTypes; 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 be34cce3e4..8c5f9ce8d6 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 @@ -74,7 +74,7 @@ public class PolicyTypeImportManager { final boolean includeToModelDefaultImports) { final Either>, ResponseFormat> elementTypes = commonImportManager.createElementTypes( toscaTypeImportData, this::createPolicyTypesFromYml, this::upsertPolicyTypesByDao, modelName); - if (includeToModelDefaultImports && StringUtils.isNotEmpty(modelName)) { + if (elementTypes.isLeft() && includeToModelDefaultImports && StringUtils.isNotEmpty(modelName)) { commonImportManager.addTypesToDefaultImports(ElementTypeEnum.POLICY_TYPE, toscaTypeImportData.getToscaTypesYml(), modelName); } return elementTypes; 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 1bd19143c6..06eb86cc67 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 @@ -66,7 +66,7 @@ public class RelationshipTypeImportManager { .createElementTypes(relationshipTypeYml, relationshipTypesFromYml -> createRelationshipTypesFromYml(relationshipTypeYml, modelName), relationshipTypesToCreate -> createRelationshipTypesByDao(relationshipTypesToCreate, inTransaction), ElementTypeEnum.RELATIONSHIP_TYPE); - if (includeToModelDefaultImports && StringUtils.isNotEmpty(modelName)) { + if (elementTypes.isLeft() && includeToModelDefaultImports && StringUtils.isNotEmpty(modelName)) { commonImportManager.addTypesToDefaultImports(ElementTypeEnum.RELATIONSHIP_TYPE, relationshipTypeYml, modelName); } return elementTypes; -- cgit 1.2.3-korg