import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
import org.opendaylight.controller.md.sal.dom.api.DOMDataReadWriteTransaction;
import org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction;
-import org.opendaylight.controller.md.sal.dom.api.DOMTransactionChain;
import org.opendaylight.restconf.common.context.InstanceIdentifierContext;
import org.opendaylight.restconf.common.context.NormalizedNodeContext;
import org.opendaylight.restconf.common.errors.RestconfDocumentedException;
import org.opendaylight.restconf.common.errors.RestconfError.ErrorTag;
import org.opendaylight.restconf.common.errors.RestconfError.ErrorType;
import org.opendaylight.restconf.common.validation.RestconfValidationUtils;
+import org.opendaylight.restconf.nb.rfc8040.handlers.TransactionChainHandler;
import org.opendaylight.restconf.nb.rfc8040.references.SchemaContextRef;
import org.opendaylight.restconf.nb.rfc8040.rests.transactions.TransactionVarsWrapper;
import org.opendaylight.restconf.nb.rfc8040.utils.parser.ParserIdentifier;
final ResponseFactory responseFactory =
new ResponseFactory(existsResponse.result ? Status.NO_CONTENT : Status.CREATED);
final CheckedFuture<Void, TransactionCommitFailedException> submitData = submitData(path, schemaContext,
- transactionNode.getTransactionChain(), readWriteTransaction, payload.getData(), insert, point);
+ transactionNode.getTransactionChainHandler(), readWriteTransaction, payload.getData(), insert, point);
FutureCallbackTx.addCallback(submitData, RestconfDataServiceConstant.PutData.PUT_TX_TYPE, responseFactory);
return responseFactory.build();
}
* path of data
* @param schemaContext
* {@link SchemaContext}
- * @param domTransactionChain
+ * @param transactionChainHandler
* write transaction
* @param data
* data
* @return {@link CheckedFuture}
*/
private static CheckedFuture<Void, TransactionCommitFailedException> submitData(final YangInstanceIdentifier path,
- final SchemaContext schemaContext, final DOMTransactionChain domTransactionChain,
+ final SchemaContext schemaContext, final TransactionChainHandler transactionChainHandler,
final DOMDataReadWriteTransaction readWriteTransaction,
final NormalizedNode<?, ?> data, final String insert, final String point) {
if (insert == null) {
case "first":
if (schemaNode instanceof ListSchemaNode) {
final NormalizedNode<?, ?> readData =
- readList(path, schemaContext, domTransactionChain, schemaNode);
+ readList(path, schemaContext, transactionChainHandler, schemaNode);
final OrderedMapNode readList = (OrderedMapNode) readData;
if (readList == null || readList.getValue().isEmpty()) {
return makePut(path, schemaContext, readWriteTransaction, data);
}
} else {
final NormalizedNode<?, ?> readData =
- readList(path, schemaContext, domTransactionChain, schemaNode);
+ readList(path, schemaContext, transactionChainHandler, schemaNode);
final OrderedLeafSetNode<?> readLeafList = (OrderedLeafSetNode<?>) readData;
if (readLeafList == null || readLeafList.getValue().isEmpty()) {
case "before":
if (schemaNode instanceof ListSchemaNode) {
final NormalizedNode<?, ?> readData =
- readList(path, schemaContext, domTransactionChain, schemaNode);
+ readList(path, schemaContext, transactionChainHandler, schemaNode);
final OrderedMapNode readList = (OrderedMapNode) readData;
if (readList == null || readList.getValue().isEmpty()) {
return makePut(path, schemaContext, readWriteTransaction, data);
}
} else {
final NormalizedNode<?, ?> readData =
- readList(path, schemaContext, domTransactionChain, schemaNode);
+ readList(path, schemaContext, transactionChainHandler, schemaNode);
final OrderedLeafSetNode<?> readLeafList = (OrderedLeafSetNode<?>) readData;
if (readLeafList == null || readLeafList.getValue().isEmpty()) {
case "after":
if (schemaNode instanceof ListSchemaNode) {
final NormalizedNode<?, ?> readData =
- readList(path, schemaContext, domTransactionChain, schemaNode);
+ readList(path, schemaContext, transactionChainHandler, schemaNode);
final OrderedMapNode readList = (OrderedMapNode) readData;
if (readList == null || readList.getValue().isEmpty()) {
return makePut(path, schemaContext, readWriteTransaction, data);
}
} else {
final NormalizedNode<?, ?> readData =
- readList(path, schemaContext, domTransactionChain, schemaNode);
+ readList(path, schemaContext, transactionChainHandler, schemaNode);
final OrderedLeafSetNode<?> readLeafList = (OrderedLeafSetNode<?>) readData;
if (readLeafList == null || readLeafList.getValue().isEmpty()) {
}
public static NormalizedNode<?, ?> readList(final YangInstanceIdentifier path, final SchemaContext schemaContext,
- final DOMTransactionChain domTransactionChain, final DataSchemaNode schemaNode) {
+ final TransactionChainHandler transactionChainHandler, final DataSchemaNode schemaNode) {
final InstanceIdentifierContext<?> iid = new InstanceIdentifierContext<SchemaNode>(
path.getParent(), schemaNode, null, schemaContext);
- final TransactionVarsWrapper transactionNode =
- new TransactionVarsWrapper(iid, null, domTransactionChain);
+ final TransactionVarsWrapper transactionNode = new TransactionVarsWrapper(iid, null, transactionChainHandler);
final NormalizedNode<?, ?> readData = ReadDataTransactionUtil
.readData(RestconfDataServiceConstant.ReadData.CONFIG, transactionNode, schemaContext);
return readData;