diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphMapper.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphMapper.java index dae5752a15..c77a147751 100644 --- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphMapper.java +++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphMapper.java @@ -162,6 +162,7 @@ public class EntityGraphMapper { private static final String TYPE_CATEGORY = "AtlasGlossaryCategory"; private static final String TYPE_TERM = "AtlasGlossaryTerm"; private static final String TYPE_PRODUCT = "DataProduct"; + private static final String TYPE_DOMAIN = "DataDomain"; private static final String TYPE_PROCESS = "Process"; private static final String ATTR_MEANINGS = "meanings"; private static final String ATTR_ANCHOR = "anchor"; @@ -199,6 +200,9 @@ public class EntityGraphMapper { private final IFullTextMapper fullTextMapperV2; private final TaskManagement taskManagement; private final TransactionInterceptHelper transactionInterceptHelper; + private final EntityGraphRetriever retrieverNoRelation; + + private static final Set excludedTypes = new HashSet<>(Arrays.asList(TYPE_GLOSSARY, TYPE_CATEGORY, TYPE_TERM, TYPE_PRODUCT, TYPE_DOMAIN)); @Inject public EntityGraphMapper(DeleteHandlerDelegate deleteDelegate, RestoreHandlerV1 restoreHandlerV1, AtlasTypeRegistry typeRegistry, AtlasGraph graph, @@ -214,6 +218,7 @@ public EntityGraphMapper(DeleteHandlerDelegate deleteDelegate, RestoreHandlerV1 this.entityChangeNotifier = entityChangeNotifier; this.instanceConverter = instanceConverter; this.entityRetriever = new EntityGraphRetriever(graph, typeRegistry); + this.retrieverNoRelation = new EntityGraphRetriever(graph, typeRegistry, true); this.fullTextMapperV2 = fullTextMapperV2; this.taskManagement = taskManagement; this.transactionInterceptHelper = transactionInterceptHelper; @@ -4960,7 +4965,6 @@ public List unlinkBusinessPolicy(String policyId, Set unlin public List linkMeshEntityToAssets(String meshEntityId, Set linkGuids) throws AtlasBaseException { List linkedVertices = new ArrayList<>(); - Set excludedTypes = new HashSet<>(Arrays.asList(TYPE_GLOSSARY, TYPE_CATEGORY, TYPE_TERM, TYPE_PRODUCT)); for (String guid : linkGuids) { AtlasVertex ev = findByGuid(graph, guid); @@ -4968,6 +4972,7 @@ public List linkMeshEntityToAssets(String meshEntityId, Set if (ev != null) { String typeName = ev.getProperty(TYPE_NAME_PROPERTY_KEY, String.class); if (excludedTypes.contains(typeName)){ + LOG.warn("Type {} is not allowed to link with mesh entity", typeName); continue; } Set existingValues = ev.getMultiValuedSetProperty(DOMAIN_GUIDS_ATTR, String.class); @@ -4993,7 +4998,6 @@ public List linkMeshEntityToAssets(String meshEntityId, Set public List unlinkMeshEntityFromAssets(String meshEntityId, Set unlinkGuids) throws AtlasBaseException { List unlinkedVertices = new ArrayList<>(); - Set excludedTypes = new HashSet<>(Arrays.asList(TYPE_GLOSSARY, TYPE_CATEGORY, TYPE_TERM, TYPE_PRODUCT)); for (String guid : unlinkGuids) { AtlasVertex ev = AtlasGraphUtilsV2.findByGuid(graph, guid); @@ -5001,6 +5005,7 @@ public List unlinkMeshEntityFromAssets(String meshEntityId, Set UPDATE + READ AtlasAuthorizationUtils.verifyAccess(new AtlasEntityAccessRequest(typeRegistry, AtlasPrivilege.ENTITY_UPDATE, sourceEntity),