Search in sources :

Example 1 with AlterItemTag

use of com.zimbra.cs.redolog.op.AlterItemTag in project zm-mailbox by Zimbra.

the class Mailbox method alterTag.

public void alterTag(OperationContext octxt, int[] itemIds, MailItem.Type type, Flag.FlagInfo finfo, boolean addTag, TargetConstraint tcon) throws ServiceException {
    AlterItemTag redoRecorder = new AlterItemTag(mId, itemIds, type, finfo.flagName, addTag, tcon);
    boolean success = false;
    try {
        beginTransaction("alterTag", octxt, redoRecorder);
        setOperationTargetConstraint(tcon);
        alterTag(itemIds, type, finfo.toFlag(this), addTag);
        success = true;
    } finally {
        endTransaction(success);
    }
}
Also used : AlterItemTag(com.zimbra.cs.redolog.op.AlterItemTag)

Example 2 with AlterItemTag

use of com.zimbra.cs.redolog.op.AlterItemTag 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

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