use of com.enonic.xp.task.TaskService in project xp by enonic.
the class GetTaskHandler method getTask.
public TaskMapper getTask() {
final TaskService taskService = this.taskServiceSupplier.get();
final TaskInfo taskInfo = taskService.getTaskInfo(TaskId.from(taskId));
return taskInfo == null ? null : new TaskMapper(taskInfo);
}
use of com.enonic.xp.task.TaskService in project xp by enonic.
the class ListTasksHandler method list.
public List<TaskMapper> list() {
final TaskService taskService = taskServiceSupplier.get();
final List<TaskInfo> tasks = taskService.getAllTasks();
Stream<TaskInfo> taskStream = tasks.stream();
if (name != null) {
taskStream = taskStream.filter((t) -> t.getName().equals(name));
}
if (state != null) {
taskStream = taskStream.filter((t) -> t.getState() == state);
}
return taskStream.map(TaskMapper::new).collect(Collectors.toList());
}
Aggregations