Sho SHIMIZU | 228140c | 2014-08-11 19:15:43 -0700 | [diff] [blame] | 1 | package net.onrc.onos.api.newintent; |
Toshio Koide | 4ea8419 | 2014-07-31 12:10:12 -0700 | [diff] [blame] | 2 | |
| 3 | import net.onrc.onos.api.batchoperation.BatchOperation; |
| 4 | import net.onrc.onos.api.batchoperation.BatchOperationEntry; |
| 5 | |
| 6 | /** |
| 7 | * A list of intent operations. |
| 8 | */ |
| 9 | public 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 | } |