Search in sources :

Example 11 with MailServiceException

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

the class CreateMountpoint method redo.

@Override
public void redo() throws Exception {
    int mboxId = getMailboxId();
    Mailbox mailbox = MailboxManager.getInstance().getMailboxById(mboxId);
    try {
        mailbox.createMountpoint(getOperationContext(), mFolderId, mName, mOwnerId, mRemoteId, mRemoteUuid, defaultView, mFlags, Color.fromMetadata(mColor), mReminderEnabled);
    } catch (MailServiceException e) {
        if (e.getCode() == MailServiceException.ALREADY_EXISTS) {
            if (mLog.isInfoEnabled()) {
                mLog.info("Mount " + mId + " already exists in mailbox " + mboxId);
            }
        } else {
            throw e;
        }
    }
}
Also used : Mailbox(com.zimbra.cs.mailbox.Mailbox) MailServiceException(com.zimbra.cs.mailbox.MailServiceException)

Example 12 with MailServiceException

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

the class CreateSavedSearch method redo.

@Override
public void redo() throws Exception {
    int mboxId = getMailboxId();
    Mailbox mailbox = MailboxManager.getInstance().getMailboxById(mboxId);
    try {
        mailbox.createSearchFolder(getOperationContext(), mFolderId, mName, mQuery, mTypes, mSort, mFlags, Color.fromMetadata(mColor));
    } catch (MailServiceException e) {
        String code = e.getCode();
        if (code.equals(MailServiceException.ALREADY_EXISTS)) {
            if (mLog.isInfoEnabled())
                mLog.info("Search " + mSearchId + " already exists in mailbox " + mboxId);
        } else
            throw e;
    }
}
Also used : Mailbox(com.zimbra.cs.mailbox.Mailbox) MailServiceException(com.zimbra.cs.mailbox.MailServiceException)

Example 13 with MailServiceException

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

the class CreateTag method redo.

@Override
public void redo() throws Exception {
    int mboxId = getMailboxId();
    Mailbox mbox = MailboxManager.getInstance().getMailboxById(mboxId);
    try {
        mbox.createTag(getOperationContext(), mName, Color.fromMetadata(mColor));
    } catch (MailServiceException e) {
        String code = e.getCode();
        if (code.equals(MailServiceException.ALREADY_EXISTS)) {
            if (mLog.isInfoEnabled())
                mLog.info("Tag " + mTagId + " already exists in mailbox " + mboxId);
        } else {
            throw e;
        }
    }
}
Also used : Mailbox(com.zimbra.cs.mailbox.Mailbox) MailServiceException(com.zimbra.cs.mailbox.MailServiceException)

Example 14 with MailServiceException

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

the class CreateChat method redo.

@Override
public void redo() throws Exception {
    int mboxId = getMailboxId();
    Mailbox mbox = MailboxManager.getInstance().getMailboxById(mboxId);
    ParsedMessage pm = new ParsedMessage(getMessageBody(), getTimestamp(), mbox.attachmentsIndexingEnabled());
    try {
        mbox.createChat(getOperationContext(), pm, getFolderId(), getFlags(), getTags());
    } catch (MailServiceException e) {
        if (e.getCode() == MailServiceException.ALREADY_EXISTS) {
            mLog.info("Chat " + getMessageId() + " is already in mailbox " + mboxId);
            return;
        } else {
            throw e;
        }
    }
}
Also used : Mailbox(com.zimbra.cs.mailbox.Mailbox) ParsedMessage(com.zimbra.cs.mime.ParsedMessage) MailServiceException(com.zimbra.cs.mailbox.MailServiceException)

Example 15 with MailServiceException

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

the class CreateFolderPath method redo.

@Override
public void redo() throws Exception {
    int mboxId = getMailboxId();
    Mailbox mailbox = MailboxManager.getInstance().getMailboxById(mboxId);
    Folder.FolderOptions fopt = new Folder.FolderOptions();
    fopt.setAttributes(attrs).setColor(Color.fromMetadata(color)).setDate(date);
    fopt.setDefaultView(defaultView).setFlags(flags).setUrl(url).setCustomMetadata(custom);
    try {
        mailbox.createFolder(getOperationContext(), path, fopt);
    } catch (MailServiceException e) {
        String code = e.getCode();
        if (code.equals(MailServiceException.ALREADY_EXISTS)) {
            mLog.info("Folder %s already exists in mailbox %d", path, mboxId);
        } else {
            throw e;
        }
    }
}
Also used : Mailbox(com.zimbra.cs.mailbox.Mailbox) MailServiceException(com.zimbra.cs.mailbox.MailServiceException) Folder(com.zimbra.cs.mailbox.Folder)

Aggregations

MailServiceException (com.zimbra.cs.mailbox.MailServiceException)22 Mailbox (com.zimbra.cs.mailbox.Mailbox)18 OperationContext (com.zimbra.cs.mailbox.OperationContext)6 Folder (com.zimbra.cs.mailbox.Folder)4 ParsedMessage (com.zimbra.cs.mime.ParsedMessage)4 ItemId (com.zimbra.cs.service.util.ItemId)4 ServiceException (com.zimbra.common.service.ServiceException)3 MailItem (com.zimbra.cs.mailbox.MailItem)3 ExportPeriodNotSpecifiedException (com.zimbra.cs.mailbox.MailServiceException.ExportPeriodNotSpecifiedException)3 ExportPeriodTooLongException (com.zimbra.cs.mailbox.MailServiceException.ExportPeriodTooLongException)3 NoSuchItemException (com.zimbra.cs.mailbox.MailServiceException.NoSuchItemException)3 Mountpoint (com.zimbra.cs.mailbox.Mountpoint)3 UserServletException (com.zimbra.cs.service.UserServletException)3 IOException (java.io.IOException)3 CalendarItem (com.zimbra.cs.mailbox.CalendarItem)2 Contact (com.zimbra.cs.mailbox.Contact)2 DeliveryContext (com.zimbra.cs.mailbox.DeliveryContext)2 DeliveryOptions (com.zimbra.cs.mailbox.DeliveryOptions)2 MailSender (com.zimbra.cs.mailbox.MailSender)2 SetCalendarItemData (com.zimbra.cs.mailbox.Mailbox.SetCalendarItemData)2