Class: SpotFlow::Bpmn::Event
- Inherits:
-
Step
show all
- Defined in:
- lib/spot_flow/bpmn/event.rb
Instance Attribute Summary collapse
Attributes inherited from Step
#default, #default_ref, #incoming, #outgoing
Attributes inherited from Element
#extension_elements, #id, #name
Instance Method Summary
collapse
Methods inherited from Step
#converging?, #diverging?, #input_mappings, #leave, #outgoing_flows, #output_mappings
Methods inherited from Element
#inspect
Constructor Details
#initialize(attributes = {}) ⇒ Event
Returns a new instance of Event.
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/spot_flow/bpmn/event.rb', line 8
def initialize(attributes = {})
super(attributes.except(:message_event_definition, :signal_event_definition, :error_event_definition, :terminate_event_definition, :timer_event_definition))
@event_definitions = []
Array.wrap(attributes[:message_event_definition]).each do |med|
@event_definitions.push MessageEventDefinition.new(med)
end if attributes[:message_event_definition].present?
Array.wrap(attributes[:signal_event_definition]).each do |sed|
@event_definitions.push SignalEventDefinition.new(sed)
end if attributes[:signal_event_definition].present?
Array.wrap(attributes[:error_event_definition]).each do |eed|
@event_definitions.push ErrorEventDefinition.new(eed)
end if attributes[:error_event_definition].present?
Array.wrap(attributes[:terminate_event_definition]).each do |ted|
@event_definitions.push TerminateEventDefinition.new(ted)
end if attributes[:terminate_event_definition].present?
Array.wrap(attributes[:timer_event_definition]).each do |ted|
@event_definitions.push TimerEventDefinition.new(ted)
end if attributes[:timer_event_definition].present?
end
|
Instance Attribute Details
#event_definitions ⇒ Object
Returns the value of attribute event_definitions.
6
7
8
|
# File 'lib/spot_flow/bpmn/event.rb', line 6
def event_definitions
@event_definitions
end
|
Instance Method Details
#conditional_event_definition ⇒ Object
78
79
80
|
# File 'lib/spot_flow/bpmn/event.rb', line 78
def conditional_event_definition
event_definitions.find { |ed| ed.is_a?(ConditionalEventDefinition) }
end
|
#error_event_definition ⇒ Object
90
91
92
|
# File 'lib/spot_flow/bpmn/event.rb', line 90
def error_event_definition
event_definitions.find { |ed| ed.is_a?(ErrorEventDefinition) }
end
|
#error_event_definitions ⇒ Object
86
87
88
|
# File 'lib/spot_flow/bpmn/event.rb', line 86
def error_event_definitions
event_definitions.select { |ed| ed.is_a?(ErrorEventDefinition) }
end
|
#escalation_event_definition ⇒ Object
82
83
84
|
# File 'lib/spot_flow/bpmn/event.rb', line 82
def escalation_event_definition
event_definitions.find { |ed| ed.is_a?(EscalationEventDefinition) }
end
|
#event_definition_ids ⇒ Object
34
35
36
|
# File 'lib/spot_flow/bpmn/event.rb', line 34
def event_definition_ids
event_definitions.map(&:id)
end
|
#execute(execution) ⇒ Object
110
111
112
|
# File 'lib/spot_flow/bpmn/event.rb', line 110
def execute(execution)
event_definitions.each { |event_definition| event_definition.execute(execution) }
end
|
#is_catching? ⇒ Boolean
38
39
40
|
# File 'lib/spot_flow/bpmn/event.rb', line 38
def is_catching?
false
end
|
#is_conditional? ⇒ Boolean
50
51
52
|
# File 'lib/spot_flow/bpmn/event.rb', line 50
def is_conditional?
conditional_event_definition.present?
end
|
#is_error? ⇒ Boolean
58
59
60
|
# File 'lib/spot_flow/bpmn/event.rb', line 58
def is_error?
error_event_definition.present?
end
|
#is_escalation? ⇒ Boolean
54
55
56
|
# File 'lib/spot_flow/bpmn/event.rb', line 54
def is_escalation?
escalation_event_definition.present?
end
|
#is_message? ⇒ Boolean
62
63
64
|
# File 'lib/spot_flow/bpmn/event.rb', line 62
def is_message?
!message_event_definitions.empty?
end
|
#is_none? ⇒ Boolean
46
47
48
|
# File 'lib/spot_flow/bpmn/event.rb', line 46
def is_none?
event_definitions.empty?
end
|
#is_signal? ⇒ Boolean
66
67
68
|
# File 'lib/spot_flow/bpmn/event.rb', line 66
def is_signal?
!signal_event_definitions.empty?
end
|
#is_terminate? ⇒ Boolean
70
71
72
|
# File 'lib/spot_flow/bpmn/event.rb', line 70
def is_terminate?
terminate_event_definition.present?
end
|
#is_throwing? ⇒ Boolean
42
43
44
|
# File 'lib/spot_flow/bpmn/event.rb', line 42
def is_throwing?
false
end
|
#is_timer? ⇒ Boolean
74
75
76
|
# File 'lib/spot_flow/bpmn/event.rb', line 74
def is_timer?
timer_event_definition.present?
end
|
#message_event_definitions ⇒ Object
94
95
96
|
# File 'lib/spot_flow/bpmn/event.rb', line 94
def message_event_definitions
event_definitions.select { |ed| ed.is_a?(MessageEventDefinition) }
end
|
#signal_event_definitions ⇒ Object
98
99
100
|
# File 'lib/spot_flow/bpmn/event.rb', line 98
def signal_event_definitions
event_definitions.select { |ed| ed.is_a?(SignalEventDefinition) }
end
|
#terminate_event_definition ⇒ Object
102
103
104
|
# File 'lib/spot_flow/bpmn/event.rb', line 102
def terminate_event_definition
event_definitions.find { |ed| ed.is_a?(TerminateEventDefinition) }
end
|
#timer_event_definition ⇒ Object
106
107
108
|
# File 'lib/spot_flow/bpmn/event.rb', line 106
def timer_event_definition
event_definitions.find { |ed| ed.is_a?(TimerEventDefinition) }
end
|