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