[Blackbird] Fixing Intent purge case (ONOS-1207)

Master needs to remove from the current map.

Change-Id: I30eccbe188997949ef2d63d6dbd37b0d8d4b3f5e
diff --git a/core/store/dist/src/main/java/org/onosproject/store/intent/impl/GossipIntentStore.java b/core/store/dist/src/main/java/org/onosproject/store/intent/impl/GossipIntentStore.java
index 8ff462e..43e184f 100644
--- a/core/store/dist/src/main/java/org/onosproject/store/intent/impl/GossipIntentStore.java
+++ b/core/store/dist/src/main/java/org/onosproject/store/intent/impl/GossipIntentStore.java
@@ -224,6 +224,8 @@
             }
             return true;
 
+        case PURGE_REQ:
+            return true;
 
         case COMPILING:
         case RECOMPILING:
@@ -241,7 +243,11 @@
         if (isUpdateAcceptable(currentData, newData)) {
             // Only the master is modifying the current state. Therefore assume
             // this always succeeds
-            currentMap.put(newData.key(), copyData(newData));
+            if (newData.state() == PURGE_REQ) {
+                currentMap.remove(newData.key(), newData);
+            } else {
+                currentMap.put(newData.key(), copyData(newData));
+            }
 
             // if current.put succeeded
             pendingMap.remove(newData.key(), newData);
@@ -325,14 +331,6 @@
                 .collect(Collectors.toList());
     }
 
-    @Override
-    public void purge(Key key) {
-        IntentData data = currentMap.get(key);
-        if (data.state() == WITHDRAWN || data.state() == FAILED) {
-            currentMap.remove(key, data);
-        }
-    }
-
     private void notifyDelegateIfNotNull(IntentEvent event) {
         if (event != null) {
             notifyDelegate(event);