Search in sources :

Example 6 with TaskService

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);
}
Also used : TaskInfo(com.enonic.xp.task.TaskInfo) TaskService(com.enonic.xp.task.TaskService)

Example 7 with TaskService

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());
}
Also used : TaskInfo(com.enonic.xp.task.TaskInfo) BeanContext(com.enonic.xp.script.bean.BeanContext) TaskState(com.enonic.xp.task.TaskState) List(java.util.List) Stream(java.util.stream.Stream) ScriptBean(com.enonic.xp.script.bean.ScriptBean) TaskService(com.enonic.xp.task.TaskService) Supplier(java.util.function.Supplier) Collectors(java.util.stream.Collectors) TaskInfo(com.enonic.xp.task.TaskInfo) TaskService(com.enonic.xp.task.TaskService)

Aggregations

TaskService (com.enonic.xp.task.TaskService)7 TaskId (com.enonic.xp.task.TaskId)3 PropertyTree (com.enonic.xp.data.PropertyTree)2 DescriptorKey (com.enonic.xp.page.DescriptorKey)2 SubmitTaskParams (com.enonic.xp.task.SubmitTaskParams)2 TaskInfo (com.enonic.xp.task.TaskInfo)2 ApplicationKey (com.enonic.xp.app.ApplicationKey)1 ContentService (com.enonic.xp.content.ContentService)1 SyncContentService (com.enonic.xp.content.SyncContentService)1 Context (com.enonic.xp.context.Context)1 ContextAccessor (com.enonic.xp.context.ContextAccessor)1 ContextBuilder (com.enonic.xp.context.ContextBuilder)1 OsgiSupport (com.enonic.xp.core.internal.osgi.OsgiSupport)1 Form (com.enonic.xp.form.Form)1 UpdateLastRunCommand (com.enonic.xp.impl.scheduler.UpdateLastRunCommand)1 NodeService (com.enonic.xp.node.NodeService)1 ProjectService (com.enonic.xp.project.ProjectService)1 ScheduleCalendar (com.enonic.xp.scheduler.ScheduleCalendar)1 ScheduledJob (com.enonic.xp.scheduler.ScheduledJob)1 ScheduledJobName (com.enonic.xp.scheduler.ScheduledJobName)1