Class JobScriptService

  • All Implemented Interfaces:
    org.xwiki.script.service.ScriptService

    @Component
    @Named("job")
    @Singleton
    public class JobScriptService
    extends Object
    implements org.xwiki.script.service.ScriptService
    Provides job-specific scripting APIs.
    Since:
    7.2M1
    Version:
    $Id: c7053bb83392d9299642c0389834533e4e57b48a $
    • Field Detail

      • JOB_ERROR_KEY

        public static final String JOB_ERROR_KEY
        The key under which the last encountered error is stored in the current execution context.
        See Also:
        Constant Field Values
    • Constructor Detail

      • JobScriptService

        public JobScriptService()
    • Method Detail

      • getJobStatus

        public org.xwiki.job.event.status.JobStatus getJobStatus​(List<String> jobId)
        Parameters:
        jobId - the job id
        Returns:
        the status of the specified job, null if the status cannot be found
      • getJob

        public org.xwiki.job.Job getJob​(List<String> jobId)
                                 throws AccessDeniedException
        Parameters:
        jobId - the job id
        Returns:
        the job instance, null if the job does not exist
        Throws:
        AccessDeniedException - when the author does not have the right to use this API
        Since:
        11.10
      • getCurrentJob

        public org.xwiki.job.Job getCurrentJob​(Collection<String> path)
        Get a reference to the currently job executed in the specified job group.
        Parameters:
        path - specifies the job group where to look for a running job
        Returns:
        currently executing job in the specified job group, or null if no job is being executed
      • getCurrentJobStatus

        public org.xwiki.job.event.status.JobStatus getCurrentJobStatus​(Collection<String> path)
        Get the status of the currently executing job in the specified group job, if any.
        Parameters:
        path - specifies the job group where to look for a running job
        Returns:
        status of the currently executing job in the specified group, or null if no job is being executed
      • safe

        protected <T> T safe​(T unsafe)
        Type Parameters:
        T - the type of the object
        Parameters:
        unsafe - the unsafe object
        Returns:
        the safe version of the passed object
      • getLastError

        public Exception getLastError()
        Get the error generated while performing the previously called action.
        Returns:
        an eventual exception or null if no exception was thrown