From e3b229559b35a1cc87037411df1e641c138505f7 Mon Sep 17 00:00:00 2001 From: PRATHAM2002-DS Date: Fri, 15 Nov 2024 19:41:45 +0530 Subject: [PATCH 1/2] mesh-280: validation for dataProductAssetDSL attribute --- .../store/graph/v2/preprocessor/PreProcessorUtils.java | 1 + .../v2/preprocessor/datamesh/DataProductPreProcessor.java | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/preprocessor/PreProcessorUtils.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/preprocessor/PreProcessorUtils.java index e5171fde92..de42d0ae1a 100644 --- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/preprocessor/PreProcessorUtils.java +++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/preprocessor/PreProcessorUtils.java @@ -70,6 +70,7 @@ public class PreProcessorUtils { public static final String INPUT_PORT_GUIDS_ATTR = "daapInputPortGuids"; public static final String DAAP_STATUS_ATTR = "daapStatus"; public static final String DAAP_ARCHIVED_STATUS = "Archived"; + public static final String DAAP_ASSET_DSL_ATTR = "dataProductAssetsDSL"; //Migration Constants public static final String MIGRATION_TYPE_PREFIX = "MIGRATION:"; diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/preprocessor/datamesh/DataProductPreProcessor.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/preprocessor/datamesh/DataProductPreProcessor.java index d8aee05974..458a5c695f 100644 --- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/preprocessor/datamesh/DataProductPreProcessor.java +++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/preprocessor/datamesh/DataProductPreProcessor.java @@ -83,6 +83,10 @@ private void processCreateProduct(AtlasEntity entity,AtlasVertex vertex) throws entity.removeAttribute(OUTPUT_PORT_GUIDS_ATTR); entity.removeAttribute(INPUT_PORT_GUIDS_ATTR); + if(!entity.hasAttribute(DAAP_ASSET_DSL_ATTR) && entity.getAttribute(DAAP_ASSET_DSL_ATTR) == null){ + throw new AtlasBaseException(AtlasErrorCode.BAD_REQUEST, "DataProductAssetDSL attribute is mandatory for DataProduct creation"); + } + if (parentDomainObject == null) { throw new AtlasBaseException(OPERATION_NOT_SUPPORTED, "Cannot create a Product without a Domain Relationship"); } else { From d4c2f423d460647e90941fe8f806374b5b587a6f Mon Sep 17 00:00:00 2001 From: PRATHAM2002-DS Date: Thu, 21 Nov 2024 12:24:46 +0530 Subject: [PATCH 2/2] mesh-280: resolved error --- .../graph/v2/preprocessor/datamesh/DataProductPreProcessor.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/preprocessor/datamesh/DataProductPreProcessor.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/preprocessor/datamesh/DataProductPreProcessor.java index 458a5c695f..6d2a122217 100644 --- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/preprocessor/datamesh/DataProductPreProcessor.java +++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/preprocessor/datamesh/DataProductPreProcessor.java @@ -83,7 +83,7 @@ private void processCreateProduct(AtlasEntity entity,AtlasVertex vertex) throws entity.removeAttribute(OUTPUT_PORT_GUIDS_ATTR); entity.removeAttribute(INPUT_PORT_GUIDS_ATTR); - if(!entity.hasAttribute(DAAP_ASSET_DSL_ATTR) && entity.getAttribute(DAAP_ASSET_DSL_ATTR) == null){ + if(!entity.hasAttribute(DAAP_ASSET_DSL_ATTR) || entity.getAttribute(DAAP_ASSET_DSL_ATTR) == null){ throw new AtlasBaseException(AtlasErrorCode.BAD_REQUEST, "DataProductAssetDSL attribute is mandatory for DataProduct creation"); }