Class: ProcessEngine::Schema::Node

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

Defined Under Namespace

Modules: NodeType

Constant Summary collapse

COMPUTED_NODE_TYPES =
[ NodeType::END_EVENT,
NodeType::EXCLUSIVE_GATEWAY,
NodeType::PARALLEL_BRANCHING,
NodeType::SCRIPT_TASK ]

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(node_hash) ⇒ Node

Returns a new instance of Node.



20
21
22
23
24
25
26
27
# File 'app/models/process_engine/schema/node.rb', line 20

def initialize(node_hash)
  @node_id = node_hash.fetch(:node_id)
  @node_type = node_hash.fetch(:node_type)
  @name = node_hash.fetch(:name)
  @owners = node_hash.fetch(:owners, [])
  @extension = node_hash.fetch(:extension, {})
  @transitions = []
end

Instance Attribute Details

#extensionObject (readonly)

Returns the value of attribute extension.



18
19
20
# File 'app/models/process_engine/schema/node.rb', line 18

def extension
  @extension
end

#nameObject (readonly)

Returns the value of attribute name.



18
19
20
# File 'app/models/process_engine/schema/node.rb', line 18

def name
  @name
end

#node_idObject (readonly)

Returns the value of attribute node_id.



18
19
20
# File 'app/models/process_engine/schema/node.rb', line 18

def node_id
  @node_id
end

#node_typeObject (readonly)

Returns the value of attribute node_type.



18
19
20
# File 'app/models/process_engine/schema/node.rb', line 18

def node_type
  @node_type
end

#ownersObject (readonly)

Returns the value of attribute owners.



18
19
20
# File 'app/models/process_engine/schema/node.rb', line 18

def owners
  @owners
end

#transitionsObject (readonly)

Returns the value of attribute transitions.



18
19
20
# File 'app/models/process_engine/schema/node.rb', line 18

def transitions
  @transitions
end

Instance Method Details

#next_nodesObject

all linked next nodes without considerting node type



30
31
32
# File 'app/models/process_engine/schema/node.rb', line 30

def next_nodes
  transitions.map(&:target)
end

#next_schedulable_nodes(options = {}) ⇒ Object



34
35
36
37
38
39
40
41
42
# File 'app/models/process_engine/schema/node.rb', line 34

def next_schedulable_nodes(options = {})

  nns = next_nodes
  if node_type == NodeType::EXCLUSIVE_GATEWAY
    ProcessEngine::Schema::Interceptor::ExclusiveGateway.execute(self, options)
  else
    nns
  end
end

#node_extensionObject



44
45
46
# File 'app/models/process_engine/schema/node.rb', line 44

def node_extension
  ProcessEngine::Schema::NodeExtension.new(self)
end