Package javax.mail

Examples of javax.mail.FetchProfile


            addResult(aFolder);

            Message[] messages = aFolder.getMessages();

            // Use a suitable FetchProfile
            FetchProfile fp = new FetchProfile();
            fp.add(FetchProfile.Item.ENVELOPE);
            fp.add(FetchProfile.Item.FLAGS);
            fp.add("X-Mailer");
            aFolder.fetch(messages, fp);

            // add all messages to the result
            addResult(messages);
View Full Code Here


            addResult(aFolder);

            Message[] messages = aFolder.getMessages();

            // Use a suitable FetchProfile
            FetchProfile fp = new FetchProfile();
            fp.add(FetchProfile.Item.ENVELOPE);
            fp.add(FetchProfile.Item.FLAGS);
            fp.add("X-Mailer");
            aFolder.fetch(messages, fp);

            // add all messages to the result
            addResult(messages);
View Full Code Here

        msgs = folder.getMessages();
        logger
            .debug( "Millis for getting " + msgs.length + " messages: "
                + (System.currentTimeMillis() - time) );
        time = System.currentTimeMillis();
        FetchProfile fp = MessageUtils.createFetchProfile( false, sortfield );

        logger.debug( "Start fetching messages..." );
        folder.fetch( msgs, fp );
        logger.debug( "Millis for fetching " + msgs.length + " Messages: "
            + (System.currentTimeMillis() - time) );
View Full Code Here

   * @param sortfield
   * @return
   */
  public static FetchProfile createFetchProfile( boolean complete, String sortfield ) {

    FetchProfile fp = new FetchProfile();
    if ( complete ) {
      fp.add( FetchProfile.Item.ENVELOPE );
      fp.add( FetchProfile.Item.FLAGS );
      fp.add( FetchProfile.Item.CONTENT_INFO );
      fp.add( IMAPFolder.FetchProfileItem.SIZE );
      fp.add( CubusConstants.FETCH_ITEM_PRIORITY );
      fp.add( UIDFolder.FetchProfileItem.UID );
    }
    else {
      if ( sortfield != null ) {
        if ( MessageListFields.ATTACHMENT_FLAG.name().equals( sortfield ) ) {
          fp.add( FetchProfile.Item.CONTENT_INFO );
        }
        else if ( MessageListFields.SUBJECT.name().equals( sortfield )
            || MessageListFields.FROM.name().equals( sortfield )
            || MessageListFields.TO.name().equals( sortfield )
            || MessageListFields.DATE.name().equals( sortfield ) ) {
          fp.add( FetchProfile.Item.ENVELOPE );
        }
        else if ( MessageListFields.SIZE.name().equals( sortfield ) ) {
          fp.add( IMAPFolder.FetchProfileItem.SIZE );
        }
      }
    }
    return fp;
  }
View Full Code Here

          Message[] pagedMessages = new Message[pageSize];
          int pagedIndex = 0;
          for (int msgIndex = start; msgIndex < start + pageSize; msgIndex++) {
            pagedMessages[pagedIndex++] = msgs[msgIndex];
          }
          FetchProfile completeProfile = MessageUtils.createFetchProfile( true, null );
          currentFolder.fetch( pagedMessages, completeProfile );

          String[][] messageStringArray = new String[pageSize][MessageListFields.values().length];
          Preferences preferences = SessionManager.get().getPreferences();
View Full Code Here

        msgs = folder.getMessages();
        log
            .debug( "Millis for getting " + msgs.length + " messages: "
                + (System.currentTimeMillis() - time) );
        time = System.currentTimeMillis();
        FetchProfile fp = MessageUtils.createFetchProfile( false, sortField );

        log.debug( "Start fetching messages..." );
        folder.fetch( msgs, fp );
        log.debug( "Millis for fetching " + msgs.length + " Messages: "
            + (System.currentTimeMillis() - time) );
View Full Code Here

   * @param sortfield
   * @return
   */
  public static FetchProfile createFetchProfile( boolean complete, MessageListFields sortfield ) {

    FetchProfile fp = new FetchProfile();
    if ( complete ) {
      fp.add( FetchProfile.Item.ENVELOPE );
      fp.add( FetchProfile.Item.FLAGS );
      fp.add( FetchProfile.Item.CONTENT_INFO );
      fp.add( IMAPFolder.FetchProfileItem.SIZE );
      fp.add( CubusConstants.FETCH_ITEM_PRIORITY );
      fp.add( UIDFolder.FetchProfileItem.UID );
    }
    else {
      if ( sortfield != null ) {
        if ( MessageListFields.SUBJECT == sortfield || MessageListFields.FROM == sortfield
            || MessageListFields.TO == sortfield || MessageListFields.SEND_DATE == sortfield ) {
          fp.add( FetchProfile.Item.ENVELOPE );
        }
        else if ( MessageListFields.SIZE == sortfield ) {
          fp.add( IMAPFolder.FetchProfileItem.SIZE );
        }
      }
    }
    return fp;
  }
View Full Code Here

          Message[] pagedMessages = new Message[pageSize];
          int pagedIndex = 0;
          for (int msgIndex = start; msgIndex < start + pageSize; msgIndex++) {
            pagedMessages[pagedIndex++] = msgs[msgIndex];
          }
          FetchProfile completeProfile = MessageUtils.createFetchProfile( true, null );
          currentFolder.fetch( pagedMessages, completeProfile );

          Preferences preferences = SessionManager.get().getPreferences();

          GWTMessageRecord[] messageStringArray = ConvertUtil.convertMessagesToStringArray(
View Full Code Here

  {
    if (_holdsMessages)
    {
      if (_messageListModel == null)
      {
        FetchProfile fetchProfile = new FetchProfile();
        fetchProfile.add(FetchProfile.Item.ENVELOPE);
        fetchProfile.add(FetchProfile.Item.FLAGS);
        _messageListModel = new MessageDataModel(_folder,
                                                 fetchProfile,
                                                 _MESSAGE_LOAD_BLOCK_SIZE);
      }
View Full Code Here

      Folder folder = this.getCurrentFolder();
      folder.open(Folder.READ_ONLY);
      CurrentFolderMessagesInfo folderInfos = (CurrentFolderMessagesInfo) this.getRequest().getSession().getAttribute(CurrentFolderMessagesInfo.CURRENT_FOLDER_MESSAGES);
      //if (this.hasToReloadMessages(folder, folderInfos)) {
      Message messages[] = folder.getMessages();
      FetchProfile profile = new FetchProfile();
      profile.add(FetchProfile.Item.ENVELOPE);
      folder.fetch(messages, profile);
      this.setOpenedFolder(folder);
      messageList = Arrays.asList(messages);
      this.orderMessages(messageList);
      folderInfos = new CurrentFolderMessagesInfo(this.getCurrentFolderName(), messageList);
View Full Code Here

TOP

Related Classes of javax.mail.FetchProfile

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.