Class: SpotFlow::Bpmn::ServiceTask

Inherits:
Task show all
Defined in:
lib/spot_flow/bpmn/task.rb

Direct Known Subclasses

BusinessRuleTask, ScriptTask

Instance Attribute Summary collapse

Attributes inherited from Activity

#attachments

Attributes inherited from Step

#default, #default_ref, #incoming, #outgoing

Attributes inherited from Element

#extension_elements, #id, #name

Instance Method Summary collapse

Methods inherited from Task

#result_to_variables, #signal

Methods inherited from Activity

#initialize

Methods inherited from Step

#converging?, #diverging?, #initialize, #input_mappings, #leave, #outgoing_flows, #output_mappings

Methods inherited from Element

#initialize, #inspect

Constructor Details

This class inherits a constructor from SpotFlow::Bpmn::Activity

Instance Attribute Details

#serviceObject

Returns the value of attribute service.



64
65
66
# File 'lib/spot_flow/bpmn/task.rb', line 64

def service
  @service
end

Instance Method Details

#execute(execution) ⇒ Object



74
75
76
# File 'lib/spot_flow/bpmn/task.rb', line 74

def execute(execution)
  execution.wait
end

#headersObject



86
87
88
# File 'lib/spot_flow/bpmn/task.rb', line 86

def headers
  extension_elements&.task_headers&.headers
end

#is_automated?Boolean

Returns:

  • (Boolean)


66
67
68
# File 'lib/spot_flow/bpmn/task.rb', line 66

def is_automated?
  true
end

#is_manual?Boolean

Returns:

  • (Boolean)


70
71
72
# File 'lib/spot_flow/bpmn/task.rb', line 70

def is_manual?
  false
end

#run(execution) ⇒ Object



90
91
92
93
94
95
# File 'lib/spot_flow/bpmn/task.rb', line 90

def run(execution)
  if defined?(task_type)
    klass = task_type.constantize
    klass.new.call(execution.parent.variables, headers || {})
  end
end

#task_retriesObject



82
83
84
# File 'lib/spot_flow/bpmn/task.rb', line 82

def task_retries
  extension_elements&.task_definition&.retries
end

#task_typeObject



78
79
80
# File 'lib/spot_flow/bpmn/task.rb', line 78

def task_type
  extension_elements&.task_definition&.type
end