mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-12 08:25:44 +01:00
Merge review branches
This commit is contained in:
@@ -8,7 +8,6 @@ import sonia.scm.api.rest.resources.AbstractManagerResource;
|
||||
|
||||
import javax.ws.rs.core.GenericEntity;
|
||||
import javax.ws.rs.core.Response;
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.util.Collection;
|
||||
import java.util.function.Function;
|
||||
@@ -17,13 +16,15 @@ import java.util.function.Supplier;
|
||||
import static javax.ws.rs.core.Response.Status.BAD_REQUEST;
|
||||
|
||||
/**
|
||||
* Adapter from resource http endpoints to managers.
|
||||
* Adapter from resource http endpoints to managers, for Collection resources (e.g. {@code /users}).
|
||||
*
|
||||
* Provides common CRUD operations and DTO to Model Object mapping to keep Resources more DRY.
|
||||
*
|
||||
* @param <MODEL_OBJECT> The type of the model object, eg. {@link sonia.scm.user.User}.
|
||||
* @param <DTO> The corresponding transport object, eg. {@link UserDto}.
|
||||
* @param <EXCEPTION> The exception type for the model object, eg. {@link sonia.scm.user.UserException}.
|
||||
*
|
||||
* @see SingleResourceManagerAdapter
|
||||
*/
|
||||
@SuppressWarnings("squid:S00119") // "MODEL_OBJECT" is much more meaningful than "M", right?
|
||||
class CollectionResourceManagerAdapter<MODEL_OBJECT extends ModelObject,
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
package sonia.scm.api.v2.resources;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter @Setter
|
||||
public class PermissionDto {
|
||||
private String type;
|
||||
private String name;
|
||||
private boolean groupPermission;
|
||||
}
|
||||
@@ -19,7 +19,6 @@ import javax.ws.rs.Path;
|
||||
import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.QueryParam;
|
||||
import javax.ws.rs.core.Response;
|
||||
import java.io.IOException;
|
||||
|
||||
public class RepositoryCollectionResource {
|
||||
|
||||
@@ -51,7 +50,7 @@ public class RepositoryCollectionResource {
|
||||
@GET
|
||||
@Path("")
|
||||
@Produces(VndMediaType.REPOSITORY_COLLECTION)
|
||||
@TypeHint(UserDto[].class)
|
||||
@TypeHint(RepositoryDto[].class)
|
||||
@StatusCodes({
|
||||
@ResponseCode(code = 200, condition = "success"),
|
||||
@ResponseCode(code = 401, condition = "not authenticated / invalid credentials"),
|
||||
@@ -87,7 +86,7 @@ public class RepositoryCollectionResource {
|
||||
})
|
||||
@TypeHint(TypeHint.NO_CONTENT.class)
|
||||
@ResponseHeaders(@ResponseHeader(name = "Location", description = "uri to the created repository"))
|
||||
public Response create(RepositoryDto repositoryDto) throws IOException, RepositoryException {
|
||||
public Response create(RepositoryDto repositoryDto) throws RepositoryException {
|
||||
return adapter.create(repositoryDto,
|
||||
() -> dtoToRepositoryMapper.map(repositoryDto, null),
|
||||
repository -> resourceLinks.repository().self(repository.getNamespace(), repository.getName()));
|
||||
|
||||
@@ -15,13 +15,15 @@ import java.util.function.Supplier;
|
||||
import static javax.ws.rs.core.Response.Status.BAD_REQUEST;
|
||||
|
||||
/**
|
||||
* Adapter from resource http endpoints to managers.
|
||||
* Adapter from resource http endpoints to managers, for Single resources (e.g. {@code /user/name}).
|
||||
*
|
||||
* Provides common CRUD operations and DTO to Model Object mapping to keep Resources more DRY.
|
||||
*
|
||||
* @param <MODEL_OBJECT> The type of the model object, eg. {@link sonia.scm.user.User}.
|
||||
* @param <DTO> The corresponding transport object, eg. {@link UserDto}.
|
||||
* @param <EXCEPTION> The exception type for the model object, eg. {@link sonia.scm.user.UserException}.
|
||||
*
|
||||
* @see CollectionResourceManagerAdapter
|
||||
*/
|
||||
@SuppressWarnings("squid:S00119") // "MODEL_OBJECT" is much more meaningful than "M", right?
|
||||
class SingleResourceManagerAdapter<MODEL_OBJECT extends ModelObject,
|
||||
|
||||
Reference in New Issue
Block a user