Class ActionResultBuilder


  • public class ActionResultBuilder
    extends Object

    Provides a job action invocation ActionResult builder.

    Examples

    The example below uses creates a ActionResult object to signal the job step action has successfully completed.

     import com.avoka.tm.job.*
     import com.avoka.tm.util.*
     import com.avoka.tm.vo.*
     import javax.servlet.http.*
    
     class FluentJobActionService {
    
           // Injected at runtime
           public Logger logger
    
           ActionResult invoke(SvcDef svcDef, Job job, JobAction jobAction, HttpServletRequest request, User user) {
    
               // Business logic ...
    
               String xml = Jobs.getStartTxnXml(job)
               Path path = new Path(xml)
               String refNumber = path.val('//Application/RefNumber')
    
               return new ActionResultBuilder()
                   .setStatus('Completed')
                   .setMessage('Action completed for: ' + refNumber)
                   .build()
           }
     } 
    Since:
    5.0.0
    • Constructor Detail

      • ActionResultBuilder

        public ActionResultBuilder()
    • Method Detail

      • setStatus

        public ActionResultBuilder setStatus​(String status)
        Set the job action result status.
        Parameters:
        status - the job action result status
        Returns:
        the job action result builder
      • setRoute

        public ActionResultBuilder setRoute​(String route)
        Set the job action result route step.
        Parameters:
        route - the step name to route the job flow to
        Returns:
        the job action result builder
      • setMessage

        public ActionResultBuilder setMessage​(String message)
        Set the job action result message for process auditing purposes.
        Parameters:
        message - the action result message for process auditing purposes
        Returns:
        the job action result builder
      • setExpiryTime

        public ActionResultBuilder setExpiryTime​(Date expiryTime)
        Set the step action expiry time after which the job action should be cancelled.
        Parameters:
        expiryTime - the step action expiry time after which the job action should be cancelled
        Returns:
        the job action result builder
      • setMaxRetryAttempts

        public ActionResultBuilder setMaxRetryAttempts​(Integer maxRetryAttempts)
        Set the maximum number of time to attempt performing the step action.
        Parameters:
        maxRetryAttempts - the maximum number of time to attempt performing the step action
        Returns:
        the job action result builder
      • setNextRetryAttempt

        public ActionResultBuilder setNextRetryAttempt​(Date nextRetryAttempt)
        Set the time to next retry performing step action.
        Parameters:
        nextRetryAttempt - the time to next retry performing step action
        Returns:
        the job action result builder
      • setNextRetryAttemptMins

        public ActionResultBuilder setNextRetryAttemptMins​(int minutes)
        The next time in minutes to retry performing the action.
        Parameters:
        minutes - the next time in minutes to retry performing the action
        Returns:
        the job action result builder
      • build

        public ActionResult build()
        Return a new job action result object based on the specified properties.
        Returns:
        a new job action result object based on the specified properties.