use of com.cloudogu.scm.review.pullrequest.dto.PullRequestDto in project scm-review-plugin by scm-manager.
the class PullRequestRootResource method getAll.
@GET
@Path("{namespace}/{name}")
@Produces(PullRequestMediaType.PULL_REQUEST_COLLECTION)
@Operation(summary = "Collection of pull requests", description = "Returns a list of pull requests by status.", tags = "Pull Request", operationId = "review_get_pull_request_collection")
@ApiResponse(responseCode = "200", description = "success", content = @Content(mediaType = PullRequestMediaType.PULL_REQUEST_COLLECTION, schema = @Schema(implementation = HalRepresentation.class)))
@ApiResponse(responseCode = "401", description = "not authenticated / invalid credentials")
@ApiResponse(responseCode = "403", description = "not authorized, the current user does not have the \"readPullRequest\" privilege")
@ApiResponse(responseCode = "500", description = "internal server error", content = @Content(mediaType = VndMediaType.ERROR_TYPE, schema = @Schema(implementation = ErrorDto.class)))
public HalRepresentation getAll(@Context UriInfo uriInfo, @PathParam("namespace") String namespace, @PathParam("name") String name, @QueryParam("status") @DefaultValue("OPEN") PullRequestSelector pullRequestSelector) {
Repository repository = service.getRepository(namespace, name);
PermissionCheck.checkRead(repository);
List<PullRequestDto> pullRequestDtos = service.getAll(namespace, name).stream().filter(pullRequestSelector).map(pr -> mapper.using(uriInfo).map(pr, repository)).sorted(Comparator.comparing(this::getLastModification).reversed()).collect(Collectors.toList());
PullRequestResourceLinks resourceLinks = new PullRequestResourceLinks(uriInfo::getBaseUri);
boolean permission = PermissionCheck.mayCreate(repository);
return createCollection(permission, resourceLinks.pullRequestCollection().all(namespace, name), resourceLinks.pullRequestCollection().create(namespace, name), pullRequestDtos, "pullRequests");
}
use of com.cloudogu.scm.review.pullrequest.dto.PullRequestDto in project scm-review-plugin by scm-manager.
the class MyOpenTasksTest method mockMapper.
@BeforeEach
void mockMapper() {
when(mapper.map(any(), any())).thenAnswer(invocationOnMock -> {
PullRequestDto dto = new PullRequestDto();
dto.setId(invocationOnMock.getArgument(0, PullRequest.class).getId());
return dto;
});
}
use of com.cloudogu.scm.review.pullrequest.dto.PullRequestDto in project scm-review-plugin by scm-manager.
the class MyOpenReviewsTest method mockMapper.
@BeforeEach
void mockMapper() {
when(mapper.map(any(), any())).thenAnswer(invocationOnMock -> {
PullRequestDto dto = new PullRequestDto();
dto.setId(invocationOnMock.getArgument(0, PullRequest.class).getId());
return dto;
});
}
use of com.cloudogu.scm.review.pullrequest.dto.PullRequestDto in project scm-review-plugin by scm-manager.
the class MyPullRequestsTest method mockMapper.
@BeforeEach
void mockMapper() {
when(mapper.map(any(), any())).thenAnswer(invocationOnMock -> {
PullRequestDto dto = new PullRequestDto();
dto.setId(invocationOnMock.getArgument(0, PullRequest.class).getId());
return dto;
});
}
Aggregations