caruby-tissue 1.3.2 → 1.3.3
Sign up to get free protection for your applications and to get access to all the features.
data/History.txt
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'date'
|
2
|
+
require 'catissue/domain/hash_code'
|
2
3
|
|
3
4
|
module CaTissue
|
4
5
|
# import the Java class
|
@@ -6,7 +7,7 @@ module CaTissue
|
|
6
7
|
|
7
8
|
# The CollectionProtocol domain class.
|
8
9
|
class CollectionProtocol
|
9
|
-
include Resource
|
10
|
+
include Resource, HashCode
|
10
11
|
|
11
12
|
# caTissue alert - Bug #64: Some domain collection properties not initialized.
|
12
13
|
# Initialize consent_tiers if necessary.
|
@@ -52,23 +53,6 @@ module CaTissue
|
|
52
53
|
registrations.nil? ? [] : registrations.map { |reg| reg.participant }
|
53
54
|
end
|
54
55
|
|
55
|
-
# Overrides the Java CollectionProtocol hashCode to make the hash insensitive to identifier assignment.
|
56
|
-
#
|
57
|
-
# @see #==
|
58
|
-
def hash
|
59
|
-
# caTissue alert - bad caTissue API hashCode leads to ugly cascading errors when using a CP in a Set
|
60
|
-
(object_id * 31) + 17
|
61
|
-
end
|
62
|
-
|
63
|
-
# Returns whether other is {#equal?} to CollectionProtocol.
|
64
|
-
#
|
65
|
-
# This method is a work-around for caTissue Bug #70: CollectionProtocol and non-CollectionProtocol are equal in caTissue 1.1.
|
66
|
-
def ==(other)
|
67
|
-
object_id == other.object_id
|
68
|
-
end
|
69
|
-
|
70
|
-
alias :eql? :==
|
71
|
-
|
72
56
|
# Returns a new CollectionProtocolRegistration for the specified participant in this CollectionProtocol with
|
73
57
|
# optional +protocol_participant_identifier+ ppi.
|
74
58
|
def register(participant, ppi=nil)
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'caruby/util/collection'
|
2
|
+
require 'catissue/domain/hash_code'
|
2
3
|
|
3
4
|
module CaTissue
|
4
5
|
# import the Java class
|
@@ -6,7 +7,7 @@ module CaTissue
|
|
6
7
|
|
7
8
|
# The CollectionProtocolRegistration domain class.
|
8
9
|
class CollectionProtocolEvent
|
9
|
-
include Resource
|
10
|
+
include Resource, HashCode
|
10
11
|
|
11
12
|
# caTissue alert - Bug #64: Some domain collection properties not initialized.
|
12
13
|
# Initialize specimen_collection_groups if necessary.
|
@@ -46,25 +47,6 @@ module CaTissue
|
|
46
47
|
self.specimen_collection_groups ||= Java::JavaUtil::LinkedHashSet.new
|
47
48
|
end
|
48
49
|
|
49
|
-
# Overrides the Java CollectionProtocolEvent hashCode to make the hash insensitive to identifier assignment.
|
50
|
-
def hash
|
51
|
-
# caTissue alert - caTissue determines the hashCode from the identifier. Consequently, a CollectionProtocolEvent
|
52
|
-
# added to a HashSet without an identifier can no longer find the CPE when it is assigned an identifier.
|
53
|
-
# This bug results in obscure delayed cascade errors. Work-around is to override the hash method in the
|
54
|
-
# Ruby CPE wrapper class.
|
55
|
-
(object_id * 31) + 17
|
56
|
-
end
|
57
|
-
|
58
|
-
# Returns whether other is a CollectionProtocolEvent with the same identifier as this CollectionProtocolEvent,
|
59
|
-
# or the same object_id if this CollectionProtocolEvent's identifier is nil.
|
60
|
-
#
|
61
|
-
# This method is a work-around for caTissue bug: CollectionProtocolEvent and non-CollectionProtocolEvent are equal in caTissue 1.1.
|
62
|
-
def ==(other)
|
63
|
-
object_id == other.object_id
|
64
|
-
end
|
65
|
-
|
66
|
-
alias :eql? :==
|
67
|
-
|
68
50
|
# Removes associations to this registration
|
69
51
|
def delete
|
70
52
|
protocol.events.delete(self) if protocol
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module CaTissue
|
2
|
+
# This HashCode mix-in overrides the caTissue hashCode and equality test to work around caTissue bugs.
|
3
|
+
module HashCode
|
4
|
+
# caTissue alert - caTissue hashCode changes with identifier assignment.
|
5
|
+
# This leads to ugly cascading errors when used in a Set or Hash.
|
6
|
+
#
|
7
|
+
# @return [Integer] a unique hash code
|
8
|
+
# @see #==
|
9
|
+
def hash
|
10
|
+
# JRuby alert - JRuby 1.5 object_id can be a String, e.g. CollectionProtocol_null.
|
11
|
+
# Work-around to the work-around is to make a unique object id in this aberrant case.
|
12
|
+
@_hc ||= (Object.new.object_id * 31) + 17
|
13
|
+
end
|
14
|
+
|
15
|
+
# Returns whether other is of type same type as this object with the same hash as this object.
|
16
|
+
#
|
17
|
+
# caTissue alert - Bug #70: caTissue equal returns true for class mismatch.
|
18
|
+
#
|
19
|
+
# @param other the object to compare
|
20
|
+
# @return [Boolean] whether the objects are identical
|
21
|
+
# @see #hash
|
22
|
+
def ==(other)
|
23
|
+
equal?(other)
|
24
|
+
end
|
25
|
+
|
26
|
+
alias :eql? :equal?
|
27
|
+
end
|
28
|
+
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'caruby/util/collection'
|
2
2
|
require 'caruby/util/partial_order'
|
3
3
|
require 'catissue/util/storage_type_holder'
|
4
|
+
require 'catissue/domain/hash_code'
|
4
5
|
|
5
6
|
module CaTissue
|
6
7
|
# import the Java class
|
@@ -8,7 +9,7 @@ module CaTissue
|
|
8
9
|
|
9
10
|
# The StorageType domain class.
|
10
11
|
class StorageType
|
11
|
-
include StorageTypeHolder, PartialOrder, Resource
|
12
|
+
include StorageTypeHolder, PartialOrder, Resource, HashCode
|
12
13
|
|
13
14
|
add_attribute_aliases(:default_temperature => :default_temprature_in_centigrade)
|
14
15
|
|
@@ -70,13 +71,5 @@ module CaTissue
|
|
70
71
|
return 1 if holds_storage_types.detect { |child| child >= other }
|
71
72
|
-1 if other > self
|
72
73
|
end
|
73
|
-
|
74
|
-
# Overrides the Java StorageType hashCode to make the hash insensitive to identifier assignment.
|
75
|
-
#
|
76
|
-
# @see #==
|
77
|
-
def hash
|
78
|
-
# caTissue alert - bad caTissue API hashCode leads to ugly cascading errors when using a CP in a Set
|
79
|
-
(object_id * 31) + 17
|
80
|
-
end
|
81
74
|
end
|
82
75
|
end
|
data/lib/catissue/version.rb
CHANGED
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: caruby-tissue
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 1.3.
|
5
|
+
version: 1.3.3
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- OHSU
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date:
|
13
|
+
date: 2011-02-26 00:00:00 -08:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -116,6 +116,7 @@ files:
|
|
116
116
|
- lib/catissue/domain/embedded_event_parameters.rb
|
117
117
|
- lib/catissue/domain/external_identifier.rb
|
118
118
|
- lib/catissue/domain/frozen_event_parameters.rb
|
119
|
+
- lib/catissue/domain/hash_code.rb
|
119
120
|
- lib/catissue/domain/institution.rb
|
120
121
|
- lib/catissue/domain/new_specimen_array_order_item.rb
|
121
122
|
- lib/catissue/domain/order_details.rb
|