Class BatchJob

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable

    public class BatchJob
    extends GeneratedBatchJob
    A BatchJob is a subclass of Job, which divides the task which should be performed into several Steps. Thus a complex task (for example a BMECat import) can be divided into several small steps (for example article, media and price import) which are assigned to one BatchJob.

    The performCronJob(CronJob) implementation of the BatchJob iterates over all pending steps and executes each Step.

    See Also:
    Serialized Form
    • Constructor Detail

      • BatchJob

        public BatchJob()
    • Method Detail

      • setCurrentlyExecutingStep

        protected static final void setCurrentlyExecutingStep​(Step step)
      • unsetCurrentlyExecutingStep

        protected static final void unsetCurrentlyExecutingStep()
      • getCurrentlyExecutingStep

        protected static final Step getCurrentlyExecutingStep()
      • hasCurrentlyExecutingStep

        protected static final boolean hasCurrentlyExecutingStep()
      • setSteps

        public void setSteps​(SessionContext ctx,
                             java.util.List<Step> steps)
        Sets the Steps of the BatchJob and deletes all Steps which were assigned before and which are not part of the specified Collection.
        Specified by:
        setSteps in class GeneratedBatchJob
        Parameters:
        ctx - 123
        steps - the List of the new Steps
      • getSteps

        public java.util.List<Step> getSteps()
        Returns a List of all Steps of the BatchJob.
        Overrides:
        getSteps in class GeneratedBatchJob
        Returns:
        a List of all Steps of the BatchJob
      • getSteps

        public java.util.List<Step> getSteps​(SessionContext ctx)
        Returns a List of all Steps of the BatchJob.
        Specified by:
        getSteps in class GeneratedBatchJob
        Parameters:
        ctx - 123
        Returns:
        a List of all Steps of the BatchJob
      • getSteps

        public java.util.List<Step> getSteps​(int start,
                                             int count)
        Returns a List containing the specified range of Steps of the BatchJob. (Range: start -> (start + count))
        Parameters:
        start - the start index of the range
        count - the number of steps in the range
        Returns:
        a List containing the specified range of Steps of the BatchJob
      • getSteps

        public java.util.List<Step> getSteps​(SessionContext ctx,
                                             int start,
                                             int count)
        Returns a List containing the specified range of Steps of the BatchJob. (Range: start -> (start + count))
        Parameters:
        ctx - 123
        start - the start index of the range
        count - the number of steps in the range
        Returns:
        a List containing the specified range of Steps of the BatchJob
      • getFirstStep

        public Step getFirstStep()
        Returns the first Step.
        Returns:
        the first Step
      • getFirstStep

        public Step getFirstStep​(SessionContext ctx)
        Returns the first Step.
        Parameters:
        ctx -
        Returns:
        the first Step
      • getLastStep

        public Step getLastStep()
        Returns the last Step.
        Returns:
        the last Step
      • getLastStep

        public Step getLastStep​(SessionContext ctx)
        Returns the last Step.
        Parameters:
        ctx -
        Returns:
        the last Step
      • getAllPreviousSteps

        public java.util.Collection<Step> getAllPreviousSteps​(Step step)
        Returns a Collection of all predecessor Steps of the specified Step.
        Parameters:
        step - the Step whose predecessor Steps should be returned
        Returns:
        a Collection of all predecessor Steps of the specified Step
      • getAllPreviousSteps

        public java.util.Collection<Step> getAllPreviousSteps​(SessionContext ctx,
                                                              Step step)
        Returns a Collection of all predecessor Steps of the specified Step.
        Parameters:
        ctx - 123
        step - the Step whose predecessor Steps should be returned
        Returns:
        a Collection of all predecessor Steps of the specified Step
      • getNextSequenceNumber

        protected java.lang.Integer getNextSequenceNumber()
        Returns the next sequence number.
        Returns:
        the next sequence number
      • getNextSequenceNumber

        protected java.lang.Integer getNextSequenceNumber​(SessionContext ctx)
        Returns the next sequence number.
        Parameters:
        ctx - 123
        Returns:
        the next sequence number
      • addStep

        protected Step addStep()
      • addStep

        public Step addStep​(ComposedType stepType)
        Adds a Step of the specified type to the BatchJob and returns it.
        Parameters:
        stepType - the ComposedType of the Step, which will be added
        Returns:
        the new Step which have been added to the BatchJob
      • addStep

        public Step addStep​(ComposedType stepType,
                            java.util.Map additionalAttributes)
        Adds a Step of the specified type to the BatchJob and returns it.
        Parameters:
        stepType - the ComposedType of the Step, which will be added
        additionalAttributes - additionalAttributes, which will be used to the create the specified Step type
        Returns:
        the new Step which have been added to the BatchJob
      • undoCronJob

        protected CronJob.CronJobResult undoCronJob​(CronJob cronJob)
        Starts the undo-process of the BatchJob for the specified CronJob.
        Overrides:
        undoCronJob in class Job
        Parameters:
        cronJob - the CronJob, which is used for the undo-process
        Returns:
        CronJob.CronJobResult the result of the undo-process
      • performCronJob

        protected CronJob.CronJobResult performCronJob​(CronJob cronJob)
        Performs the BatchJob using the specified CronJob. The BatchJob will execute all pending Steps in the given order. If one Step cannot be performed, the execution of the BatchJob is paused.
        Specified by:
        performCronJob in class Job
        Parameters:
        cronJob - the CronJob, which should used for execution
        Returns:
        CronJob.CronJobResult the result of the execution
        See Also:
        CronJob.getFinishedResult(boolean), CronJob.getAbortResult()
      • canUndo

        protected boolean canUndo​(CronJob cronJob)
        Returns true, if the BatchJob can be undone using the specified CronJob.
        Overrides:
        canUndo in class Job
        Parameters:
        cronJob - the CronJob to undo changes for
        Returns:
        true, if the BatchJob can be undone using the specified CronJob
        See Also:
        Job.canUndo(de.hybris.platform.cronjob.jalo.CronJob)