ONOS-6381 Transactional event listeners

Change-Id: I8f279d78323dea467796e8d37e3117a407af9f76
diff --git a/core/api/src/main/java/org/onosproject/store/service/DocumentTreeEvent.java b/core/api/src/main/java/org/onosproject/store/service/DocumentTreeEvent.java
index f640da8..81b28ac 100644
--- a/core/api/src/main/java/org/onosproject/store/service/DocumentTreeEvent.java
+++ b/core/api/src/main/java/org/onosproject/store/service/DocumentTreeEvent.java
@@ -44,7 +44,9 @@
         /**
          * Signifies an existing node being deleted.
          */
-        DELETED
+        DELETED,
+        TRANSACTION_START,
+        TRANSACTION_END
     }
 
     private final DocumentPath path;
@@ -77,6 +79,22 @@
         this.newValue = newValue;
         this.oldValue = oldValue;
     }
+    /**
+     * Constructs a new {@code DocumentTreeEvent}.
+     *
+     * @param path path to the node
+     * @param newValue optional new value; will be empty if node was deleted
+     * @param oldValue optional old value; will be empty if node was created
+     */
+    public DocumentTreeEvent(DocumentPath path,
+                             Optional<Versioned<V>> newValue,
+                             Optional<Versioned<V>> oldValue) {
+        this.path = path;
+        this.newValue = newValue;
+        this.oldValue = oldValue;
+        this.type = newValue != null ?
+                oldValue != null ? Type.UPDATED : Type.CREATED : Type.DELETED;
+    }
 
     /**
      * Returns the path to the changed node.