else
{
// copy transient as persisted
if (prevState.isNode())
{
NodeData prevData = (NodeData)prevState.getData();
newData =
new PersistedNodeData(prevData.getIdentifier(), prevData.getQPath(), prevData
.getParentIdentifier(), prevData.getPersistedVersion() + 1, prevData.getOrderNumber(), prevData
.getPrimaryTypeName(), prevData.getMixinTypeNames(), prevData.getACL());
}
else
{
PropertyData prevData = (PropertyData)prevState.getData();
if (prevData.getValues() != null) // null if it's DELETE state
{
List<ValueData> values = new ArrayList<ValueData>();
for (int i = 0; i < prevData.getValues().size(); i++)
{
ValueData vd = prevData.getValues().get(i);
if (vd instanceof TransientValueData)
{
TransientValueData tvd = (TransientValueData)vd;
ValueData pvd;
if (vd.isByteArray())
{
pvd = new ByteArrayPersistedValueData(i, vd.getAsByteArray());
values.add(pvd);
}
else
{
// TODO ask dest file from VS provider, can be null after
// TODO for JBC case, the storage connection will evict the replicated Value to read it from the DB
File destFile = null;
if (tvd.getSpoolFile() != null)
{
// spooled to temp file
pvd = new StreamPersistedValueData(i, tvd.getSpoolFile(), destFile);
}
else
{
// with original stream
pvd = new StreamPersistedValueData(i, tvd.getOriginalStream(), destFile);
}
values.add(pvd);
}
tvd.delegate(pvd);
}
else
{
values.add(vd);
}
}
newData =
new PersistedPropertyData(prevData.getIdentifier(), prevData.getQPath(), prevData
.getParentIdentifier(), prevData.getPersistedVersion() + 1, prevData.getType(), prevData
.isMultiValued(), values);
}
else
{
newData =
new PersistedPropertyData(prevData.getIdentifier(), prevData.getQPath(), prevData
.getParentIdentifier(), prevData.getPersistedVersion() + 1, prevData.getType(), prevData
.isMultiValued(), null);
}
}
}