Skip to content

Commit

Permalink
Merge pull request #3646 from atlanhq/DG-1720
Browse files Browse the repository at this point in the history
DG-1720 Support Product lineage with current lineage APIs
  • Loading branch information
hr2904 authored Oct 17, 2024
2 parents 0e9c5e4 + 853d5bb commit 6cffb84
Show file tree
Hide file tree
Showing 7 changed files with 240 additions and 88 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ public final class Constants {
public static final String PROCESS_INPUTS = "__Process.inputs";

public static String[] PROCESS_EDGE_LABELS = {PROCESS_OUTPUTS, PROCESS_INPUTS};
public static final String CONNECTION_PROCESS_ENTITY_TYPE = "ConnectionProcess";

/**
* The homeId field is used when saving into Atlas a copy of an object that is being imported from another
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
@JsonAutoDetect(getterVisibility = PUBLIC_ONLY, setterVisibility = PUBLIC_ONLY, fieldVisibility = NONE)
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
public class LineageListRequest {
public static final String LINEAGE_TYPE_DATASET_PROCESS_LINEAGE = "DatasetProcessLineage";
public static final String LINEAGE_TYPE_PRODUCT_ASSET_LINEAGE = "ProductAssetLineage";
private String guid;
private Integer size;
private Integer from;
Expand All @@ -35,6 +37,9 @@ public void setImmediateNeighbours(Boolean immediateNeighbours) {
this.immediateNeighbours = immediateNeighbours;
}


private String lineageType = LINEAGE_TYPE_DATASET_PROCESS_LINEAGE;

public enum LineageDirection {INPUT, OUTPUT}

public LineageListRequest() {
Expand Down Expand Up @@ -90,6 +95,13 @@ public Integer getDepth() {
public void setDepth(Integer depth) {
this.depth = depth;
}
public String getLineageType() {
return lineageType;
}

public void setLineageType(String lineageType) {
this.lineageType = lineageType;
}

public LineageDirection getDirection() {
return direction;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE;
import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY;
import static org.apache.atlas.model.lineage.LineageListRequest.LINEAGE_TYPE_DATASET_PROCESS_LINEAGE;

@JsonAutoDetect(getterVisibility = PUBLIC_ONLY, setterVisibility = PUBLIC_ONLY, fieldVisibility = NONE)
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
Expand All @@ -22,6 +23,7 @@ public class LineageOnDemandRequest {
private Set<String> attributes;
private Set<String> relationAttributes;
private LineageOnDemandBaseParams defaultParams;
private String lineageType = LINEAGE_TYPE_DATASET_PROCESS_LINEAGE;

public LineageOnDemandRequest() {
this.attributes = new HashSet<>();
Expand Down Expand Up @@ -64,6 +66,13 @@ public void setRelationshipTraversalFilters(SearchParameters.FilterCriteria rela
this.relationshipTraversalFilters = relationshipTraversalFilters;
}

public String getLineageType() {
return lineageType;
}

public void setLineageType(String lineageType) {
this.lineageType = lineageType;
}
public Set<String> getAttributes() {
return attributes;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import org.apache.commons.collections.Predicate;
import java.util.Set;

import static org.apache.atlas.model.lineage.LineageListRequest.LINEAGE_TYPE_DATASET_PROCESS_LINEAGE;

public final class AtlasLineageListContext {
private String guid;
private int size;
Expand All @@ -23,6 +25,7 @@ public final class AtlasLineageListContext {
private int currentEntityCounter;
private boolean depthLimitReached;
private boolean hasMoreUpdated;
private String lineageType = LINEAGE_TYPE_DATASET_PROCESS_LINEAGE;
private Boolean immediateNeighbours;

public AtlasLineageListContext(LineageListRequest lineageListRequest, AtlasTypeRegistry typeRegistry) {
Expand All @@ -35,6 +38,7 @@ public AtlasLineageListContext(LineageListRequest lineageListRequest, AtlasTypeR
this.vertexTraversalPredicate = constructInMemoryPredicate(typeRegistry, lineageListRequest.getEntityTraversalFilters());
this.edgeTraversalPredicate = constructInMemoryPredicate(typeRegistry, lineageListRequest.getRelationshipTraversalFilters());
this.attributes = lineageListRequest.getAttributes();
this.lineageType = lineageListRequest.getLineageType();
this.relationAttributes = lineageListRequest.getRelationAttributes();
this.immediateNeighbours = lineageListRequest.getImmediateNeighbours();
}
Expand Down Expand Up @@ -131,6 +135,14 @@ public void setCurrentFromCounter(int currentFromCounter) {
this.currentFromCounter = currentFromCounter;
}

public String getLineageType() {
return lineageType;
}

public void setLineageType(String lineageType) {
this.lineageType = lineageType;
}

public int getCurrentEntityCounter() {
return currentEntityCounter;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
import java.util.Map;
import java.util.Set;

import static org.apache.atlas.model.lineage.LineageListRequest.LINEAGE_TYPE_DATASET_PROCESS_LINEAGE;


public class AtlasLineageOnDemandContext {
private static final Logger LOG = LoggerFactory.getLogger(AtlasLineageContext.class);

Expand All @@ -24,13 +27,17 @@ public class AtlasLineageOnDemandContext {
private Set<String> relationAttributes;
private LineageOnDemandBaseParams defaultParams;


private String lineageType = LINEAGE_TYPE_DATASET_PROCESS_LINEAGE;

public AtlasLineageOnDemandContext(LineageOnDemandRequest lineageOnDemandRequest, AtlasTypeRegistry typeRegistry) {
this.constraints = lineageOnDemandRequest.getConstraints();
this.attributes = lineageOnDemandRequest.getAttributes();
this.relationAttributes = lineageOnDemandRequest.getRelationAttributes();
this.defaultParams = lineageOnDemandRequest.getDefaultParams();
this.vertexPredicate = constructInMemoryPredicate(typeRegistry, lineageOnDemandRequest.getEntityTraversalFilters());
this.edgePredicate = constructInMemoryPredicate(typeRegistry, lineageOnDemandRequest.getRelationshipTraversalFilters());
this.lineageType = lineageOnDemandRequest.getLineageType();
}

public Map<String, LineageOnDemandConstraints> getConstraints() {
Expand All @@ -56,6 +63,13 @@ public Predicate getEdgePredicate() {
public void setEdgePredicate(Predicate edgePredicate) {
this.edgePredicate = edgePredicate;
}
public String getLineageType() {
return lineageType;
}

public void setLineageType(String lineageType) {
this.lineageType = lineageType;
}

public Set<String> getAttributes() {
return attributes;
Expand Down
Loading

0 comments on commit 6cffb84

Please sign in to comment.