use of com.zimbra.cs.mailbox.MailServiceException.NoSuchItemException in project zm-mailbox by Zimbra.
the class Mailbox method createTagInternal.
Tag createTagInternal(int tagId, String name, Color color, boolean listed) throws ServiceException {
try {
Tag tag = getTagByName(name);
if (!listed) {
// want an implicitly-created tag but there's already a listed tag, so just return it unchanged
return tag;
} else if (tag.isListed()) {
// can't have two listed tags with the same name
throw MailServiceException.ALREADY_EXISTS(name);
}
// promote an implicitly-created tag to a listed tag
markItemCreated(tag);
tag.setListed();
if (!name.equals(tag.getName())) {
tag.rename(name);
}
tag.setColor(color);
return tag;
} catch (NoSuchItemException nsie) {
// no conflict, so just create the new tag as requested
return Tag.create(this, getNextItemId(tagId), name, color, listed);
}
}
use of com.zimbra.cs.mailbox.MailServiceException.NoSuchItemException in project zm-mailbox by Zimbra.
the class SaveDraft method generateResponse.
protected Element generateResponse(ZimbraSoapContext zsc, ItemIdFormatter ifmt, OperationContext octxt, Mailbox mbox, Message msg, boolean wantImapUid, boolean wantModSeq) {
Element response = zsc.createElement(MailConstants.SAVE_DRAFT_RESPONSE);
try {
int fields = ToXML.NOTIFY_FIELDS;
if (wantImapUid) {
fields |= Change.IMAP_UID;
}
if (wantModSeq) {
fields |= Change.MODSEQ;
}
ToXML.encodeMessageAsMP(response, ifmt, octxt, msg, null, -1, true, true, null, true, false, false, MsgContent.full, fields);
} catch (NoSuchItemException nsie) {
ZimbraLog.soap.info("draft was deleted while serializing response; omitting <m> from response");
} catch (ServiceException e) {
ZimbraLog.soap.warn("problem serializing draft structure to response", e);
}
return response;
}
Aggregations