Class TeamRestEndpoint


  • @Path("teams")
    @Consumes("application/json")
    @Produces("application/json")
    public class TeamRestEndpoint
    extends Object
    REST Teams controller. Allow to manage roles and teams members
    Author:
    maxence, sandra
    • Constructor Detail

      • TeamRestEndpoint

        public TeamRestEndpoint()
    • Method Detail

      • getTeamMembersForProject

        @GET
        @Path("members/byproject/{projectId: [0-9]+}")
        public List<TeamMember> getTeamMembersForProject​(@PathParam("projectId")
                                                         Long projectId)
        Get the members of the project team
        Parameters:
        projectId - id of the project
        Returns:
        list of team members
      • getTeamMember

        @GET
        @Path("member/{memberId: [0-9]+}")
        public TeamMember getTeamMember​(@PathParam("memberId")
                                        Long memberId)
        Get a TeamMember
        Parameters:
        memberId - id of the team member
        Returns:
        the team member
      • updateTeamMember

        @PUT
        @Path("member")
        public void updateTeamMember​(TeamMember member)
                              throws ColabMergeException
        Update a TeamMember. Only fields which are editable by users will be impacted.
        Parameters:
        member - new value
        Throws:
        ColabMergeException - if update failed
      • changeMemberPosition

        @PUT
        @Path("member/{memberId: [0-9]+}/{position}")
        public void changeMemberPosition​(@PathParam("memberId")
                                         Long memberId,
                                         @PathParam("position")
                                         HierarchicalPosition position)
        Update hierarchical position of a member
        Parameters:
        memberId - id of the member
        position - new hierarchical position
      • deleteTeamMember

        @DELETE
        @Path("member/{memberId: [0-9]+}")
        public void deleteTeamMember​(@PathParam("memberId")
                                     Long memberId)
        Delete a team member
        Parameters:
        memberId - id of the member
      • inviteSomeone

        @POST
        @Path("Invite/{projectId: [0-9]+}/{email}")
        public TeamMember inviteSomeone​(@PathParam("projectId")
                                        Long projectId,
                                        @PathParam("email")
                                        String email)
        Send invitation to someone.
        Parameters:
        projectId - id of the project
        email - recipient address
        Returns:
        the pending team member
      • generateSharingLinkToken

        @POST
        @Path("sharingLink/generate/{projectId: [0-9]+}/{cardId: [0-9]+}")
        public SerializationStringWrapper generateSharingLinkToken​(@PathParam("projectId")
                                                                   Long projectId,
                                                                   @PathParam("cardId")
                                                                   Long cardId)
        Create a token to share the project.
        Parameters:
        projectId - The id of the project that will become visible (mandatory)
        cardId - The id of the card that will become editable (optional)
        Returns:
        the URL to use to consume the token
      • deleteSharingLinkTokensByProject

        @DELETE
        @Path("sharingLink/deleteByProject/{projectId: [0-9]+}")
        public void deleteSharingLinkTokensByProject​(@PathParam("projectId")
                                                     Long projectId)
        Delete all sharing link tokens for the given project.
        Parameters:
        projectId - the id of the project
      • deleteSharingLinkTokensByCard

        @DELETE
        @Path("sharingLink/deleteByCard/{cardId: [0-9]+}")
        public void deleteSharingLinkTokensByCard​(@PathParam("cardId")
                                                  Long cardId)
        Delete all sharing link tokens for the given card.
        Parameters:
        cardId - the id of the card
      • getTeamRolesForProject

        @GET
        @Path("roles/byproject/{projectId: [0-9]+}")
        public List<TeamRole> getTeamRolesForProject​(@PathParam("projectId")
                                                     Long projectId)
        Get the team roles defined in the given project
        Parameters:
        projectId - the id of the project
        Returns:
        list of team roles
      • createRole

        @POST
        @Path("role")
        public Long createRole​(TeamRole role)
        Create a role. The role must have a projectId set.
        Parameters:
        role - the role to create
        Returns:
        id of the new role
      • getRole

        @GET
        @Path("role/{roleId: [0-9]+}")
        public TeamRole getRole​(@PathParam("roleId")
                                Long roleId)
        Get a role
        Parameters:
        roleId - id of the role
        Returns:
        the role
      • updateRole

        @PUT
        @Path("role")
        public void updateRole​(TeamRole role)
                        throws ColabMergeException
        Update a role. Only fields which are editable by users will be impacted.
        Parameters:
        role - the role to update
        Throws:
        ColabMergeException - if update failed
      • deleteRole

        @DELETE
        @Path("role/{roleId: [0-9]+}")
        public void deleteRole​(@PathParam("roleId")
                               Long roleId)
        Delete a role

        TODO: shall we allow to delete non-empty roles?

        Parameters:
        roleId - id of the role to delete id of the role to delete
      • giveRoleTo

        @PUT
        @Path("role/{roleId: [0-9]+}/giveto/{memberId: [0-9]+}")
        public void giveRoleTo​(@PathParam("roleId")
                               Long roleId,
                               @PathParam("memberId")
                               Long memberId)
        Give a role to a member. Member and role must belong to the same project. CurrentUser must have the right to edit the role
        Parameters:
        roleId - id of the role
        memberId - id of the team member
      • removeRoleFrom

        @PUT
        @Path("role/{roleId: [0-9]+}/removeto/{memberId : [0-9]+}")
        public void removeRoleFrom​(@PathParam("roleId")
                                   Long roleId,
                                   @PathParam("memberId")
                                   Long memberId)
        Remove a role from some team member. CurrentUser must have the right to edit the role.
        Parameters:
        roleId - id of the role
        memberId - id of the team member
      • getAssignmentsForProject

        @GET
        @Path("assignments/byproject/{projectId: [0-9]+}")
        public List<Assignment> getAssignmentsForProject​(@PathParam("projectId")
                                                         Long projectId)
        Get Assignments related to the given project
        Parameters:
        projectId - the id of the project
        Returns:
        assignments list
      • getAssignmentsForCard

        @GET
        @Path("assignments/bycard/{cardId: [0-9]+}")
        public List<Assignment> getAssignmentsForCard​(@PathParam("cardId")
                                                      Long cardId)
        Get assignments related to the given card
        Parameters:
        cardId - id of the card
        Returns:
        assignments list
      • createEmptyAssignment

        @PUT
        @Path("assignment/card/{cardId: [0-9]+}/member/{memberId: [0-9]+}")
        public void createEmptyAssignment​(@PathParam("cardId")
                                          Long cardId,
                                          @PathParam("memberId")
                                          Long memberId)
        Add an assignment for a card and a member without involvement level
        Parameters:
        cardId - id of the card
        memberId - id of the team member
      • setAssignment

        @POST
        @Path("assignment/card/{cardId: [0-9]+}/member/{memberId: [0-9]+}/{level}")
        public void setAssignment​(@PathParam("cardId")
                                  Long cardId,
                                  @PathParam("memberId")
                                  Long memberId,
                                  @PathParam("level")
                                  InvolvementLevel level)
        Set an assignment for a card and a member
        Parameters:
        cardId - id of the card
        memberId - id of the team member
        level - involvement level
      • removeAssignmentLevel

        @POST
        @Path("assignment/card/{cardId: [0-9]+}/member/{memberId: [0-9]+}")
        public void removeAssignmentLevel​(@PathParam("cardId")
                                          Long cardId,
                                          @PathParam("memberId")
                                          Long memberId)
        Remove the level of an assignment level for a card and a member
        Parameters:
        cardId - id of the card
        memberId - id of the team member
      • deleteAssignments

        @DELETE
        @Path("assignment/card/{cardId: [0-9]+}/member/{memberId: [0-9]+}")
        public void deleteAssignments​(@PathParam("cardId")
                                      Long cardId,
                                      @PathParam("memberId")
                                      Long memberId)
        Delete all assignments for a card and a member
        Parameters:
        cardId - id of the card
        memberId - id of the team member