Skip to content

Commit

Permalink
Merge branch 'master' into beta
Browse files Browse the repository at this point in the history
  • Loading branch information
sumandas0 committed Sep 7, 2023
2 parents 85e3745 + b25946f commit faefd09
Showing 1 changed file with 18 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3177,22 +3177,18 @@ public void updateClassifications(EntityMutationContext context, String guid, Li
isClassificationUpdated = true;
}

boolean removePropagation = false;
// check for removePropagationsOnEntityDelete update
Boolean currentRemovePropagations = currentClassification.getRemovePropagationsOnEntityDelete();
Boolean updatedRemovePropagations = classification.getRemovePropagationsOnEntityDelete();

if (updatedRemovePropagations != null && (updatedRemovePropagations != currentRemovePropagations)) {
if (updatedRemovePropagations != null && !updatedRemovePropagations.equals(currentRemovePropagations)) {
AtlasGraphUtilsV2.setEncodedProperty(classificationVertex, CLASSIFICATION_VERTEX_REMOVE_PROPAGATIONS_KEY, updatedRemovePropagations);
isClassificationUpdated = true;

// If value set true from false and source entity is deleted, remove propagated classification from propagated entities
if (updatedRemovePropagations && !currentRemovePropagations) {
boolean isEntityDeleted = entityVertex.getProperty(STATE_PROPERTY_KEY, String.class).equals(DELETED.toString());
if(isEntityDeleted && taskManagement != null && DEFERRED_ACTION_ENABLED) {
createAndQueueTask(CLASSIFICATION_PROPAGATION_DELETE, entityVertex, classificationVertex.getIdForDisplay());
}
boolean isEntityDeleted = DELETED.toString().equals(entityVertex.getProperty(STATE_PROPERTY_KEY, String.class));
if (isEntityDeleted && updatedRemovePropagations) {
removePropagation = true;
}

isClassificationUpdated = true;
}

if (isClassificationUpdated) {
Expand All @@ -3208,10 +3204,6 @@ public void updateClassifications(EntityMutationContext context, String guid, Li
mapClassification(EntityOperation.UPDATE, context, classification, entityType, entityVertex, classificationVertex);
updateModificationMetadata(entityVertex);

// handle update of 'propagate' flag
Boolean currentTagPropagation = currentClassification.isPropagate();
Boolean updatedTagPropagation = classification.isPropagate();

/* -----------------------------
| Current Tag | Updated Tag |
| Propagation | Propagation |
Expand All @@ -3225,15 +3217,22 @@ public void updateClassifications(EntityMutationContext context, String guid, Li
| true | false | => Remove Tag Propagation (send REMOVE classification notifications)
|-------------|-------------| */

Boolean currentTagPropagation = currentClassification.isPropagate();
Boolean updatedTagPropagation = classification.isPropagate();
Boolean currentRestrictPropagationThroughLineage = currentClassification.getRestrictPropagationThroughLineage();
Boolean updatedRestrictPropagationThroughLineage = classification.getRestrictPropagationThroughLineage();

if (taskManagement != null && DEFERRED_ACTION_ENABLED) {
String propagationType = updatedTagPropagation ? CLASSIFICATION_PROPAGATION_ADD : CLASSIFICATION_PROPAGATION_DELETE;
if (!Objects.equals(currentTagPropagation, updatedTagPropagation) || !Objects.equals(currentRestrictPropagationThroughLineage, updatedRestrictPropagationThroughLineage)) {
createAndQueueTask(propagationType, entityVertex, classificationVertex.getIdForDisplay(), currentRestrictPropagationThroughLineage);
if ((!Objects.equals(updatedRemovePropagations, currentRemovePropagations) ||
!Objects.equals(currentTagPropagation, updatedTagPropagation) ||
!Objects.equals(currentRestrictPropagationThroughLineage, updatedRestrictPropagationThroughLineage)) &&
taskManagement != null && DEFERRED_ACTION_ENABLED) {

String propagationType = CLASSIFICATION_PROPAGATION_ADD;
if (removePropagation || !updatedTagPropagation)
{
propagationType = CLASSIFICATION_PROPAGATION_DELETE;
}
updatedTagPropagation = null;
createAndQueueTask(propagationType, entityVertex, classificationVertex.getIdForDisplay(), currentRestrictPropagationThroughLineage);
}

// compute propagatedEntityVertices once and use it for subsequent iterations and notifications
Expand Down

0 comments on commit faefd09

Please sign in to comment.