Examples of FetchGroupImpl


Examples of org.apache.james.mailbox.model.FetchGroupImpl

        }

    }

    protected FetchGroup getFetchGroup(FetchData fetch) {
        FetchGroupImpl result = new FetchGroupImpl();

        if (fetch.isEnvelope()) {
            result.or(FetchGroup.HEADERS);
        }
        if (fetch.isBody() || fetch.isBodyStructure()) {
            result.or(FetchGroup.MIME_DESCRIPTOR);
        }

        Collection<BodyFetchElement> bodyElements = fetch.getBodyElements();
        if (bodyElements != null) {
            for (final Iterator<BodyFetchElement> it = bodyElements.iterator(); it.hasNext();) {
View Full Code Here

Examples of org.apache.james.mailbox.util.FetchGroupImpl

                List<Long> deletedUidList = (List<Long>) session.getState().get(POP3Session.DELETED_UID_LIST);

                MailboxSession mailboxSession = (MailboxSession) session.getState().get(POP3Session.MAILBOX_SESSION);
                Long uid = uidList.get(num - 1);
                if (deletedUidList.contains(uid) == false) {
                    FetchGroupImpl fetchGroup = new FetchGroupImpl(FetchGroup.BODY_CONTENT);
                    fetchGroup.or(FetchGroup.HEADERS);
                    Iterator<MessageResult> results = session.getUserMailbox().getMessages(MessageRange.one(uid), fetchGroup, mailboxSession);
                    MessageStream stream = new MessageStream();
                    OutputStream out = stream.getOutputStream();
                    OutputStream extraDotOut = new ExtraDotOutputStream(out);
                   
View Full Code Here

Examples of org.apache.james.mailbox.util.FetchGroupImpl

                List<Long> deletedUidList = (List<Long>) session.getState().get(POP3Session.DELETED_UID_LIST);

                MailboxSession mailboxSession = (MailboxSession) session.getState().get(POP3Session.MAILBOX_SESSION);
                Long uid = uidList.get(num - 1);
                if (deletedUidList.contains(uid) == false) {
                    Iterator<MessageResult> results = session.getUserMailbox().getMessages(MessageRange.one(uid), new FetchGroupImpl(FetchGroup.FULL_CONTENT), mailboxSession);
                    MessageStream stream = new MessageStream();
                    OutputStream out = stream.getOutputStream();
                    OutputStream extraDotOut = new ExtraDotOutputStream(out);
                   
                    out.write((POP3Response.OK_RESPONSE + " Message follows\r\n").getBytes());
View Full Code Here

Examples of org.apache.james.mailbox.util.FetchGroupImpl

        });
        manager.startProcessingRequest(session);
        MessageManager mailbox = manager.getMailbox(new MailboxPath(MailboxConstants.USER_NAMESPACE,
                                            session.getUser().getUserName(), "INBOX"),
                                            session);
        Iterator<MessageResult> results = mailbox.getMessages(MessageRange.all(), new FetchGroupImpl(FetchGroup.MINIMAL), session);
       
        while (results.hasNext()) {
          size += results.next().getSize();
        }
        manager.endProcessingRequest(session);
View Full Code Here

Examples of org.apache.james.mailbox.util.FetchGroupImpl

        }

    }

    protected FetchGroup getFetchGroup(FetchData fetch) {
        FetchGroupImpl result = new FetchGroupImpl();

        if (fetch.isEnvelope()) {
            result.or(FetchGroup.HEADERS);
        }
        if (fetch.isBody() || fetch.isBodyStructure()) {
            result.or(FetchGroup.MIME_DESCRIPTOR);
        }

        Collection<BodyFetchElement> bodyElements = fetch.getBodyElements();
        if (bodyElements != null) {
            for (final Iterator<BodyFetchElement> it = bodyElements.iterator(); it.hasNext();) {
View Full Code Here

Examples of org.apache.james.mailbox.util.FetchGroupImpl

                    List<MessageResult> validResults = new ArrayList<MessageResult>();

                    if (uidList.isEmpty() == false) {
                        Iterator<MessageResult> results;
                        if (uidList.size() > 1) {
                            results = session.getUserMailbox().getMessages(MessageRange.range(uidList.get(0), uidList.get(uidList.size() - 1)), new FetchGroupImpl(FetchGroup.MINIMAL), mailboxSession);
                        } else {
                            results = session.getUserMailbox().getMessages(MessageRange.one(uidList.get(0)), new FetchGroupImpl(FetchGroup.MINIMAL), mailboxSession);
                        }

                        while (results.hasNext()) {
                            MessageResult result = results.next();
                            if (deletedUidList.contains(result.getUid()) == false) {
                                size += result.getSize();
                                count++;
                                validResults.add(result);
                            }
                        }
                    }
                    StringBuilder responseBuffer = new StringBuilder(32).append(count).append(" ").append(size);
                    response = new POP3Response(POP3Response.OK_RESPONSE, responseBuffer.toString());
                    count = 0;
                    for (int i = 0; i < validResults.size(); i++) {
                        responseBuffer = new StringBuilder(16).append(i + 1).append(" ").append(validResults.get(i).getSize());
                        response.appendLine(responseBuffer.toString());

                    }
                    response.appendLine(".");
                } catch (MailboxException me) {
                    response = new POP3Response(POP3Response.ERR_RESPONSE);
                }
            } else {
                int num = 0;
                try {
                    num = Integer.parseInt(parameters);
                    Long uid = uidList.get(num - 1);
                    if (deletedUidList.contains(uid) == false) {
                        Iterator<MessageResult> results = session.getUserMailbox().getMessages(MessageRange.one(uid), new FetchGroupImpl(FetchGroup.MINIMAL), mailboxSession);

                        StringBuilder responseBuffer = new StringBuilder(64).append(num).append(" ").append(results.next().getSize());
                        response = new POP3Response(POP3Response.OK_RESPONSE, responseBuffer.toString());
                    } else {
                        StringBuilder responseBuffer = new StringBuilder(64).append("Message (").append(num).append(") already deleted.");
View Full Code Here

Examples of org.apache.james.mailbox.util.FetchGroupImpl

    protected void stat(POP3Session session) {
        try {
            MailboxSession mailboxSession = (MailboxSession) session.getState().get(POP3Session.MAILBOX_SESSION);

            List<Long> uids = new ArrayList<Long>();
            Iterator<MessageResult> it = session.getUserMailbox().getMessages(MessageRange.all(), new FetchGroupImpl(FetchGroup.MINIMAL), mailboxSession);
            while (it.hasNext()) {
                uids.add(it.next().getUid());
            }
            session.getState().put(POP3Session.UID_LIST, uids);
            session.getState().put(POP3Session.DELETED_UID_LIST, new ArrayList<Long>());
View Full Code Here

Examples of org.apache.james.mailbox.util.FetchGroupImpl

                List<Long> deletedUidList = (List<Long>) session.getState().get(POP3Session.DELETED_UID_LIST);
                long size = 0;
                int count = 0;
                if (uidList.isEmpty() == false) {
                    MailboxSession mailboxSession = (MailboxSession) session.getState().get(POP3Session.MAILBOX_SESSION);
                    Iterator<MessageResult> results = session.getUserMailbox().getMessages(MessageRange.range(uidList.get(0), uidList.get(uidList.size() - 1)), new FetchGroupImpl(FetchGroup.MINIMAL), mailboxSession);

                    List<MessageResult> validResults = new ArrayList<MessageResult>();
                    while (results.hasNext()) {
                        MessageResult result = results.next();
                        if (deletedUidList.contains(result.getUid()) == false) {
View Full Code Here

Examples of org.apache.james.mailbox.util.FetchGroupImpl

                List<Long> deletedUidList = (List<Long>) session.getState().get(POP3Session.DELETED_UID_LIST);

                MailboxSession mailboxSession = (MailboxSession) session.getState().get(POP3Session.MAILBOX_SESSION);
                Long uid = uidList.get(num - 1);
                if (deletedUidList.contains(uid) == false) {
                    FetchGroupImpl fetchGroup = new FetchGroupImpl(FetchGroup.BODY_CONTENT);
                    fetchGroup.or(FetchGroup.HEADERS);
                    Iterator<MessageResult> results = session.getUserMailbox().getMessages(MessageRange.one(uid), fetchGroup, mailboxSession);
                    OutputStream out = session.getOutputStream();
                    OutputStream extraDotOut = new ExtraDotOutputStream(out);
                   
                    out.write((POP3Response.OK_RESPONSE + " Message follows\r\n").getBytes());
View Full Code Here

Examples of org.apache.james.mailbox.util.FetchGroupImpl

                List<Long> deletedUidList = (List<Long>) session.getState().get(POP3Session.DELETED_UID_LIST);

                MailboxSession mailboxSession = (MailboxSession) session.getState().get(POP3Session.MAILBOX_SESSION);
                Long uid = uidList.get(num - 1);
                if (deletedUidList.contains(uid) == false) {
                    Iterator<MessageResult> results = session.getUserMailbox().getMessages(MessageRange.one(uid), new FetchGroupImpl(FetchGroup.FULL_CONTENT), mailboxSession);
                    OutputStream out = session.getOutputStream();
                    OutputStream extraDotOut = new ExtraDotOutputStream(out);
                   
                    out.write((POP3Response.OK_RESPONSE + " Message follows\r\n").getBytes());
                    out.flush();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.