You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@atlas.apache.org by sa...@apache.org on 2018/05/01 19:31:03 UTC
atlas git commit: ATLAS-2633: Tag Propagation ,
V2 notifications : When propagate value is switched from False to
True ,
'CLASSIFICATION_UPDATE' notification is sent instead of 'CLASSIFICATION_ADD'
Repository: atlas
Updated Branches:
refs/heads/master efe0935eb -> b6bbe7d8a
ATLAS-2633: Tag Propagation , V2 notifications : When propagate value is switched from False to True , 'CLASSIFICATION_UPDATE' notification is sent instead of 'CLASSIFICATION_ADD'
Project: http://git-wip-us.apache.org/repos/asf/atlas/repo
Commit: http://git-wip-us.apache.org/repos/asf/atlas/commit/b6bbe7d8
Tree: http://git-wip-us.apache.org/repos/asf/atlas/tree/b6bbe7d8
Diff: http://git-wip-us.apache.org/repos/asf/atlas/diff/b6bbe7d8
Branch: refs/heads/master
Commit: b6bbe7d8a57ded52e9116730d10bb2c1453d413e
Parents: efe0935
Author: Sarath Subramanian <ss...@hortonworks.com>
Authored: Tue May 1 12:30:47 2018 -0700
Committer: Sarath Subramanian <ss...@hortonworks.com>
Committed: Tue May 1 12:30:47 2018 -0700
----------------------------------------------------------------------
.../atlas/notification/EntityNotificationListenerV2.java | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/atlas/blob/b6bbe7d8/webapp/src/main/java/org/apache/atlas/notification/EntityNotificationListenerV2.java
----------------------------------------------------------------------
diff --git a/webapp/src/main/java/org/apache/atlas/notification/EntityNotificationListenerV2.java b/webapp/src/main/java/org/apache/atlas/notification/EntityNotificationListenerV2.java
index 1fb032a..ab17ae4 100644
--- a/webapp/src/main/java/org/apache/atlas/notification/EntityNotificationListenerV2.java
+++ b/webapp/src/main/java/org/apache/atlas/notification/EntityNotificationListenerV2.java
@@ -18,6 +18,7 @@
package org.apache.atlas.notification;
import org.apache.atlas.AtlasErrorCode;
+import org.apache.atlas.RequestContextV1;
import org.apache.atlas.exception.AtlasBaseException;
import org.apache.atlas.listener.EntityChangeListenerV2;
import org.apache.atlas.model.instance.AtlasClassification;
@@ -85,7 +86,14 @@ public class EntityNotificationListenerV2 implements EntityChangeListenerV2 {
@Override
public void onClassificationsUpdated(AtlasEntity entity, List<AtlasClassification> classifications) throws AtlasBaseException {
- notifyEntityEvents(Collections.singletonList(entity), CLASSIFICATION_UPDATE);
+ 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);
+ }
}
@Override