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);
}
}
Aggregations