Class UIUserGroupsService


  • @Component
    public class UIUserGroupsService
    extends java.lang.Object
    Service class for the UI for handling UserGroups
    • Constructor Detail

      • UIUserGroupsService

        @Autowired
        public UIUserGroupsService​(UserGroupService userGroupService,
                                   UserService userService,
                                   org.springframework.context.MessageSource messageSource)
    • Method Detail

      • deleteUserGroup

        public java.lang.String deleteUserGroup​(java.lang.Long id,
                                                java.util.Locale locale)
        Delete a specific user group
        Parameters:
        id - Identifier for the user group to delete
        locale - Current users locale
        Returns:
        Message to user about what happened
      • getUserGroupDetails

        public UserGroupDetails getUserGroupDetails​(java.lang.Long groupId)
        Get details about a specific user group
        Parameters:
        groupId - identifier for a UserGroup
        Returns:
        UserGroupDetails
      • updateUserGroupDetails

        public void updateUserGroupDetails​(java.lang.Long groupId,
                                           FieldUpdate update)
        Update user group details
        Parameters:
        groupId - identifier for an UserGroup to update
        update - details about which field and value to update
      • getUserGroupRoles

        public java.util.List<UserGroupRole> getUserGroupRoles​(java.util.Locale locale)
        Get a list of all user group roles with their translations
        Parameters:
        locale - current users Locale
        Returns:
        list of UserGroupRole
      • getAvailableUsersForUserGroup

        public java.util.List<User> getAvailableUsersForUserGroup​(java.lang.Long groupId,
                                                                  java.lang.String query)
        Get a list of system users who are not on the project yet.
        Parameters:
        groupId - identifier for a UserGroup
        query - used to search for a specific user
        Returns:
        list of User that can be added to the project
      • addMemberToUserGroup

        public java.lang.String addMemberToUserGroup​(java.lang.Long groupId,
                                                     java.lang.Long userId,
                                                     java.lang.String role,
                                                     java.util.Locale locale)
        Add a new member to the user group
        Parameters:
        groupId - identifier for the UserGroup
        userId - identifier for the User
        role - role to assign to the user
        locale - current users Locale
        Returns:
        message to the user about the status of this request
      • updateUserRoleOnUserGroup

        public java.lang.String updateUserRoleOnUserGroup​(java.lang.Long groupId,
                                                          java.lang.Long userId,
                                                          java.lang.String role,
                                                          java.util.Locale locale)
                                                   throws UserGroupWithoutOwnerException
        Update a users role on a project
        Parameters:
        groupId - identifier for a UserGroup
        userId - identifier for a User
        role - role to update the user to
        locale - Current users Locale
        Returns:
        Message to user about the result of the update
        Throws:
        UserGroupWithoutOwnerException - thrown if changing the users role would result in the user group not having an owner
      • removeMemberFromUserGroup

        public java.lang.String removeMemberFromUserGroup​(java.lang.Long groupId,
                                                          java.lang.Long userId,
                                                          java.util.Locale locale)
                                                   throws UserGroupWithoutOwnerException
        Remove a user from an user group
        Parameters:
        groupId - identifier for a UserGroup
        userId - identifier for a User
        locale - current users Locale
        Returns:
        Message to user about the result of removing the user
        Throws:
        UserGroupWithoutOwnerException - thrown if removing the user would result in the user group not having an owner
      • getProjectsForUserGroup

        public java.util.List<UserGroupProjectTableModel> getProjectsForUserGroup​(java.lang.Long groupId,
                                                                                  java.util.Locale locale)
        Gets a list of projects that are on a user group
        Parameters:
        groupId - identifier for an UserGroup
        locale - current users Locale
        Returns:
        list of UserGroupProjectTableModel