Merge "Bug 9092: revert to org.json temporarily"
[netconf.git] / restconf / sal-rest-connector / src / main / java / org / opendaylight / restconf / restful / transaction / TransactionVarsWrapper.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.restconf.restful.transaction;
9
10 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
11 import org.opendaylight.controller.md.sal.dom.api.DOMMountPoint;
12 import org.opendaylight.controller.md.sal.dom.api.DOMTransactionChain;
13 import org.opendaylight.netconf.sal.restconf.impl.InstanceIdentifierContext;
14
15 /**
16  * This class represent delegation wrapper for transaction variables.
17  *
18  */
19 public final class TransactionVarsWrapper {
20
21     private final InstanceIdentifierContext<?> instanceIdentifier;
22     private final DOMMountPoint mountPoint;
23     private LogicalDatastoreType configuration = null;
24     private final DOMTransactionChain transactionChain;
25
26     /**
27      * Set base type of variables, which ones we need for transaction.
28      * {@link LogicalDatastoreType} is default set to null (to read all data
29      * from DS - config + state).
30      *
31      * @param instanceIdentifier
32      *             {@link InstanceIdentifierContext} of data for transaction
33      * @param mountPoint
34      *             mount point if is present
35      * @param transactionChain
36      *             transaction chain for creating specific type of transaction
37      *            in specific operation
38      */
39     public TransactionVarsWrapper(final InstanceIdentifierContext<?> instanceIdentifier, final DOMMountPoint mountPoint,
40             final DOMTransactionChain transactionChain) {
41         this.instanceIdentifier = instanceIdentifier;
42         this.mountPoint = mountPoint;
43         this.transactionChain = transactionChain;
44     }
45
46     /**
47      * Get instance identifier of data.
48      *
49      * @return {@link InstanceIdentifierContext}
50      */
51     public InstanceIdentifierContext<?> getInstanceIdentifier() {
52         return this.instanceIdentifier;
53     }
54
55     /**
56      * Get mount point.
57      *
58      * @return {@link DOMMountPoint}
59      */
60     public DOMMountPoint getMountPoint() {
61         return this.mountPoint;
62     }
63
64     /**
65      * Set {@link LogicalDatastoreType} of data for transaction.
66      *
67      * @param configuration
68      *             {@link LogicalDatastoreType}
69      */
70     public void setLogicalDatastoreType(final LogicalDatastoreType configuration) {
71         this.configuration = configuration;
72
73     }
74
75     /**
76      * Get type of data.
77      *
78      * @return {@link LogicalDatastoreType}
79      */
80     public LogicalDatastoreType getLogicalDatastoreType() {
81         return this.configuration;
82     }
83
84     /**
85      * Get transaction chain for creating specific transaction for specific
86      * operation.
87      *
88      * @return transaction chain
89      */
90     public DOMTransactionChain getTransactionChain() {
91         return this.transactionChain;
92     }
93 }