Remove unused parameters

This commit is contained in:
René Pfeuffer
2018-06-28 06:47:43 +02:00
parent 9ec59b680e
commit 8eb544c966
4 changed files with 15 additions and 25 deletions

View File

@@ -19,7 +19,6 @@ import javax.ws.rs.Path;
import javax.ws.rs.Produces; import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam; import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context; import javax.ws.rs.core.Context;
import javax.ws.rs.core.Request;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo; import javax.ws.rs.core.UriInfo;
import java.io.IOException; import java.io.IOException;
@@ -45,8 +44,6 @@ public class GroupCollectionResource {
* Returns all groups for a given page number with a given page size (default page size is {@value DEFAULT_PAGE_SIZE}). * Returns all groups for a given page number with a given page size (default page size is {@value DEFAULT_PAGE_SIZE}).
* *
* <strong>Note:</strong> This method requires "group" privilege. * <strong>Note:</strong> This method requires "group" privilege.
*
* @param request the current request
* @param page the number of the requested page * @param page the number of the requested page
* @param pageSize the page size (default page size is {@value DEFAULT_PAGE_SIZE}) * @param pageSize the page size (default page size is {@value DEFAULT_PAGE_SIZE})
* @param sortBy sort parameter * @param sortBy sort parameter
@@ -62,8 +59,7 @@ public class GroupCollectionResource {
@ResponseCode(code = 403, condition = "not authorized, the current user does not have the \"group\" privilege"), @ResponseCode(code = 403, condition = "not authorized, the current user does not have the \"group\" privilege"),
@ResponseCode(code = 500, condition = "internal server error") @ResponseCode(code = 500, condition = "internal server error")
}) })
public Response getAll(@Context Request request, public Response getAll(@DefaultValue("0") @QueryParam("page") int page,
@DefaultValue("0") @QueryParam("page") int page,
@DefaultValue("" + DEFAULT_PAGE_SIZE) @QueryParam("pageSize") int pageSize, @DefaultValue("" + DEFAULT_PAGE_SIZE) @QueryParam("pageSize") int pageSize,
@QueryParam("sortby") String sortBy, @QueryParam("sortby") String sortBy,
@DefaultValue("false") @DefaultValue("false")

View File

@@ -9,11 +9,14 @@ import sonia.scm.group.GroupManager;
import sonia.scm.web.VndMediaType; import sonia.scm.web.VndMediaType;
import javax.inject.Inject; import javax.inject.Inject;
import javax.ws.rs.*; import javax.ws.rs.Consumes;
import javax.ws.rs.core.Context; import javax.ws.rs.DELETE;
import javax.ws.rs.core.Request; import javax.ws.rs.GET;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;
public class GroupResource { public class GroupResource {
@@ -34,7 +37,6 @@ public class GroupResource {
* *
* <strong>Note:</strong> This method requires "group" privilege. * <strong>Note:</strong> This method requires "group" privilege.
* *
* @param request the current request
* @param id the id/name of the group * @param id the id/name of the group
* *
*/ */
@@ -49,7 +51,7 @@ public class GroupResource {
@ResponseCode(code = 404, condition = "not found, no group with the specified id/name available"), @ResponseCode(code = 404, condition = "not found, no group with the specified id/name available"),
@ResponseCode(code = 500, condition = "internal server error") @ResponseCode(code = 500, condition = "internal server error")
}) })
public Response get(@Context Request request, @Context UriInfo uriInfo, @PathParam("id") String id) { public Response get(@PathParam("id") String id) {
return adapter.get(id, groupToGroupDtoMapper::map); return adapter.get(id, groupToGroupDtoMapper::map);
} }
@@ -93,7 +95,7 @@ public class GroupResource {
@ResponseCode(code = 500, condition = "internal server error") @ResponseCode(code = 500, condition = "internal server error")
}) })
@TypeHint(TypeHint.NO_CONTENT.class) @TypeHint(TypeHint.NO_CONTENT.class)
public Response update(@Context UriInfo uriInfo, @PathParam("id") String name, GroupDto groupDto) { public Response update(@PathParam("id") String name, GroupDto groupDto) {
return adapter.update(name, existing -> dtoToGroupMapper.map(groupDto)); return adapter.update(name, existing -> dtoToGroupMapper.map(groupDto));
} }
} }

View File

@@ -19,7 +19,6 @@ import javax.ws.rs.Path;
import javax.ws.rs.Produces; import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam; import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context; import javax.ws.rs.core.Context;
import javax.ws.rs.core.Request;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo; import javax.ws.rs.core.UriInfo;
import java.io.IOException; import java.io.IOException;
@@ -46,8 +45,6 @@ public class UserCollectionResource {
* Returns all users for a given page number with a given page size (default page size is {@value DEFAULT_PAGE_SIZE}). * Returns all users for a given page number with a given page size (default page size is {@value DEFAULT_PAGE_SIZE}).
* *
* <strong>Note:</strong> This method requires "user" privilege. * <strong>Note:</strong> This method requires "user" privilege.
*
* @param request the current request
* @param page the number of the requested page * @param page the number of the requested page
* @param pageSize the page size (default page size is {@value DEFAULT_PAGE_SIZE}) * @param pageSize the page size (default page size is {@value DEFAULT_PAGE_SIZE})
* @param sortBy sort parameter * @param sortBy sort parameter
@@ -63,8 +60,7 @@ public class UserCollectionResource {
@ResponseCode(code = 403, condition = "not authorized, the current user does not have the \"user\" privilege"), @ResponseCode(code = 403, condition = "not authorized, the current user does not have the \"user\" privilege"),
@ResponseCode(code = 500, condition = "internal server error") @ResponseCode(code = 500, condition = "internal server error")
}) })
public Response getAll(@Context Request request, public Response getAll(@DefaultValue("0") @QueryParam("page") int page,
@DefaultValue("0") @QueryParam("page") int page,
@DefaultValue("" + DEFAULT_PAGE_SIZE) @QueryParam("pageSize") int pageSize, @DefaultValue("" + DEFAULT_PAGE_SIZE) @QueryParam("pageSize") int pageSize,
@QueryParam("sortby") String sortBy, @QueryParam("sortby") String sortBy,
@DefaultValue("false") @QueryParam("desc") boolean desc) { @DefaultValue("false") @QueryParam("desc") boolean desc) {

View File

@@ -16,10 +16,7 @@ import javax.ws.rs.PUT;
import javax.ws.rs.Path; import javax.ws.rs.Path;
import javax.ws.rs.PathParam; import javax.ws.rs.PathParam;
import javax.ws.rs.Produces; import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.Request;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;
public class UserResource { public class UserResource {
@@ -40,7 +37,6 @@ public class UserResource {
* *
* <strong>Note:</strong> This method requires "user" privilege. * <strong>Note:</strong> This method requires "user" privilege.
* *
* @param request the current request
* @param id the id/name of the user * @param id the id/name of the user
* *
*/ */
@@ -55,7 +51,7 @@ public class UserResource {
@ResponseCode(code = 404, condition = "not found, no user with the specified id/name available"), @ResponseCode(code = 404, condition = "not found, no user with the specified id/name available"),
@ResponseCode(code = 500, condition = "internal server error") @ResponseCode(code = 500, condition = "internal server error")
}) })
public Response get(@Context Request request, @Context UriInfo uriInfo, @PathParam("id") String id) { public Response get(@PathParam("id") String id) {
return adapter.get(id, userToDtoMapper::map); return adapter.get(id, userToDtoMapper::map);
} }
@@ -99,7 +95,7 @@ public class UserResource {
@ResponseCode(code = 500, condition = "internal server error") @ResponseCode(code = 500, condition = "internal server error")
}) })
@TypeHint(TypeHint.NO_CONTENT.class) @TypeHint(TypeHint.NO_CONTENT.class)
public Response update(@Context UriInfo uriInfo, @PathParam("id") String name, UserDto userDto) { public Response update(@PathParam("id") String name, UserDto userDto) {
return adapter.update(name, existing -> dtoToUserMapper.map(userDto, existing.getPassword())); return adapter.update(name, existing -> dtoToUserMapper.map(userDto, existing.getPassword()));
} }
} }