Class RegistryBasedTaskRepository

  • All Implemented Interfaces:
    TaskRepository

    public class RegistryBasedTaskRepository
    extends Object
    implements TaskRepository
    Registry based task repository implementation.
    • Constructor Detail

      • RegistryBasedTaskRepository

        public RegistryBasedTaskRepository​(int tenantId,
                                           String taskType)
                                    throws org.wso2.carbon.ntask.common.TaskException
        Throws:
        org.wso2.carbon.ntask.common.TaskException
    • Method Detail

      • getTenantId

        public int getTenantId()
        Description copied from interface: TaskRepository
        Returns the tenant domain of the tasks represented by this task manager.
        Specified by:
        getTenantId in interface TaskRepository
        Returns:
        The tenant domain of the tasks
      • getRegistry

        public static org.wso2.carbon.registry.core.Registry getRegistry()
                                                                  throws org.wso2.carbon.ntask.common.TaskException
        Throws:
        org.wso2.carbon.ntask.common.TaskException
      • getTaskType

        public String getTaskType()
      • getAllTasks

        public List<TaskInfo> getAllTasks()
                                   throws org.wso2.carbon.ntask.common.TaskException
        Description copied from interface: TaskRepository
        Returns all the task information data in the repository.
        Specified by:
        getAllTasks in interface TaskRepository
        Returns:
        A list of TaskInfo objects
        Throws:
        org.wso2.carbon.ntask.common.TaskException
      • getTask

        public TaskInfo getTask​(String taskName)
                         throws org.wso2.carbon.ntask.common.TaskException
        Description copied from interface: TaskRepository
        Returns task information of a given task name
        Specified by:
        getTask in interface TaskRepository
        Parameters:
        taskName - The task name
        Returns:
        The task information object
        Throws:
        org.wso2.carbon.ntask.common.TaskException - if the task cannot be found
      • addTask

        public void addTask​(TaskInfo taskInfo)
                     throws org.wso2.carbon.ntask.common.TaskException
        Description copied from interface: TaskRepository
        Adds given task information to the repository.
        Specified by:
        addTask in interface TaskRepository
        Parameters:
        taskInfo - The task information object
        Throws:
        org.wso2.carbon.ntask.common.TaskException
      • deleteTask

        public boolean deleteTask​(String taskName)
                           throws org.wso2.carbon.ntask.common.TaskException
        Description copied from interface: TaskRepository
        Deletes existing task information from the repository.
        Specified by:
        deleteTask in interface TaskRepository
        Parameters:
        taskName - The task name
        Returns:
        true if the task was found and deleted
        Throws:
        org.wso2.carbon.ntask.common.TaskException
      • getTasksType

        public String getTasksType()
        Description copied from interface: TaskRepository
        Returns the type of the tasks represented by this task manager.
        Specified by:
        getTasksType in interface TaskRepository
        Returns:
        The type of the tasks
      • getAvailableTenantTasksInRepo

        public static List<TaskManagerId> getAvailableTenantTasksInRepo()
                                                                 throws org.wso2.carbon.ntask.common.TaskException
        Throws:
        org.wso2.carbon.ntask.common.TaskException
      • getAllTenantTaskManagersForType

        public static List<TaskManagerId> getAllTenantTaskManagersForType​(String taskType)
                                                                   throws org.wso2.carbon.ntask.common.TaskException
        Throws:
        org.wso2.carbon.ntask.common.TaskException
      • setTaskMetadataProp

        public void setTaskMetadataProp​(String taskName,
                                        String key,
                                        String value)
                                 throws org.wso2.carbon.ntask.common.TaskException
        Description copied from interface: TaskRepository
        Sets a task metadata property to a given task name with a given property key.
        Specified by:
        setTaskMetadataProp in interface TaskRepository
        Parameters:
        taskName - The name of the task the metadata property to be assigned to
        key - The key of the metadata property
        value - The value of the metadata property
        Throws:
        org.wso2.carbon.ntask.common.TaskException
      • getTaskMetadataProp

        public String getTaskMetadataProp​(String taskName,
                                          String key)
                                   throws org.wso2.carbon.ntask.common.TaskException
        Description copied from interface: TaskRepository
        Returns the task metadata property value, if the task does not exist, this will return null.
        Specified by:
        getTaskMetadataProp in interface TaskRepository
        Parameters:
        taskName - The name of the task to retrieve the metadata property from
        key - The key of the metadata propery
        Returns:
        The metadata property value
        Throws:
        org.wso2.carbon.ntask.common.TaskException