Skip to content

Commit deb8283

Browse files
committed
fixes igniterealtime#139: Refactor: remove unused code from PersistenceManager
PersistenceManager had a lot of definition that wasn't used. It either had no implementation, or the little implementation that was there, went unreferenced. This commit removes it all, reducing code complexity by a significant factor. It appears to me that all removed code was replaced by code in the implementation of ConversationManager - although I'm not 100% sure.
1 parent f30b0fd commit deb8283

File tree

3 files changed

+33
-351
lines changed

3 files changed

+33
-351
lines changed

src/java/com/reucon/openfire/plugin/archive/PersistenceManager.java

+1-58
Original file line numberDiff line numberDiff line change
@@ -2,63 +2,18 @@
22

33
import com.reucon.openfire.plugin.archive.model.ArchivedMessage;
44
import com.reucon.openfire.plugin.archive.model.Conversation;
5-
import com.reucon.openfire.plugin.archive.model.Participant;
65
import com.reucon.openfire.plugin.archive.xep0059.XmppResultSet;
76
import org.jivesoftware.util.NotFoundException;
87
import org.xmpp.packet.JID;
98

109
import java.util.Collection;
1110
import java.util.Date;
12-
import java.util.List;
1311

1412
/**
1513
* Manages database persistence.
1614
*/
1715
public interface PersistenceManager
1816
{
19-
/**
20-
* Creates a new archived message.
21-
*
22-
* @param message the message to create.
23-
* @return <code>true</code> on success, <code>false</code> otherwise.
24-
*/
25-
boolean createMessage(ArchivedMessage message);
26-
27-
/**
28-
* Selects all messages and passes each message to the given callback for processing.
29-
*
30-
* @param callback callback to process messages.
31-
* @return number of messages processed.
32-
*/
33-
int processAllMessages(ArchivedMessageConsumer callback);
34-
35-
/**
36-
* Creates a new conversation.
37-
*
38-
* @param conversation the conversation to create.
39-
* @return <code>true</code> on success, <code>false</code> otherwise.
40-
*/
41-
boolean createConversation(Conversation conversation);
42-
43-
/**
44-
* Updates the end time of a conversation. The conversation must be persisted.
45-
*
46-
* @param conversation conversation to update with id and endDate attributes not null.
47-
* @return <code>true</code> on success, <code>false</code> otherwise.
48-
*/
49-
boolean updateConversationEnd(Conversation conversation);
50-
51-
/**
52-
* Adds a new participant to a conversation.
53-
*
54-
* @param participant the participant to add.
55-
* @param conversationId id of the conversation to add the participant to.
56-
* @return <code>true</code> on success, <code>false</code> otherwise.
57-
*/
58-
boolean createParticipant(Participant participant, Long conversationId);
59-
60-
List<Conversation> findConversations(String[] participants, Date startDate, Date endDate);
61-
6217
/**
6318
* Searches for conversations.
6419
*
@@ -85,10 +40,6 @@ public interface PersistenceManager
8540
*/
8641
Collection<ArchivedMessage> findMessages( Date startDate, Date endDate, JID owner, JID with, String query, XmppResultSet xmppResultSet, boolean useStableID) throws NotFoundException;
8742

88-
Collection<Conversation> getActiveConversations(int conversationTimeout);
89-
90-
List<Conversation> getConversations(Collection<Long> conversationIds);
91-
9243
/**
9344
* Returns the conversation with the given owner, with and start time including participants and messages.
9445
*
@@ -97,13 +48,5 @@ public interface PersistenceManager
9748
* @param start exact start time
9849
* @return the matching conversation or <code>null</code> if none matches.
9950
*/
100-
Conversation getConversation(JID owner, JID with, Date start);
101-
102-
/**
103-
* Returns the conversation with the given id including participants and messages.
104-
*
105-
* @param conversationId id of the conversation to retrieve.
106-
* @return the matching conversation or <code>null</code> if none matches.
107-
*/
108-
Conversation getConversation(Long conversationId);
51+
Conversation getConversation(JID owner, JID with, Date start); // TODO move to ConversationManager?
10952
}

0 commit comments

Comments
 (0)