Repository: atlas
Updated Branches:
  refs/heads/branch-1.0 e576b763a -> 4eb412051


ATLAS-2844: added eventTime field in EntityNotificationV2

(cherry picked from commit 96f2c2996e6e3ccfd26e0297be5f29640a2ec781)


Project: http://git-wip-us.apache.org/repos/asf/atlas/repo
Commit: http://git-wip-us.apache.org/repos/asf/atlas/commit/4eb41205
Tree: http://git-wip-us.apache.org/repos/asf/atlas/tree/4eb41205
Diff: http://git-wip-us.apache.org/repos/asf/atlas/diff/4eb41205

Branch: refs/heads/branch-1.0
Commit: 4eb4120514963442ea328bae50bdedf15cca049c
Parents: e576b76
Author: Madhan Neethiraj <[email protected]>
Authored: Thu Aug 30 15:17:06 2018 -0700
Committer: Madhan Neethiraj <[email protected]>
Committed: Fri Aug 31 10:05:31 2018 -0700

----------------------------------------------------------------------
 .../model/notification/EntityNotification.java     | 17 ++++++++++++++++-
 .../notification/EntityNotificationListenerV2.java |  2 +-
 2 files changed, 17 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/atlas/blob/4eb41205/intg/src/main/java/org/apache/atlas/model/notification/EntityNotification.java
----------------------------------------------------------------------
diff --git 
a/intg/src/main/java/org/apache/atlas/model/notification/EntityNotification.java
 
b/intg/src/main/java/org/apache/atlas/model/notification/EntityNotification.java
index 6cdae89..1eae100 100644
--- 
a/intg/src/main/java/org/apache/atlas/model/notification/EntityNotification.java
+++ 
b/intg/src/main/java/org/apache/atlas/model/notification/EntityNotification.java
@@ -105,16 +105,22 @@ public class EntityNotification implements Serializable {
 
         private AtlasEntityHeader entity;
         private OperationType     operationType;
+        private long              eventTime;
 
         public EntityNotificationV2() {
-            super(ENTITY_NOTIFICATION_V2);
+            this(null, null, System.currentTimeMillis());
         }
 
         public EntityNotificationV2(AtlasEntityHeader entity, OperationType 
operationType) {
+            this(entity, operationType, System.currentTimeMillis());
+        }
+
+        public EntityNotificationV2(AtlasEntityHeader entity, OperationType 
operationType, long eventTime) {
             super(ENTITY_NOTIFICATION_V2);
 
             setEntity(entity);
             setOperationType(operationType);
+            setEventTime(eventTime);
         }
 
         public AtlasEntityHeader getEntity() {
@@ -133,6 +139,14 @@ public class EntityNotification implements Serializable {
             this.operationType = operationType;
         }
 
+        public long getEventTime() {
+            return eventTime;
+        }
+
+        public void setEventTime(long eventTime) {
+            this.eventTime = eventTime;
+        }
+
         @Override
         public boolean equals(Object o) {
             if (this == o) { return true; }
@@ -163,6 +177,7 @@ public class EntityNotification implements Serializable {
                 sb.append(entity);
             }
             sb.append(", operationType=").append(operationType);
+            sb.append(", eventTime=").append(eventTime);
             sb.append("}");
 
             return sb;

http://git-wip-us.apache.org/repos/asf/atlas/blob/4eb41205/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 9587af9..e0a60a1 100644
--- 
a/webapp/src/main/java/org/apache/atlas/notification/EntityNotificationListenerV2.java
+++ 
b/webapp/src/main/java/org/apache/atlas/notification/EntityNotificationListenerV2.java
@@ -125,7 +125,7 @@ public class EntityNotificationListenerV2 implements 
EntityChangeListenerV2 {
                 continue;
             }
 
-            messages.add(new 
EntityNotificationV2(toNotificationHeader(entity), operationType));
+            messages.add(new 
EntityNotificationV2(toNotificationHeader(entity), operationType, 
RequestContext.get().getRequestTime()));
         }
 
         if (!messages.isEmpty()) {

Reply via email to