use of org.commonjava.indy.model.core.dto.NotFoundCacheDTO in project indy by Commonjava.
the class NfcResource method getAll.
@GET
@ApiOperation("Retrieve all not-found cache entries currently tracked")
@ApiResponses({ @ApiResponse(code = 200, response = NotFoundCacheDTO.class, message = "The full not-found cache") })
@Produces(ApplicationContent.application_json)
public Response getAll(@ApiParam(name = "pageIndex", value = "page index") @QueryParam("pageIndex") final Integer pageIndex, @ApiParam(name = "pageSize", value = "page size") @QueryParam("pageSize") final Integer pageSize) {
NotFoundCacheDTO dto;
Page page = new Page(pageIndex, pageSize);
if (page != null && page.allowPaging()) {
Pagination<NotFoundCacheDTO> nfcPagination = controller.getAllMissing(page);
dto = nfcPagination.getCurrData();
} else {
dto = controller.getAllMissing();
}
return responseHelper.formatOkResponseWithJsonEntity(dto);
}
use of org.commonjava.indy.model.core.dto.NotFoundCacheDTO in project indy by Commonjava.
the class NfcController method getNotFoundCacheDTO.
private NotFoundCacheDTO getNotFoundCacheDTO(Map<Location, Set<String>> allMissing) {
final NotFoundCacheDTO dto = new NotFoundCacheDTO();
for (final Location loc : allMissing.keySet()) {
if (loc instanceof KeyedLocation) {
final List<String> paths = new ArrayList<String>(allMissing.get(loc));
Collections.sort(paths);
dto.addSection(((KeyedLocation) loc).getKey(), paths);
}
}
return dto;
}
use of org.commonjava.indy.model.core.dto.NotFoundCacheDTO in project indy by Commonjava.
the class NfcResource method getStore.
@Path("/{packageType}/{type: (hosted|group|remote)}/{name}")
@ApiOperation("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 getStore(@ApiParam(name = "packageType", required = true, value = "The type of package (eg. maven, npm, generic-http)") @PathParam("packageType") final String packageType, @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) {
Response response;
final StoreType type = StoreType.get(t);
final StoreKey key = new StoreKey(packageType, type, name);
try {
final NotFoundCacheDTO dto = controller.getMissing(key);
response = formatOkResponseWithJsonEntity(dto, serializer);
} catch (final IndyWorkflowException e) {
response = formatResponse(e);
}
return response;
}
use of org.commonjava.indy.model.core.dto.NotFoundCacheDTO in project indy by Commonjava.
the class NfcController method getAllMissing.
public NotFoundCacheDTO getAllMissing() {
final NotFoundCacheDTO dto = new NotFoundCacheDTO();
final Map<Location, Set<String>> allMissing = cache.getAllMissing();
for (final Location loc : allMissing.keySet()) {
if (loc instanceof KeyedLocation) {
final List<String> paths = new ArrayList<String>(allMissing.get(loc));
Collections.sort(paths);
dto.addSection(((KeyedLocation) loc).getKey(), paths);
}
}
return dto;
}
use of org.commonjava.indy.model.core.dto.NotFoundCacheDTO in project indy by Commonjava.
the class NfcResource method getStore.
@Path("/{packageType}/{type: (hosted|group|remote)}/{name}")
@ApiOperation("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 getStore(@ApiParam(name = "packageType", required = true, value = "type of package (eg. maven, npm, generic-http)") @PathParam("packageType") final String packageType, @ApiParam(allowableValues = "hosted,group,remote", name = "type", required = true, value = "type of store") @PathParam("type") final String t, @ApiParam(name = "name", value = "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);
final StoreKey key = new StoreKey(packageType, 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);
} catch (final IndyWorkflowException e) {
response = responseHelper.formatResponse(e);
}
return response;
}
Aggregations