Class: Neo4j::Embedded::EmbeddedRelationship

Inherits:
Object
  • Object
show all
Defined in:
lib/neo4j-embedded/embedded_relationship.rb

Class Method Summary collapse

Class Method Details

.extend_java_class(java_clazz) ⇒ Object

This method is used to extend a Java Neo4j class so that it includes the same mixins as this class.



5
6
7
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
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
59
60
61
62
63
64
65
66
67
68
# File 'lib/neo4j-embedded/embedded_relationship.rb', line 5

def extend_java_class(java_clazz)
  java_clazz.class_eval do
    include Neo4j::Embedded::Property
    include Neo4j::EntityEquality
    include Neo4j::Relationship::Wrapper
    include Neo4j::Core::ActiveEntity
    extend Neo4j::Core::TxMethods

    alias_method :_other_node, :getOtherNode

    def exist?
      !!graph_database.get_relationship_by_id(neo_id)
    rescue Java::OrgNeo4jGraphdb.NotFoundException
      false
    end
    tx_methods :exist?

    def inspect
      "EmbeddedRelationship neo_id: #{neo_id}"
    end

    def start_node
      _start_node.wrapper
    end
    tx_methods :start_node
    alias_method :_start_node_id, :start_node
    tx_methods :_start_node_id

    def _start_node
      getStartNode
    end

    def rel_type
      @_rel_type ||= _rel_type
    end

    def _rel_type
      getType().name().to_sym
    end
    tx_methods :rel_type

    def del
      delete
    end
    tx_methods :del

    def other_node(n)
      _other_node(n.neo4j_obj).wrapper
    end
    tx_methods :other_node

    def end_node
      _end_node.wrapper
    end
    tx_methods :end_node
    alias_method :_end_node_id, :end_node
    tx_methods :_end_node_id

    def _end_node
      getEndNode
    end

  end
end