Skip to content

Commit

Permalink
Merge pull request #4414 from atlanhq/mesh-363-execution
Browse files Browse the repository at this point in the history
MESH-365 : Execution API for Business Lineage
  • Loading branch information
PRATHAM2002-DS authored Mar 10, 2025
2 parents b0a9517 + 8f87000 commit b0d01ff
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,7 @@ public class BusinessLineageService implements AtlasBusinessLineageService {
private static final String TYPE_DOMAIN = "DataDomain";

private final AtlasGraph graph;
private final AtlasGremlinQueryProvider gremlinQueryProvider;
private final EntityGraphRetriever entityRetriever;
private final AtlasTypeRegistry atlasTypeRegistry;
private final TransactionInterceptHelper transactionInterceptHelper;
private final GraphHelper graphHelper;
private final AtlasRelationshipStoreV2 relationshipStoreV2;
Expand All @@ -75,9 +73,7 @@ public class BusinessLineageService implements AtlasBusinessLineageService {
@Inject
BusinessLineageService(AtlasTypeRegistry typeRegistry, AtlasGraph atlasGraph, TransactionInterceptHelper transactionInterceptHelper, AtlasRelationshipStoreV2 relationshipStoreV2, IAtlasMinimalChangeNotifier atlasAlternateChangeNotifier) {
this.graph = atlasGraph;
this.gremlinQueryProvider = AtlasGremlinQueryProvider.INSTANCE;
this.entityRetriever = new EntityGraphRetriever(atlasGraph, typeRegistry);
this.atlasTypeRegistry = typeRegistry;
this.transactionInterceptHelper = transactionInterceptHelper;
this.graphHelper = new GraphHelper(atlasGraph);
this.relationshipStoreV2 = relationshipStoreV2;
Expand Down Expand Up @@ -237,7 +233,7 @@ public void addInputRelation(AtlasVertex assetVertex, AtlasVertex productVertex,
if(!daapOutputPortGuids.contains(assetGuid) && !daapInputPortGuids.contains(assetGuid)){
AtlasRelationship relationship = new AtlasRelationship();
relationship.setTypeName(REL_DATA_PRODUCT_TO_INPUT_PORTS);
AtlasEdge newInputPortEdge = relationshipStoreV2.getOrCreate(assetVertex, productVertex, relationship, true);
relationshipStoreV2.getOrCreate(assetVertex, productVertex, relationship, true);
LOG.info("Added input relation between asset and product");
}
updateInternalAttr(productVertex, assetGuid, operation);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ public AtlasEdge getOrCreate(AtlasVertex end1Vertex, AtlasVertex end2Vertex, Atl
AtlasEdge ret = getRelationship(end1Vertex, end2Vertex, relationship);

if (ret == null) {
ret = createRelationship(end1Vertex, end2Vertex, relationship, false, false);
ret = createRelationship(end1Vertex, end2Vertex, relationship, false, skipAuth);
recordRelationshipMutation(RelationshipMutation.RELATIONSHIP_CREATE, ret, entityRetriever);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.apache.atlas.web.rest;

import org.apache.atlas.AtlasErrorCode;
import org.apache.atlas.RequestContext;
import org.apache.atlas.annotation.Timed;
import org.apache.atlas.exception.AtlasBaseException;
Expand All @@ -20,6 +21,8 @@
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;

import static org.apache.atlas.repository.util.AccessControlUtils.ARGO_SERVICE_USER_NAME;

@Path("business-lineage")
@Singleton
@Service
Expand Down Expand Up @@ -61,6 +64,10 @@ public void createLineage(final BusinessLineageRequest request) throws AtlasBase
perf = AtlasPerfTracer.getPerfTracer(PERF_LOG, "BusinessLineageREST.createLineage()");
}

if (!ARGO_SERVICE_USER_NAME.equals(RequestContext.getCurrentUser())) {
throw new AtlasBaseException(AtlasErrorCode.UNAUTHORIZED_ACCESS, RequestContext.getCurrentUser(), "Lineage creation");
}

// Create lineage
businessLineageService.createLineage(request);

Expand Down

0 comments on commit b0d01ff

Please sign in to comment.