blob: 0e34debb0ef55eac237c103d5163b879571196d9 [file] [log] [blame]
Sho SHIMIZU228140c2014-08-11 19:15:43 -07001package net.onrc.onos.api.newintent;
Toshio Koide4ea84192014-07-31 12:10:12 -07002
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}