@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("/job")
public Jobs getJobs(@QueryParam("workflowId") String workflowId, @DefaultValue("-1") @QueryParam("startTime") long minFinishTime,
@DefaultValue("-1") @QueryParam("endTime") long maxStartTime) {
Jobs jobs = new Jobs();
PostgresConnector conn = null;
try {
conn = getConnector();
if (workflowId != null)
jobs.setJobs(conn.fetchJobDetails(workflowId));
else if (maxStartTime >= minFinishTime)
jobs.setJobs(conn.fetchJobDetails(minFinishTime, maxStartTime));
} catch (IOException e) {
LOG.error("Error interacting with RCA database ", e);
jobs.setJobs(EMPTY_JOBS);
} finally {
if (conn != null) {
conn.close();
}
}