Search in sources :

Example 1 with CreateTag

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

the class Mailbox method createTag.

public Tag createTag(OperationContext octxt, String name, Color color) throws ServiceException {
    name = StringUtil.stripControlCharacters(name);
    if (Strings.isNullOrEmpty(name)) {
        throw ServiceException.INVALID_REQUEST("tag must have a name", null);
    }
    CreateTag redoRecorder = new CreateTag(mId, name, color);
    boolean success = false;
    try {
        beginTransaction("createTag", octxt, redoRecorder);
        if (!hasFullAccess()) {
            throw ServiceException.PERM_DENIED("you do not have sufficient permissions");
        }
        CreateTag redoPlayer = (CreateTag) currentChange().getRedoPlayer();
        int tagId = redoPlayer == null ? ID_AUTO_INCREMENT : redoPlayer.getTagId();
        Tag tag = createTagInternal(tagId, name, color, true);
        redoRecorder.setTagId(tag.getId());
        success = true;
        return tag;
    } finally {
        endTransaction(success);
    }
}
Also used : CreateTag(com.zimbra.cs.redolog.op.CreateTag) AlterItemTag(com.zimbra.cs.redolog.op.AlterItemTag) CreateTag(com.zimbra.cs.redolog.op.CreateTag) DbTag(com.zimbra.cs.db.DbTag) RefreshMountpoint(com.zimbra.cs.redolog.op.RefreshMountpoint) TargetConstraint(com.zimbra.cs.mailbox.MailItem.TargetConstraint) CreateMountpoint(com.zimbra.cs.redolog.op.CreateMountpoint)

Aggregations

DbTag (com.zimbra.cs.db.DbTag)1 TargetConstraint (com.zimbra.cs.mailbox.MailItem.TargetConstraint)1 AlterItemTag (com.zimbra.cs.redolog.op.AlterItemTag)1 CreateMountpoint (com.zimbra.cs.redolog.op.CreateMountpoint)1 CreateTag (com.zimbra.cs.redolog.op.CreateTag)1 RefreshMountpoint (com.zimbra.cs.redolog.op.RefreshMountpoint)1