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 Details

  • Constructor Details

    • ChatMongoDataStorage

      public ChatMongoDataStorage()
  • Method Details

    • write

      public void write(String message, String user, String room, String isSystem)
      Specified by:
      write in interface ChatDataStorage
    • write

      public void write(String message, String user, String room, String isSystem, String options)
      Specified by:
      write in interface ChatDataStorage
    • save

      public String save(String message, String user, String room, String isSystem, String options)
      Specified by:
      save in interface ChatDataStorage
    • delete

      public void delete(String room, String user, String messageId)
      Specified by:
      delete in interface ChatDataStorage
    • getTeamRoomByName

      public List<org.exoplatform.chat.model.RoomBean> getTeamRoomByName(String teamName)
      Description copied from interface: ChatDataStorage
      Return rooms by name
      Specified by:
      getTeamRoomByName in interface ChatDataStorage
      Returns:
    • getTeamRoomById

      public org.exoplatform.chat.model.RoomBean getTeamRoomById(String roomId)
      Description copied from interface: ChatDataStorage
      Retrieve a Room by its ID
      Specified by:
      getTeamRoomById in interface ChatDataStorage
      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: ChatDataStorage
      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 Room
      Specified by:
      deleteTeamRoom in interface ChatDataStorage
      Parameters:
      roomId - the team room ID to delete
      user - the owner of the team room
    • edit

      public void edit(String room, String user, String messageId, String message)
      Specified by:
      edit in interface ChatDataStorage
    • read

      public String read(String room)
      Specified by:
      read in interface ChatDataStorage
    • read

      public String read(String room, boolean isTextOnly, Long fromTimestamp)
      Specified by:
      read in interface ChatDataStorage
    • read

      public String read(String room, boolean isTextOnly, Long fromTimestamp, Long toTimestamp, int limitToLoad)
      Description copied from interface: ChatDataStorage
      Read messages from room from a dedicated timestamp to another with limit.
      Specified by:
      read in interface ChatDataStorage
      Returns:
    • getMessage

      public org.exoplatform.chat.model.MessageBean getMessage(String roomId, String messageId)
      Specified by:
      getMessage in interface ChatDataStorage
    • getSpaceRoom

      public String getSpaceRoom(String space)
      Specified by:
      getSpaceRoom in interface ChatDataStorage
    • getSpaceRoomByName

      public String getSpaceRoomByName(String name)
      Specified by:
      getSpaceRoomByName in interface ChatDataStorage
    • getTeamRoom

      public String getTeamRoom(String team, String user)
      Specified by:
      getTeamRoom in interface ChatDataStorage
    • getExternalRoom

      public String getExternalRoom(String identifier)
      Specified by:
      getExternalRoom in interface ChatDataStorage
    • getTeamCreator

      public String getTeamCreator(String room)
      Specified by:
      getTeamCreator in interface ChatDataStorage
    • setRoomName

      public void setRoomName(String room, String name)
      Specified by:
      setRoomName in interface ChatDataStorage
    • isRoomEnabled

      public boolean isRoomEnabled(String room)
      Specified by:
      isRoomEnabled in interface ChatDataStorage
    • setRoomEnabled

      public void setRoomEnabled(String room, boolean enabled)
      Specified by:
      setRoomEnabled in interface ChatDataStorage
    • setRoomMeetingStatus

      public void setRoomMeetingStatus(String room, boolean start, String startTime)
      Specified by:
      setRoomMeetingStatus in interface ChatDataStorage
    • getRoom

      public String getRoom(List<String> users)
      Specified by:
      getRoom in interface ChatDataStorage
    • getTypeRoomChat

      public String getTypeRoomChat(String roomId)
      Specified by:
      getTypeRoomChat in interface ChatDataStorage
    • 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:
      getExistingRooms in interface ChatDataStorage
      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:
      getRooms in interface ChatDataStorage
    • 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:
      getUserRooms in interface ChatDataStorage
      Parameters:
      user - the user for whom roomw will be loaded
      onlineUsers - list of online users
      filter - the filter used to filter rooms
      offset - the current offset
      limit - the limit of rooms
      notificationService - service storing rooms notifications
      tokenService - 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:
      getUserRooms in interface ChatDataStorage
      Parameters:
      user - the user for whom roomw will be loaded
      onlineUsers - list of online users
      filter - the filter used to filter rooms
      offset - the current offset
      limit - the limit of rooms
      notificationService - service storing rooms notifications
      tokenService - service storing tokens
      roomType - 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:
      getNumberOfRooms in interface ChatDataStorage
    • getNumberOfMessages

      public int getNumberOfMessages()
      Specified by:
      getNumberOfMessages in interface ChatDataStorage