/**
* a versionable node is being copied:
* copied properties declared by mix:versionable need to be
* adjusted accordingly.
*/
VersionManager manager = session.getVersionManager();
if (fullVersionable) {
if (propName.equals(NameConstants.JCR_VERSIONHISTORY)) {
// jcr:versionHistory
VersionHistoryInfo history =
manager.getVersionHistory(session, newState);
InternalValue value = InternalValue.create(
history.getVersionHistoryId().getUUID());
newChildState.setValues(new InternalValue[] { value });
} else if (propName.equals(NameConstants.JCR_BASEVERSION)
|| propName.equals(NameConstants.JCR_PREDECESSORS)) {
// jcr:baseVersion or jcr:predecessors
VersionHistoryInfo history =
manager.getVersionHistory(session, newState);
InternalValue value = InternalValue.create(
history.getRootVersionId().getUUID());
newChildState.setValues(new InternalValue[] { value });
} else if (propName.equals(NameConstants.JCR_ISCHECKEDOUT)) {
// jcr:isCheckedOut
newChildState.setValues(new InternalValue[]{InternalValue.create(true)});
}
} else {
// for simple versionable, we just initialize the
// version history when we see the jcr:isCheckedOut
if (propName.equals(NameConstants.JCR_ISCHECKEDOUT)) {
// jcr:isCheckedOut
newChildState.setValues(new InternalValue[]{InternalValue.create(true)});
manager.getVersionHistory(session, newState);
}
}
}
if (newChildState.getType() == PropertyType.REFERENCE) {