use of org.sirix.exception.SirixException in project sirix by sirixdb.
the class DBNode method append.
@Override
public DBNode append(Kind kind, QNm name, Atomic value) throws DocumentException {
if (mIsWtx) {
moveRtx();
final XdmNodeWriteTrx wtx = (XdmNodeWriteTrx) mRtx;
try {
return append(wtx, kind, name, value);
} catch (final SirixException e) {
wtx.close();
throw new DocumentException(e);
}
} else {
final XdmNodeWriteTrx wtx = getWtx();
try {
return append(wtx, kind, name, value);
} catch (final SirixException e) {
wtx.close();
throw new DocumentException(e);
}
}
}
use of org.sirix.exception.SirixException in project sirix by sirixdb.
the class DBNode method insertAfter.
private DBNode insertAfter(XdmNodeWriteTrx wtx, SubtreeParser parser) throws DocumentException {
try {
final SubtreeBuilder builder = new SubtreeBuilder(mCollection, wtx, Insert.ASRIGHTSIBLING, Collections.<SubtreeListener<? super AbstractTemporalNode<DBNode>>>emptyList());
parser.parse(builder);
return new DBNode(wtx.moveTo(builder.getStartNodeKey()).get(), mCollection);
} catch (final SirixException e) {
throw new DocumentException(e);
}
}
use of org.sirix.exception.SirixException in project sirix by sirixdb.
the class DBNode method append.
private DBNode append(XdmNodeReadTrx rtx, Node<?> child) throws DocumentException {
try {
SubtreeBuilder builder = null;
if (rtx.hasFirstChild()) {
rtx.moveToLastChild();
builder = new SubtreeBuilder(mCollection, (XdmNodeWriteTrx) rtx, Insert.ASRIGHTSIBLING, Collections.<SubtreeListener<? super AbstractTemporalNode<DBNode>>>emptyList());
} else {
builder = new SubtreeBuilder(mCollection, (XdmNodeWriteTrx) rtx, Insert.ASFIRSTCHILD, Collections.<SubtreeListener<? super AbstractTemporalNode<DBNode>>>emptyList());
}
child.parse(builder);
rtx.moveTo(builder.getStartNodeKey());
} catch (final SirixException e) {
throw new DocumentException(e);
}
return new DBNode(rtx, mCollection);
}
use of org.sirix.exception.SirixException in project sirix by sirixdb.
the class DBNode method replaceWith.
private DBNode replaceWith(XdmNodeWriteTrx wtx, SubtreeParser parser) throws DocumentException {
final SubtreeBuilder builder = createBuilder(wtx);
parser.parse(builder);
try {
return replace(builder.getStartNodeKey(), wtx);
} catch (final SirixException e) {
throw new DocumentException(e);
}
}
use of org.sirix.exception.SirixException in project sirix by sirixdb.
the class DBNode method prepend.
private DBNode prepend(XdmNodeWriteTrx wtx, Node<?> child) throws DocumentException {
try {
SubtreeBuilder builder = null;
if (wtx.hasFirstChild()) {
wtx.moveToFirstChild();
builder = new SubtreeBuilder(mCollection, wtx, Insert.ASLEFTSIBLING, Collections.<SubtreeListener<? super AbstractTemporalNode<DBNode>>>emptyList());
} else {
builder = new SubtreeBuilder(mCollection, wtx, Insert.ASFIRSTCHILD, Collections.<SubtreeListener<? super AbstractTemporalNode<DBNode>>>emptyList());
}
child.parse(builder);
wtx.moveTo(builder.getStartNodeKey());
} catch (final SirixException e) {
throw new DocumentException(e);
}
return new DBNode(wtx, mCollection);
}
Aggregations