boolean progress = true;
while (!addEvents.isEmpty() && progress) {
progress = false;
for (Iterator<Event> it = addEvents.iterator(); it.hasNext();) {
Event ev = it.next();
NodeId parentId = ev.getParentId();
HierarchyEntry parent = null;
if (parentId != null) {
parent = hierarchyMgr.lookup(parentId);
if (parent == null && ev.getPath() != null && parentId.getUniqueID() != null) {
// parentID contains a uniqueID part -> try to lookup
// the parent by path.
try {
Path parentPath = ev.getPath().getAncestor(1);
parent = hierarchyMgr.lookup(parentPath);
} catch (RepositoryException e) {
// should not occur
log.debug(e.getMessage());
}
}
}
if (parent != null && parent.denotesNode()) {
((NodeEntry) parent).refresh(ev);
it.remove();
progress = true;
}
}
}
/* process all other events (removal, property changed) */
for (Event event : events) {
int type = event.getType();
NodeId parentId = event.getParentId();
NodeEntry parent = (parentId != null) ? (NodeEntry) hierarchyMgr.lookup(parentId) : null;
switch (type) {
case Event.NODE_REMOVED:
case Event.PROPERTY_REMOVED:
// notify parent about removal if its child-entry.