use of com.zimbra.soap.mail.type.ConversationMsgHitInfo in project zm-mailbox by Zimbra.
the class SearchResponse method doConvMsgHit.
private Element doConvMsgHit(Element el, Message msg, long numMsgsInConv) {
// Folder ID useful when undoing a move to different folder, also determining whether in junk/trash
ConversationMsgHitInfo cMsgHit = ConversationMsgHitInfo.fromIdAndFolderId(ifmt.formatItemId(msg), ifmt.formatItemId(new ItemId(msg.getMailbox().getAccountId(), msg.getFolderId())));
// if it's a 1-message conversation, hand back size for the lone message
if (numMsgsInConv == 1) {
cMsgHit.setSize(msg.getSize());
}
if (msg.isDraft() && msg.getDraftAutoSendTime() != 0) {
cMsgHit.setAutoSendTime(msg.getDraftAutoSendTime());
}
if (!msg.getFlagString().equalsIgnoreCase("")) {
cMsgHit.setFlags(msg.getFlagString());
}
cMsgHit.setDate(msg.getDate());
cMsgHit.toElement(el);
return el;
}
use of com.zimbra.soap.mail.type.ConversationMsgHitInfo in project zm-mailbox by Zimbra.
the class SearchResponse method add.
private Element add(ConversationHit hit) throws ServiceException {
if (params.getFetchMode() == SearchParams.Fetch.IDS) {
Element el = element.addNonUniqueElement(MailConstants.E_CONV);
for (MessageHit mhit : hit.getMessageHits()) {
ConversationMsgHitInfo cMsgHit = new ConversationMsgHitInfo(ifmt.formatItemId(mhit.getItemId()));
cMsgHit.toElement(el);
}
return el;
} else {
Conversation conv = hit.getConversation();
MessageHit mhit = hit.getFirstMessageHit();
Element el = ToXML.encodeConversationSummary(element, ifmt, octxt, conv, mhit == null ? null : mhit.getMessage(), params.getWantRecipients());
Collection<MessageHit> msgHits = hit.getMessageHits();
long numMsgs = el.getAttributeLong(MailConstants.A_NUM, 0);
if (!params.fullConversation() || numMsgs == msgHits.size()) {
for (MessageHit mh : msgHits) {
Message msg = mh.getMessage();
doConvMsgHit(el, msg, numMsgs);
}
} else {
for (Message msg : conv.getMailbox().getMessagesByConversation(octxt, conv.getId(), SortBy.DATE_DESC, -1, /* limit */
false)) {
doConvMsgHit(el, msg, numMsgs);
}
}
return el;
}
}
Aggregations