Class WorkflowExecutionUtils


  • public class WorkflowExecutionUtils
    extends java.lang.Object
    Convenience methods to be used by unit tests and during development. Intended to be a collection of relatively small static utility methods.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean containsEvent​(java.util.List<io.temporal.api.history.v1.HistoryEvent> history, io.temporal.api.enums.v1.EventType eventType)  
      static io.temporal.api.enums.v1.WorkflowExecutionStatus getCloseStatus​(io.temporal.api.history.v1.HistoryEvent event)  
      static io.temporal.api.enums.v1.EventType getEventTypeForCommand​(io.temporal.api.enums.v1.CommandType commandType)
      Returns event that corresponds to a command.
      static java.lang.String getFailureCause​(io.temporal.api.history.v1.HistoryEvent historyEvent)  
      static java.lang.String getId​(io.temporal.api.history.v1.HistoryEvent historyEvent)  
      static java.util.Optional<io.temporal.api.common.v1.Payloads> getResultFromCloseEvent​(io.temporal.api.common.v1.WorkflowExecution workflowExecution, java.util.Optional<java.lang.String> workflowType, io.temporal.api.history.v1.HistoryEvent closeEvent, DataConverter converter)  
      static io.temporal.api.common.v1.WorkflowExecution getWorkflowIdFromExternalWorkflowCompletedEvent​(io.temporal.api.history.v1.HistoryEvent event)  
      static boolean isActivityTaskClosedEvent​(io.temporal.api.history.v1.HistoryEvent event)  
      static boolean isCommandEvent​(io.temporal.api.history.v1.HistoryEvent event)
      Command event is an event that is created to mirror a command issued by a workflow task
      static boolean isExternalWorkflowClosedEvent​(io.temporal.api.history.v1.HistoryEvent event)  
      static boolean isFullHistory​(io.temporal.api.workflowservice.v1.PollWorkflowTaskQueueResponseOrBuilder workflowTask)  
      static boolean isWorkflowExecutionClosedEvent​(io.temporal.api.history.v1.HistoryEventOrBuilder event)  
      static boolean isWorkflowExecutionCompleteCommand​(io.temporal.api.command.v1.Command command)  
      static boolean isWorkflowTaskClosedEvent​(io.temporal.api.history.v1.HistoryEventOrBuilder event)  
      static java.lang.String prettyPrintCommands​(java.lang.Iterable<io.temporal.api.command.v1.Command> commands)  
      static java.lang.String prettyPrintObject​(com.google.protobuf.MessageOrBuilder object)
      Pretty prints a proto message.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • WorkflowExecutionUtils

        public WorkflowExecutionUtils()
    • Method Detail

      • getResultFromCloseEvent

        public static java.util.Optional<io.temporal.api.common.v1.Payloads> getResultFromCloseEvent​(io.temporal.api.common.v1.WorkflowExecution workflowExecution,
                                                                                                     java.util.Optional<java.lang.String> workflowType,
                                                                                                     io.temporal.api.history.v1.HistoryEvent closeEvent,
                                                                                                     DataConverter converter)
      • isWorkflowTaskClosedEvent

        public static boolean isWorkflowTaskClosedEvent​(io.temporal.api.history.v1.HistoryEventOrBuilder event)
      • isWorkflowExecutionClosedEvent

        public static boolean isWorkflowExecutionClosedEvent​(io.temporal.api.history.v1.HistoryEventOrBuilder event)
      • isWorkflowExecutionCompleteCommand

        public static boolean isWorkflowExecutionCompleteCommand​(io.temporal.api.command.v1.Command command)
      • isActivityTaskClosedEvent

        public static boolean isActivityTaskClosedEvent​(io.temporal.api.history.v1.HistoryEvent event)
      • isExternalWorkflowClosedEvent

        public static boolean isExternalWorkflowClosedEvent​(io.temporal.api.history.v1.HistoryEvent event)
      • getWorkflowIdFromExternalWorkflowCompletedEvent

        public static io.temporal.api.common.v1.WorkflowExecution getWorkflowIdFromExternalWorkflowCompletedEvent​(io.temporal.api.history.v1.HistoryEvent event)
      • getId

        public static java.lang.String getId​(io.temporal.api.history.v1.HistoryEvent historyEvent)
      • getFailureCause

        public static java.lang.String getFailureCause​(io.temporal.api.history.v1.HistoryEvent historyEvent)
      • getCloseStatus

        public static io.temporal.api.enums.v1.WorkflowExecutionStatus getCloseStatus​(io.temporal.api.history.v1.HistoryEvent event)
      • prettyPrintCommands

        public static java.lang.String prettyPrintCommands​(java.lang.Iterable<io.temporal.api.command.v1.Command> commands)
      • prettyPrintObject

        public static java.lang.String prettyPrintObject​(com.google.protobuf.MessageOrBuilder object)
        Pretty prints a proto message.
      • containsEvent

        public static boolean containsEvent​(java.util.List<io.temporal.api.history.v1.HistoryEvent> history,
                                            io.temporal.api.enums.v1.EventType eventType)
      • isCommandEvent

        public static boolean isCommandEvent​(io.temporal.api.history.v1.HistoryEvent event)
        Command event is an event that is created to mirror a command issued by a workflow task
      • getEventTypeForCommand

        public static io.temporal.api.enums.v1.EventType getEventTypeForCommand​(io.temporal.api.enums.v1.CommandType commandType)
        Returns event that corresponds to a command.
      • isFullHistory

        public static boolean isFullHistory​(io.temporal.api.workflowservice.v1.PollWorkflowTaskQueueResponseOrBuilder workflowTask)