use of com.zimbra.client.event.ZCreateTagEvent in project zm-mailbox by Zimbra.
the class ZMailbox method handleCreated.
private void handleCreated(Element created) throws ServiceException {
if (created == null) {
return;
}
List<ZCreateEvent> events = null;
List<ZFolder> parentFixup = null;
for (Element e : created.listElements()) {
ZCreateEvent event = null;
if (e.getName().equals(MailConstants.E_CONV)) {
event = new ZCreateConversationEvent(e);
} else if (e.getName().equals(MailConstants.E_MSG)) {
event = new ZCreateMessageEvent(e);
} else if (e.getName().equals(MailConstants.E_CONTACT)) {
event = new ZCreateContactEvent(e);
} else if (e.getName().equals(MailConstants.E_APPOINTMENT)) {
event = new ZCreateAppointmentEvent(e);
} else if (e.getName().equals(MailConstants.E_TASK)) {
event = new ZCreateTaskEvent(e);
} else if (e.getName().equals(MailConstants.E_FOLDER)) {
String parentId = e.getAttribute(MailConstants.A_FOLDER);
ZFolder parent = getFolderById(parentId);
ZFolder child = new ZFolder(e, parent, this);
addItemIdMapping(child);
event = new ZCreateFolderEvent(child);
parentFixup = parentCheck(parentFixup, child, parent);
} else if (e.getName().equals(MailConstants.E_MOUNT)) {
String parentId = e.getAttribute(MailConstants.A_FOLDER);
ZFolder parent = getFolderById(parentId);
ZMountpoint child = new ZMountpoint(e, parent, this);
addItemIdMapping(child);
addRemoteItemIdMapping(child.getCanonicalRemoteId(), child);
parentFixup = parentCheck(parentFixup, child, parent);
event = new ZCreateMountpointEvent(child);
} else if (e.getName().equals(MailConstants.E_SEARCH)) {
String parentId = e.getAttribute(MailConstants.A_FOLDER);
ZFolder parent = getFolderById(parentId);
ZSearchFolder child = new ZSearchFolder(e, parent, this);
addItemIdMapping(child);
event = new ZCreateSearchFolderEvent(child);
parentFixup = parentCheck(parentFixup, child, parent);
} else if (e.getName().equals(MailConstants.E_TAG)) {
event = new ZCreateTagEvent(new ZTag(e, this));
addTag(((ZCreateTagEvent) event).getTag());
}
if (event != null) {
if (events == null) {
events = new ArrayList<ZCreateEvent>();
}
events.add(event);
}
}
if (parentFixup != null) {
for (ZFolder f : parentFixup) {
ZFolder parent = getFolderById(f.getParentId());
if (parent != null) {
parent.addChild(f);
f.setParent(parent);
}
}
}
if (events != null) {
for (ZCreateEvent event : events) {
for (ZEventHandler handler : mHandlers) {
handler.handleCreate(event, this);
}
}
}
}
Aggregations