Module: Foobara::EntitiesPlumbing
- Defined in:
- foobara-0.7.3/projects/entities_plumbing/lib/foobara/entities_plumbing.rb,
foobara-0.7.3/projects/entities_plumbing/src/command_connectors_extension.rb
Defined Under Namespace
Modules: CommandConnectorsExtension
Class Method Summary
collapse
Class Method Details
.add_persistence_states_and_transitions ⇒ Object
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
# File 'projects/entities_plumbing/lib/foobara/entities_plumbing.rb', line 25
def add_persistence_states_and_transitions
original_terminal_states = Command::StateMachine.terminal_states
original_transition_map = Command::StateMachine.transition_map
new_transition_map = {}
new_transition_map[:initialized] = { open_transaction: :transaction_opened }
new_transition_map[:transaction_opened] = { cast_and_validate_inputs: :inputs_casted_and_validated }
new_transition_map[:inputs_casted_and_validated] = { load_records: :loaded_records }
new_transition_map[:loaded_records] = { validate_records: :validated_records }
new_transition_map[:validated_records] = { validate: :validated_execution }
new_transition_map[:validated_execution] = {
run_execute: original_transition_map[:validated_execution][:run_execute]
}
new_transition_map[:executing] = { commit_transaction: :transaction_committed }
new_transition_map[:transaction_committed] = { succeed: :succeeded }
new_transition_map[new_transition_map.keys] = {
error: :errored,
fail: :failed
}
[:succeeded, :errored, :failed].each do |state|
new_transition_map[state] = original_transition_map[state]
end
Command::StateMachine.remove_all_callbacks
Command::StateMachine.allow_recreating_callback_methods
Command::StateMachine.set_transition_map(
new_transition_map,
terminal_states: original_terminal_states
)
end
|
.install_command_connector_extensions ⇒ Object
.new_project_added(new_project) ⇒ Object
19
20
21
22
23
|
# File 'projects/entities_plumbing/lib/foobara/entities_plumbing.rb', line 19
def new_project_added(new_project)
if new_project.symbol == "command_connectors"
install_command_connector_extensions
end
end
|