@Override public IModel<Task> model(Task object) { return new LoadableTaskModel(object.getTaskId(), taskboxService); }
@Override public void updateTask(Task task) throws WorkflowException { Task oldTask = getTaskForId(task.getTaskId()); try { persistence.update(oldTask, task); updateInRunningWorkflow(oldTask, task); LOGGER.info("updated task {}", task.getTaskId()); } catch (PersistenceException e) { LOGGER.error("tried to update task {}, but it didnt work!", task.getTaskId()); throw new WorkflowException(e); } }
@Override public void createNewTask(ProcessBag bag) throws PersistenceException { Task task = new Task(bag); persistence.create(task); LOGGER.info("New human task with id {} created", task.getTaskId()); }
@Override public synchronized void finishTask(Task task) throws WorkflowException { InternalWorkflowEvent finishedEvent = new InternalWorkflowEvent("TaskFinished", task); Task t = Task.createTaskWithAllValuesSetToNull(); t.setTaskId(task.getTaskId()); List<Task> old = getTasksForExample(t); if (old.size() > 0) { try { updateInRunningWorkflow(old.get(0), task); persistence.delete(t); } catch (PersistenceException e) { throw new WorkflowException(e); } workflowService.processEvent(finishedEvent); LOGGER.info("finished task {}", task.getTaskId()); } else { LOGGER.error("tried to finish task {}, BUT there is no such task.", task.getTaskId()); } }
@Override public int compare(Task arg0, Task arg1) { int ret = 0; try { if (sp.getProperty().equals("taskId")) { ret = arg0.getTaskId().compareTo(arg1.getTaskId()); } else if (sp.getProperty().equals("taskType")) { ret = arg0.getTaskType().compareTo(arg1.getTaskType()); } else if (sp.getProperty().equals("description")) { ret = arg0.getDescription().compareTo(arg1.getDescription()); } else if (sp.getProperty().equals("taskCreationTimestamp")) { ret = arg0.getTaskCreationTimestamp().compareTo(arg1.getTaskCreationTimestamp()); } } catch (NullPointerException ex) { ret = -1; } if (!sp.isAscending()) { return ret * -1; } return ret; }
public boolean match(Task task) { if (getTaskId() != null) { if (!task.getTaskId().startsWith(getTaskId())) { return false; } } if (getTaskType() != null) { if (!task.getTaskType().startsWith(getTaskType())) { return false; } } if (getDescription() != null) { if (!(task.getDescription().toLowerCase().indexOf(getDescription().toLowerCase()) > -1)) { return false; } } return true; } }
task = t; add(new Label("taskid", task.getTaskId())); add(new Label("taskname", task.getName())); add(new Label("tasktype", task.getTaskType() != null ? task.getTaskType() : "N/A"));