changesLog.add(ItemState.createAddedState(versionData));
// jcr:primaryType
TransientPropertyData propData =
TransientPropertyData.createPropertyData(versionData, Constants.JCR_PRIMARYTYPE, PropertyType.NAME, false,
new TransientValueData(Constants.NT_VERSION));
changesLog.add(ItemState.createAddedState(propData));
// jcr:mixinTypes
propData =
TransientPropertyData.createPropertyData(versionData, Constants.JCR_MIXINTYPES, PropertyType.NAME, true,
new TransientValueData(Constants.MIX_REFERENCEABLE));
changesLog.add(ItemState.createAddedState(propData));
// jcr:uuid
propData =
TransientPropertyData.createPropertyData(versionData, Constants.JCR_UUID, PropertyType.STRING, false,
new TransientValueData(uuid));
changesLog.add(ItemState.createAddedState(propData));
// jcr:created
propData =
TransientPropertyData.createPropertyData(versionData, Constants.JCR_CREATED, PropertyType.DATE, false,
new TransientValueData(session.getTransientNodesManager().getWorkspaceDataManager().getCurrentTime()));
changesLog.add(ItemState.createAddedState(propData));
// A reference to V is added to the jcr:successors property of
// each of the versions identified in Vs jcr:predecessors property.
List<ValueData> predecessors =
((PropertyData)dataManager.getItemData(versionableNodeData, new QPathEntry(Constants.JCR_PREDECESSORS, 0),
ItemType.PROPERTY)).getValues();
List<ValueData> predecessorsNew = new ArrayList<ValueData>();
for (ValueData predecessorValue : predecessors)
{
byte[] pib;
try
{
pib = predecessorValue.getAsByteArray();
}
catch (IOException e)
{
throw new RepositoryException(e);
}
VersionImpl predecessor = (VersionImpl)dataManager.getItemByIdentifier(new String(pib), false);
predecessor.addSuccessor(versionData.getIdentifier(), changesLog);
predecessorsNew.add(new TransientValueData(pib));
}
// jcr:predecessors
propData =
TransientPropertyData.createPropertyData(versionData, Constants.JCR_PREDECESSORS, PropertyType.REFERENCE,
true, predecessorsNew);
changesLog.add(ItemState.createAddedState(propData));
// jcr:frozenNode
NodeData frozenData =
TransientNodeData.createNodeData(versionData, Constants.JCR_FROZENNODE, Constants.NT_FROZENNODE);
changesLog.add(ItemState.createAddedState(frozenData));
propData =
TransientPropertyData.createPropertyData(frozenData, Constants.JCR_PRIMARYTYPE, PropertyType.NAME, false,
new TransientValueData(Constants.NT_FROZENNODE));
changesLog.add(ItemState.createAddedState(propData));
propData =
TransientPropertyData.createPropertyData(frozenData, Constants.JCR_MIXINTYPES, PropertyType.NAME, true,
new TransientValueData(Constants.MIX_REFERENCEABLE));
changesLog.add(ItemState.createAddedState(propData));
propData =
TransientPropertyData.createPropertyData(frozenData, Constants.JCR_UUID, PropertyType.STRING, false,
new TransientValueData(frozenData.getIdentifier()));
changesLog.add(ItemState.createAddedState(propData));
FrozenNodeInitializer visitor =
new FrozenNodeInitializer(frozenData, session.getTransientNodesManager(), session.getWorkspace()
.getNodeTypesHolder(), changesLog, session.getValueFactory());