Class UIProjectMembersService


  • @Component
    public class UIProjectMembersService
    extends java.lang.Object
    Service class for the UI for handling project members actions.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String addMemberToProject​(java.lang.Long projectId, NewMemberRequest request, java.util.Locale locale)
      Add a user to a project
      java.util.List<User> getAvailableUsersForProject​(java.lang.Long projectId, java.lang.String query)
      Get a filtered list of available IRIDA instance users for this project
      TableResponse<ProjectMemberTableModel> getProjectMembers​(java.lang.Long projectId, TableRequest tableRequest)
      Get a paged listing of project members passed on parameters set in the table request.
      java.lang.String removeUserFromProject​(java.lang.Long projectId, java.lang.Long userId, java.util.Locale locale)
      Remove a user from the project
      java.lang.String updateUserMetadataRoleOnProject​(java.lang.Long projectId, java.lang.Long userId, java.lang.String metadataRole, java.util.Locale locale)
      Update a users metadata role on a project
      java.lang.String updateUserRoleOnProject​(java.lang.Long projectId, java.lang.Long userId, java.lang.String role, java.util.Locale locale)
      Update a users role on a project
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • UIProjectMembersService

        @Autowired
        public UIProjectMembersService​(ProjectService projectService,
                                       UserService userService,
                                       org.springframework.context.MessageSource messageSource)
    • Method Detail

      • getProjectMembers

        public TableResponse<ProjectMemberTableModel> getProjectMembers​(java.lang.Long projectId,
                                                                        TableRequest tableRequest)
        Get a paged listing of project members passed on parameters set in the table request.
        Parameters:
        projectId - - identifier for the current project
        tableRequest - - details about the current page of the table
        Returns:
        sorted and filtered list of project members
      • removeUserFromProject

        public java.lang.String removeUserFromProject​(java.lang.Long projectId,
                                                      java.lang.Long userId,
                                                      java.util.Locale locale)
                                               throws UIProjectWithoutOwnerException
        Remove a user from the project
        Parameters:
        projectId - - identifier for the current project
        userId - - identifier for the user to remove from the project
        locale - - of the currently logged in user
        Returns:
        Message to display to the user about the outcome of removing a user from the project.
        Throws:
        UIProjectWithoutOwnerException - if removing the user will leave the project without a manager
      • updateUserRoleOnProject

        public java.lang.String updateUserRoleOnProject​(java.lang.Long projectId,
                                                        java.lang.Long userId,
                                                        java.lang.String role,
                                                        java.util.Locale locale)
                                                 throws UIProjectWithoutOwnerException,
                                                        UIConstraintViolationException
        Update a users role on a project
        Parameters:
        projectId - - identifier for the current project
        userId - - identifier for the user to remove from the project
        role - - ProjectRole to update the user to
        locale - - of the currently logged in user
        Returns:
        message to display to the user about the outcome of the change in role.
        Throws:
        UIProjectWithoutOwnerException - if removing the user will leave the project without a manager
        UIConstraintViolationException - thrown when updating the project role to owner and the metadata role is not set to the highest level
      • updateUserMetadataRoleOnProject

        public java.lang.String updateUserMetadataRoleOnProject​(java.lang.Long projectId,
                                                                java.lang.Long userId,
                                                                java.lang.String metadataRole,
                                                                java.util.Locale locale)
                                                         throws UIConstraintViolationException
        Update a users metadata role on a project
        Parameters:
        projectId - - identifier for the current project
        userId - - identifier for the user to remove from the project
        metadataRole - - ProjectMetadataRole to update the user to
        locale - - of the currently logged in user
        Returns:
        message to display to the user about the outcome of the change in role.
        Throws:
        UIConstraintViolationException - thrown when updating the project role to owner and the metadata role is
      • getAvailableUsersForProject

        public java.util.List<User> getAvailableUsersForProject​(java.lang.Long projectId,
                                                                java.lang.String query)
        Get a filtered list of available IRIDA instance users for this project
        Parameters:
        projectId - - identifier for the current project
        query - - search query to filter the users by
        Returns:
        List of filtered users.
      • addMemberToProject

        public java.lang.String addMemberToProject​(java.lang.Long projectId,
                                                   NewMemberRequest request,
                                                   java.util.Locale locale)
        Add a user to a project
        Parameters:
        projectId - - identifier for the current project
        request - - details about the user to add to the project (id and role)
        locale - - of the currently logged in user
        Returns:
        message to display to the user about the outcome of adding the user to the project