All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.enonic.xp.task.AbstractRunnableTask Maven / Gradle / Ivy

There is a newer version: 7.14.4
Show newest version
package com.enonic.xp.task;

import com.enonic.xp.content.ContentService;

@Deprecated
public abstract class AbstractRunnableTask
    implements RunnableTask
{
    protected final String description;

    protected final TaskService taskService;

    protected ContentService contentService;

    protected AbstractRunnableTask( Builder builder )
    {
        this.description = builder.description;
        this.taskService = builder.taskService;
        this.contentService = builder.contentService;
    }

    public TaskResultJson createTaskResult()
    {
        final TaskId taskId = taskService.submitTask( this, this.description );
        return new TaskResultJson( taskId );
    }

    public abstract static class Builder
    {

        private String description;

        private TaskService taskService;

        private ContentService contentService;

        public T description( final String description )
        {
            this.description = description;
            return (T) this;
        }

        public T taskService( final TaskService taskService )
        {
            this.taskService = taskService;
            return (T) this;
        }

        public T contentService( final ContentService contentService )
        {
            this.contentService = contentService;
            return (T) this;
        }

        public abstract AbstractRunnableTask build();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy