Mountpoint mpt; try { mpt = mbox.createMountpoint(lc.getOperationContext(), iidParent.getId(), name, ownerId, remoteId, MailItem.getTypeForName(view)); } catch (ServiceException se) { if (se.getCode() == MailServiceException.ALREADY_EXISTS && t.getAttributeBool(MailService.A_FETCH_IF_EXISTS, false)) { Folder folder = mbox.getFolderByName(lc.getOperationContext(), iidParent.getId(), name); if (folder instanceof Mountpoint) mpt = (Mountpoint) folder; else throw se; } else throw se; }
boolean fetchIfExists = t.getAttributeBool(MailService.A_FETCH_IF_EXISTS, false);  CreateMountpointOperation op = new CreateMountpointOperation(session, octxt, mbox, Requester.SOAP, iidParent, name, ownerId, remoteId, view, fetchIfExists); op.schedule(); Mountpoint mpt = op.getMountpoint();
    public Element handle(Element request, Map<String, Object> context) throws ServiceException {        ZimbraSoapContext lc = getZimbraSoapContext(context);        Mailbox mbox = getRequestedMailbox(lc);        Element t = request.getElement(MailService.E_MOUNT);        String name      = t.getAttribute(MailService.A_NAME);        String ownerId   = t.getAttribute(MailService.A_ZIMBRA_ID);        int    remoteId  = (int) t.getAttributeLong(MailService.A_REMOTE_ID);        String view      = t.getAttribute(MailService.A_DEFAULT_VIEW, null);        ItemId iidParent = new ItemId(t.getAttribute(MailService.A_FOLDER), lc);        Mountpoint mpt;        try {            mpt = mbox.createMountpoint(lc.getOperationContext(), iidParent.getId(), name, ownerId, remoteId, MailItem.getTypeForName(view));        } catch (ServiceException se) {            if (se.getCode() == MailServiceException.ALREADY_EXISTS && t.getAttributeBool(MailService.A_FETCH_IF_EXISTS, false)) {                Folder folder = mbox.getFolderByName(lc.getOperationContext(), iidParent.getId(), name);                if (folder instanceof Mountpoint)                    mpt = (Mountpoint) folder;                else                    throw se;            } else                throw se;        }                Element response = lc.createElement(MailService.CREATE_MOUNTPOINT_RESPONSE);        if (mpt != null)            ToXML.encodeMountpoint(response, lc, mpt);        return response;    }