|
1 | 1 | import java.io.*;
|
2 | 2 | import java.util.ArrayList;
|
3 | 3 | import java.util.List;
|
4 |
| -public class UserDatabase implements UserExists, UserRetriever, UserCreator, IRetrieveList, UserModificationGateway{ |
| 4 | +public class UserDatabase implements UserExists, UserRetriever, UserCreator, IRetrieveList, UserModificationGateway, |
| 5 | +ConvHistGateway, MsgSenderGateway { |
5 | 6 | File accounts;
|
6 | 7 | List<User> accountList;
|
7 | 8 | public UserDatabase(){
|
@@ -114,4 +115,36 @@ public void modifyUser(String oldUsername, User modified){
|
114 | 115 | System.out.println("Error");
|
115 | 116 | }
|
116 | 117 | }
|
| 118 | + |
| 119 | + // Below two methods are used by conversation history-related interactors |
| 120 | + // (Commented as objects are not found) |
| 121 | +// /** |
| 122 | +// * Pushes a new message to a chat's conversation history (in memory not persisting storage) |
| 123 | +// * @param dsRequestModel input data containing user ID, chat ID, message content |
| 124 | +// */ |
| 125 | +// public void saveMessage(MsgSenderDsRequestModel dsRequestModel) { |
| 126 | +// String userID = dsRequestModel.getUserID(); |
| 127 | +// String chatID = dsRequestModel.getChatID(); |
| 128 | +// Message message = dsRequestModel.getMessage(); |
| 129 | +// |
| 130 | +// // Find chat under specified User |
| 131 | +// Chat chat = this.getUser(userID).getChat(chatID); |
| 132 | +// |
| 133 | +// chat.addMessage(message); |
| 134 | +// } |
| 135 | +// |
| 136 | +// /** |
| 137 | +// * Gets a chat's conversation history (from memory not persisting storage) |
| 138 | +// * @param dsRequestModel input data containing user ID, chat ID |
| 139 | +// * @return a chat's conversation history |
| 140 | +// */ |
| 141 | +// public ArrayList<Message> getConversationHistory(ConvHistDsRequestModel dsRequestModel) { |
| 142 | +// String userID = dsRequestModel.getUserID(); |
| 143 | +// String chatID = dsRequestModel.getChatID(); |
| 144 | +// |
| 145 | +// // Find chat under specified User |
| 146 | +// Chat chat = this.getUser(userID).getChat(chatID); |
| 147 | +// |
| 148 | +// return Chat.getConversationHistory(); |
| 149 | +// } |
117 | 150 | }
|
0 commit comments