7d6< import java.text.DateFormat;
10d8< import java.util.Collections;
12d9< import java.util.HashMap;
15d11<
20c16,17< import org.jivesoftware.util.Log;
---> import org.slf4j.Logger;> import org.slf4j.LoggerFactory;
22d18<
34a31,32> > private static final Logger Log = LoggerFactory.getLogger(JdbcPersistenceManager.class);
136,137c134< long maxRetrievable = JiveGlobals.getIntProperty("conversation.maxRetrievable", ConversationManager.DEFAULT_MAX_RETRIEVABLE)< * JiveConstants.DAY;
---> long maxRetrievable = JiveGlobals.getIntProperty("conversation.maxRetrievable", ConversationManager.DEFAULT_MAX_RETRIEVABLE) * JiveConstants.DAY;
146a144,145> } else {> result = startDate;
152c151< final HashMap<Long, Conversation> conversations;
---> final List<Conversation> conversations;
157c156< conversations = new HashMap<Long, Conversation>();
---> conversations = new ArrayList<Conversation>();
163a163,167> > if (ownerJid != null && withJid != null && ownerJid.contains(withJid)) {> withJid = null;> }>
204c208,209< querySB.append(" ORDER BY ").append(CONVERSATION_ID);
---> querySB.append(" GROUP BY ").append(CONVERSATION_ID);> querySB.append(" ORDER BY ").append(CONVERSATION_ID).append(" ").append(JiveGlobals.getProperty("conversation.list.order", ""));
218c223< conversations.put(conv.getId(), conv);
---> conversations.add(conv);
220c225,226< } catch (SQLException sqle) {
---> }> catch (SQLException sqle) {
222c228,229< } finally {
---> }> finally {
226,230c233,235< if (xmppResultSet != null && conversations.size() > 0) {< ArrayList<Long> sortedConvKeys = new ArrayList<Long>(conversations.keySet());< Collections.sort(sortedConvKeys);< xmppResultSet.setFirst(sortedConvKeys.get(0));< xmppResultSet.setLast(sortedConvKeys.get(sortedConvKeys.size() - 1));
---> if (xmppResultSet != null && !conversations.isEmpty()) {> xmppResultSet.setFirst(conversations.get(0).getId());> xmppResultSet.setLast(conversations.get(conversations.size() - 1).getId());
232c237< return conversations.values();
---> return conversations;
266c271,272< } catch (SQLException sqle) {
---> }> catch (SQLException sqle) {
269c275,276< } finally {
---> }> finally {
300c307,308< } catch (SQLException sqle) {
---> }> catch (SQLException sqle) {
303c311,312< } finally {
---> }> finally {
308,309c317< private int bindConversationParameters(Date startDate, Date endDate, String ownerJid, String withJid, PreparedStatement pstmt)< throws SQLException {
---> private int bindConversationParameters(Date startDate, Date endDate, String ownerJid, String withJid, PreparedStatement pstmt) throws SQLException {
346c354,355< } catch (SQLException sqle) {
---> }> catch (SQLException sqle) {
348c357,358< } finally {
---> }> finally {
360,362c370< if (conversationIds.isEmpty()) {< return conversations;< }
---> if (conversationIds.isEmpty()) { return conversations; }
393c401,402< } catch (SQLException sqle) {
---> }> catch (SQLException sqle) {
395c404,405< } finally {
---> }> finally {
440a451>
442a454>
451a464>
491c504,505< } catch (SQLException sqle) {
---> }> catch (SQLException sqle) {
493c507,508< } finally {
---> }> finally {
↧
Re: Archive Conversations list and count doesn't match
↧