Skip to content

Commit

Permalink
Update GraphHelper.java
Browse files Browse the repository at this point in the history
  • Loading branch information
sumandas0 committed May 30, 2024
1 parent 1e26506 commit 9812fe8
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;

import static org.apache.atlas.AtlasErrorCode.RELATIONSHIP_CREATE_INVALID_PARAMS;
import static org.apache.atlas.model.instance.AtlasEntity.Status.ACTIVE;
Expand Down Expand Up @@ -391,21 +392,21 @@ public static List<AtlasVertex> getAllAssetsWithClassificationAttached(AtlasGrap
}
List<AtlasVertex> classificationVerticesList = IteratorUtils.toList(classificationVertices.iterator());
LOG.info("classificationVerticesList size: {}", classificationVerticesList.size());
HashSet<AtlasVertex> classificationVerticesSet = new HashSet<>();
HashSet<AtlasVertex> entityVerticesSet = new HashSet<>();
for (AtlasVertex classificationVertex : classificationVerticesList) {
Iterable attachedVertices = classificationVertex.query()
.direction(AtlasEdgeDirection.IN)
.label(CLASSIFICATION_LABEL).vertices();
if (attachedVertices != null) {
Iterator<AtlasVertex> attachedVerticesIterator = attachedVertices.iterator();
while (attachedVerticesIterator.hasNext()) {
classificationVerticesSet.add(attachedVerticesIterator.next());
entityVerticesSet.add(attachedVerticesIterator.next());
}
LOG.info("classificationVerticesSet size: {}", classificationVerticesSet.size());
LOG.info("classificationVerticesSet size: {}", entityVerticesSet.size());
}
}

return new ArrayList<>(classificationVerticesSet);
return entityVerticesSet.stream().collect(Collectors.toList());
}
public static AtlasEdge getClassificationEdge(AtlasVertex entityVertex, AtlasVertex classificationVertex) {
AtlasEdge ret = null;
Expand Down

0 comments on commit 9812fe8

Please sign in to comment.