Package org.apache.james.mailbox.model

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


            basePath = new MailboxPath(MailboxConstants.USER_NAMESPACE, mailboxSession.getUser().getUserName(), CharsetUtil.decodeModifiedUTF7(finalReferencename));
        } else {
            basePath = buildFullPath(session, CharsetUtil.decodeModifiedUTF7(finalReferencename));
        }

        final MailboxQuery expression = new MailboxQuery(basePath, CharsetUtil.decodeModifiedUTF7(mailboxName), mailboxSession.getPathDelimiter());
        final Collection<String> mailboxResponses = new ArrayList<String>();
        for (final String mailbox : mailboxes) {
            respond(responder, expression, mailbox, true, mailboxes, mailboxResponses, mailboxSession.getPathDelimiter());
        }
    }
View Full Code Here


                    basePath = new MailboxPath(MailboxConstants.USER_NAMESPACE, user, finalReferencename);
                } else {
                    basePath = buildFullPath(session, finalReferencename);
                }

                results = getMailboxManager().search(new MailboxQuery(basePath, CharsetUtil.decodeModifiedUTF7(mailboxName), mailboxSession.getPathDelimiter()), mailboxSession);
            }

            for (final MailboxMetaData metaData : results) {
                processResult(responder, isRelative, metaData, getMailboxType(session, mailboxTyper, metaData.getPath()));
            }
View Full Code Here

            manager.startProcessingRequest(session);

            // get all mailboxes for the user to calculate the size
            // TODO: See JAMES-1198
            List<MailboxMetaData> mList = manager.search(
                    new MailboxQuery(MailboxPath.inbox(session), "", session.getPathDelimiter()), session);
            for (MailboxMetaData aMList : mList) {
                MessageManager mailbox = manager.getMailbox(aMList.getPath(), session);
                Iterator<MessageResult> results = mailbox.getMessages(MessageRange.all(), FetchGroupImpl.MINIMAL,
                        session);
                while (results.hasNext()) {
View Full Code Here

    public boolean deleteMailboxes(String username) {
        MailboxSession session = null;
        try {
            session = mailboxManager.createSystemSession(username, log);
            mailboxManager.startProcessingRequest(session);
            List<MailboxMetaData> mList = mailboxManager.search(new MailboxQuery(MailboxPath.inbox(session), "", session.getPathDelimiter()), session);
            for (MailboxMetaData aMList : mList) {
                mailboxManager.deleteMailbox(aMList.getPath(), session);
            }
            return true;
        } catch (MailboxException e) {
View Full Code Here

        List<String> boxes = new ArrayList<String>();
        MailboxSession session = null;
        try {
            session = mailboxManager.createSystemSession(username, log);
            mailboxManager.startProcessingRequest(session);
            List<MailboxMetaData> mList = mailboxManager.search(new MailboxQuery(MailboxPath.inbox(session), "", session.getPathDelimiter()), session);
            for (MailboxMetaData aMList : mList) {
                boxes.add(aMList.getPath().getName());
            }
            Collections.sort(boxes);
        } catch (MailboxException e) {
View Full Code Here

        assertFalse(expression.isExpressionMatch(SECOND_PART));
    }

    @Test
    public void testContainsFreeWildcard() throws Exception {
        MailboxQuery expression = create(SECOND_PART + '*' + PART);
        assertFalse(expression.isExpressionMatch(""));
        assertFalse(expression.isExpressionMatch(SECOND_PART));
        assertTrue(expression.isExpressionMatch(SECOND_PART + PART));
        assertTrue(expression.isExpressionMatch(SECOND_PART + '.' + PART));
        assertFalse(expression.isExpressionMatch(PART));
        assertTrue(expression.isExpressionMatch(SECOND_PART + "w.hat.eve.r" + PART));
    }
View Full Code Here

        assertTrue(expression.isExpressionMatch(SECOND_PART + "w.hat.eve.r" + PART));
    }

    @Test
    public void testDoubleFreeWildcard() throws Exception {
        MailboxQuery expression = create(SECOND_PART + "**" + PART);
        assertFalse(expression.isExpressionMatch(""));
        assertFalse(expression.isExpressionMatch(SECOND_PART));
        assertTrue(expression.isExpressionMatch(SECOND_PART + PART));
        assertTrue(expression.isExpressionMatch(SECOND_PART + '.' + PART));
        assertFalse(expression.isExpressionMatch(PART));
        assertTrue(expression.isExpressionMatch(SECOND_PART + "w.hat.eve.r" + PART));
    }
View Full Code Here

        assertTrue(expression.isExpressionMatch(SECOND_PART + "w.hat.eve.r" + PART));
    }

    @Test
    public void testFreeLocalWildcard() throws Exception {
        MailboxQuery expression = create(SECOND_PART + "*%" + PART);
        assertFalse(expression.isExpressionMatch(""));
        assertFalse(expression.isExpressionMatch(SECOND_PART));
        assertTrue(expression.isExpressionMatch(SECOND_PART + PART));
        assertTrue(expression.isExpressionMatch(SECOND_PART + '.' + PART));
        assertFalse(expression.isExpressionMatch(PART));
        assertTrue(expression.isExpressionMatch(SECOND_PART + "w.hat.eve.r" + PART));
    }
View Full Code Here

        assertTrue(expression.isExpressionMatch(SECOND_PART + "w.hat.eve.r" + PART));
    }

    @Test
    public void testLocalFreeWildcard() throws Exception {
        MailboxQuery expression = create(SECOND_PART + "%*" + PART);
        assertFalse(expression.isExpressionMatch(""));
        assertFalse(expression.isExpressionMatch(SECOND_PART));
        assertTrue(expression.isExpressionMatch(SECOND_PART + PART));
        assertTrue(expression.isExpressionMatch(SECOND_PART + '.' + PART));
        assertFalse(expression.isExpressionMatch(PART));
        assertTrue(expression.isExpressionMatch(SECOND_PART + "w.hat.eve.r" + PART));
    }
View Full Code Here

        assertTrue(expression.isExpressionMatch(SECOND_PART + "w.hat.eve.r" + PART));
    }

    @Test
    public void testMultipleFreeWildcards() throws Exception {
        MailboxQuery expression = create(SECOND_PART + '*' + PART + '*'
                + SECOND_PART + "**");
        assertTrue(expression.isExpressionMatch(SECOND_PART + PART
                + SECOND_PART));
        assertTrue(expression.isExpressionMatch(SECOND_PART + '.' + PART + '.'
                + SECOND_PART));
        assertTrue(expression.isExpressionMatch(SECOND_PART + "tosh.bosh"
                + PART + "tosh.bosh" + SECOND_PART + "boshtosh"));
        assertFalse(expression.isExpressionMatch(SECOND_PART + '.'
                + PART.substring(1) + '.' + SECOND_PART));
        assertTrue(expression.isExpressionMatch(SECOND_PART + '.'
                + PART.substring(1) + '.' + SECOND_PART + PART + '.'
                + SECOND_PART + "toshbosh"));
        assertFalse(expression.isExpressionMatch(SECOND_PART + '.'
                + PART.substring(1) + '.' + SECOND_PART + PART + '.'
                + SECOND_PART.substring(1)));
        assertTrue(expression.isExpressionMatch(SECOND_PART + "tosh.bosh"
                + PART + "tosh.bosh" + PART + SECOND_PART + "boshtosh" + PART
                + SECOND_PART));
        assertFalse(expression.isExpressionMatch(SECOND_PART.substring(1)
                + "tosh.bosh" + PART + "tosh.bosh" + SECOND_PART
                + PART.substring(1) + SECOND_PART + "boshtosh" + PART
                + SECOND_PART.substring(1)));
    }
View Full Code Here

TOP

Related Classes of org.apache.james.mailbox.model.MailboxQuery

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.