Re-organize intent related packages
- Delete classes under intent package except for ApplicaitonIntent,
PacketConnectivityIntent, and OpticalConnectivityIntent
- Move PacketConnectivityIntent and OpticalConnectivityIntent under
net.onrc.onos.api.newintent package
- Adapt BatchOperation related changes for Intent and IntentId class
This is for ONOS-1887.
Change-Id: I4d25a0f8cbba806e9dd6e00333b6c7157c854658
diff --git a/src/main/java/net/onrc/onos/api/newintent/IntentBatchOperation.java b/src/main/java/net/onrc/onos/api/newintent/IntentBatchOperation.java
new file mode 100644
index 0000000..0e34deb
--- /dev/null
+++ b/src/main/java/net/onrc/onos/api/newintent/IntentBatchOperation.java
@@ -0,0 +1,42 @@
+package net.onrc.onos.api.newintent;
+
+import net.onrc.onos.api.batchoperation.BatchOperation;
+import net.onrc.onos.api.batchoperation.BatchOperationEntry;
+
+/**
+ * A list of intent operations.
+ */
+public class IntentBatchOperation extends
+ BatchOperation<BatchOperationEntry<IntentBatchOperation.Operator, ?>> {
+ /**
+ * The intent operators.
+ */
+ public enum Operator {
+ ADD,
+ REMOVE,
+ }
+
+ /**
+ * Adds an add-intent operation.
+ *
+ * @param intent the intent to be added
+ * @return the IntentBatchOperation object if succeeded, null otherwise
+ */
+ public IntentBatchOperation addAddIntentOperation(Intent intent) {
+ return (null == super.addOperation(
+ new BatchOperationEntry<Operator, Intent>(Operator.ADD, intent)))
+ ? null : this;
+ }
+
+ /**
+ * Adds a remove-intent operation.
+ *
+ * @param id the ID of intent to be removed
+ * @return the IntentBatchOperation object if succeeded, null otherwise
+ */
+ public IntentBatchOperation addRemoveIntentOperation(IntentId id) {
+ return (null == super.addOperation(
+ new BatchOperationEntry<Operator, IntentId>(Operator.REMOVE, id)))
+ ? null : this;
+ }
+}