}
}
}
//
DomainSession session = parentCtx.getSession();
//
ObjectContext addedCtx = session.unwrap(addedElement);
Status status = addedCtx.getStatus();
//
if (status == Status.TRANSIENT) {
parentCtx.addChild(addedCtx);
} else if (status == Status.PERSISTENT) {
Object insertedParent = addedCtx.getParent();
ObjectContext addedParentCtx = session.unwrap(insertedParent);
//
if (addedParentCtx != parentCtx) {
throw new UnsupportedOperationException("Not yet supported but that should be a node move operation");
}
} else {
throw new IllegalArgumentException();
}
//
if (nextElement == null) {
parentCtx.orderBefore(addedCtx, null);
} else {
ObjectContext nextCtx = session.unwrap(nextElement);
parentCtx.orderBefore(addedCtx, nextCtx);
}
}