Search in sources :

Example 1 with NormalizedTags

use of com.zimbra.cs.mailbox.Tag.NormalizedTags in project zm-mailbox by Zimbra.

the class Mailbox method alterTag.

public void alterTag(OperationContext octxt, int[] itemIds, MailItem.Type type, String tagName, boolean addTag, TargetConstraint tcon) throws ServiceException {
    AlterItemTag redoRecorder = new AlterItemTag(mId, itemIds, type, tagName, addTag, tcon);
    boolean success = false;
    try {
        beginTransaction("alterTag", octxt, redoRecorder);
        setOperationTargetConstraint(tcon);
        Tag tag;
        try {
            tag = getTagByName(tagName);
        } catch (NoSuchItemException nsie) {
            if (tagName.startsWith(Tag.FLAG_NAME_PREFIX)) {
                throw nsie;
            }
            Tag.NormalizedTags ntags = new NormalizedTags(this, new String[] { tagName }, addTag, true);
            if (ntags.getTags().length == 0) {
                success = true;
                return;
            }
            tag = getTagByName(ntags.getTags()[0]);
        }
        alterTag(itemIds, type, tag, addTag);
        success = true;
    } finally {
        endTransaction(success);
    }
}
Also used : NormalizedTags(com.zimbra.cs.mailbox.Tag.NormalizedTags) AlterItemTag(com.zimbra.cs.redolog.op.AlterItemTag) CreateTag(com.zimbra.cs.redolog.op.CreateTag) DbTag(com.zimbra.cs.db.DbTag) NoSuchItemException(com.zimbra.cs.mailbox.MailServiceException.NoSuchItemException) AlterItemTag(com.zimbra.cs.redolog.op.AlterItemTag)

Aggregations

DbTag (com.zimbra.cs.db.DbTag)1 NoSuchItemException (com.zimbra.cs.mailbox.MailServiceException.NoSuchItemException)1 NormalizedTags (com.zimbra.cs.mailbox.Tag.NormalizedTags)1 AlterItemTag (com.zimbra.cs.redolog.op.AlterItemTag)1 CreateTag (com.zimbra.cs.redolog.op.CreateTag)1