blob: b5ca1aae0511a04e76ff0d945d3c5122fadf88bd [file] [log] [blame]
Toshio Koide4ea84192014-07-31 12:10:12 -07001package net.onrc.onos.api.intent;
2
3import net.onrc.onos.api.batchoperation.BatchOperation;
4import net.onrc.onos.api.batchoperation.BatchOperationEntry;
5
6/**
7 * A list of intent operations.
8 */
9public class IntentBatchOperation extends
10 BatchOperation<BatchOperationEntry<IntentBatchOperation.Operator, ?>> {
11 /**
12 * The intent operators.
13 */
14 public enum Operator {
15 ADD,
16 REMOVE,
17 }
18
19 /**
20 * Adds an add-intent operation.
21 *
22 * @param intent the intent to be added
23 * @return the IntentBatchOperation object if succeeded, null otherwise
24 */
25 public IntentBatchOperation addAddIntentOperation(Intent intent) {
26 return (null == super.addOperation(
27 new BatchOperationEntry<Operator, Intent>(Operator.ADD, intent)))
28 ? null : this;
29 }
30
31 /**
32 * Adds a remove-intent operation.
33 *
34 * @param id the ID of intent to be removed
35 * @return the IntentBatchOperation object if succeeded, null otherwise
36 */
37 public IntentBatchOperation addRemoveIntentOperation(IntentId id) {
38 return (null == super.addOperation(
39 new BatchOperationEntry<Operator, IntentId>(Operator.REMOVE, id)))
40 ? null : this;
41 }
42}