Brian O'Connor | b876bf1 | 2014-10-02 14:59:37 -0700 | [diff] [blame] | 1 | package org.onlab.onos.net.intent; |
| 2 | |
| 3 | /** |
| 4 | * A list of intent operations. |
| 5 | */ |
| 6 | public 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 | } |