neo4j-java-driver 0.3.5-java → 1.7.3-java

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 866688516c97a667d7f2a4a6e02f80b500a63adc4dbc2ba1b12fd56b2261d840
4
- data.tar.gz: a466a394747f26a3304762a98bb2a197632756340c3fa41f47deae6345927c99
3
+ metadata.gz: e81fce8c0fbbb53c241d69d389d080b937a21196083c84d8af4aa08d063d4def
4
+ data.tar.gz: 98ccbc63152681cba9b0abfacf8f4411a407f35dbdae043090aec840b0d508e5
5
5
  SHA512:
6
- metadata.gz: aba8b8646b15c048c1bf81b96af2acd3a1631221169edacc9beab7d1b6ca4f74e507a3bbec3873ffa7358ef705ea4a0b9088178b99a393d14af702b9b0c18d53
7
- data.tar.gz: a9909b50278aa1330a93b30af06fde0f14f9f41d83fce4364fd59ca0be952d146f8c5bf69008508db1e036225086841f1e7d6ccea13e8f623521dc8bb34b54ac
6
+ metadata.gz: a96853c233c87cb214a655f26ef1eea9207585b4a3a3836719fd5e033572753db5f89df6f69f4396b46c9f543ac9fce572f887c194008bb0b9299dedd2550c2c
7
+ data.tar.gz: dc69debcd6fdfcd018c367f0b72da7c97d0a04a7685243f20b50539cac0e18edc188bf27056cb96fd33968576dddf87e6857e7940bbdbb179fbe3366b45e723a
@@ -9,6 +9,8 @@ module Neo4j
9
9
  module Driver
10
10
  include_package 'org.neo4j.driver.v1'
11
11
 
12
+ Record = Java::OrgNeo4jDriverInternal::InternalRecord
13
+ StatementResult = Java::OrgNeo4jDriverInternal::InternalStatementResult
12
14
  Transaction = Java::OrgNeo4jDriverInternal::ExplicitTransaction
13
15
 
14
16
  module Net
@@ -40,7 +42,7 @@ end
40
42
  Loader.load
41
43
 
42
44
  Java::OrgNeo4jDriverInternal::InternalDriver.prepend Neo4j::Driver::Ext::InternalDriver
43
- Java::OrgNeo4jDriverInternal::InternalEntity.include Neo4j::Driver::Ext::MapAccessor
45
+ Java::OrgNeo4jDriverInternal::InternalEntity.include Neo4j::Driver::Ext::InternalEntity
44
46
  Java::OrgNeo4jDriverInternal::InternalNode.prepend Neo4j::Driver::Ext::InternalNode
45
47
  Java::OrgNeo4jDriverInternal::InternalPath.include Neo4j::Driver::Ext::StartEndNaming
46
48
  Java::OrgNeo4jDriverInternal::InternalPath::SelfContainedSegment.include Neo4j::Driver::Ext::StartEndNaming
@@ -17,10 +17,8 @@ module Neo4j
17
17
  unit = nil
18
18
  case key.to_s
19
19
  when 'encryption'
20
- unless value
21
- method = :without_encryption
22
- value = nil
23
- end
20
+ method = :without_encryption unless value
21
+ value = nil
24
22
  when 'timeout'
25
23
  value = java.time.Duration.ofMillis(Driver::Internal::DurationNormalizer.milliseconds(value))
26
24
  when /time(out)?$/
@@ -20,8 +20,19 @@ module Neo4j
20
20
 
21
21
  def reverse_check
22
22
  yield
23
- rescue StandardError => e
24
- raise(e.cause || ExceptionMapper.reverse_exception_class(e)&.new('') || e)
23
+ rescue Neo4j::Driver::Exceptions::ServiceUnavailableException => e
24
+ raise(throwable(e.cause) || org.neo4j.driver.v1.exceptions.ServiceUnavailableException.new(e.message))
25
+ rescue Neo4j::Driver::Exceptions::Neo4jException,
26
+ Neo4j::Driver::Exceptions::NoSuchRecordException,
27
+ Neo4j::Driver::Exceptions::UntrustedServerException,
28
+ Neo4j::Driver::Exceptions::IllegalStateException => e
29
+ raise(throwable(e.cause) || e)
30
+ end
31
+
32
+ private
33
+
34
+ def throwable(e)
35
+ e if e.is_a? Java::JavaLang::Throwable
25
36
  end
26
37
  end
27
38
  end
@@ -23,14 +23,7 @@ module Neo4j
23
23
  end
24
24
 
25
25
  def arguments
26
- [code, message, self, suppressed.map(&method(:mapped_exception))]
27
- end
28
-
29
- def self.reverse_exception_class(exception)
30
- case exception
31
- when Neo4j::Driver::Exceptions::ServiceUnavailableException
32
- ServiceUnavailableException
33
- end
26
+ [code, message, suppressed.map(&method(:mapped_exception))]
34
27
  end
35
28
 
36
29
  private
@@ -3,14 +3,18 @@
3
3
  module Neo4j
4
4
  module Driver
5
5
  module Ext
6
- module MapAccessor
6
+ module InternalEntity
7
7
  include MapConverter
8
8
 
9
- alias properties to_hash
9
+ alias properties to_h
10
10
 
11
11
  def [](key)
12
12
  get(key.to_s).as_ruby_object
13
13
  end
14
+
15
+ def ==(other)
16
+ java_method(:isEqual).call(other)
17
+ end
14
18
  end
15
19
  end
16
20
  end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Neo4j
4
+ module Driver
5
+ module Ext
6
+ module InternalKeys
7
+ include ExceptionCheckable
8
+
9
+ def keys
10
+ check { super.map(&:to_sym) }
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
@@ -4,12 +4,20 @@ module Neo4j
4
4
  module Driver
5
5
  module Ext
6
6
  module InternalRecord
7
+ include MapConverter
8
+ include InternalKeys
9
+
7
10
  def values
8
11
  java_send(:values).map(&:as_ruby_object)
9
12
  end
10
13
 
11
- define_method(:[]) do |key|
12
- java_method(:get, [key.is_a?(Integer) ? Java::int : java.lang.String]).call(key).as_ruby_object
14
+ def [](key)
15
+ case key
16
+ when Integer
17
+ java_method(:get, [Java::int]).call(key)
18
+ else
19
+ java_method(:get, [java.lang.String]).call(key.to_s)
20
+ end.as_ruby_object
13
21
  end
14
22
 
15
23
  def first
@@ -6,8 +6,9 @@ module Neo4j
6
6
  module InternalStatementResult
7
7
  include Enumerable
8
8
  include ExceptionCheckable
9
+ include InternalKeys
9
10
 
10
- %i[has_next? next keys single consume summary peek].each do |method|
11
+ %i[has_next? next single consume summary peek].each do |method|
11
12
  define_method(method) do |*args, &block|
12
13
  check { super(*args, &block) }
13
14
  end
@@ -4,7 +4,7 @@ module Neo4j
4
4
  module Driver
5
5
  module Ext
6
6
  module MapConverter
7
- def to_hash
7
+ def to_h
8
8
  java_method(:asMap, [org.neo4j.driver.v1.util.Function]).call(&:itself).to_hash
9
9
  .transform_values!(&:as_ruby_object).symbolize_keys!
10
10
  end
@@ -11,7 +11,7 @@ module Neo4j
11
11
  when Java::OrgNeo4jDriverInternalTypes::TypeConstructor::LIST
12
12
  values(&:itself).map(&:as_ruby_object)
13
13
  when Java::OrgNeo4jDriverInternalTypes::TypeConstructor::MAP
14
- to_hash
14
+ to_h
15
15
  when Java::OrgNeo4jDriverInternalTypes::TypeConstructor::DATE
16
16
  date = as_local_date
17
17
  Date.new(date.year, date.month_value, date.day_of_month)
@@ -4,12 +4,11 @@ module Neo4j
4
4
  module Driver
5
5
  module Exceptions
6
6
  class Neo4jException < RuntimeError
7
- attr_reader :code, :cause, :suppressed
7
+ attr_reader :code, :suppressed
8
8
 
9
9
  def initialize(*args)
10
10
  @code = args.shift if args.count > 1
11
11
  message = args.shift
12
- @cause = args.shift
13
12
  @suppressed = args.shift
14
13
  super(message)
15
14
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Neo4j
4
4
  module Driver
5
- VERSION = '0.3.5'
5
+ VERSION = '1.7.3'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: neo4j-java-driver
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.5
4
+ version: 1.7.3
5
5
  platform: java
6
6
  authors:
7
7
  - Heinrich Klobuczek
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-03-30 00:00:00.000000000 Z
11
+ date: 2020-10-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -218,12 +218,13 @@ files:
218
218
  - jruby/neo4j/driver/ext/graph_database.rb
219
219
  - jruby/neo4j/driver/ext/internal/summary/internal_result_summary.rb
220
220
  - jruby/neo4j/driver/ext/internal_driver.rb
221
+ - jruby/neo4j/driver/ext/internal_entity.rb
222
+ - jruby/neo4j/driver/ext/internal_keys.rb
221
223
  - jruby/neo4j/driver/ext/internal_node.rb
222
224
  - jruby/neo4j/driver/ext/internal_record.rb
223
225
  - jruby/neo4j/driver/ext/internal_relationship.rb
224
226
  - jruby/neo4j/driver/ext/internal_statement_result.rb
225
227
  - jruby/neo4j/driver/ext/logger.rb
226
- - jruby/neo4j/driver/ext/map_accessor.rb
227
228
  - jruby/neo4j/driver/ext/map_converter.rb
228
229
  - jruby/neo4j/driver/ext/neo_converter.rb
229
230
  - jruby/neo4j/driver/ext/network_session.rb