Commit b6bbe7d8 by Sarath Subramanian

ATLAS-2633: Tag Propagation , V2 notifications : When propagate value is…

ATLAS-2633: Tag Propagation , V2 notifications : When propagate value is switched from False to True , 'CLASSIFICATION_UPDATE' notification is sent instead of 'CLASSIFICATION_ADD'
parent efe0935e
No related merge requests found
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
package org.apache.atlas.notification; package org.apache.atlas.notification;
import org.apache.atlas.AtlasErrorCode; import org.apache.atlas.AtlasErrorCode;
import org.apache.atlas.RequestContextV1;
import org.apache.atlas.exception.AtlasBaseException; import org.apache.atlas.exception.AtlasBaseException;
import org.apache.atlas.listener.EntityChangeListenerV2; import org.apache.atlas.listener.EntityChangeListenerV2;
import org.apache.atlas.model.instance.AtlasClassification; import org.apache.atlas.model.instance.AtlasClassification;
...@@ -85,8 +86,15 @@ public class EntityNotificationListenerV2 implements EntityChangeListenerV2 { ...@@ -85,8 +86,15 @@ public class EntityNotificationListenerV2 implements EntityChangeListenerV2 {
@Override @Override
public void onClassificationsUpdated(AtlasEntity entity, List<AtlasClassification> classifications) throws AtlasBaseException { public void onClassificationsUpdated(AtlasEntity entity, List<AtlasClassification> classifications) throws AtlasBaseException {
Map<String, List<AtlasClassification>> addedPropagations = RequestContextV1.get().getAddedPropagations();
Map<String, List<AtlasClassification>> removedPropagations = RequestContextV1.get().getRemovedPropagations();
if (addedPropagations.containsKey(entity.getGuid())) {
notifyEntityEvents(Collections.singletonList(entity), CLASSIFICATION_ADD);
} else if (!removedPropagations.containsKey(entity.getGuid())) {
notifyEntityEvents(Collections.singletonList(entity), CLASSIFICATION_UPDATE); notifyEntityEvents(Collections.singletonList(entity), CLASSIFICATION_UPDATE);
} }
}
@Override @Override
public void onClassificationsDeleted(AtlasEntity entity, List<AtlasClassification> classifications) throws AtlasBaseException { public void onClassificationsDeleted(AtlasEntity entity, List<AtlasClassification> classifications) throws AtlasBaseException {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment