use of org.commonjava.indy.revisions.jaxrs.dto.ChangeSummaryDTO in project indy by Commonjava.
the class RevisionsAdminResource method doGet.
@ApiOperation("Retrieve the changelog for the Indy data directory content with the specified path, start-index, and number of results")
@ApiResponses({ @ApiResponse(code = 200, message = "JSON containing changelog entries", response = ChangeSummaryDTO.class), @ApiResponse(code = 400, message = "In case the revisions add-on is disabled") })
@Path("/data/changelog/{path: .+}")
@GET
@Produces(ApplicationContent.application_json)
public Response doGet(@PathParam("path") final String path, @QueryParam("start") final int start, @QueryParam("count") final int count) {
if (!config.isEnabled()) {
return responseHelper.formatResponse(ApplicationStatus.BAD_REQUEST, "Revisions add-on is disabled");
}
Response response;
try {
final List<ChangeSummary> listing = revisionsManager.getDataChangeLog(path, start, count);
response = responseHelper.formatOkResponseWithJsonEntity(new ChangeSummaryDTO(listing));
} catch (final GitSubsystemException e) {
logger.error("Failed to read git changelog from data dir: " + e.getMessage(), e);
response = responseHelper.formatResponse(e, "Failed to read git changelog from data dir.");
}
return response;
}
use of org.commonjava.indy.revisions.jaxrs.dto.ChangeSummaryDTO in project indy by Commonjava.
the class ChangelogResource method getStoreChangelog.
@ApiOperation("Retrieve the changelog for the Indy group/repository definition with the start-index and number of results")
@ApiResponses({ @ApiResponse(code = 200, message = "JSON containing changelog entries", response = ChangeSummaryDTO.class), @ApiResponse(code = 400, message = "Requested group/repository type is not one of: {remote, hosted, group}") })
@Path("/store/{type}/{name}")
public Response getStoreChangelog(@ApiParam(allowableValues = "hosted,group,remote", required = true) @PathParam("type") final String t, @PathParam("name") final String storeName, @QueryParam("start") int start, @QueryParam("count") int count) {
final StoreType storeType = StoreType.get(t);
if (storeType == null) {
return Response.status(Status.BAD_REQUEST).entity("Invalid store type: '" + t + "'").build();
}
final StoreKey key = new StoreKey(storeType, storeName);
if (start < 0) {
start = 0;
}
if (count < 1) {
count = DEFAULT_CHANGELOG_COUNT;
}
Response response;
try {
final List<ChangeSummary> dataChangeLog = revisions.getDataChangeLog(key, start, count);
response = responseHelper.formatOkResponseWithJsonEntity(new ChangeSummaryDTO(dataChangeLog));
logger.info("\n\n\n\n\n\n{} Sent changelog for: {}\n\n{}\n\n\n\n\n\n\n", new Date(), key, dataChangeLog);
} catch (final GitSubsystemException e) {
final String message = String.format("Failed to lookup changelog for: %s. Reason: %s", key, e.getMessage());
logger.error(message, e);
response = responseHelper.formatResponse(e);
}
return response;
}
Aggregations