use of org.commonjava.indy.core.model.Pagination in project indy by Commonjava.
the class NfcResource method deprecatedGetStore.
@Path("/{type: (hosted|group|remote)}/{name}")
@ApiOperation("[Deprecated] Retrieve all not-found cache entries currently tracked for a given store")
@ApiResponses({ @ApiResponse(code = 200, response = NotFoundCacheDTO.class, message = "The not-found cache for the specified artifact store") })
@GET
@Produces(ApplicationContent.application_json)
public Response deprecatedGetStore(@ApiParam(allowableValues = "hosted,group,remote", name = "type", required = true, value = "The type of store") @PathParam("type") final String t, @ApiParam(name = "name", value = "The name of the store") @PathParam("name") final String name, @ApiParam(name = "pageIndex", value = "page index") @QueryParam("pageIndex") final Integer pageIndex, @ApiParam(name = "pageSize", value = "page size") @QueryParam("pageSize") final Integer pageSize) {
Response response;
final StoreType type = StoreType.get(t);
String altPath = Paths.get("/api/nfc", MAVEN_PKG_KEY, type.singularEndpointName(), name).toString();
final StoreKey key = new StoreKey(type, name);
try {
NotFoundCacheDTO dto;
Page page = new Page(pageIndex, pageSize);
if (page != null && page.allowPaging()) {
Pagination<NotFoundCacheDTO> nfcPagination = controller.getMissing(key, page);
dto = nfcPagination.getCurrData();
} else {
dto = controller.getMissing(key);
}
response = responseHelper.formatOkResponseWithJsonEntity(dto, rb -> responseHelper.markDeprecated(rb, altPath));
} catch (final IndyWorkflowException e) {
response = responseHelper.formatResponse(e, (rb) -> responseHelper.markDeprecated(rb, altPath));
}
return response;
}
Aggregations