10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
# File 'app/concerns/rails_workflow/operation_templates/default_builder.rb', line 10
def build_operation! process, completed_dependencies = []
attrs = attributes.
with_indifferent_access.
slice(:title, :async, :is_background).
merge({
template: self,
process: process,
status: Operation::NOT_STARTED,
manager: process.manager
})
attrs[:dependencies] = completed_dependencies.map { |dep|
{
operation_id: dep.id,
status: dep.status
}
}
operation = operation_class.create(attrs) do |op|
op.context = RailsWorkflow::OperationTemplate.build_context! op, completed_dependencies
build_operation op
end
if child_process.present?
operation.child_process = RailsWorkflow::ProcessManager.
build_process(
child_process.id,
operation.context.data
)
end
operation
end
|