@Override public List<Task> findByStory(Story $story) throws DAOException { List<Task> tasks = new LinkedList<Task>(); List<Task> allTasks = this.findAll(); for (Task task : allTasks) { if (task.getStory().equals($story)) { tasks.add(task); } // if } // for return tasks; }
@GET @Produces(MediaType.APPLICATION_JSON) public Response getTask() { TasksQueue taskManager = TasksQueue.getInstance(); Response.Status status = Status.OK; Task nextTask = taskManager.getNext(); String message = composeMessage(nextTask); if (nextTask != null) { nextTask.setComplitaionStartTime(Calendar.getInstance().getTime()); mainLogger.info("Task {} was sent to compilation at {}", nextTask.getComplitaionStartTime()); } return Response.status(status).entity(message).build(); }