use of com.zimbra.client.ZSearchHit in project zm-mailbox by Zimbra.
the class TestUtil method deleteMessages.
private static void deleteMessages(ZMailbox mbox, String query) throws ServiceException {
// Delete messages
ZSearchParams params = new ZSearchParams(query);
params.setTypes(ZSearchParams.TYPE_MESSAGE);
List<ZSearchHit> hits = mbox.search(params).getHits();
if (hits.size() > 0) {
List<String> ids = new ArrayList<String>();
for (ZSearchHit hit : hits) {
ids.add(hit.getId());
}
mbox.deleteMessage(StringUtil.join(",", ids));
}
}
use of com.zimbra.client.ZSearchHit in project zm-mailbox by Zimbra.
the class TestUtil method search.
public static List<ZMessage> search(ZMailbox mbox, ZSearchParams params) throws ServiceException {
List<ZMessage> msgs = new ArrayList<ZMessage>();
for (ZSearchHit hit : mbox.search(params).getHits()) {
ZGetMessageParams msgParams = new ZGetMessageParams();
msgParams.setId(hit.getId());
msgs.add(mbox.getMessage(msgParams));
}
return msgs;
}
use of com.zimbra.client.ZSearchHit in project zm-mailbox by Zimbra.
the class TestUtil method search.
public static List<String> search(ZMailbox mbox, String query, String type) throws ServiceException {
List<String> ids = new ArrayList<String>();
ZSearchParams params = new ZSearchParams(query);
params.setTypes(type);
for (ZSearchHit hit : mbox.search(params).getHits()) {
ids.add(hit.getId());
}
return ids;
}
Aggregations