Search in sources :

Example 1 with MailboxIdConflictException

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

the class CreateMailbox method redo.

@Override
public void redo() throws Exception {
    int opMboxId = getMailboxId();
    Mailbox mbox = MailboxManager.getInstance().getMailboxByAccountId(mAccountId, false);
    if (mbox == null) {
        Account account = Provisioning.getInstance().get(AccountBy.id, mAccountId);
        if (account == null) {
            throw new RedoException("Account " + mAccountId + " does not exist", this);
        }
        mbox = MailboxManager.getInstance().createMailbox(getOperationContext(), account);
        if (mbox == null) {
            //something went really wrong
            throw new RedoException("unable to create mailbox for accountId " + mAccountId, this);
        }
    }
    int mboxId = mbox.getId();
    if (opMboxId == mboxId) {
        mLog.info("Mailbox " + opMboxId + " for account " + mAccountId + " already exists");
        return;
    } else {
        throw new MailboxIdConflictException(mAccountId, opMboxId, mboxId, this);
    }
}
Also used : Account(com.zimbra.cs.account.Account) Mailbox(com.zimbra.cs.mailbox.Mailbox) MailboxIdConflictException(com.zimbra.cs.redolog.MailboxIdConflictException) RedoException(com.zimbra.cs.redolog.RedoException)

Aggregations

Account (com.zimbra.cs.account.Account)1 Mailbox (com.zimbra.cs.mailbox.Mailbox)1 MailboxIdConflictException (com.zimbra.cs.redolog.MailboxIdConflictException)1 RedoException (com.zimbra.cs.redolog.RedoException)1