{
PlainChangesLog subLog = logIterator.nextLog();
String sessionId = subLog.getSessionId();
ExtendedSession userSession;
if (subLog.getSession() != null)
{
userSession = subLog.getSession();
}
else
{
userSession = sessionRegistry.getSession(sessionId);
}
if (userSession != null)
{
for (ItemState itemState : subLog.getAllStates())
{
if (itemState.isEventFire())
{
ItemData item = itemState.getData();
try
{
int eventType = eventType(itemState);
if (eventType != SKIP_EVENT && isTypeMatch(criteria, eventType)
&& isPathMatch(criteria, item, userSession) && isIdentifierMatch(criteria, item)
&& isNodeTypeMatch(criteria, item, userSession, subLog)
&& isSessionMatch(criteria, sessionId))
{
String path =
userSession.getLocationFactory().createJCRPath(item.getQPath()).getAsString(false);
if (eventType== ExtendedEvent.NODE_MOVED)
{
String oldPath =
userSession.getLocationFactory().createJCRPath(itemState.getOldPath()).getAsString(false);
Map<String, String> info = new HashMap<String, String>();
if(itemState.isMoved())
{
info.put(ExtendedEvent.SRC_ABS_PATH, oldPath);
info.put(ExtendedEvent.DEST_ABS_PATH, path);
}
else if (itemState.isOrdered())
{
info.put(ExtendedEvent.SRC_CHILD_REL_PATH, oldPath);
info.put(ExtendedEvent.DEST_CHILD_REL_PATH, path);
}
events.add(new EventImpl(eventType, path, userSession.getUserID(), info));
}
else
{
events.add(new EventImpl(eventType, path, userSession.getUserID()));
}
}
}