Class MatrixService

java.lang.Object
io.meeds.chat.service.MatrixService

@Service public class MatrixService extends Object
  • Constructor Details

    • MatrixService

      public MatrixService()
  • Method Details

    • init

      @PostConstruct public void init()
    • getRoomBySpace

      public String getRoomBySpace(org.exoplatform.social.core.space.model.Space space)
      Returns the ID of the room linked to a space
      Parameters:
      space -
      Returns:
      the roomId linked to the space
    • getSpaceByRoomId

      public org.exoplatform.social.core.space.model.Space getSpaceByRoomId(String roomId)
      Returns the ID of the room linked to a space
      Parameters:
      roomId - the Matrix room ID
      Returns:
      the roomId linked to the space
    • createMatrixRoom

      public SpaceRoom createMatrixRoom(org.exoplatform.social.core.space.model.Space space, String roomId)
      records the matrix ID of the room linked top the space
      Parameters:
      space - the Space
      roomId - the ID of the matrix room
      Returns:
      the room ID
    • createMatrixRoomForSpace

      public String createMatrixRoomForSpace(org.exoplatform.social.core.space.model.Space space) throws Exception
      Creates a room for predefined space
      Parameters:
      space - the space
      Returns:
      String representing the room id
      Throws:
      org.exoplatform.ws.frameworks.json.impl.JsonException
      IOException
      InterruptedException
      Exception
    • getMatrixIdForUser

      public String getMatrixIdForUser(String userName)
      Get the matrix ID of a defined user
      Parameters:
      userName - of the user
      Returns:
      the matrix ID
    • getJWTSessionToken

      public String getJWTSessionToken(String userNameOnMatrix)
      Returns the JWT for user authentication
      Parameters:
      userNameOnMatrix - the username of the current user
      Returns:
      String
    • saveUserAccount

      public String saveUserAccount(org.exoplatform.services.organization.User user, boolean isNew, boolean isEnableUserOperation)
      Saves a new user on Matrix
      Parameters:
      user - the user to create on Matrix
      isNew - boolean if the user is new, then true
      Returns:
      String the matrix user ID
    • uploadFileOnMatrix

      public String uploadFileOnMatrix(String fileName, String mimeType, byte[] fileBytes)
    • updateUserAvatar

      public void updateUserAvatar(String userMatrixID, String userAvatarUrl)
    • disableAccount

      public void disableAccount(String matrixUsername)
    • updateRoomDescription

      public boolean updateRoomDescription(String roomId, String description)
    • updateRoomAvatar

      public void updateRoomAvatar(String roomId, String avatarURL)
    • getRoomSettings

      public MatrixRoomPermissions getRoomSettings(String roomId)
    • updateRoomSettings

      public boolean updateRoomSettings(String roomId, MatrixRoomPermissions matrixRoomPermissions)
    • kickUserFromRoom

      public void kickUserFromRoom(String roomId, String matrixIdOfUser, String message)
    • joinUserToRoom

      public void joinUserToRoom(String roomId, String matrixIdOfUser)
    • renameRoom

      public void renameRoom(String roomId, String spaceDisplayName)
    • makeUserAdminInRoom

      public void makeUserAdminInRoom(String matrixRoomId, String matrixIdOfUser)
    • createRoom

      public String createRoom(String teamDisplayName, String description) throws Exception
      Throws:
      Exception
    • getAllLinkedRooms

      public long getAllLinkedRooms()
    • getDirectMessagingRoom

      public DirectMessagingRoom getDirectMessagingRoom(String firstParticipant, String secondParticipant)
    • createDirectMessagingRoom

      public DirectMessagingRoom createDirectMessagingRoom(DirectMessagingRoom directMessagingRoom) throws org.exoplatform.commons.ObjectAlreadyExistsException
      Throws:
      org.exoplatform.commons.ObjectAlreadyExistsException
    • getMatrixDMRoomsOfUser

      public List<DirectMessagingRoom> getMatrixDMRoomsOfUser(String user)
    • isUserMemberOfGroup

      public boolean isUserMemberOfGroup(String userName, String groupId) throws Exception
      Throws:
      Exception