b48b43a61cb268d7eb501faf4c60c1983ddef25a
[netconf.git] / restconf / restconf-nb-bierman02 / src / main / java / org / opendaylight / netconf / sal / restconf / impl / PutResult.java
1 /*
2  * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.netconf.sal.restconf.impl;
9
10 import com.google.common.util.concurrent.CheckedFuture;
11 import javax.ws.rs.core.Response.Status;
12 import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
13
14 /**
15  * Wrapper for status and future of PUT operation.
16  *
17  */
18 public class PutResult {
19     private final Status status;
20     private final CheckedFuture<Void, TransactionCommitFailedException> future;
21
22     /**
23      * Wrap status and future by constructor - make this immutable.
24      *
25      * @param status
26      *            status of operations
27      * @param future
28      *            result of submit of PUT operation
29      */
30     public PutResult(final Status status, final CheckedFuture<Void, TransactionCommitFailedException> future) {
31         this.status = status;
32         this.future = future;
33     }
34
35     /**
36      * Get status.
37      *
38      * @return {@link Status} result
39      */
40     public Status getStatus() {
41         return this.status;
42     }
43
44     /**
45      * Get future.
46      *
47      * @return {@link CheckedFuture} result
48      */
49     public CheckedFuture<Void, TransactionCommitFailedException> getFutureOfPutData() {
50         return this.future;
51     }
52 }