Class ChatMongoDataStorage
- java.lang.Object
-
- org.exoplatform.chat.services.mongodb.ChatMongoDataStorage
-
- All Implemented Interfaces:
ChatDataStorage
@Named("chatStorage") @ApplicationScoped @Singleton public class ChatMongoDataStorage extends Object implements ChatDataStorage
-
-
Field Summary
Fields Modifier and Type Field Description static StringM_ROOM_PREFIXstatic StringM_ROOMS_COLLECTION
-
Constructor Summary
Constructors Constructor Description ChatMongoDataStorage()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddelete(String room, String user, String messageId)voiddeleteTeamRoom(String roomId, String user)Delete a Team Room by its corresponding ID.
Nothing happen if :
the roomId doesn't exists the roomId doesn't correspond to a Team Room the specified user is not the owner of the Team Roomvoidedit(String room, String user, String messageId, String message)List<org.exoplatform.chat.model.RoomBean>getExistingRooms(String user, boolean withPublic, boolean isAdmin, org.exoplatform.chat.services.NotificationService notificationService, org.exoplatform.chat.services.TokenService tokenService)StringgetExternalRoom(String identifier)org.exoplatform.chat.model.MessageBeangetMessage(String roomId, String messageId)intgetNumberOfMessages()intgetNumberOfRooms()StringgetRoom(List<String> users)org.exoplatform.chat.model.RoomsBeangetRooms(String user, List<String> onlineUsers, String filter, boolean withUsers, boolean withSpaces, boolean withPublic, boolean withOffline, boolean isAdmin, int limit, org.exoplatform.chat.services.NotificationService notificationService, org.exoplatform.chat.services.TokenService tokenService)StringgetSpaceRoom(String space)StringgetSpaceRoomByName(String name)StringgetTeamCreator(String room)StringgetTeamRoom(String team, String user)org.exoplatform.chat.model.RoomBeangetTeamRoomById(String roomId)Retrieve a Room by its IDList<org.exoplatform.chat.model.RoomBean>getTeamRoomByName(String teamName)Return rooms by nameStringgetTypeRoomChat(String roomId)org.exoplatform.chat.model.RoomsBeangetUserRooms(String user, List<String> onlineUsers, String filter, int offset, int limit, org.exoplatform.chat.services.NotificationService notificationService, org.exoplatform.chat.services.TokenService tokenService)This will load all user rooms with paginationorg.exoplatform.chat.model.RoomsBeangetUserRooms(String user, List<String> onlineUsers, String filter, int offset, int limit, org.exoplatform.chat.services.NotificationService notificationService, org.exoplatform.chat.services.TokenService tokenService, String roomType)This will load all user rooms with paginationbooleanisRoomEnabled(String room)Stringread(String room)Stringread(String room, boolean isTextOnly, Long fromTimestamp)Stringread(String room, boolean isTextOnly, Long fromTimestamp, Long toTimestamp, int limitToLoad)Read messages from room from a dedicated timestamp to another with limit.Stringsave(String message, String user, String room, String isSystem, String options)voidsetRoomEnabled(String room, boolean enabled)voidsetRoomMeetingStatus(String room, boolean start, String startTime)voidsetRoomName(String room, String name)voidwrite(String message, String user, String room, String isSystem)voidwrite(String message, String user, String room, String isSystem, String options)
-
-
-
Field Detail
-
M_ROOM_PREFIX
public static final String M_ROOM_PREFIX
- See Also:
- Constant Field Values
-
M_ROOMS_COLLECTION
public static final String M_ROOMS_COLLECTION
- See Also:
- Constant Field Values
-
-
Method Detail
-
write
public void write(String message, String user, String room, String isSystem)
- Specified by:
writein interfaceChatDataStorage
-
write
public void write(String message, String user, String room, String isSystem, String options)
- Specified by:
writein interfaceChatDataStorage
-
save
public String save(String message, String user, String room, String isSystem, String options)
- Specified by:
savein interfaceChatDataStorage
-
delete
public void delete(String room, String user, String messageId)
- Specified by:
deletein interfaceChatDataStorage
-
getTeamRoomByName
public List<org.exoplatform.chat.model.RoomBean> getTeamRoomByName(String teamName)
Description copied from interface:ChatDataStorageReturn rooms by name- Specified by:
getTeamRoomByNamein interfaceChatDataStorage- Returns:
-
getTeamRoomById
public org.exoplatform.chat.model.RoomBean getTeamRoomById(String roomId)
Description copied from interface:ChatDataStorageRetrieve a Room by its ID- Specified by:
getTeamRoomByIdin interfaceChatDataStorage- Parameters:
roomId- the ID of the room- Returns:
- the room or null if the room doesn't exists
-
deleteTeamRoom
public void deleteTeamRoom(String roomId, String user)
Description copied from interface:ChatDataStorageDelete a Team Room by its corresponding ID.
Nothing happen if :
- the roomId doesn't exists
- the roomId doesn't correspond to a Team Room
- the specified user is not the owner of the Team Room
- Specified by:
deleteTeamRoomin interfaceChatDataStorage- Parameters:
roomId- the team room ID to deleteuser- the owner of the team room
-
edit
public void edit(String room, String user, String messageId, String message)
- Specified by:
editin interfaceChatDataStorage
-
read
public String read(String room)
- Specified by:
readin interfaceChatDataStorage
-
read
public String read(String room, boolean isTextOnly, Long fromTimestamp)
- Specified by:
readin interfaceChatDataStorage
-
read
public String read(String room, boolean isTextOnly, Long fromTimestamp, Long toTimestamp, int limitToLoad)
Description copied from interface:ChatDataStorageRead messages from room from a dedicated timestamp to another with limit.- Specified by:
readin interfaceChatDataStorage- Returns:
-
getMessage
public org.exoplatform.chat.model.MessageBean getMessage(String roomId, String messageId)
- Specified by:
getMessagein interfaceChatDataStorage
-
getSpaceRoom
public String getSpaceRoom(String space)
- Specified by:
getSpaceRoomin interfaceChatDataStorage
-
getSpaceRoomByName
public String getSpaceRoomByName(String name)
- Specified by:
getSpaceRoomByNamein interfaceChatDataStorage
-
getTeamRoom
public String getTeamRoom(String team, String user)
- Specified by:
getTeamRoomin interfaceChatDataStorage
-
getExternalRoom
public String getExternalRoom(String identifier)
- Specified by:
getExternalRoomin interfaceChatDataStorage
-
getTeamCreator
public String getTeamCreator(String room)
- Specified by:
getTeamCreatorin interfaceChatDataStorage
-
setRoomName
public void setRoomName(String room, String name)
- Specified by:
setRoomNamein interfaceChatDataStorage
-
isRoomEnabled
public boolean isRoomEnabled(String room)
- Specified by:
isRoomEnabledin interfaceChatDataStorage
-
setRoomEnabled
public void setRoomEnabled(String room, boolean enabled)
- Specified by:
setRoomEnabledin interfaceChatDataStorage
-
setRoomMeetingStatus
public void setRoomMeetingStatus(String room, boolean start, String startTime)
- Specified by:
setRoomMeetingStatusin interfaceChatDataStorage
-
getRoom
public String getRoom(List<String> users)
- Specified by:
getRoomin interfaceChatDataStorage
-
getTypeRoomChat
public String getTypeRoomChat(String roomId)
- Specified by:
getTypeRoomChatin interfaceChatDataStorage
-
getExistingRooms
public List<org.exoplatform.chat.model.RoomBean> getExistingRooms(String user, boolean withPublic, boolean isAdmin, org.exoplatform.chat.services.NotificationService notificationService, org.exoplatform.chat.services.TokenService tokenService)
- Specified by:
getExistingRoomsin interfaceChatDataStorage- Returns:
- All existing personal rooms of given
user
-
getRooms
public org.exoplatform.chat.model.RoomsBean getRooms(String user, List<String> onlineUsers, String filter, boolean withUsers, boolean withSpaces, boolean withPublic, boolean withOffline, boolean isAdmin, int limit, org.exoplatform.chat.services.NotificationService notificationService, org.exoplatform.chat.services.TokenService tokenService)
- Specified by:
getRoomsin interfaceChatDataStorage
-
getUserRooms
public org.exoplatform.chat.model.RoomsBean getUserRooms(String user, List<String> onlineUsers, String filter, int offset, int limit, org.exoplatform.chat.services.NotificationService notificationService, org.exoplatform.chat.services.TokenService tokenService)
This will load all user rooms with pagination- Specified by:
getUserRoomsin interfaceChatDataStorage- Parameters:
user- the user for whom roomw will be loadedonlineUsers- list of online usersfilter- the filter used to filter roomsoffset- the current offsetlimit- the limit of roomsnotificationService- service storing rooms notificationstokenService- service storing tokens- Returns:
- RoomsBean containing all rooms with unread messages
-
getUserRooms
public org.exoplatform.chat.model.RoomsBean getUserRooms(String user, List<String> onlineUsers, String filter, int offset, int limit, org.exoplatform.chat.services.NotificationService notificationService, org.exoplatform.chat.services.TokenService tokenService, String roomType)
This will load all user rooms with pagination- Specified by:
getUserRoomsin interfaceChatDataStorage- Parameters:
user- the user for whom roomw will be loadedonlineUsers- list of online usersfilter- the filter used to filter roomsoffset- the current offsetlimit- the limit of roomsnotificationService- service storing rooms notificationstokenService- service storing tokensroomType- type of the room : u for one to one , t for team room or s for space rooms- Returns:
- RoomsBean containing all rooms with unread messages
-
getNumberOfRooms
public int getNumberOfRooms()
- Specified by:
getNumberOfRoomsin interfaceChatDataStorage
-
getNumberOfMessages
public int getNumberOfMessages()
- Specified by:
getNumberOfMessagesin interfaceChatDataStorage
-
-