@Test public void getWorkspaceSpecificUserMemberShipsTest() throws ApplicationException { WorkspaceUserMembership membership = new WorkspaceUserMembership(workspace, user); Mockito.when(userManager.getWorkspaceSpecificUserMemberships(workspaceId)) .thenReturn(membership); WorkspaceUserMemberShipDTO workspaceSpecificUserMemberShips = workspaceMembershipResource.getWorkspaceSpecificUserMemberShips(workspaceId); Assert.assertNotNull(workspaceSpecificUserMemberShips); Assert.assertEquals(login, workspaceSpecificUserMemberShips.getMember().getLogin()); }
@GET @ApiOperation(value = "Get workspace's user membership for authenticated user", response = WorkspaceUserMemberShipDTO.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "Successful retrieval of WorkspaceUserMemberShipDTO"), @ApiResponse(code = 401, message = "Unauthorized"), @ApiResponse(code = 500, message = "Internal server error") }) @Path("users/me") @Produces(MediaType.APPLICATION_JSON) public WorkspaceUserMemberShipDTO getWorkspaceSpecificUserMemberShips(@ApiParam(required = true, value = "Workspace id") @PathParam("workspaceId") String workspaceId) throws EntityNotFoundException, UserNotActiveException, WorkspaceNotEnabledException { WorkspaceUserMembership workspaceUserMemberships = userManager.getWorkspaceSpecificUserMemberships(workspaceId); return mapper.map(workspaceUserMemberships, WorkspaceUserMemberShipDTO.class); }
WorkspaceMembershipResource { @GET @ApiOperation(value = "Get workspace's user membership for authenticated user", response = WorkspaceUserMemberShipDTO.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "Successful retrieval of WorkspaceUserMemberShipDTO"), @ApiResponse(code = 401, message = "Unauthorized"), @ApiResponse(code = 500, message = "Internal server error") }) @Path("users/me") @Produces(MediaType.APPLICATION_JSON) public WorkspaceUserMemberShipDTO getWorkspaceSpecificUserMemberShips(@ApiParam(required = true, value = "Workspace id") @PathParam("workspaceId") String workspaceId) throws EntityNotFoundException, UserNotActiveException, WorkspaceNotEnabledException { WorkspaceUserMembership workspaceUserMemberships = userManager.getWorkspaceSpecificUserMemberships(workspaceId); return mapper.map(workspaceUserMemberships, WorkspaceUserMemberShipDTO.class); } }
WorkspaceMembershipResource { @GET @ApiOperation(value = "Get workspace's user membership for authenticated user", response = WorkspaceUserMemberShipDTO.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "Successful retrieval of WorkspaceUserMemberShipDTO"), @ApiResponse(code = 401, message = "Unauthorized"), @ApiResponse(code = 500, message = "Internal server error") }) @Path("users/me") @Produces(MediaType.APPLICATION_JSON) public WorkspaceUserMemberShipDTO getWorkspaceSpecificUserMemberShips(@ApiParam(required = true, value = "Workspace id") @PathParam("workspaceId") String workspaceId) throws EntityNotFoundException, UserNotActiveException, WorkspaceNotEnabledException { WorkspaceUserMembership workspaceUserMemberships = userManager.getWorkspaceSpecificUserMemberships(workspaceId); return mapper.map(workspaceUserMemberships, WorkspaceUserMemberShipDTO.class); } WorkspaceMembershipResource(); }
WorkspaceMembershipResource { @GET @ApiOperation(value = "Get workspace's user membership for authenticated user", response = WorkspaceUserMemberShipDTO.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "Successful retrieval of WorkspaceUserMemberShipDTO"), @ApiResponse(code = 401, message = "Unauthorized"), @ApiResponse(code = 500, message = "Internal server error") }) @Path("users/me") @Produces(MediaType.APPLICATION_JSON) public WorkspaceUserMemberShipDTO getWorkspaceSpecificUserMemberShips(@ApiParam(required = true, value = "Workspace id") @PathParam("workspaceId") String workspaceId) throws EntityNotFoundException, UserNotActiveException, WorkspaceNotEnabledException { WorkspaceUserMembership workspaceUserMemberships = userManager.getWorkspaceSpecificUserMemberships(workspaceId); return mapper.map(workspaceUserMemberships, WorkspaceUserMemberShipDTO.class); } WorkspaceMembershipResource(); @PostConstruct void init(); @GET @ApiOperation(value = "Get workspace's user memberships", response = WorkspaceUserMemberShipDTO.class, responseContainer = "List") @ApiResponses(value = { @ApiResponse(code = 200, message = "Successful retrieval of WorkspaceUserMemberShipDTOs. It can be an empty list."), @ApiResponse(code = 401, message = "Unauthorized"), @ApiResponse(code = 403, message = "Forbidden"), @ApiResponse(code = 500, message = "Internal server error") }) @Path("users") @Produces(MediaType.APPLICATION_JSON) WorkspaceUserMemberShipDTO[] getWorkspaceUserMemberShips(
            @ApiParam(required = true, value = "Workspace id") @PathParam("workspaceId") String workspaceId); @GET @ApiOperation(value = "Get workspace's user membership for authenticated user", response = WorkspaceUserMemberShipDTO.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "Successful retrieval of WorkspaceUserMemberShipDTO"), @ApiResponse(code = 401, message = "Unauthorized"), @ApiResponse(code = 500, message = "Internal server error") }) @Path("users/me") @Produces(MediaType.APPLICATION_JSON) WorkspaceUserMemberShipDTO getWorkspaceSpecificUserMemberShips(@ApiParam(required = true, value = "Workspace id") @PathParam("workspaceId") String workspaceId); @GET @ApiOperation(value = "Get workspace's group membership for authenticated user", response = WorkspaceUserGroupMemberShipDTO.class, responseContainer = "List") @ApiResponses(value = { @ApiResponse(code = 200, message = "Successful retrieval of WorkspaceUserGroupMemberShipDTOs. It can be an empty list."), @ApiResponse(code = 401, message = "Unauthorized"), @ApiResponse(code = 403, message = "Forbidden"), @ApiResponse(code = 500, message = "Internal server error") }) @Path("usergroups") @Produces(MediaType.APPLICATION_JSON) WorkspaceUserGroupMemberShipDTO[] getWorkspaceUserGroupMemberShips(
            @ApiParam(required = true, value = "Workspace id")  @PathParam("workspaceId") String workspaceId); @GET @ApiOperation(value = "Get workspace's group membership for authenticated user", response = WorkspaceUserGroupMemberShipDTO.class, responseContainer = "List") @ApiResponses(value = { @ApiResponse(code = 200, message = "Successful retrieval of WorkspaceUserGroupMemberShipDTOs. It can be an empty list."), @ApiResponse(code = 401, message = "Unauthorized"), @ApiResponse(code = 403, message = "Forbidden"), @ApiResponse(code = 500, message = "Internal server error") }) @Path("usergroups/me") @Produces(MediaType.APPLICATION_JSON) Response getWorkspaceSpecificUserGroupMemberShips(
            @ApiParam(required = true, value = "Workspace id")  @PathParam("workspaceId") String workspaceId); }
WorkspaceMembershipResource { @GET @ApiOperation(value = "Get workspace's user membership for authenticated user", response = WorkspaceUserMemberShipDTO.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "Successful retrieval of WorkspaceUserMemberShipDTO"), @ApiResponse(code = 401, message = "Unauthorized"), @ApiResponse(code = 500, message = "Internal server error") }) @Path("users/me") @Produces(MediaType.APPLICATION_JSON) public WorkspaceUserMemberShipDTO getWorkspaceSpecificUserMemberShips(@ApiParam(required = true, value = "Workspace id") @PathParam("workspaceId") String workspaceId) throws EntityNotFoundException, UserNotActiveException, WorkspaceNotEnabledException { WorkspaceUserMembership workspaceUserMemberships = userManager.getWorkspaceSpecificUserMemberships(workspaceId); return mapper.map(workspaceUserMemberships, WorkspaceUserMemberShipDTO.class); } WorkspaceMembershipResource(); @PostConstruct void init(); @GET @ApiOperation(value = "Get workspace's user memberships", response = WorkspaceUserMemberShipDTO.class, responseContainer = "List") @ApiResponses(value = { @ApiResponse(code = 200, message = "Successful retrieval of WorkspaceUserMemberShipDTOs. It can be an empty list."), @ApiResponse(code = 401, message = "Unauthorized"), @ApiResponse(code = 403, message = "Forbidden"), @ApiResponse(code = 500, message = "Internal server error") }) @Path("users") @Produces(MediaType.APPLICATION_JSON) WorkspaceUserMemberShipDTO[] getWorkspaceUserMemberShips(
            @ApiParam(required = true, value = "Workspace id") @PathParam("workspaceId") String workspaceId); @GET @ApiOperation(value = "Get workspace's user membership for authenticated user", response = WorkspaceUserMemberShipDTO.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "Successful retrieval of WorkspaceUserMemberShipDTO"), @ApiResponse(code = 401, message = "Unauthorized"), @ApiResponse(code = 500, message = "Internal server error") }) @Path("users/me") @Produces(MediaType.APPLICATION_JSON) WorkspaceUserMemberShipDTO getWorkspaceSpecificUserMemberShips(@ApiParam(required = true, value = "Workspace id") @PathParam("workspaceId") String workspaceId); @GET @ApiOperation(value = "Get workspace's group membership for authenticated user", response = WorkspaceUserGroupMemberShipDTO.class, responseContainer = "List") @ApiResponses(value = { @ApiResponse(code = 200, message = "Successful retrieval of WorkspaceUserGroupMemberShipDTOs. It can be an empty list."), @ApiResponse(code = 401, message = "Unauthorized"), @ApiResponse(code = 403, message = "Forbidden"), @ApiResponse(code = 500, message = "Internal server error") }) @Path("usergroups") @Produces(MediaType.APPLICATION_JSON) WorkspaceUserGroupMemberShipDTO[] getWorkspaceUserGroupMemberShips(
            @ApiParam(required = true, value = "Workspace id")  @PathParam("workspaceId") String workspaceId); @GET @ApiOperation(value = "Get workspace's group membership for authenticated user", response = WorkspaceUserGroupMemberShipDTO.class, responseContainer = "List") @ApiResponses(value = { @ApiResponse(code = 200, message = "Successful retrieval of WorkspaceUserGroupMemberShipDTOs. It can be an empty list."), @ApiResponse(code = 401, message = "Unauthorized"), @ApiResponse(code = 403, message = "Forbidden"), @ApiResponse(code = 500, message = "Internal server error") }) @Path("usergroups/me") @Produces(MediaType.APPLICATION_JSON) Response getWorkspaceSpecificUserGroupMemberShips(
            @ApiParam(required = true, value = "Workspace id")  @PathParam("workspaceId") String workspaceId);  }