diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/preprocessor/AssetPreProcessor.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/preprocessor/AssetPreProcessor.java index 9655a59c00..35c612813b 100644 --- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/preprocessor/AssetPreProcessor.java +++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/preprocessor/AssetPreProcessor.java @@ -82,12 +82,17 @@ private void processDomainLinkAttribute(AtlasEntity entity) throws AtlasBaseExce private void validateDomainAssetLinks(AtlasEntity entity) throws AtlasBaseException { List domainGuids = ( List) entity.getAttribute(DOMAIN_GUIDS); + Set excludedTypes = new HashSet<>(Arrays.asList(ATLAS_GLOSSARY_ENTITY_TYPE, ATLAS_GLOSSARY_TERM_ENTITY_TYPE, ATLAS_GLOSSARY_CATEGORY_ENTITY_TYPE, DATA_PRODUCT_ENTITY_TYPE, DATA_DOMAIN_ENTITY_TYPE)); if(CollectionUtils.isNotEmpty(domainGuids)){ if(domainGuids.size() > 1) { throw new AtlasBaseException(AtlasErrorCode.INVALID_PARAMETERS, "Asset can be linked to only one domain"); } + if (excludedTypes.contains(entity.getTypeName())) { + throw new AtlasBaseException(AtlasErrorCode.INVALID_PARAMETERS, "Asset Type {} is not allowed to link with Domain", entity.getTypeName()); + } + for(String domainGuid : domainGuids) { AtlasVertex domainVertex = entityRetriever.getEntityVertex(domainGuid); if(domainVertex == null) {