Class: ProcessEngine::ProcessSchema

Inherits:
Object
  • Object
show all
Defined in:
app/models/process_engine/process_schema.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(process_definition) ⇒ ProcessSchema

Returns a new instance of ProcessSchema.



4
5
6
7
8
# File 'app/models/process_engine/process_schema.rb', line 4

def initialize(process_definition)
  nodes_hash = process_definition.bpmn_json.fetch("nodes", [])
  @transitions_hash = process_definition.bpmn_json.fetch("transitions", [])
  initialize_graph(nodes_hash, @transitions_hash)
end

Instance Attribute Details

#nodesObject (readonly)

Returns the value of attribute nodes.



2
3
4
# File 'app/models/process_engine/process_schema.rb', line 2

def nodes
  @nodes
end

Instance Method Details

#node(node_id) ⇒ Object



10
11
12
# File 'app/models/process_engine/process_schema.rb', line 10

def node(node_id)
  nodes.find { |n| n.node_id == node_id }
end

#nodes_by_type(node_type) ⇒ Object



14
15
16
# File 'app/models/process_engine/process_schema.rb', line 14

def nodes_by_type(node_type)
  nodes.select{ |node| node.node_type == node_type }
end