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(new PlainChangesLogImpl(vstates, changes.getSessionId(), changes.getEventType(),
pairId));
nonVersionLogs.addLog(new PlainChangesLogImpl(nvstates, changes.getSessionId(), changes.getEventType(),
pairId));
}
else
{
versionLogs.addLog(new PlainChangesLogImpl(vstates, changes.getSessionId(), changes.getEventType()));
}
}
else if (nvstates.size() > 0)
{
nonVersionLogs.addLog(new PlainChangesLogImpl(nvstates, changes.getSessionId(), changes.getEventType()));
}
}
if (versionLogs.getSize() > 0)
{
versionDataManager.save(versionLogs);
}
if (nonVersionLogs.getSize() > 0)
{
super.save(nonVersionLogs);
}
}