Class: SpotFlow::Bpmn::MessageEventDefinition

Inherits:
EventDefinition show all
Defined in:
lib/spot_flow/bpmn/event_definition.rb

Instance Attribute Summary collapse

Attributes inherited from Element

#extension_elements, #id, #name

Instance Method Summary collapse

Methods inherited from Element

#inspect

Constructor Details

#initialize(attributes = {}) ⇒ MessageEventDefinition

Returns a new instance of MessageEventDefinition.



57
58
59
60
61
# File 'lib/spot_flow/bpmn/event_definition.rb', line 57

def initialize(attributes = {})
  super(attributes.except(:message_ref))

  @message_ref = attributes[:message_ref]
end

Instance Attribute Details

#messageObject

Returns the value of attribute message.



55
56
57
# File 'lib/spot_flow/bpmn/event_definition.rb', line 55

def message
  @message
end

#message_refObject

Returns the value of attribute message_ref.



55
56
57
# File 'lib/spot_flow/bpmn/event_definition.rb', line 55

def message_ref
  @message_ref
end

Instance Method Details

#execute(execution) ⇒ Object



63
64
65
66
67
68
69
# File 'lib/spot_flow/bpmn/event_definition.rb', line 63

def execute(execution)
  if execution.step.is_throwing?
    execution.throw_message(message_name)
  else
    execution.message_names.push message_name
  end
end

#message_idObject



71
72
73
# File 'lib/spot_flow/bpmn/event_definition.rb', line 71

def message_id
  message&.id
end

#message_nameObject



75
76
77
# File 'lib/spot_flow/bpmn/event_definition.rb', line 75

def message_name
  message&.name
end