PropertyState predecessorIds = versionNode.getProperty(JCR_PREDECESSORS);
for (String succId : successorIds.getValue(Type.REFERENCES)) {
NodeBuilder successor = getVersionById(vh, succId);
PropertyBuilder pb = new PropertyBuilder(Type.REFERENCE).setArray();
pb.setName(JCR_PREDECESSORS).setValues(successor.getProperty(JCR_PREDECESSORS).getValue(Type.REFERENCES));
pb.removeValue(versionId);
pb.setValues(predecessorIds.getValue(Type.REFERENCES));
successor.setProperty(pb.getPropertyState());
}
for (String predId : predecessorIds.getValue(Type.REFERENCES)) {
NodeBuilder predecessor = getVersionById(vh, predId);
PropertyBuilder pb = new PropertyBuilder(Type.REFERENCE).setArray();
pb.setName(JCR_SUCCESSORS).setValues(predecessor.getProperty(JCR_SUCCESSORS).getValue(Type.REFERENCES));
pb.removeValue(versionId);
pb.setValues(successorIds.getValue(Type.REFERENCES));
predecessor.setProperty(pb.getPropertyState());
}
versionNode.remove();
}