ResourceOperationHistoryCriteria criteria = new ResourceOperationHistoryCriteria();
JobId jobId = new JobId(jobName);
criteria.addFilterJobId(jobId);
ResourceOperationHistory history ;//= opsManager.getOperationHistoryByJobId(caller,jobName);
List<ResourceOperationHistory> list = opsManager.findResourceOperationHistoriesByCriteria(caller,criteria);
if (list==null || list.isEmpty()) {
log.info("No history with id " + jobId + " found");
throw new StuffNotFoundException("OperationHistory with id " + jobId);
}
history = list.get(0);
OperationHistoryRest hist = historyToHistoryRest(history, uriInfo);
Response.ResponseBuilder builder;
if (mediaType.equals(MediaType.TEXT_HTML_TYPE)) {
builder = Response.ok(renderTemplate("operationHistory.ftl",hist));
} else {
builder = Response.ok(hist);
}
if (history.getStatus()== OperationRequestStatus.SUCCESS) {
// add a long time cache header
CacheControl cc = new CacheControl();
cc.setMaxAge(1200);
builder.cacheControl(cc);
}