Skip to content

Commit

Permalink
Added one more validation : To not handle propagated classification c…
Browse files Browse the repository at this point in the history
…onfigs for an entity
  • Loading branch information
hr2904 committed Dec 2, 2024
1 parent c8dca0c commit 45c1c3d
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -248,12 +248,14 @@ private Map<String, List<AtlasClassification>> validateAndTransfer(AtlasEntityHe
Set<String> requiredClassificationKeys = Stream.concat(
Optional.ofNullable(incomingEntityHeader.getRemoveClassifications()).orElse(Collections.emptyList()).stream(),
Optional.ofNullable(incomingEntityHeader.getUpdateClassifications()).orElse(Collections.emptyList()).stream()
).map(this::generateClassificationComparisonKey)
).filter(classification -> classification.getEntityGuid().equals(entityToBeChanged.getGuid()))
.map(this::generateClassificationComparisonKey)
.collect(Collectors.toSet());

Set<String> preExistingClassificationKeys = Optional.ofNullable(entityToBeChanged.getClassifications())
.orElse(Collections.emptyList())
.stream()
.filter(classification -> classification.getEntityGuid().equals(entityToBeChanged.getGuid()))
.map(this::generateClassificationComparisonKey)
.collect(Collectors.toSet());

@@ -269,6 +271,7 @@ private Map<String, List<AtlasClassification>> validateAndTransfer(AtlasEntityHe
List<AtlasClassification> filteredClassifications = Optional.ofNullable(incomingEntityHeader.getAppendClassifications())
.orElse(Collections.emptyList())
.stream()
.filter(classification -> classification.getEntityGuid().equals(entityToBeChanged.getGuid()))
.filter(appendClassification -> !preExistingClassificationKeys.contains(generateClassificationComparisonKey(appendClassification)))
.collect(Collectors.toList());

0 comments on commit 45c1c3d

Please sign in to comment.