package org.opendaylight.restconf.nb.rfc8040.rests.transactions;
import static com.google.common.base.Verify.verifyNotNull;
+import static org.opendaylight.mdsal.common.api.LogicalDatastoreType.CONFIGURATION;
import static org.opendaylight.restconf.nb.rfc8040.rests.utils.DeleteDataTransactionUtil.DELETE_TX_TYPE;
import static org.opendaylight.restconf.nb.rfc8040.rests.utils.PostDataTransactionUtil.checkItemDoesNotExists;
import java.util.Map;
import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.mdsal.common.api.CommitInfo;
-import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
import org.opendaylight.mdsal.common.api.ReadFailedException;
import org.opendaylight.mdsal.dom.api.DOMDataBroker;
import org.opendaylight.mdsal.dom.api.DOMDataTreeReadWriteTransaction;
}
@Override
- public void delete(final LogicalDatastoreType store, final YangInstanceIdentifier path) {
- final FluentFuture<Boolean> isExists = verifyNotNull(rwTx).exists(store, path);
+ public void delete(final YangInstanceIdentifier path) {
+ final FluentFuture<Boolean> isExists = verifyNotNull(rwTx).exists(CONFIGURATION, path);
DeleteDataTransactionUtil.checkItemExists(isExists, path, DELETE_TX_TYPE);
- rwTx.delete(store, path);
+ rwTx.delete(CONFIGURATION, path);
}
@Override
- public void remove(final LogicalDatastoreType store, final YangInstanceIdentifier path) {
- verifyNotNull(rwTx).delete(store, path);
+ public void remove(final YangInstanceIdentifier path) {
+ verifyNotNull(rwTx).delete(CONFIGURATION, path);
}
@Override
- public void merge(final LogicalDatastoreType store, final YangInstanceIdentifier path, final NormalizedNode data) {
- verifyNotNull(rwTx).merge(store, path, data);
+ public void merge(final YangInstanceIdentifier path, final NormalizedNode data) {
+ verifyNotNull(rwTx).merge(CONFIGURATION, path, data);
}
@Override
- public void create(final LogicalDatastoreType store, final YangInstanceIdentifier path, final NormalizedNode data,
+ public void create(final YangInstanceIdentifier path, final NormalizedNode data,
final SchemaContext schemaContext) {
if (data instanceof MapNode || data instanceof LeafSetNode) {
final NormalizedNode emptySubTree = ImmutableNodes.fromInstanceId(schemaContext, path);
- merge(LogicalDatastoreType.CONFIGURATION, YangInstanceIdentifier.create(emptySubTree.getIdentifier()),
- emptySubTree);
+ merge(YangInstanceIdentifier.create(emptySubTree.getIdentifier()), emptySubTree);
TransactionUtil.ensureParentsByMerge(path, schemaContext, this);
final Collection<? extends NormalizedNode> children = ((NormalizedNodeContainer<?>) data).body();
final BatchedExistenceCheck check =
- BatchedExistenceCheck.start(verifyNotNull(rwTx), LogicalDatastoreType.CONFIGURATION, path, children);
+ BatchedExistenceCheck.start(verifyNotNull(rwTx), CONFIGURATION, path, children);
for (final NormalizedNode child : children) {
final YangInstanceIdentifier childPath = path.node(child.getIdentifier());
- verifyNotNull(rwTx).put(store, childPath, child);
+ verifyNotNull(rwTx).put(CONFIGURATION, childPath, child);
}
// ... finally collect existence checks and abort the transaction if any of them failed.
checkExistence(path, check);
} else {
- final FluentFuture<Boolean> isExists = verifyNotNull(rwTx).exists(store, path);
+ final FluentFuture<Boolean> isExists = verifyNotNull(rwTx).exists(CONFIGURATION, path);
checkItemDoesNotExists(isExists, path);
TransactionUtil.ensureParentsByMerge(path, schemaContext, this);
- verifyNotNull(rwTx).put(store, path, data);
+ verifyNotNull(rwTx).put(CONFIGURATION, path, data);
}
}
@Override
- public void replace(final LogicalDatastoreType store, final YangInstanceIdentifier path, final NormalizedNode data,
+ public void replace(final YangInstanceIdentifier path, final NormalizedNode data,
final SchemaContext schemaContext) {
if (data instanceof MapNode || data instanceof LeafSetNode) {
final NormalizedNode emptySubtree = ImmutableNodes.fromInstanceId(schemaContext, path);
- merge(LogicalDatastoreType.CONFIGURATION, YangInstanceIdentifier.create(emptySubtree.getIdentifier()),
- emptySubtree);
+ merge(YangInstanceIdentifier.create(emptySubtree.getIdentifier()), emptySubtree);
TransactionUtil.ensureParentsByMerge(path, schemaContext, this);
for (final NormalizedNode child : ((NormalizedNodeContainer<?>) data).body()) {
final YangInstanceIdentifier childPath = path.node(child.getIdentifier());
- verifyNotNull(rwTx).put(store, childPath, child);
+ verifyNotNull(rwTx).put(CONFIGURATION, childPath, child);
}
} else {
TransactionUtil.ensureParentsByMerge(path, schemaContext, this);
- verifyNotNull(rwTx).put(store, path, data);
+ verifyNotNull(rwTx).put(CONFIGURATION, path, data);
}
}