Search in sources :

Example 11 with ZSearchResult

use of com.zimbra.client.ZSearchResult in project zm-mailbox by Zimbra.

the class ZMailboxUtil method doSearchConvNext.

private void doSearchConvNext() throws ServiceException {
    ZSearchParams sp = mConvSearchParams;
    ZSearchResult sr = mConvSearchResult;
    if (sp == null || sr == null || !sr.hasMore())
        return;
    List<ZSearchHit> hits = sr.getHits();
    if (hits.size() == 0)
        return;
    sp.setOffset(sp.getOffset() + hits.size());
    dumpConvSearch(mMbox.searchConversation(mConvSearchConvId, sp), verboseOpt());
}
Also used : ZSearchResult(com.zimbra.client.ZSearchResult) ZSearchHit(com.zimbra.client.ZSearchHit) ZSearchParams(com.zimbra.client.ZSearchParams)

Example 12 with ZSearchResult

use of com.zimbra.client.ZSearchResult in project zm-mailbox by Zimbra.

the class ZMailboxUtil method doSearchConvPrevious.

private void doSearchConvPrevious() throws ServiceException {
    ZSearchParams sp = mConvSearchParams;
    ZSearchResult sr = mConvSearchResult;
    if (sp == null || sr == null || sp.getOffset() == 0)
        return;
    sp.setOffset(sp.getOffset() - sr.getHits().size());
    dumpConvSearch(mMbox.searchConversation(mConvSearchConvId, sp), verboseOpt());
}
Also used : ZSearchResult(com.zimbra.client.ZSearchResult) ZSearchParams(com.zimbra.client.ZSearchParams)

Example 13 with ZSearchResult

use of com.zimbra.client.ZSearchResult in project zm-mailbox by Zimbra.

the class TestDraftCount method checkMessageCount.

private void checkMessageCount(String query, int expected) throws Exception {
    ZSearchParams params = new ZSearchParams(query);
    params.setTypes("message");
    params.setOffset(0);
    params.setSortBy(SearchSortBy.rcptAsc);
    ZSearchResult results = mbox.search(params);
    assertEquals(expected, results.getHits().size());
    params.setSortBy(SearchSortBy.rcptDesc);
    results = mbox.search(params);
    assertEquals(expected, results.getHits().size());
}
Also used : ZSearchResult(com.zimbra.client.ZSearchResult) ZSearchParams(com.zimbra.client.ZSearchParams)

Example 14 with ZSearchResult

use of com.zimbra.client.ZSearchResult in project zm-mailbox by Zimbra.

the class TestDraftCount method deleteFromQuery.

private void deleteFromQuery(String query) throws Exception {
    //delete all messages currently in drafts folder
    ZSearchParams params = new ZSearchParams(query);
    params.setTypes("message");
    params.setOffset(0);
    ZSearchResult results = mbox.search(params);
    for (ZSearchHit hit : results.getHits()) {
        ZMessageHit msg = (ZMessageHit) hit;
        mbox.deleteMessage(hit.getId());
    }
}
Also used : ZSearchResult(com.zimbra.client.ZSearchResult) ZSearchHit(com.zimbra.client.ZSearchHit) ZSearchParams(com.zimbra.client.ZSearchParams) ZMessageHit(com.zimbra.client.ZMessageHit)

Example 15 with ZSearchResult

use of com.zimbra.client.ZSearchResult in project zm-mailbox by Zimbra.

the class TestTrashImapMessage method testTrashImapMessage.

@Test
public void testTrashImapMessage() throws Exception {
    String subj = "testtrashimap";
    addMessage(imapDsMbox1, subj, "test");
    refreshImapData();
    ZSearchParams params = new ZSearchParams("subject:" + subj);
    params.setTypes("MESSAGE");
    ZSearchResult result = mbox.search(params);
    ZSearchHit hit = result.getHits().get(0);
    String id = hit.getId();
    msgIds.add(id);
    mbox.trashMessage(id);
    params = new ZSearchParams("in:\"" + IMAP_DS_1_FOLDER_NAME + "/Trash\"");
    params.setTypes("MESSAGE");
    result = mbox.search(params);
    List<ZSearchHit> hits = result.getHits();
    Assert.assertEquals(1, hits.size());
    Assert.assertEquals(id, hits.get(0).getId());
}
Also used : ZSearchResult(com.zimbra.client.ZSearchResult) ZSearchHit(com.zimbra.client.ZSearchHit) ZSearchParams(com.zimbra.client.ZSearchParams) Test(org.junit.Test)

Aggregations

ZSearchResult (com.zimbra.client.ZSearchResult)19 ZSearchParams (com.zimbra.client.ZSearchParams)17 Test (org.junit.Test)12 ZSearchHit (com.zimbra.client.ZSearchHit)8 ArrayList (java.util.ArrayList)2 ZMailbox (com.zimbra.client.ZMailbox)1 ZMessageHit (com.zimbra.client.ZMessageHit)1 SoapFaultException (com.zimbra.common.soap.SoapFaultException)1 Account (com.zimbra.cs.account.Account)1