Tabnine Logo
MailboxExistsException.<init>
Code IndexAdd Tabnine to your IDE (free)

How to use
org.apache.james.mailbox.exception.MailboxExistsException
constructor

Best Java code snippets using org.apache.james.mailbox.exception.MailboxExistsException.<init> (Showing top 6 results out of 315)

origin: org.apache.james/apache-james-mailbox-jpa

/**
 * Commit the transaction. If the commit fails due a conflict in a unique key constraint a {@link MailboxExistsException}
 * will get thrown
 */
@Override
protected void commit() throws MailboxException {
  try {
    getEntityManager().getTransaction().commit();
  } catch (PersistenceException e) {
    if (e instanceof EntityExistsException) {
      throw new MailboxExistsException(lastMailboxName);
    }
    if (e instanceof RollbackException) {
      Throwable t = e.getCause();
      if (t != null && t instanceof EntityExistsException) {
        throw new MailboxExistsException(lastMailboxName);
      }
    }
    throw new MailboxException("Commit of transaction failed", e);
  }
}

origin: org.apache.james/apache-james-mailbox-cassandra

@Override
public MailboxId save(Mailbox mailbox) throws MailboxException {
  Preconditions.checkArgument(mailbox instanceof SimpleMailbox);
  SimpleMailbox cassandraMailbox = (SimpleMailbox) mailbox;
  CassandraId cassandraId = retrieveId(cassandraMailbox);
  cassandraMailbox.setMailboxId(cassandraId);
  boolean applied = trySave(cassandraMailbox, cassandraId).join();
  if (!applied) {
    throw new MailboxExistsException(mailbox.generateAssociatedPath().asString());
  }
  return cassandraId;
}
origin: org.apache.james/apache-james-mailbox-memory

@Override
public MailboxId save(Mailbox mailbox) throws MailboxException {
  InMemoryId id = (InMemoryId) mailbox.getMailboxId();
  if (id == null) {
    id = InMemoryId.of(mailboxIdGenerator.incrementAndGet());
    mailbox.setMailboxId(id);
  } else {
    try {
      Mailbox mailboxWithPreviousName = findMailboxById(id);
      mailboxesByPath.remove(mailboxWithPreviousName.generateAssociatedPath());
    } catch (MailboxNotFoundException e) {
      // No need to remove the previous mailbox
    }
  }
  Mailbox previousMailbox = mailboxesByPath.putIfAbsent(mailbox.generateAssociatedPath(), mailbox);
  if (previousMailbox != null) {
    throw new MailboxExistsException(mailbox.getName());
  }
  return mailbox.getMailboxId();
}
origin: org.apache.james/apache-james-mailbox-store

throw new MailboxExistsException(sanitizedMailboxPath.asString());
origin: org.apache.james/apache-james-mailbox-store

@Override
public void renameMailbox(MailboxPath from, MailboxPath to, MailboxSession session) throws MailboxException {
  LOGGER.debug("renameMailbox {} to {}", from, to);
  if (mailboxExists(to, session)) {
    throw new MailboxExistsException(to.toString());
  }
  if (isMailboxNameTooLong(to)) {
    throw new TooLongMailboxNameException("Mailbox name exceed maximum size of " + MAX_MAILBOX_NAME_LENGTH + " characters");
  }
  assertIsOwner(session, from);
  MailboxMapper mapper = mailboxSessionMapperFactory.getMailboxMapper(session);
  mapper.execute(Mapper.toTransaction(() -> doRenameMailbox(from, to, session, mapper)));
}
origin: org.apache.james/apache-james-mailbox-jpa

@Override
public MailboxId save(Mailbox mailbox) throws MailboxException {
  try {
    if (isPathAlreadyUsedByAnotherMailbox(mailbox)) {
      throw new MailboxExistsException(mailbox.getName());
    }
    this.lastMailboxName = mailbox.getName();
    JPAMailbox persistedMailbox = JPAMailbox.from(mailbox);
    getEntityManager().persist(persistedMailbox);
    if (!(mailbox instanceof JPAMailbox)) {
      mailbox.setMailboxId(persistedMailbox.getMailboxId());
    }
    return mailbox.getMailboxId();
  } catch (PersistenceException e) {
    throw new MailboxException("Save of mailbox " + mailbox.getName() + " failed", e);
  } 
}
org.apache.james.mailbox.exceptionMailboxExistsException<init>

Popular methods of MailboxExistsException

  • getMessage

Popular in Java

  • Finding current android device location
  • setRequestProperty (URLConnection)
  • runOnUiThread (Activity)
  • getSharedPreferences (Context)
  • FlowLayout (java.awt)
    A flow layout arranges components in a left-to-right flow, much like lines of text in a paragraph. F
  • Calendar (java.util)
    Calendar is an abstract base class for converting between a Date object and a set of integer fields
  • Date (java.util)
    A specific moment in time, with millisecond precision. Values typically come from System#currentTime
  • ResourceBundle (java.util)
    ResourceBundle is an abstract class which is the superclass of classes which provide Locale-specifi
  • JOptionPane (javax.swing)
  • Join (org.hibernate.mapping)
  • Best plugins for Eclipse
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now