Package org.apache.james.imap.api.message

Examples of org.apache.james.imap.api.message.IdRange$IdRangeComperator


        SearchKey key = SearchKey.buildSequenceSet(IdRange.mergeRanges(Arrays.asList(range)).toArray(new IdRange[0]));
        return new Input("*:100,110,200:201,400:*", key);
    }

    public static Input uid() {
        IdRange[] range = { new IdRange(100, Long.MAX_VALUE), new IdRange(110),
                new IdRange(200, 201), new IdRange(400, Long.MAX_VALUE) };
        SearchKey key = SearchKey.buildUidSet(IdRange.mergeRanges(Arrays.asList(range)).toArray(new IdRange[0]));
        return new Input("UID *:100,110,200:201,400:*", key);
    }
View Full Code Here


    }

    @Test
    public void testSequenceSetUpperUnlimited() throws Exception {
        expectsGetSelectedMailbox();
        final IdRange[] ids = { new IdRange(1, Long.MAX_VALUE) };
        final SearchQuery.NumericRange[] ranges = { new SearchQuery.NumericRange(
                42, 100L) };
        mockery.checking(new Expectations() {{
          allowing(selectedMailbox).existsCount();will(returnValue(100L));
            oneOf(selectedMailbox).uid(with(equal(1)));will(returnValue(42L));
View Full Code Here

    }

    @Test
    public void testSequenceSetMsnRange() throws Exception {
        expectsGetSelectedMailbox();
        final IdRange[] ids = { new IdRange(1, 5) };
        final SearchQuery.NumericRange[] ranges = { new SearchQuery.NumericRange(
                42, 1729) };
        mockery.checking(new Expectations() {{
          allowing(selectedMailbox).existsCount();will(returnValue(2L));
            oneOf(selectedMailbox).uid(with(equal(1)));will(returnValue(42L));
View Full Code Here

    }

    @Test
    public void testSequenceSetSingleMsn() throws Exception {
        expectsGetSelectedMailbox();
        final IdRange[] ids = { new IdRange(1) };
        final SearchQuery.NumericRange[] ranges = { new SearchQuery.NumericRange(
                42) };
        mockery.checking(new Expectations() {{
          allowing(selectedMailbox).existsCount();will(returnValue(1L));
            exactly(2).of(selectedMailbox).uid(with(equal(1)));will(returnValue(42L));
View Full Code Here

        Input input = new Input(buffer.toString(), SearchKey.buildAnd(keys));
        return input;
    }

    public static Input sequence() {
        IdRange[] range = { new IdRange(100, Long.MAX_VALUE), new IdRange(110),
                new IdRange(200, 201), new IdRange(400, Long.MAX_VALUE) };
        SearchKey key = SearchKey.buildSequenceSet(IdRange.mergeRanges(Arrays.asList(range)).toArray(new IdRange[0]));
        return new Input("*:100,110,200:201,400:*", key);
    }
View Full Code Here

        SearchKey key = SearchKey.buildSequenceSet(IdRange.mergeRanges(Arrays.asList(range)).toArray(new IdRange[0]));
        return new Input("*:100,110,200:201,400:*", key);
    }

    public static Input uid() {
        IdRange[] range = { new IdRange(100, Long.MAX_VALUE), new IdRange(110),
                new IdRange(200, 201), new IdRange(400, Long.MAX_VALUE) };
        SearchKey key = SearchKey.buildUidSet(IdRange.mergeRanges(Arrays.asList(range)).toArray(new IdRange[0]));
        return new Input("UID *:100,110,200:201,400:*", key);
    }
View Full Code Here

            unsolicitedResponses(session, responder, false);

            // in case of MULTIAPPEND support we will push more then one UID
            // here
            okComplete(command, tag, ResponseCode.appendUid(uidValidity, new IdRange[] { new IdRange(uid) }), responder);
        } catch (MailboxNotFoundException e) {
            // Indicates that the mailbox does not exist
            // So TRY CREATE
            tryCreate(session, tag, command, responder, e);
            /*
 
View Full Code Here

                }
                List<MessageRange> ranges = MessageRange.toRanges(idList);
                idRanges = new IdRange[ranges.size()];
                for (int i = 0 ; i <ranges.size(); i++) {
                    MessageRange range = ranges.get(i);
                    idRanges[i] = new IdRange(range.getUidFrom(), range.getUidTo());
                }
               
                boolean esearch = false;
                for (int i = 0; i < resultOptions.size(); i++) {
                    if (SearchResultOption.SAVE != resultOptions.get(i)) {
                        esearch = true;
                        break;
                    }
                }
               
                if (esearch) {
                    long min = -1;
                    long max = -1;
                    long count = ids.length;

                    if (ids.length > 0) {
                        min = ids[0];
                        max = ids[ids.length -1];
                    }
                  
                   
                    // Save the sequence-set for later usage. This is part of SEARCHRES
                    if (resultOptions.contains(SearchResultOption.SAVE)) {
                        if (resultOptions.contains(SearchResultOption.ALL) || resultOptions.contains(SearchResultOption.COUNT)) {
                            // if the options contain ALL or COUNT we need to save the complete sequence-set
                            SearchResUtil.saveSequenceSet(session, idRanges);
                        } else {
                            List<IdRange> savedRanges = new ArrayList<IdRange>();
                            if (resultOptions.contains(SearchResultOption.MIN)) {
                                // Store the MIN
                                savedRanges.add(new IdRange(min))
                            }
                            if (resultOptions.contains(SearchResultOption.MAX)) {
                                // Store the MAX
                                savedRanges.add(new IdRange(max));
                            }
                            SearchResUtil.saveSequenceSet(session, savedRanges.toArray(new IdRange[0]));
                        }
                    }
                    response = new ESearchResponse(min, max, count, idRanges, tag, useUids, resultOptions);
View Full Code Here

    private Criterion sequence(IdRange[] sequenceNumbers, final ImapSession session, boolean msn) throws MessageRangeException {
        final int length = sequenceNumbers.length;
        final List<SearchQuery.NumericRange> ranges = new ArrayList<SearchQuery.NumericRange>();
        for (int i = 0; i < length; i++) {
            final IdRange range = sequenceNumbers[i];

            // correctly calculate the ranges. See IMAP-292
            final SelectedMailbox selected = session.getSelected();
            MessageRange mRange = messageRange(selected, range, !msn);
            if (mRange != null) {
View Full Code Here

        Input input = new Input(buffer.toString(), SearchKey.buildAnd(keys));
        return input;
    }

    public static Input sequence() {
        IdRange[] range = { new IdRange(100, Long.MAX_VALUE), new IdRange(110),
                new IdRange(200, 201), new IdRange(400, Long.MAX_VALUE) };
        SearchKey key = SearchKey.buildSequenceSet(IdRange.mergeRanges(Arrays.asList(range)).toArray(new IdRange[0]));
        return new Input("*:100,110,200:201,400:*", key);
    }
View Full Code Here

TOP

Related Classes of org.apache.james.imap.api.message.IdRange$IdRangeComperator

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.