Tabnine Logo
HumanReadableText
Code IndexAdd Tabnine to your IDE (free)

How to use
HumanReadableText
in
org.apache.james.imap.api.display

Best Java code snippets using org.apache.james.imap.api.display.HumanReadableText (Showing top 20 results out of 315)

origin: org.apache.james/apache-james-imap-api

public static final HumanReadableText unseen(long numberUnseen) {
  return new HumanReadableText("org.apache.james.imap.UNSEEN", "Message " + numberUnseen + " is first unseen");
}
origin: org.apache.james.protocols/protocols-imap

@Override
public String localize(HumanReadableText text, Locales locales) {
  
  String result;
  if (text == null) {
    result = null;
  } else {
    //FIXME implement the locale selection
    final Locale chosenLocale = Locale.US;
    //FIXME implement the localized value lookup depending on chosenLocale
    result = text.getDefaultValue();
    
    Object[] params = text.getParameters();
    if (params != null && params.length > 0) {
      MessageFormat messageFormat = new MessageFormat(result, chosenLocale);
      result = messageFormat.format(params);
    }
  }
  return result;
}
origin: org.apache.james/apache-james-imap-processor

private void handleResponseException(final ImapProcessor.Responder responder, MailboxException e, final HumanReadableText message, ImapSession session) {
  session.getLog().info(message.toString());
  session.getLog().debug(message.toString(), e);
  // TODO: consider whether error message should be passed to the user
  final StatusResponse response = factory.untaggedNo(message);
  responder.respond(response);
}
origin: org.apache.james/apache-james-imap-processor

protected void permanentFlags(Responder responder, MessageManager.MetaData metaData, SelectedMailbox selected) {
  final Flags permanentFlags = metaData.getPermanentFlags();
  if (permanentFlags.contains(Flags.Flag.USER)) {
    permanentFlags.add(selected.getApplicableFlags());
  }
  final StatusResponse untaggedOk = factory.untaggedOk(HumanReadableText.permanentFlags(permanentFlags), ResponseCode.permanentFlags(permanentFlags));
  responder.respond(untaggedOk);
}

origin: org.apache.james.protocols/protocols-imap

private boolean unseen(Responder responder, MessageUid firstUnseen, SelectedMailbox selected, MailboxSession session) throws MailboxException {
  if (firstUnseen != null) {
    final MessageUid unseenUid = firstUnseen;
    int msn = selected.msn(unseenUid);
    if (msn == SelectedMailbox.NO_SUCH_MESSAGE) {
      LOGGER.debug("No message found with uid {} in mailbox {}", unseenUid, selected.getPath().getFullName(session.getPathDelimiter()));
      return false;
    } 
    final StatusResponse untaggedOk = statusResponseFactory.untaggedOk(HumanReadableText.unseen(msn), ResponseCode.unseen(msn));
    responder.respond(untaggedOk);
  }
  return true;
}
origin: org.apache.james.protocols/protocols-imap

  @Test
  public void processShouldResponseNoWhenManagerThrowsAnnotationException() throws Exception {
    doThrow(AnnotationException.class).when(mockMailboxManager).updateAnnotations(eq(inbox), eq(mockMailboxSession), eq(mailboxAnnotations));

    processor.process(request, mockResponder, mockImapSession);

    verify(mockStatusResponseFactory, times(1)).taggedNo(any(String.class), any(ImapCommand.class), humanTextCaptor.capture());

    assertThat(humanTextCaptor.getAllValues().get(FIRST_ELEMENT_INDEX).getKey()).isEqualTo(HumanReadableText.MAILBOX_ANNOTATION_KEY);

  }
}
origin: org.apache.james.protocols/protocols-imap

protected void permanentFlags(Responder responder, MessageManager.MetaData metaData, SelectedMailbox selected) {
  final Flags permanentFlags = metaData.getPermanentFlags();
  if (permanentFlags.contains(Flags.Flag.USER)) {
    permanentFlags.add(selected.getApplicableFlags());
  }
  final StatusResponse untaggedOk = factory.untaggedOk(HumanReadableText.permanentFlags(permanentFlags), ResponseCode.permanentFlags(permanentFlags));
  responder.respond(untaggedOk);
}

origin: org.apache.james/apache-james-imap-processor

private boolean unseen(Responder responder, Long firstUnseen, final SelectedMailbox selected, MailboxSession session) throws MailboxException {
  if (firstUnseen != null) {
    final long unseenUid = firstUnseen;
    int msn = selected.msn(unseenUid);
    if (msn == SelectedMailbox.NO_SUCH_MESSAGE) {
      if (session.getLog().isDebugEnabled()) {
        session.getLog().debug("No message found with uid " + unseenUid + " in mailbox " + selected.getPath().getFullName(session.getPathDelimiter()));
      }
      return false;
    } 
    final StatusResponse untaggedOk = statusResponseFactory.untaggedOk(HumanReadableText.unseen(msn), ResponseCode.unseen(msn));
    responder.respond(untaggedOk);
  }
  return true;
}
origin: org.apache.james.protocols/protocols-imap

public static final HumanReadableText unseen(long numberUnseen) {
  return new HumanReadableText("org.apache.james.imap.UNSEEN", "MailboxMessage " + numberUnseen + " is first unseen");
}
origin: org.apache.james/apache-james-imap-message

/**
 * @see Localizer#localize(HumanReadableText, Locales)
 */
public String localize(HumanReadableText text, Locales locales) {
  
  String result;
  if (text == null) {
    result = null;
  } else {
    //FIXME implement the locale selection
    final Locale chosenLocale = Locale.US;
    //FIXME implement the localized value lookup depending on chosenLocale
    result = text.getDefaultValue();
    
    Object[] params = text.getParameters();
    if (params != null && params.length > 0) {
      MessageFormat messageFormat = new MessageFormat(result, chosenLocale);
      result = messageFormat.format(params);
    }
  }
  return result;
}
origin: org.apache.james/apache-james-imap-api

public static final HumanReadableText permanentFlags(Flags flags) {
  String text;
  if (flags.getSystemFlags() != null && flags.getSystemFlags().length > 0) {
    text = "Limited";
  } else {
    text = "No permanent flags permitted";
  }
  return new HumanReadableText("org.apache.james.imap.PERMANENT_FLAGS", text);
}
origin: org.apache.james.protocols/protocols-imap

public static final HumanReadableText permanentFlags(Flags flags) {
  String text;
  if (flags.getSystemFlags() != null && flags.getSystemFlags().length > 0) {
    text = "Limited";
  } else {
    text = "No permanent flags permitted";
  }
  return new HumanReadableText("org.apache.james.imap.PERMANENT_FLAGS", text);
}
origin: org.apache.james.protocols/protocols-imap

@Override
protected void doProcess(SetQuotaRequest message, ImapSession session, String tag, ImapCommand command, Responder responder) {
  Object[] params = new Object[]{
    "Full admin rights",
    command.getName(),
    "Can not perform SETQUOTA commands"
  };
  HumanReadableText humanReadableText = new HumanReadableText(HumanReadableText.UNSUFFICIENT_RIGHTS_KEY, HumanReadableText.UNSUFFICIENT_RIGHTS_DEFAULT_VALUE, params);
  no(command, tag, responder, humanReadableText);
}
origin: org.apache.james.protocols/protocols-imap

@Override
protected void doProcess(SetAnnotationRequest message, ImapSession session, String tag, ImapCommand command,
             Responder responder) {
  final MailboxManager mailboxManager = getMailboxManager();
  final MailboxSession mailboxSession = ImapSessionUtils.getMailboxSession(session);
  final String mailboxName = message.getMailboxName();
  try {
    MailboxPath mailboxPath = PathConverter.forSession(session).buildFullPath(mailboxName);
    mailboxManager.updateAnnotations(mailboxPath, mailboxSession, message.getMailboxAnnotations());
    okComplete(command, tag, responder);
  } catch (MailboxNotFoundException e) {
    LOGGER.info("{} failed for mailbox {}", command.getName(), mailboxName, e);
    no(command, tag, responder, HumanReadableText.FAILURE_NO_SUCH_MAILBOX, StatusResponse.ResponseCode.tryCreate());
  } catch (AnnotationException e) {
    LOGGER.info("{} failed for mailbox {}", command.getName(), mailboxName, e);
    no(command, tag, responder, new HumanReadableText(HumanReadableText.MAILBOX_ANNOTATION_KEY, e.getMessage()));
  } catch (MailboxException e) {
    LOGGER.error("{} failed for mailbox {}", command.getName(), mailboxName, e);
    no(command, tag, responder, HumanReadableText.GENERIC_FAILURE_DURING_PROCESSING);
  }
}
origin: org.apache.james/apache-james-imap-processor

        mailboxName
    };
    HumanReadableText text = new HumanReadableText(HumanReadableText.UNSUFFICIENT_RIGHTS_KEY, HumanReadableText.UNSUFFICIENT_RIGHTS_DEFAULT_VALUE, params);
    no(command, tag, responder, text);
  HumanReadableText text = new HumanReadableText(HumanReadableText.UNSUPPORTED_RIGHT_KEY, HumanReadableText.UNSUPPORTED_RIGHT_DEFAULT_VALUE, params);
  taggedBad(command, tag, responder, text);
} catch (MailboxNotFoundException e) {
origin: org.apache.james/apache-james-imap-processor

        mailboxName
    };
    HumanReadableText text = new HumanReadableText(HumanReadableText.UNSUFFICIENT_RIGHTS_KEY, HumanReadableText.UNSUFFICIENT_RIGHTS_DEFAULT_VALUE, params);
    no(command, tag, responder, text);
  HumanReadableText text = new HumanReadableText(HumanReadableText.UNSUPPORTED_RIGHT_KEY, HumanReadableText.UNSUPPORTED_RIGHT_DEFAULT_VALUE, params);
  taggedBad(command, tag, responder, text);
} catch (MailboxNotFoundException e) {
origin: org.apache.james/apache-james-imap-processor

    mailboxName
};
HumanReadableText text = new HumanReadableText(HumanReadableText.UNSUFFICIENT_RIGHTS_KEY, HumanReadableText.UNSUFFICIENT_RIGHTS_DEFAULT_VALUE, params);
no(command, tag, responder, text);
origin: org.apache.james.protocols/protocols-imap

        mailboxName
    };
    HumanReadableText text = new HumanReadableText(HumanReadableText.UNSUFFICIENT_RIGHTS_KEY, HumanReadableText.UNSUFFICIENT_RIGHTS_DEFAULT_VALUE, params);
    no(command, tag, responder, text);
  } else {
  HumanReadableText text = new HumanReadableText(HumanReadableText.UNSUPPORTED_RIGHT_KEY, HumanReadableText.UNSUPPORTED_RIGHT_DEFAULT_VALUE, params);
  taggedBad(command, tag, responder, text);
} catch (MailboxNotFoundException e) {
origin: org.apache.james/apache-james-imap-processor

    mailboxName
};
HumanReadableText text = new HumanReadableText(HumanReadableText.UNSUFFICIENT_RIGHTS_KEY, HumanReadableText.UNSUFFICIENT_RIGHTS_DEFAULT_VALUE, params);
no(command, tag, responder, text);
origin: org.apache.james.protocols/protocols-imap

        mailboxName
    };
    HumanReadableText text = new HumanReadableText(HumanReadableText.UNSUFFICIENT_RIGHTS_KEY, HumanReadableText.UNSUFFICIENT_RIGHTS_DEFAULT_VALUE, params);
    no(command, tag, responder, text);
  } else {
  HumanReadableText text = new HumanReadableText(HumanReadableText.UNSUPPORTED_RIGHT_KEY, HumanReadableText.UNSUPPORTED_RIGHT_DEFAULT_VALUE, params);
  taggedBad(command, tag, responder, text);
} catch (MailboxNotFoundException e) {
org.apache.james.imap.api.displayHumanReadableText

Javadoc

Keys human response text that may be displayed to the user.

Most used methods

  • <init>
  • getDefaultValue
    Gets the default value for this text.
  • getParameters
    Gets parameters that may be substituted into the text.
  • permanentFlags
  • unseen
  • getKey
    Gets a unique key that can be used to loopup the text. How this is performed is implementation indep
  • toString

Popular in Java

  • Finding current android device location
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • onRequestPermissionsResult (Fragment)
  • onCreateOptionsMenu (Activity)
  • Container (java.awt)
    A generic Abstract Window Toolkit(AWT) container object is a component that can contain other AWT co
  • Collections (java.util)
    This class consists exclusively of static methods that operate on or return collections. It contains
  • Deque (java.util)
    A linear collection that supports element insertion and removal at both ends. The name deque is shor
  • ConcurrentHashMap (java.util.concurrent)
    A plug-in replacement for JDK1.5 java.util.concurrent.ConcurrentHashMap. This version is based on or
  • ImageIO (javax.imageio)
  • HttpServletRequest (javax.servlet.http)
    Extends the javax.servlet.ServletRequest interface to provide request information for HTTP servlets.
  • From CI to AI: The AI layer in your organization
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