caruby-tissue 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (133) hide show
  1. data/History.txt +4 -0
  2. data/LEGAL +5 -0
  3. data/LICENSE +22 -0
  4. data/README.md +44 -0
  5. data/bin/crtdump +31 -0
  6. data/bin/crtexample +18 -0
  7. data/bin/crtextract +47 -0
  8. data/bin/crtmigrate +17 -0
  9. data/bin/crtsmoke +27 -0
  10. data/examples/galena/README.md +53 -0
  11. data/examples/galena/bin/migrate.rb +42 -0
  12. data/examples/galena/bin/seed.rb +43 -0
  13. data/examples/galena/conf/extract/simple_fields.yaml +4 -0
  14. data/examples/galena/conf/migration/filter_fields.yaml +7 -0
  15. data/examples/galena/conf/migration/filter_migration.yaml +9 -0
  16. data/examples/galena/conf/migration/frozen_fields.yaml +11 -0
  17. data/examples/galena/conf/migration/frozen_migration.yaml +9 -0
  18. data/examples/galena/conf/migration/general_fields.yaml +42 -0
  19. data/examples/galena/conf/migration/general_migration.yaml +9 -0
  20. data/examples/galena/conf/migration/simple_fields.yaml +30 -0
  21. data/examples/galena/conf/migration/simple_migration.yaml +7 -0
  22. data/examples/galena/conf/migration/small_fields.yaml +24 -0
  23. data/examples/galena/conf/migration/small_migration.yaml +9 -0
  24. data/examples/galena/data/filter.csv +1 -0
  25. data/examples/galena/data/frozen.csv +1 -0
  26. data/examples/galena/data/general.csv +1 -0
  27. data/examples/galena/data/minimal.csv +1 -0
  28. data/examples/galena/data/simple.csv +1 -0
  29. data/examples/galena/data/small.csv +1 -0
  30. data/examples/galena/doc/CaTissue.html +93 -0
  31. data/examples/galena/doc/CaTissue/CollectionProtocolRegistration.html +181 -0
  32. data/examples/galena/doc/CaTissue/Participant.html +241 -0
  33. data/examples/galena/doc/CaTissue/SpecimenCollectionGroup.html +190 -0
  34. data/examples/galena/doc/CaTissue/StorageContainer.html +179 -0
  35. data/examples/galena/doc/CaTissue/TissueSpecimen.html +320 -0
  36. data/examples/galena/doc/Galena.html +290 -0
  37. data/examples/galena/doc/Galena/Seed.html +203 -0
  38. data/examples/galena/doc/Galena/Seed/Defaults.html +646 -0
  39. data/examples/galena/doc/_index.html +188 -0
  40. data/examples/galena/doc/class_list.html +36 -0
  41. data/examples/galena/doc/css/common.css +1 -0
  42. data/examples/galena/doc/css/full_list.css +53 -0
  43. data/examples/galena/doc/css/style.css +307 -0
  44. data/examples/galena/doc/file.README.html +108 -0
  45. data/examples/galena/doc/file_list.html +38 -0
  46. data/examples/galena/doc/frames.html +13 -0
  47. data/examples/galena/doc/index.html +108 -0
  48. data/examples/galena/doc/js/app.js +202 -0
  49. data/examples/galena/doc/js/full_list.js +149 -0
  50. data/examples/galena/doc/js/jquery.js +154 -0
  51. data/examples/galena/doc/method_list.html +179 -0
  52. data/examples/galena/doc/top-level-namespace.html +112 -0
  53. data/examples/galena/lib/README.html +33 -0
  54. data/examples/galena/lib/galena.rb +8 -0
  55. data/examples/galena/lib/galena/cli/seed.rb +43 -0
  56. data/examples/galena/lib/galena/migration/filter_shims.rb +43 -0
  57. data/examples/galena/lib/galena/migration/frozen_shims.rb +54 -0
  58. data/examples/galena/lib/galena/seed/defaults.rb +97 -0
  59. data/lib/catissue.rb +26 -0
  60. data/lib/catissue/cli/command.rb +51 -0
  61. data/lib/catissue/cli/example.rb +31 -0
  62. data/lib/catissue/cli/migrate.rb +60 -0
  63. data/lib/catissue/cli/smoke.rb +45 -0
  64. data/lib/catissue/database.rb +451 -0
  65. data/lib/catissue/database/annotation/annotatable_service.rb +25 -0
  66. data/lib/catissue/database/annotation/annotation_service.rb +79 -0
  67. data/lib/catissue/database/annotation/annotator.rb +84 -0
  68. data/lib/catissue/database/annotation/entity_manager.rb +10 -0
  69. data/lib/catissue/database/annotation/integration_service.rb +87 -0
  70. data/lib/catissue/database/controlled_value_finder.rb +43 -0
  71. data/lib/catissue/database/controlled_values.rb +162 -0
  72. data/lib/catissue/domain/abstract_domain_object.rb +8 -0
  73. data/lib/catissue/domain/abstract_position.rb +22 -0
  74. data/lib/catissue/domain/abstract_specimen.rb +288 -0
  75. data/lib/catissue/domain/abstract_specimen_collection_group.rb +25 -0
  76. data/lib/catissue/domain/address.rb +13 -0
  77. data/lib/catissue/domain/cancer_research_group.rb +11 -0
  78. data/lib/catissue/domain/capacity.rb +34 -0
  79. data/lib/catissue/domain/check_in_check_out_event_parameter.rb +19 -0
  80. data/lib/catissue/domain/collection_event_parameters.rb +13 -0
  81. data/lib/catissue/domain/collection_protocol.rb +177 -0
  82. data/lib/catissue/domain/collection_protocol_event.rb +108 -0
  83. data/lib/catissue/domain/collection_protocol_registration.rb +108 -0
  84. data/lib/catissue/domain/consent_tier_response.rb +13 -0
  85. data/lib/catissue/domain/consent_tier_status.rb +29 -0
  86. data/lib/catissue/domain/container.rb +234 -0
  87. data/lib/catissue/domain/container_position.rb +21 -0
  88. data/lib/catissue/domain/container_type.rb +131 -0
  89. data/lib/catissue/domain/department.rb +13 -0
  90. data/lib/catissue/domain/disposal_event_parameters.rb +13 -0
  91. data/lib/catissue/domain/embedded_event_parameters.rb +10 -0
  92. data/lib/catissue/domain/external_identifier.rb +22 -0
  93. data/lib/catissue/domain/frozen_event_parameters.rb +10 -0
  94. data/lib/catissue/domain/institution.rb +13 -0
  95. data/lib/catissue/domain/new_specimen_array_order_item.rb +35 -0
  96. data/lib/catissue/domain/order_details.rb +25 -0
  97. data/lib/catissue/domain/participant.rb +138 -0
  98. data/lib/catissue/domain/participant_medical_identifier.rb +38 -0
  99. data/lib/catissue/domain/password.rb +11 -0
  100. data/lib/catissue/domain/race.rb +11 -0
  101. data/lib/catissue/domain/received_event_parameters.rb +25 -0
  102. data/lib/catissue/domain/scg_event_parameters.rb +11 -0
  103. data/lib/catissue/domain/site.rb +30 -0
  104. data/lib/catissue/domain/specimen.rb +456 -0
  105. data/lib/catissue/domain/specimen_array.rb +47 -0
  106. data/lib/catissue/domain/specimen_array_content.rb +19 -0
  107. data/lib/catissue/domain/specimen_array_type.rb +20 -0
  108. data/lib/catissue/domain/specimen_characteristics.rb +20 -0
  109. data/lib/catissue/domain/specimen_collection_group.rb +412 -0
  110. data/lib/catissue/domain/specimen_event_parameters.rb +111 -0
  111. data/lib/catissue/domain/specimen_position.rb +38 -0
  112. data/lib/catissue/domain/specimen_protocol.rb +34 -0
  113. data/lib/catissue/domain/specimen_requirement.rb +143 -0
  114. data/lib/catissue/domain/storage_container.rb +204 -0
  115. data/lib/catissue/domain/storage_type.rb +82 -0
  116. data/lib/catissue/domain/transfer_event_parameters.rb +53 -0
  117. data/lib/catissue/domain/user.rb +100 -0
  118. data/lib/catissue/extract/command.rb +31 -0
  119. data/lib/catissue/extract/delta.rb +62 -0
  120. data/lib/catissue/extract/extractor.rb +99 -0
  121. data/lib/catissue/migration/migrator.rb +101 -0
  122. data/lib/catissue/migration/shims.rb +108 -0
  123. data/lib/catissue/migration/uniquify.rb +111 -0
  124. data/lib/catissue/resource.rb +84 -0
  125. data/lib/catissue/util/controlled_value.rb +29 -0
  126. data/lib/catissue/util/location.rb +116 -0
  127. data/lib/catissue/util/log.rb +30 -0
  128. data/lib/catissue/util/person.rb +31 -0
  129. data/lib/catissue/util/position.rb +54 -0
  130. data/lib/catissue/util/storable.rb +34 -0
  131. data/lib/catissue/util/storage_type_holder.rb +30 -0
  132. data/lib/catissue/version.rb +7 -0
  133. metadata +212 -0
@@ -0,0 +1,8 @@
1
+ module CaTissue
2
+ # explicitly import AbstractDomainObject, since it is not in the default CaTissue package and therefore can't be auto-imported
3
+ java_import('edu.wustl.common.domain.AbstractDomainObject')
4
+
5
+ class AbstractDomainObject
6
+ include Resource
7
+ end
8
+ end
@@ -0,0 +1,22 @@
1
+ require 'catissue/util/position'
2
+
3
+ module CaTissue
4
+ java_import('edu.wustl.catissuecore.domain.AbstractPosition')
5
+
6
+ # The +caTissue+ AbstractPosition class is augmented with a comparison operator and the
7
+ # zero-based +row+ and +column+ methods wrapping the corresponding one-based dimension
8
+ # attributes. Each AbstractPosition is required to implement the +holder+ and +occupant+
9
+ #�methods.
10
+ class AbstractPosition
11
+ include Position, Resource
12
+
13
+ add_mandatory_attributes(:position_dimension_one, :position_dimension_two)
14
+
15
+ # Column and row are the zero-offset counterparts of position_dimension_one and
16
+ # position_dimension_two, resp.
17
+ offset_attribute(:column => :position_dimension_one, :row => :position_dimension_two)
18
+
19
+ # add the synthetic {#location} attribute
20
+ add_attribute(:location)
21
+ end
22
+ end
@@ -0,0 +1,288 @@
1
+ require 'set'
2
+ require 'caruby/util/inflector'
3
+
4
+ module CaTissue
5
+ java_import('edu.wustl.catissuecore.domain.AbstractSpecimen')
6
+
7
+ class AbstractSpecimen
8
+ include Resource
9
+
10
+ # Sets the specimen type to the specified value. The value can be a permissible caTissue String value or
11
+ # the shortcut symbols :fresh, :fixed and :frozen.
12
+ def specimen_type=(value)
13
+ value = value.to_s.capitalize_first + ' Tissue' if Symbol === value
14
+ setSpecimenType(value)
15
+ end
16
+
17
+ add_attribute_aliases(:parent => :parent_specimen,
18
+ :children => :child_specimens,
19
+ :events => :specimen_events,
20
+ :specimen_event_parameters => :specimen_events,
21
+ :event_parameters => :specimen_events,
22
+ :characteristics => :specimen_characteristics)
23
+
24
+ # caTissue alert - initial_quantity must be set (cf. Bug #160)
25
+ add_attribute_defaults(:initial_quantity => 0.0, :pathological_status => 'Not Specified', :specimen_type => 'Not Specified')
26
+
27
+ add_mandatory_attributes(:lineage, :pathological_status, :specimen_class, :specimen_type)
28
+
29
+ # Specimen characteristics are auto-generated but SpecimenRequirement characteristics are not.
30
+ # It is safe to set the :autogenerated flag for both AbstractSpecimen subclasses. This results
31
+ # in an unnecessary SpecimenRequirement create database query, but SpecimenRequirement create
32
+ # is rare and there is no harm.
33
+ #
34
+ # caTissue alert - Bug 166: API update Specimen ignores characteristics with different id.
35
+ # Guard against updating a Specimen with a SpecimenCharacteristics whose id differs from
36
+ # the existing id.
37
+ #
38
+ # The :no_cascade_update_to_create flag is set since characteristics have cascade style 'all'.
39
+ add_dependent_attribute(:specimen_characteristics, :autogenerated, :no_cascade_update_to_create)
40
+
41
+ add_dependent_attribute(:specimen_events, :create_only, :disjoint, :no_cascade_update_to_create)
42
+
43
+ set_attribute_inverse(:parent_specimen, :child_specimens)
44
+
45
+ # caTissue alert - SCG specimens query result does not set the Specimen children and parent, even though they are
46
+ # guaranteed to be in the SCG specimens result set. The children and parent must be fetched separately, resulting
47
+ # in multiple copies of the same Specimen and additional fetches.
48
+ qualify_attribute(:parent_specimen)
49
+ qualify_attribute(:child_specimens, :no_cascade_update_to_create)
50
+
51
+ class SpecimenClass
52
+ TISSUE = 'Tissue'
53
+ FLUID = 'Fluid'
54
+ MOLECULAR = 'Molecular'
55
+ CELL = 'Cell'
56
+
57
+ EXTENT = Set.new([TISSUE, FLUID, MOLECULAR, CELL])
58
+
59
+ UNIT_HASH = {TISSUE => 'gm', FLUID => 'ml', MOLECULAR => 'ug'}
60
+
61
+ # @return whether the value is an accepted tissue class value
62
+ def self.include?(value)
63
+ EXTENT.include?(value)
64
+ end
65
+ end
66
+
67
+ def initialize(params=nil)
68
+ super
69
+ self.specimen_class ||= infer_specimen_class(self.class)
70
+ end
71
+
72
+ # @return whether this specimen is derived from a parent specimen
73
+ def derived?
74
+ not parent.nil?
75
+ end
76
+
77
+ # @return whether this specimen is an aliquot
78
+ def aliquot?
79
+ lineage ||= default_lineage
80
+ lineage == 'Aliquot'
81
+ end
82
+
83
+ # @return this specimen's aliquots
84
+ def aliquots
85
+ children.filter { |child| child.aliquot? }
86
+ end
87
+
88
+ # @return whether this specimen's type is 'Fresh Tissue'
89
+ def fresh?
90
+ specimen_type == 'Fresh Tissue'
91
+ end
92
+
93
+ # @return whether this specimen's type starts with 'Fixed'
94
+ def fixed?
95
+ specimen_type =~ /^Fixed/
96
+ end
97
+
98
+ # @return whether this specimen's type starts with 'Frozen'
99
+ def frozen?
100
+ specimen_type =~ /^Frozen/
101
+ end
102
+
103
+ # @return <AbstractSpecimen> the transitive closure consisting of this AbstractSpecimen
104
+ # and all AbstractSpecimen in the derivation hierarcy.
105
+ def closure
106
+ children.inject([self]) { |coll, spc| coll.concat(spc.closure) }
107
+ end
108
+
109
+ # Returns the standard unit for this specimen
110
+ def standard_unit
111
+ self.specimen_class ||= infer_specimen_class(self.class)
112
+ SpecimenClass::UNIT_HASH[self.specimen_class]
113
+ end
114
+
115
+ # Derives a specimen from this specimen. The params are described in {Specimen#create_specimen},
116
+ # with one addition: an optional :count, the optional number of specimens to derive.
117
+ #
118
+ # If the :count parameter is greater than one and the :specimen_class,
119
+ # :specimen_type and :specimen_characteristics parameters are not set to values
120
+ # which differ from the respective values for this Specimen, then the specimen is
121
+ # aliquoted, otherwise the derived specimens are created independently, e.g.:
122
+ # spc = Specimen.create_specimen(:specimen_class => :tissue, :specimen_type => :frozen)
123
+ # spc.derive(:count => 1) #=> not aliquoted
124
+ # spc.derive(:count => 2) #=> aliquoted
125
+ # spc.derive(:specimen_type => 'Frozen Specimen') #=> two aliquots
126
+ #
127
+ # The default derived _initial_quantity_ is the parent specimen _available_quantity_
128
+ # divided by _count_ for aliquots, zero otherwise. If the child _specimen_class_
129
+ # is the same as this Specimen class, then this parent Specimen's _available_quantity_
130
+ # is decremented by the child _initial_quantity_, e.g.:
131
+ # spc.available_quantity #=> 4
132
+ # spc.derive(:initial_quantity => 1)
133
+ # spc.available_quantity #=> 3
134
+ # spc.derive(:count => 2, :specimen_type => 'Frozen Tissue')
135
+ # spc.derive(:count => 2) #=> two aliquots with quantity 1 each
136
+ # spc.available_quantity #=> 0
137
+ #
138
+ # The default derived specimen label is _label_+_+_n_, where _label_ is this specimen's
139
+ # label and _n_ is this specimen's child count after including the new derived specimen,
140
+ # e.g. 3090_3 for the third child in parent specimen with label 3090.
141
+ #
142
+ # @return the new derived specimen if _count_ is one, otherwise an Array of _count_ derived specimens
143
+ #
144
+ # Raises ValidationError if an aliquoted parent _available_quantity_ is not greater than zero
145
+ # or the derived specimen quantities exceed the parent _available_quantity_.
146
+ def derive(params={})
147
+ # add defaults
148
+ add_defaults if specimen_class.nil?
149
+ # copy the parameters
150
+ params = params.dup
151
+ # standardize the requirement param, if any
152
+ rqmt = params.delete(:requirement)
153
+ params[:specimen_requirement] ||= rqmt if rqmt
154
+ # the default specimen parameters
155
+ unless params.has_key?(:specimen_requirement) then
156
+ params[:specimen_class] ||= self.specimen_class ||= infer_specimen_class
157
+ params[:specimen_type] ||= self.specimen_type
158
+ end
159
+ unless Class === params[:specimen_class] then
160
+ params[:specimen_class] = infer_class(params)
161
+ end
162
+ count = params.delete(:count)
163
+ count ||= 1
164
+ aliquot_flag = false
165
+ if count > 1 and params[:specimen_class] == self.class and params[:specimen_type] == self.specimen_type then
166
+ # aliquots share the specimen_characteristics
167
+ child_chr = params[:specimen_characteristics] ||= self.specimen_characteristics
168
+ aliquot_flag = child_chr == self.specimen_characteristics
169
+ end
170
+ # set aliquot parameters if necessary
171
+ if aliquot_flag then set_aliquot_parameters(params, count) end
172
+ # make the derived specimens
173
+ count == 1 ? create_derived(params) : Array.new(count) { create_derived(params) }
174
+ end
175
+
176
+ # Returns whether this AbstractSpecimen is minimally consistent with the other specimen.
177
+ # This method augments the {CaRuby::Resource#minimal_match?} with an additional restriction
178
+ # that the other specimen is the same type as this specimen and
179
+ # is a tolerant match on specimen class, specimen type and pathological status.
180
+ # A _tolerant_ match condition holds if the other attribute value is equal to this
181
+ # AbstractSpecimen's attribute value or the other value is the default 'Not Specified'.
182
+ #
183
+ # @param (see CaRuby::Resource#minimal_match?)
184
+ # @return (see CaRuby::Resource#minimal_match?)
185
+ def minimal_match?(other)
186
+ super and tolerant_match?(other, TOLERANT_MATCH_ATTRS)
187
+ end
188
+
189
+ private
190
+
191
+ TOLERANT_MATCH_ATTRS = [:specimen_class, :specimen_type, :pathological_status]
192
+
193
+ # The attributes which can be merged as defaults from a parent into a derived child Specimen.
194
+ DERIVED_MERGEABLE_ATTRS = [:activity_status, :pathological_status, :specimen_class, :specimen_type]
195
+
196
+ # Sets special aliquot parameters for the given count of aliquots.
197
+ # This default implementation is a no-op. Subclasses can override.
198
+ def set_aliquot_parameters(params, count); end
199
+
200
+ def add_defaults_local
201
+ super
202
+ # parent pathological status is preferred over the configuration defaults
203
+ self.pathological_status ||= parent.pathological_status if parent
204
+ # the configuration defaults
205
+ # set the required but redundant tissue class and lineage values
206
+ self.specimen_class ||= infer_specimen_class(self.class)
207
+ self.lineage ||= default_lineage
208
+ # copy the parent characteristics or add empty characteristics
209
+ self.characteristics ||= default_characteristics
210
+ end
211
+
212
+ # Returns the Class from the given params hash.If the :specimen_class parameter
213
+ # is set to a Class, then this method returns that Class. Otherwise, if the parameter is a
214
+ # String or Symbol, then the Class is formed from the parameter as a prefix and 'Specimen' or
215
+ # 'SpecimenRequirement' depending on this AbstractSpecimen's subclass. If the
216
+ # :specimen_class parameter is missing and there is a :specimen_requirement parameter,
217
+ # then the specimen requirement specimen_class attribute value is used.
218
+ def infer_class(params)
219
+ opt = params[:specimen_class]
220
+ if opt.nil? then
221
+ rqmt = params[:specimen_requirement]
222
+ opt = rqmt.specimen_class if rqmt
223
+ end
224
+ raise ArgumentError.new("Specimen class is missing from the create parameters") if opt.nil?
225
+ return opt if Class === opt
226
+ # infer the specimen domain class from the specimen_class prefix and Specimen or SpecimenRequirement suffix
227
+ cls_nm = opt.to_s.capitalize_first + 'Specimen'
228
+ cls_nm += 'Requirement' if CaTissue::SpecimenRequirement === self
229
+ CaTissue.domain_type_with_name(cls_nm)
230
+ end
231
+
232
+ def create_derived(params)
233
+ # Merge the non-domain attribute values from this specimen, unless there is a requirement.
234
+ # Precedence order is given params highest, requirements next, this specimen lowest
235
+ params = value_hash(DERIVED_MERGEABLE_ATTRS).merge!(params) unless params.has_key?(:specimen_requirement)
236
+ # copy this specimen's characteristics if not already given in the derived specimen params
237
+ params[:specimen_characteristics] ||= default_derived_characteristics
238
+ # make the new specimen
239
+ spc = Specimen.create_specimen(params)
240
+ # set the parent
241
+ spc.parent = self
242
+ spc
243
+ end
244
+
245
+ # @return a copy of this Specimen's specimen_characteristics, or nil if none
246
+ # The new SpecimenCharacteristics does not have an identifier.
247
+ def default_derived_characteristics
248
+ chrs = specimen_characteristics || return
249
+ attrs = chrs.class.nondomain_attributes.reject { |attr| attr == :identifier }
250
+ chrs.copy(attrs)
251
+ end
252
+
253
+ # @return a copy of the parent characteristics, if any, or a new SpecimenCharacteristics otherwise
254
+ def default_characteristics
255
+ if parent and parent.characteristics then
256
+ parent.characteristics.copy
257
+ else
258
+ CaTissue::SpecimenCharacteristics.new
259
+ end
260
+ end
261
+
262
+ # Returns the the default lineage value computed as follows:
263
+ # * if there is no parent specimen, then 'New'
264
+ # * otherwise, if this Specimen's specimen_characteristics object is identical to that of
265
+ # the parent, then 'Aliquot'
266
+ # * otherwise, 'Derived'
267
+ # The aliquot condition requires that the specimen_characteristics is the same object,
268
+ # not just the same content. This odd condition is a caTissue artifact. A more sensible
269
+ # criterion is whether this Specimen and its parent share the same tissue_class and
270
+ # tissue_type, but so it goes.
271
+ def default_lineage
272
+ if parent.nil? then
273
+ 'New'
274
+ elsif specimen_characteristics.equal?(parent.specimen_characteristics) then
275
+ 'Aliquot'
276
+ else
277
+ 'Derived'
278
+ end
279
+ end
280
+
281
+ # Infers the specimen class from the first word on the specified klass Ruby class name.
282
+ # For example:
283
+ # infer_specimen_class(CaTissue::TissueRequirement) #=> "Tissue"
284
+ def infer_specimen_class(klass=self.class)
285
+ klass.to_s[/(\w+?)(Specimen(Requirement)?)$/, 1] if klass
286
+ end
287
+ end
288
+ end
@@ -0,0 +1,25 @@
1
+ module CaTissue
2
+ java_import('edu.wustl.catissuecore.domain.AbstractSpecimenCollectionGroup')
3
+
4
+ class AbstractSpecimenCollectionGroup
5
+ include Resource
6
+
7
+ add_attribute_aliases(:site => :specimen_collection_site, :collection_site => :specimen_collection_site, :diagnosis => :clinical_diagnosis)
8
+
9
+ add_attribute_defaults(:activity_status => 'Active', :clinical_status => 'Not Specified', :clinical_diagnosis => 'Not Specified')
10
+
11
+ add_mandatory_attributes(:activity_status)
12
+
13
+ qualify_attribute(:collection_site, :fetched)
14
+
15
+ # Overrides {CaRuby::Resource#each_dependent} to exclude Specimens or SpecimenRequirements with a parent,
16
+ # since parent is the immediate Specimen or SpecimenRequirement owner.
17
+ #
18
+ # @yield (see CaRuby::Resource#each_dependent)
19
+ # @yieldparam (see CaRuby::Resource#each_dependent)
20
+ def each_dependent
21
+ super { |dep| yield dep unless AbstractSpecimen === dep and dep.parent }
22
+ end
23
+
24
+ end
25
+ end
@@ -0,0 +1,13 @@
1
+ module CaTissue
2
+ java_import('edu.wustl.catissuecore.domain.Address')
3
+
4
+ class Address
5
+ include Resource
6
+
7
+ # Sets this Address's zip_code to value. The value argument can be nil, a String or an Integer.
8
+ def zip_code=(value)
9
+ value = value.to_s if Integer === value
10
+ setZipCode(value)
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,11 @@
1
+ module CaTissue
2
+ # import the Java class
3
+ java_import('edu.wustl.catissuecore.domain.CancerResearchGroup')
4
+
5
+ # The CancerResearchGroup domain class.
6
+ class CancerResearchGroup
7
+ include Resource
8
+
9
+ set_secondary_key_attributes(:name)
10
+ end
11
+ end
@@ -0,0 +1,34 @@
1
+ require 'caruby/util/coordinate'
2
+
3
+ module CaTissue
4
+ java_import('edu.wustl.catissuecore.domain.Capacity')
5
+
6
+ class Capacity
7
+ include Resource
8
+
9
+ # Sets the first dimension to the specified value. If value is nil, then the dimension is set to default one.
10
+ def one_dimension_capacity=(value)
11
+ # update the bounds as well
12
+ bounds.x = value ||= 1
13
+ setOneDimensionCapacity(value)
14
+ end
15
+
16
+ # Sets the second dimension to the specified value. If value is nil, then the dimension is set to default one.
17
+ def two_dimension_capacity=(value)
18
+ # update the bounds as well
19
+ bounds.y = value ||= 1
20
+ setTwoDimensionCapacity(value)
21
+ end
22
+
23
+ add_attribute_aliases(:columns => :one_dimension_capacity, :rows => :two_dimension_capacity)
24
+
25
+ add_attribute_defaults(:one_dimension_capacity => 1, :two_dimension_capacity => 1)
26
+
27
+ add_mandatory_attributes(:one_dimension_capacity, :two_dimension_capacity)
28
+
29
+ # Returns the read-only Coordinate with this Capacity's #rows and {#columns}.
30
+ def bounds
31
+ @bounds ||= Coordinate.new(columns, rows)
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,19 @@
1
+ module CaTissue
2
+ # import the Java class
3
+ java_import('edu.wustl.catissuecore.domain.CheckInCheckOutEventParameter')
4
+
5
+ class CheckInCheckOutEventParameter
6
+ include Resource
7
+
8
+ # The check-in/check-out status permissible values.
9
+ module Status
10
+ CHECKED_OUT = 'CHECK OUT'
11
+ CHECKED_IN = 'CHECK IN'
12
+ end
13
+
14
+ add_attribute_aliases(:status => :storage_status, :state => :storage_status)
15
+
16
+ add_mandatory_attributes(:storage_status)
17
+
18
+ end
19
+ end
@@ -0,0 +1,13 @@
1
+ require 'catissue/domain/scg_event_parameters'
2
+
3
+ module CaTissue
4
+ # import the Java class
5
+ java_import('edu.wustl.catissuecore.domain.CollectionEventParameters')
6
+
7
+ class CollectionEventParameters
8
+ include Resource, SCGEventParameters
9
+
10
+ add_attribute_defaults(:collection_procedure => 'Not Specified', :container => 'Not Specified')
11
+
12
+ end
13
+ end