public void save(final CompositeChangesLog changesLog) throws RepositoryException, InvalidItemStateException
{
final ChangesLogIterator logIterator = changesLog.getLogIterator();
final TransactionChangesLog versionLogs = new TransactionChangesLog();
final TransactionChangesLog nonVersionLogs = new TransactionChangesLog();
while (logIterator.hasNextLog())
{
List<ItemState> vstates = new ArrayList<ItemState>();
List<ItemState> nvstates = new ArrayList<ItemState>();
PlainChangesLog changes = logIterator.nextLog();
for (ItemState change : changes.getAllStates())
{
if (isSystemDescendant(change.getData().getQPath()) && !this.equals(versionDataManager))
{
vstates.add(change);
}
else
{
nvstates.add(change);
}
}
if (vstates.size() > 0)
{
if (nvstates.size() > 0)
{
// we have pair of logs for system and non-system (this) workspaces
final String pairId = IdGenerator.generate();
versionLogs.addLog(PlainChangesLogImpl.createCopy(vstates, pairId, changes));
nonVersionLogs.addLog(PlainChangesLogImpl.createCopy(nvstates, pairId, changes));
}
else
{
versionLogs.addLog(PlainChangesLogImpl.createCopy(vstates, changes));
nonVersionLogs.addLog(PlainChangesLogImpl.createCopy(nvstates, changes));
}
}
else if (nvstates.size() > 0)
{
nonVersionLogs.addLog(PlainChangesLogImpl.createCopy(nvstates, changes));
}
}
if (versionLogs.getSize() > 0)
{
versionDataManager.save(versionLogs, txResourceManager);
}
if (nonVersionLogs.getSize() > 0)
{
super.save(nonVersionLogs);
}
}