IntentStore interface changes

Change-Id: Ifa8728fb4c7edcc6d58a5e071f7252493ab2a578
diff --git a/apps/sdnip/src/main/java/org/onosproject/sdnip/IntentSynchronizer.java b/apps/sdnip/src/main/java/org/onosproject/sdnip/IntentSynchronizer.java
index 698a2d6..c51d7d3 100644
--- a/apps/sdnip/src/main/java/org/onosproject/sdnip/IntentSynchronizer.java
+++ b/apps/sdnip/src/main/java/org/onosproject/sdnip/IntentSynchronizer.java
@@ -31,7 +31,6 @@
 import org.onosproject.net.flow.criteria.Criteria.IPCriterion;
 import org.onosproject.net.flow.criteria.Criterion;
 import org.onosproject.net.intent.Intent;
-import org.onosproject.net.intent.IntentOperations;
 import org.onosproject.net.intent.IntentService;
 import org.onosproject.net.intent.IntentState;
 import org.onosproject.net.intent.MultiPointToSinglePointIntent;
@@ -256,14 +255,10 @@
             // Push the intents
             if (isElectedLeader && isActivatedLeader) {
                 log.debug("SDN-IP Submitting all Peer Intents...");
-                IntentOperations.Builder builder = IntentOperations.builder(appId);
                 for (Intent intent : intents) {
-                    builder.addSubmitOperation(intent);
+                    log.trace("SDN-IP Submitting intents: {}", intent);
+                    intentService.submit(intent);
                 }
-                IntentOperations intentOperations = builder.build();
-                log.trace("SDN-IP Submitting intents: {}",
-                          intentOperations.operations());
-                intentService.execute(intentOperations);
             }
         }
     }
@@ -361,14 +356,11 @@
             //
             // Prepare the Intent batch operations for the intents to withdraw
             //
-            IntentOperations.Builder withdrawBuilder =
-                IntentOperations.builder(appId);
             for (FibUpdate withdraw : withdraws) {
                 checkArgument(withdraw.type() == FibUpdate.Type.DELETE,
                               "FibUpdate with wrong type in withdraws list");
 
                 IpPrefix prefix = withdraw.entry().prefix();
-
                 intent = routeIntents.remove(prefix);
                 if (intent == null) {
                     log.trace("SDN-IP No intent in routeIntents to delete " +
@@ -377,15 +369,13 @@
                 }
                 if (isElectedLeader && isActivatedLeader) {
                     log.trace("SDN-IP Withdrawing intent: {}", intent);
-                    withdrawBuilder.addWithdrawOperation(intent.id());
+                    intentService.withdraw(intent);
                 }
             }
 
             //
             // Prepare the Intent batch operations for the intents to submit
             //
-            IntentOperations.Builder submitBuilder =
-                IntentOperations.builder(appId);
             for (FibUpdate update : updates) {
                 checkArgument(update.type() == FibUpdate.Type.UPDATE,
                               "FibUpdate with wrong type in updates list");
@@ -407,26 +397,8 @@
                     if (oldIntent != null) {
                         log.trace("SDN-IP Withdrawing old intent: {}",
                                   oldIntent);
-                        withdrawBuilder.addWithdrawOperation(oldIntent.id());
+                        intentService.withdraw(oldIntent);
                     }
-                    log.trace("SDN-IP Submitting intent: {}", intent);
-                    submitBuilder.addSubmitOperation(intent);
-                }
-            }
-
-            //
-            // Submit the Intent operations
-            //
-            if (isElectedLeader && isActivatedLeader) {
-                IntentOperations intentOperations = withdrawBuilder.build();
-                if (!intentOperations.operations().isEmpty()) {
-                    log.debug("SDN-IP Withdrawing intents executed");
-                    intentService.execute(intentOperations);
-                }
-                intentOperations = submitBuilder.build();
-                if (!intentOperations.operations().isEmpty()) {
-                    log.debug("SDN-IP Submitting intents executed");
-                    intentService.execute(intentOperations);
                 }
             }
         }
@@ -444,7 +416,6 @@
             Collection<Intent> storeInMemoryIntents = new LinkedList<>();
             Collection<Intent> addIntents = new LinkedList<>();
             Collection<Intent> deleteIntents = new LinkedList<>();
-            IntentOperations intentOperations;
 
             if (!isElectedLeader) {
                 return;         // Nothing to do: not the leader anymore
@@ -523,9 +494,8 @@
             }
 
             // Withdraw Intents
-            IntentOperations.Builder builder = IntentOperations.builder(appId);
             for (Intent intent : deleteIntents) {
-                builder.addWithdrawOperation(intent.id());
+                intentService.withdraw(intent);
                 log.trace("SDN-IP Intent Synchronizer: withdrawing intent: {}",
                       intent);
             }
@@ -535,13 +505,10 @@
                 isActivatedLeader = false;
                 return;
             }
-            intentOperations = builder.build();
-            intentService.execute(intentOperations);
 
             // Add Intents
-            builder = IntentOperations.builder(appId);
             for (Intent intent : addIntents) {
-                builder.addSubmitOperation(intent);
+                intentService.submit(intent);
                 log.trace("SDN-IP Intent Synchronizer: submitting intent: {}",
                           intent);
             }
@@ -551,8 +518,6 @@
                 isActivatedLeader = false;
                 return;
             }
-            intentOperations = builder.build();
-            intentService.execute(intentOperations);
 
             if (isElectedLeader) {
                 isActivatedLeader = true;       // Allow push of Intents