Commit 64b3af11 authored by linuschien's avatar linuschien Committed by Guus der Kinderen

The result date should be the startDate for the remain cases.

parent d62fe85c
...@@ -50,8 +50,8 @@ public class JdbcPersistenceManager implements PersistenceManager { ...@@ -50,8 +50,8 @@ public class JdbcPersistenceManager implements PersistenceManager {
+ "ofConversation.messageCount, " + "ofConversation.startDate, " + "ofConParticipant.bareJID, " + "ofConParticipant.jidResource," + "ofConversation.messageCount, " + "ofConversation.startDate, " + "ofConParticipant.bareJID, " + "ofConParticipant.jidResource,"
+ "ofConParticipant.nickname, " + "ofConParticipant.bareJID AS fromJID, " + "ofMessageArchive.toJID, " + "ofConParticipant.nickname, " + "ofConParticipant.bareJID AS fromJID, " + "ofMessageArchive.toJID, "
+ "min(ofConParticipant.joinedDate) AS startDate, " + "max(ofConParticipant.leftDate) as leftDate " + "min(ofConParticipant.joinedDate) AS startDate, " + "max(ofConParticipant.leftDate) as leftDate "
+ "FROM ofConversation " + "FROM ofConversation "
+ "INNER JOIN ofConParticipant ON ofConversation.conversationID = ofConParticipant.conversationID " + "INNER JOIN ofConParticipant ON ofConversation.conversationID = ofConParticipant.conversationID "
+ "INNER JOIN (SELECT conversationID, toJID FROM ofMessageArchive union all SELECT conversationID, fromJID as toJID FROM ofMessageArchive) ofMessageArchive ON ofConParticipant.conversationID = ofMessageArchive.conversationID "; + "INNER JOIN (SELECT conversationID, toJID FROM ofMessageArchive union all SELECT conversationID, fromJID as toJID FROM ofMessageArchive) ofMessageArchive ON ofConParticipant.conversationID = ofMessageArchive.conversationID ";
public static final String SELECT_CONVERSATIONS_GROUP_BY = " GROUP BY ofConversation.conversationID, ofConversation.room, ofConversation.isExternal, ofConversation.lastActivity, ofConversation.messageCount, ofConversation.startDate, ofConParticipant.bareJID, ofConParticipant.jidResource, ofConParticipant.nickname, ofConParticipant.bareJID, ofMessageArchive.toJID"; public static final String SELECT_CONVERSATIONS_GROUP_BY = " GROUP BY ofConversation.conversationID, ofConversation.room, ofConversation.isExternal, ofConversation.lastActivity, ofConversation.messageCount, ofConversation.startDate, ofConParticipant.bareJID, ofConParticipant.jidResource, ofConParticipant.nickname, ofConParticipant.bareJID, ofMessageArchive.toJID";
...@@ -95,7 +95,6 @@ public class JdbcPersistenceManager implements PersistenceManager { ...@@ -95,7 +95,6 @@ public class JdbcPersistenceManager implements PersistenceManager {
public static final String CONVERSATION_WITH_JID = "ofMessageArchive.toJID"; public static final String CONVERSATION_WITH_JID = "ofMessageArchive.toJID";
// public static final String CONVERSATION_WITH_JID = "c.withJid"; // public static final String CONVERSATION_WITH_JID = "c.withJid";
public static final String MESSAGE_ID = "ofMessageArchive.messageID"; public static final String MESSAGE_ID = "ofMessageArchive.messageID";
public static final String MESSAGE_SENT_DATE = "ofMessageArchive.sentDate"; public static final String MESSAGE_SENT_DATE = "ofMessageArchive.sentDate";
...@@ -126,7 +125,6 @@ public class JdbcPersistenceManager implements PersistenceManager { ...@@ -126,7 +125,6 @@ public class JdbcPersistenceManager implements PersistenceManager {
// public static final String SELECT_PARTICIPANTS_BY_CONVERSATION = // public static final String SELECT_PARTICIPANTS_BY_CONVERSATION =
// "SELECT participantId,startTime,endTime,jid FROM archiveParticipants WHERE conversationId =? ORDER BY startTime"; // "SELECT participantId,startTime,endTime,jid FROM archiveParticipants WHERE conversationId =? ORDER BY startTime";
public static final String SELECT_MESSAGES = "SELECT DISTINCT " + "ofMessageArchive.fromJID, " public static final String SELECT_MESSAGES = "SELECT DISTINCT " + "ofMessageArchive.fromJID, "
+ "ofMessageArchive.toJID, " + "ofMessageArchive.sentDate, " + "ofMessageArchive.stanza, " + "ofMessageArchive.toJID, " + "ofMessageArchive.sentDate, " + "ofMessageArchive.stanza, "
+ "ofMessageArchive.messageID, " + "ofConParticipant.bareJID " + "ofMessageArchive.messageID, " + "ofConParticipant.bareJID "
...@@ -168,7 +166,7 @@ public class JdbcPersistenceManager implements PersistenceManager { ...@@ -168,7 +166,7 @@ public class JdbcPersistenceManager implements PersistenceManager {
public Date getAuditedStartDate(Date startDate) { public Date getAuditedStartDate(Date startDate) {
long maxRetrievable = JiveGlobals.getIntProperty("conversation.maxRetrievable", ConversationManager.DEFAULT_MAX_RETRIEVABLE) long maxRetrievable = JiveGlobals.getIntProperty("conversation.maxRetrievable", ConversationManager.DEFAULT_MAX_RETRIEVABLE)
* JiveConstants.DAY; * JiveConstants.DAY;
Date result; Date result = startDate;
if (maxRetrievable > 0) { if (maxRetrievable > 0) {
Date now = new Date(); Date now = new Date();
Date maxRetrievableDate = new Date(now.getTime() - maxRetrievable); Date maxRetrievableDate = new Date(now.getTime() - maxRetrievable);
...@@ -176,12 +174,8 @@ public class JdbcPersistenceManager implements PersistenceManager { ...@@ -176,12 +174,8 @@ public class JdbcPersistenceManager implements PersistenceManager {
result = maxRetrievableDate; result = maxRetrievableDate;
} else if (startDate.before(maxRetrievableDate)) { } else if (startDate.before(maxRetrievableDate)) {
result = maxRetrievableDate; result = maxRetrievableDate;
} else {
result = startDate;
} }
}else{ }
result = startDate;
}
return result; return result;
} }
...@@ -887,5 +881,4 @@ public class JdbcPersistenceManager implements PersistenceManager { ...@@ -887,5 +881,4 @@ public class JdbcPersistenceManager implements PersistenceManager {
return false; return false;
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment