blob: 144385507b21b7fcf96ac78037b73da0dc21a1e7 [file] [log] [blame]
Hongtao Yin142b7582015-01-21 14:41:30 -08001/*
2 * Copyright 2015 Open Networking Laboratory
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16package org.onosproject.net.flowext;
17
18import com.google.common.base.MoreObjects;
19import org.onosproject.net.flow.CompletedBatchOperation;
20import org.onosproject.net.flow.FlowRule;
21
22import java.util.Set;
23
24/**
25 * Experimental extension to the flow rule subsystem; still under development.
26 * <p>
27 * Representation of a completed flow rule batch operation.
28 * </p>
29 */
30//TODO explain the purpose of this class beyond FlowRuleProvider
31public class FlowExtCompletedOperation extends CompletedBatchOperation {
32 // the batchId is provided by application, once one flow rule of this batch failed
33 // all the batch should withdraw
34 private final long batchId;
35
36 public FlowExtCompletedOperation(long batchId, boolean success, Set<FlowRule> failures) {
37 super(success, failures, null);
38 this.batchId = batchId;
39 }
40
41 /**
42 * Returns the BatchId of this BatchOperation.
43 *
44 * @return the number of Batch
45 */
46 public long getBatchId() {
47 return batchId;
48 }
49
50 /**
51 * Returns a string representation of the object.
52 *
53 * @return a string representation of the object.
54 */
55 @Override
56 public String toString() {
57 return MoreObjects.toStringHelper(getClass())
58 .add("success?", isSuccess())
59 .add("failedItems", failedIds())
60 .toString();
61 }
62}