caruby-tissue 1.5.4 → 1.5.5
Sign up to get free protection for your applications and to get access to all the features.
- data/History.md +4 -0
- data/examples/galena/README.md +2 -11
- data/examples/galena/conf/migration/filter_defaults.yaml +1 -0
- data/examples/galena/conf/migration/filter_values.yaml +13 -0
- data/examples/galena/lib/galena/tissue/migration/filter_shims.rb +3 -15
- data/examples/galena/lib/galena/tissue/migration/frozen_shims.rb +3 -6
- data/examples/galena/lib/galena/tissue/seed/defaults.rb +2 -2
- data/lib/catissue/annotation/annotatable_class.rb +10 -8
- data/lib/catissue/annotation/annotation_class.rb +6 -3
- data/lib/catissue/annotation/annotation_module.rb +7 -2
- data/lib/catissue/cli/command.rb +11 -4
- data/lib/catissue/cli/migrate.rb +5 -16
- data/lib/catissue/database/annotation/annotation_service.rb +2 -2
- data/lib/catissue/database/annotation/entity_facade.rb +6 -11
- data/lib/catissue/database/annotation/record_entry_integrator.rb +4 -4
- data/lib/catissue/database/controlled_values.rb +2 -3
- data/lib/catissue/database.rb +64 -35
- data/lib/catissue/domain/abstract_specimen.rb +24 -26
- data/lib/catissue/domain/abstract_specimen_collection_group.rb +1 -1
- data/lib/catissue/domain/capacity.rb +1 -1
- data/lib/catissue/domain/collection_protocol.rb +12 -9
- data/lib/catissue/domain/collection_protocol_event.rb +9 -11
- data/lib/catissue/domain/collection_protocol_registration.rb +5 -5
- data/lib/catissue/domain/container.rb +3 -4
- data/lib/catissue/domain/container_type.rb +11 -12
- data/lib/catissue/domain/disposal_event_parameters.rb +1 -1
- data/lib/catissue/domain/new_specimen_array_order_item.rb +6 -5
- data/lib/catissue/domain/order_details.rb +4 -0
- data/lib/catissue/domain/participant.rb +17 -17
- data/lib/catissue/domain/participant_medical_identifier.rb +2 -3
- data/lib/catissue/domain/site.rb +7 -9
- data/lib/catissue/domain/specimen/pathology/prostate_specimen_gleason_score.rb +2 -3
- data/lib/catissue/domain/specimen/pathology/prostate_specimen_pathology_annotation.rb +4 -3
- data/lib/catissue/domain/specimen/pathology/specimen_additional_finding.rb +5 -7
- data/lib/catissue/domain/specimen/pathology/specimen_base_solid_tissue_pathology_annotation.rb +11 -11
- data/lib/catissue/domain/specimen/pathology/specimen_details.rb +2 -4
- data/lib/catissue/domain/specimen/pathology/specimen_histologic_grade.rb +2 -4
- data/lib/catissue/domain/specimen/pathology/specimen_histologic_type.rb +6 -6
- data/lib/catissue/domain/specimen/pathology/specimen_histologic_variant_type.rb +2 -4
- data/lib/catissue/domain/specimen/pathology/specimen_invasion.rb +2 -4
- data/lib/catissue/domain/specimen.rb +35 -45
- data/lib/catissue/domain/specimen_array.rb +1 -1
- data/lib/catissue/domain/specimen_collection_group/pathology/base_pathology_annotation.rb +4 -4
- data/lib/catissue/domain/specimen_collection_group/pathology/base_solid_tissue_pathology_annotation.rb +4 -4
- data/lib/catissue/domain/specimen_collection_group.rb +40 -46
- data/lib/catissue/domain/specimen_protocol.rb +4 -6
- data/lib/catissue/domain/specimen_requirement.rb +13 -16
- data/lib/catissue/domain/storage_container.rb +5 -2
- data/lib/catissue/domain/storage_type.rb +1 -1
- data/lib/catissue/domain/user.rb +16 -7
- data/lib/catissue/extract/command.rb +1 -1
- data/lib/catissue/extract/delta.rb +7 -15
- data/lib/catissue/migration/migratable.rb +106 -8
- data/lib/catissue/migration/migrator.rb +20 -12
- data/lib/catissue/migration/shims.rb +3 -3
- data/lib/catissue/util/collectible.rb +2 -2
- data/lib/catissue/util/collectible_event_parameters.rb +2 -2
- data/lib/catissue/util/position.rb +3 -3
- data/lib/catissue/version.rb +1 -1
- data/test/lib/catissue/domain/address_test.rb +3 -2
- data/test/lib/catissue/domain/participant_test.rb +11 -0
- data/test/lib/catissue/domain/specimen_collection_group_test.rb +62 -12
- data/test/lib/catissue/domain/specimen_test.rb +0 -1
- data/test/lib/catissue/test_case.rb +2 -2
- data/test/lib/examples/galena/tissue/migration/seedify.rb +5 -5
- data/test/lib/examples/galena/tissue/migration/test_case.rb +9 -5
- metadata +8 -17
- data/conf/extract/simple_fields.yaml +0 -4
- data/conf/migration/filter_fields.yaml +0 -7
- data/conf/migration/filter_migration.yaml +0 -9
- data/conf/migration/frozen_fields.yaml +0 -11
- data/conf/migration/frozen_migration.yaml +0 -9
- data/conf/migration/general_fields.yaml +0 -44
- data/conf/migration/general_migration.yaml +0 -9
- data/conf/migration/simple_fields.yaml +0 -30
- data/conf/migration/simple_migration.yaml +0 -7
- data/conf/migration/small_fields.yaml +0 -24
- data/conf/migration/small_migration.yaml +0 -9
data/History.md
CHANGED
@@ -1,6 +1,10 @@
|
|
1
1
|
This history lists major release themes. See the GitHub Commits (https://github.com/caruby/tissue)
|
2
2
|
for change details.
|
3
3
|
|
4
|
+
1.5.5 / 2011-09-22
|
5
|
+
------------------
|
6
|
+
* Use migration value filter option.
|
7
|
+
|
4
8
|
1.5.4 / 2011-08-16
|
5
9
|
------------------
|
6
10
|
* Fixed case sensitive DB bug. Bug # 7.
|
data/examples/galena/README.md
CHANGED
@@ -39,14 +39,6 @@ Each example has a field mapping configuration in the `conf/migration` directory
|
|
39
39
|
For example, the `simple.csv` input file is migrated into caTissue using the
|
40
40
|
`simple_migration.yaml` configuration file.
|
41
41
|
|
42
|
-
You can browse the source repository [example files](https://github.com/caruby/tissue/tree/master/examples/galena), where:
|
43
|
-
|
44
|
-
* `conf/migration` has the mapping configuration files
|
45
|
-
|
46
|
-
* `data` has the sample data
|
47
|
-
|
48
|
-
* `lib/galena/tissue/migration` has the shim code
|
49
|
-
|
50
42
|
Migrate the Galena `simple` example as follows:
|
51
43
|
|
52
44
|
1. Open a console in the copied Galena example location.
|
@@ -81,9 +73,9 @@ features of the caRuby Migration utility as follows:
|
|
81
73
|
|
82
74
|
`crtmigrate --target TissueSpecimen --mapping conf/migration/general_fields.yaml data/general.csv`
|
83
75
|
|
84
|
-
* <tt>filter</tt> -
|
76
|
+
* <tt>filter</tt> - custom default, value filter, and shim code to convert input values to caTissue values and reject an incomplete migration
|
85
77
|
|
86
|
-
`crtmigrate --target TissueSpecimen --mapping conf/migration/filter_fields.yaml --shims lib/galena/tissue/migration/filter_shims.rb --bad bad.csv data/filter.csv`
|
78
|
+
`crtmigrate --target TissueSpecimen --mapping conf/migration/filter_fields.yaml --defaults conf/migration/filter_defaults.yaml --filters conf/migration/filter_values.yaml --shims lib/galena/tissue/migration/filter_shims.rb --bad bad.csv data/filter.csv`
|
87
79
|
|
88
80
|
* <tt>frozen</tt> - storage locations
|
89
81
|
|
@@ -119,4 +111,3 @@ The following input fields are included in the examples:
|
|
119
111
|
* <tt>Gleason</tt>: Specimen primary gleason score
|
120
112
|
* <tt>Grade</tt>: Specimen histologic WHO grade
|
121
113
|
|
122
|
-
The fields listed are those used in the examples. caTissue supports any caTissue domain object.
|
@@ -0,0 +1 @@
|
|
1
|
+
TissueSpecimen.specimen_type: Fixed Tissue
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# This value filter configuration file demonstrates how to transform an input field value
|
2
|
+
# to a caTissue value. The specimen type input field is a string which can be TRUE, FALSE
|
3
|
+
# or missing. If the input value matches the case-insensitive regular expression /TRUE/i,
|
4
|
+
# then the input value is transformed to the caTissue value 'Frozen Tissue'. A missing
|
5
|
+
# input value is set to 'Fixed Tissue' by the filter_defaults.yaml configuration.
|
6
|
+
#
|
7
|
+
# A straight-forward value => value mapping would be expressed as:
|
8
|
+
# 'TRUE' : 'Frozen Tissue'
|
9
|
+
# 'FALSE' : 'Fixed Tissue'
|
10
|
+
#
|
11
|
+
TissueSpecimen.specimen_type:
|
12
|
+
!ruby/regexp '/TRUE/i' : 'Frozen Tissue'
|
13
|
+
!ruby/regexp '/FALSE/i' : 'Fixed Tissue'
|
@@ -1,40 +1,28 @@
|
|
1
1
|
require 'uom'
|
2
2
|
|
3
3
|
module CaTissue
|
4
|
-
#
|
4
|
+
# Declares the classes modified for migration.
|
5
5
|
shims Participant, TissueSpecimen, SpecimenCollectionGroup
|
6
6
|
|
7
7
|
class Participant
|
8
8
|
# Extracts the Participant first name from the +Initials+ input field.
|
9
9
|
def migrate_first_name(value, row)
|
10
|
-
# The first initial is the first "name".
|
11
10
|
value[0, 1]
|
12
11
|
end
|
13
12
|
|
14
13
|
# Extracts the Participant last name from the +Initials+ input field.
|
15
|
-
#
|
16
|
-
# @param [String] value the input initials field
|
17
|
-
# @param @param [{Symbol => Object}] row the input row field => value hash
|
18
14
|
def migrate_last_name(value, row)
|
19
|
-
# The last initial is the last "name".
|
20
15
|
value[-1, 1]
|
21
16
|
end
|
22
17
|
end
|
23
18
|
|
24
19
|
class TissueSpecimen
|
25
20
|
# Transforms the +Frozen?+ flag input field to the caTissue specimen type +Frozen Tissue+ value.
|
26
|
-
#
|
27
|
-
# @param [String] value the input specimen type field
|
28
|
-
# @param @param [{Symbol => Object}] row the input row field => value hash
|
29
21
|
def migrate_specimen_type(value, row)
|
30
22
|
value =~ /TRUE/i ? 'Frozen Tissue' : 'Fixed Tissue'
|
31
23
|
end
|
32
|
-
|
33
24
|
# Parses the source field as a UOM::Measurement if it is a string.
|
34
25
|
# Otherwises, returns the source value.
|
35
|
-
#
|
36
|
-
# @param [String, Numeric] value the input quantity field
|
37
|
-
# @param @param [{Symbol => Object}] row the input row field => value hash
|
38
26
|
def migrate_initial_quantity(value, row)
|
39
27
|
# if value is not a string, then use it as is
|
40
28
|
return value unless value.is_a?(String)
|
@@ -45,9 +33,9 @@ module CaTissue
|
|
45
33
|
end
|
46
34
|
|
47
35
|
class SpecimenCollectionGroup
|
48
|
-
#
|
36
|
+
# Returns whether this SCG has a SPN.
|
49
37
|
def migration_valid?
|
50
|
-
|
38
|
+
surgical_pathology_number
|
51
39
|
end
|
52
40
|
end
|
53
41
|
end
|
@@ -2,18 +2,15 @@
|
|
2
2
|
require File.join(File.dirname(__FILE__), '..', 'seed', 'defaults')
|
3
3
|
|
4
4
|
module CaTissue
|
5
|
-
#
|
5
|
+
# Declares the classes modified for migration.
|
6
6
|
shims TissueSpecimen, CollectionProtocolRegistration, StorageContainer
|
7
7
|
|
8
8
|
class StorageContainer
|
9
9
|
# Creates the migrated box in the database, if necessary.
|
10
10
|
#
|
11
|
-
# @param
|
12
|
-
# @param [<Resource>] migrated the migrated instances
|
11
|
+
# @param (see CaRuby::Migratable#migrate)
|
13
12
|
def migrate(row, migrated)
|
14
13
|
super
|
15
|
-
# Fetch the box from the database, if it exists.
|
16
|
-
# Otherwise, create the box.
|
17
14
|
find or create_galena_box
|
18
15
|
end
|
19
16
|
|
@@ -34,7 +31,7 @@ module CaTissue
|
|
34
31
|
# Add the box to the first open slot in the first unfilled rack in the freezer.
|
35
32
|
frz << self
|
36
33
|
logger.debug { "Placed the tissue box #{self} in freezer #{frz}." }
|
37
|
-
logger.debug { "Creating the tissue box #{self}
|
34
|
+
logger.debug { "Creating the tissue box #{self}..." }
|
38
35
|
create
|
39
36
|
end
|
40
37
|
end
|
@@ -16,8 +16,8 @@ module Galena
|
|
16
16
|
|
17
17
|
# Pre-defined Galena example administrative objects. If the Galena example is already set up
|
18
18
|
# in the caTissue database, then the default object secondary key attributes can be used as a
|
19
|
-
#
|
20
|
-
# attributes can be created by calling
|
19
|
+
# {CaRuby::Persistable#find} template to retrieve the existing objects. Otherwise, the Defaults
|
20
|
+
# attributes can be created by calling {CaRuby::Persistable#create}.
|
21
21
|
#
|
22
22
|
# In a real-world use case, the administrative objects are typically built in the UI before-hand.
|
23
23
|
# In that case, it is only necessary to define the object secondary key rather than content, e.g.:
|
@@ -11,12 +11,12 @@ module CaTissue
|
|
11
11
|
# annotation objects, or nil if this is not a primary annotation class
|
12
12
|
attr_reader :entity_id
|
13
13
|
|
14
|
-
# @return [Class] the {
|
14
|
+
# @return [Class] the {DEIntegration} proxy class (nil for 1.1 caTissue)
|
15
15
|
def de_integration_proxy_class
|
16
16
|
@de_integration_proxy_class or (superclass.de_integration_proxy_class if superclass < Annotatable)
|
17
17
|
end
|
18
18
|
|
19
|
-
# Adds
|
19
|
+
# Adds {CaRuby::Domain::Metadata} and {AnnotatableClass} functionality to the given class.
|
20
20
|
#
|
21
21
|
# @param [Class] the domain class to extend
|
22
22
|
def self.extend_class(klass)
|
@@ -61,7 +61,7 @@ module CaTissue
|
|
61
61
|
annotation_defined?(symbol)
|
62
62
|
end
|
63
63
|
|
64
|
-
# Refines the
|
64
|
+
# Refines the {CaRuby::Domain::Attributes#toxic_attributes} to exclude annotation attributes.
|
65
65
|
#
|
66
66
|
# @return [<Symbol>] the non-annotation unfetched attributes
|
67
67
|
def toxic_attributes
|
@@ -90,7 +90,7 @@ module CaTissue
|
|
90
90
|
end
|
91
91
|
end
|
92
92
|
|
93
|
-
# Filters
|
93
|
+
# Filters {CaRuby::Domain::Attributes#loadable_attributes} to exclude the {#annotation_attributes}
|
94
94
|
# since annotation lazy-loading is not supported.
|
95
95
|
#
|
96
96
|
# @return (see CaRuby::Domain::Attributes#loadable_attributes)
|
@@ -164,17 +164,19 @@ module CaTissue
|
|
164
164
|
#
|
165
165
|
# @param [String] name the name of the annotation module
|
166
166
|
# @param [{Symbol => Object}] opts the annotation options
|
167
|
-
# @option opts [String] :package the package name (default the
|
168
|
-
# @option opts [String] :service the service name (default the
|
167
|
+
# @option opts [String] :package the package name (default is the lower-case underscore name)
|
168
|
+
# @option opts [String] :service the service name (default is the lower-case underscore name)
|
169
|
+
# @option opts [String] :group the DE group short name (default is the package)
|
169
170
|
def add_annotation(name, opts={})
|
170
171
|
# the module symbol
|
171
172
|
mod_sym = name.camelize.to_sym
|
172
173
|
# the module spec defaults
|
173
|
-
pkg = opts[:package] ||= name.
|
174
|
+
pkg = opts[:package] ||= name.underscore
|
174
175
|
svc = opts[:service] ||= name.underscore
|
176
|
+
grp = opts[:group] ||= pkg
|
175
177
|
# add the annotation entry
|
176
178
|
@ann_spec_hash[mod_sym] = opts
|
177
|
-
logger.info("Added #{qp} annotation #{name} with module #{mod_sym}, package #{pkg}
|
179
|
+
logger.info("Added #{qp} annotation #{name} with module #{mod_sym}, package #{pkg}, service #{svc} and group #{grp}.")
|
178
180
|
end
|
179
181
|
|
180
182
|
# @return [Boolean] whether this annotatable class's annotations are loaded
|
@@ -13,6 +13,8 @@ module CaTissue
|
|
13
13
|
# @return [Intger, nil] the container id, or nil if this is not a primary annotation
|
14
14
|
attr_reader :container_id
|
15
15
|
|
16
|
+
# @param [Class] klass the {Annotation} class to enable
|
17
|
+
# @param [Module] mod the {AnnotationModule} which scopes the class
|
16
18
|
def self.extend_class(klass, mod)
|
17
19
|
# Enable the class meta-data.
|
18
20
|
klass.extend(CaRuby::Domain::Metadata)
|
@@ -32,8 +34,9 @@ module CaTissue
|
|
32
34
|
|
33
35
|
# Adds metadata to this annotation class.
|
34
36
|
#
|
35
|
-
# @param
|
37
|
+
# @param (see AnnotationClass.extend_class)
|
36
38
|
def add_annotation_metadata(mod)
|
39
|
+
@domain_module = mod
|
37
40
|
alias_attribute(:annotation_module, :domain_module)
|
38
41
|
efcd = Annotation::EntityFacade.instance
|
39
42
|
@entity_id = efcd.annotation_entity_id(self, false)
|
@@ -52,7 +55,7 @@ module CaTissue
|
|
52
55
|
@ann_attrs ||= domain_attributes.compose { |attr_md| attr_md.type < Annotation }
|
53
56
|
end
|
54
57
|
|
55
|
-
# Filters
|
58
|
+
# Filters {CaRuby::Domain::Attributes#loadable_attributes} to exclude all references,
|
56
59
|
# since annotation lazy-loading is not supported.
|
57
60
|
#
|
58
61
|
# @return [Array] an empty array
|
@@ -73,7 +76,7 @@ module CaTissue
|
|
73
76
|
not ref.nil?
|
74
77
|
end
|
75
78
|
|
76
|
-
# @return [Boolean] whether this annotation is neither a {#primary?} nor a {
|
79
|
+
# @return [Boolean] whether this annotation is neither a {#primary?} nor a #{secondary} annotation
|
77
80
|
def tertiary_annotation
|
78
81
|
not (primary? or secondary?)
|
79
82
|
end
|
@@ -11,11 +11,14 @@ module CaTissue
|
|
11
11
|
|
12
12
|
# @return [ProxyClass] the annotation proxy class
|
13
13
|
attr_reader :proxy
|
14
|
+
|
15
|
+
# @return [String] the group short name
|
16
|
+
attr_reader :group
|
14
17
|
|
15
18
|
# @return [Class] the hook-annotation association class, or nil for 1.1.x caTissue
|
16
19
|
attr_reader :record_entry_class
|
17
20
|
|
18
|
-
# @return [Symbol] the {
|
21
|
+
# @return [Symbol] the {#de_integration_proxy_class} hook writer method, or nil for 1.1.x caTissue
|
19
22
|
attr_reader :record_entry_hook_writer
|
20
23
|
|
21
24
|
# @param [AnnotationModule] mod the annotation module to build
|
@@ -23,6 +26,7 @@ module CaTissue
|
|
23
26
|
# @param [{Symbol => Object}] the options
|
24
27
|
# @option opts [String] :package the DE package name
|
25
28
|
# @option opts [String] :service the DE service name
|
29
|
+
# @option opts [String] :group the DE group short name
|
26
30
|
# @option opts [String] :record_entry the record entry name class for post-1.1.x caTissue
|
27
31
|
def self.extend_module(mod, hook, opts)
|
28
32
|
mod.extend(self)
|
@@ -37,6 +41,7 @@ module CaTissue
|
|
37
41
|
logger.debug { "Building #{hook.qp} annotation #{qp}..." }
|
38
42
|
pkg = opts[:package]
|
39
43
|
@svc_nm = opts[:service]
|
44
|
+
@group = opts[:group]
|
40
45
|
# Enable the resource metadata aspect.
|
41
46
|
md_proc = Proc.new { |klass| AnnotationClass.extend_class(klass, self) }
|
42
47
|
CaRuby::Domain::Importer.extend_module(self, :mixin => Annotation, :metadata => md_proc, :package => pkg)
|
@@ -75,7 +80,7 @@ module CaTissue
|
|
75
80
|
# a record entry class.
|
76
81
|
#
|
77
82
|
# @param [String] the record entry class name specified in the
|
78
|
-
# {CaTissue::
|
83
|
+
# {CaTissue::AnnotatableClass#add_annotation} +:record_entry+ option
|
79
84
|
def import_record_entry_class(klass, hook)
|
80
85
|
@record_entry_class = const_get(klass.name.demodulize.to_sym)
|
81
86
|
@record_entry_hook_writer = "#{hook.name.demodulize.underscore}=".to_sym
|
data/lib/catissue/cli/command.rb
CHANGED
@@ -6,7 +6,7 @@ begin
|
|
6
6
|
rescue Exception => e
|
7
7
|
logger.error("caTissue client load was unsuccessful - #{e}:\n#{e.backtrace.qp}")
|
8
8
|
puts "caTissue client load was unsuccessful - #{e}."
|
9
|
-
puts "See the log at
|
9
|
+
puts "See the log at #{CaRuby::Log.instance.file} for more information."
|
10
10
|
exit 1
|
11
11
|
end
|
12
12
|
|
@@ -15,9 +15,16 @@ require 'catissue/version'
|
|
15
15
|
|
16
16
|
module CaTissue
|
17
17
|
module CLI
|
18
|
-
# Augments
|
18
|
+
# Augments {CaRuby::CLI::Command} with caTissue-specific command line option handlers.
|
19
19
|
class Command < CaRuby::CLI::Command
|
20
|
-
#
|
20
|
+
#
|
21
|
+
# Built-in options include those specified in +CaRuby::CLI::Command.initialize+
|
22
|
+
# as well as the following:
|
23
|
+
# * --version : print the version of caRuby Tissue as well as the supported caTissue releases and exit
|
24
|
+
#
|
25
|
+
# @param [(<Symbol>, <String, Class>)] specs the arguments and options
|
26
|
+
# described in +CaRuby::CLI::Command.initialize+
|
27
|
+
# @see {CaRuby::CLI::Command#initialize}
|
21
28
|
def initialize(specs=[])
|
22
29
|
specs << VERSION_OPT
|
23
30
|
super
|
@@ -29,7 +36,7 @@ module CaTissue
|
|
29
36
|
|
30
37
|
# If the version option is set, then prints the version and exits.
|
31
38
|
# Otherwise, extracts the connection command line options, adds them
|
32
|
-
# to
|
39
|
+
# to the CaTissue access properties, and yields to the executor block.
|
33
40
|
#
|
34
41
|
# @param [{Symbol => Object}] opts the command line argument and option symbol => value hash
|
35
42
|
def handle_options(opts)
|
data/lib/catissue/cli/migrate.rb
CHANGED
@@ -15,18 +15,18 @@ module CaTissue
|
|
15
15
|
SPECS = [
|
16
16
|
[:input, "input", "Source file to migrate"],
|
17
17
|
[:target, "-t", "--target CLASS", "Migration target class"],
|
18
|
-
[:mapping, "-m", "--mapping FILE", "The input field => caTissue attribute mapping file"],
|
19
|
-
[:
|
20
|
-
[:
|
18
|
+
[:mapping, "-m", "--mapping FILE[,FILE...]", Array, "The input field => caTissue attribute mapping file(s)"],
|
19
|
+
[:filters, "--filters FILE[,FILE...]", Array, "The input value => caTissue value mapping file(s)"],
|
20
|
+
[:defaults, "-d", "--defaults FILE[,FILE...]", Array, "The caTissue attribute default value file(s)"],
|
21
|
+
[:shims, "-s", "--shims FILE[,FILE...]", Array, "Migration customization shim file(s) to load"],
|
21
22
|
[:bad, "-b", "--bad FILE", "Write each invalid record to the given file and continue migration"],
|
22
23
|
[:unique, "-u", "--unique", "Make the migrated objects unique for testing"],
|
23
24
|
[:offset, "-o", "--offset N", Integer, "Number of input records to skip before starting the migration"]
|
24
25
|
]
|
25
26
|
|
26
|
-
# Creates a {
|
27
|
+
# Creates a {Migrate} command with the given standard command line specifications
|
27
28
|
# as well as the {SPECS} command line specifications.
|
28
29
|
#
|
29
|
-
# @param (see CaRuby::CLI::Command#initialize)
|
30
30
|
# @yield [opts] optional migrator factory
|
31
31
|
# @yieldparam [{Symbol => Object}] the {CaTissue::Migrator#initialize} creation options
|
32
32
|
# @see CaRuby::Command#run
|
@@ -46,17 +46,6 @@ module CaTissue
|
|
46
46
|
migrator = block_given? ? yield(opts) : CaTissue::Migrator.new(opts)
|
47
47
|
migrator.migrate_to_database
|
48
48
|
end
|
49
|
-
|
50
|
-
def validate(opts)
|
51
|
-
tgt = opts[:target]
|
52
|
-
if tgt.nil? then raise ArgumentError.new("Missing required migration target class option") end
|
53
|
-
begin
|
54
|
-
opts[:target] = CaTissue.const_get(tgt)
|
55
|
-
rescue Exception
|
56
|
-
logger.fatal("Could not load CaTissue class #{tgt} - #{$!}.\n#{$@.qp}")
|
57
|
-
raise MigrationError.new("Could not load migration target class #{tgt}")
|
58
|
-
end
|
59
|
-
end
|
60
49
|
end
|
61
50
|
end
|
62
51
|
end
|
@@ -19,7 +19,7 @@ module CaTissue
|
|
19
19
|
@intgtr = integrator
|
20
20
|
end
|
21
21
|
|
22
|
-
# Augments the
|
22
|
+
# Augments the {CaRuby::PersistenceService} create method to handle caTissue annotation
|
23
23
|
# service peculiarities, e.g.:
|
24
24
|
# * assigns the identifier, since assignment is not done automatically as is the case with the
|
25
25
|
# default application service
|
@@ -27,7 +27,7 @@ module CaTissue
|
|
27
27
|
# * Save all referenced annotation objects
|
28
28
|
#
|
29
29
|
# This method can only be called on primary annotation objects. A _primary_ annotation
|
30
|
-
# is a top-level annotation which has a reference to the
|
30
|
+
# is a top-level annotation which has a reference to the {Annotation#hook} which is
|
31
31
|
# being annotated.
|
32
32
|
#
|
33
33
|
# @param [Annotation] annotation the annotation object to create
|
@@ -75,7 +75,7 @@ module CaTissue
|
|
75
75
|
# classes. Use alternative SQL instead.
|
76
76
|
#
|
77
77
|
# @param [Integer] eid the referencing entity id
|
78
|
-
# @param [String]
|
78
|
+
# @param [String] name the association property name
|
79
79
|
# @return [Integer] the referenced {Annotation} class entity id
|
80
80
|
def associated_entity_id(eid, name)
|
81
81
|
# The caTissue role is capitalized.
|
@@ -145,7 +145,7 @@ module CaTissue
|
|
145
145
|
|
146
146
|
private
|
147
147
|
|
148
|
-
|
148
|
+
CORE_PKG = 'edu.wustl.catissuecore.domain'
|
149
149
|
|
150
150
|
CORE_GROUP = 'caTissueCore'
|
151
151
|
|
@@ -160,7 +160,7 @@ module CaTissue
|
|
160
160
|
# @param (see #recursive_annotation_entity_id)
|
161
161
|
# @return (see #recursive_annotation_entity_id)
|
162
162
|
def nonrecursive_annotation_entity_id(klass)
|
163
|
-
# The entity group and
|
163
|
+
# The entity group and name.
|
164
164
|
grp, name = split_annotation_entity_class_name(klass)
|
165
165
|
# Dive into some obscure SQL.
|
166
166
|
result = @executor.execute { |dbh| dbh.select_one(ANN_ENTITY_ID_SQL, grp, name) }
|
@@ -175,13 +175,8 @@ module CaTissue
|
|
175
175
|
# the Java package and base class name
|
176
176
|
pkg, base = Java.split_class_name(jname)
|
177
177
|
# A wustl domain class is in the core group.
|
178
|
-
|
179
|
-
|
180
|
-
elsif pkg.nil? or pkg['.'] then
|
181
|
-
raise AnnotationError.new("Entity group for Java class #{jname} could not be determined.")
|
182
|
-
else
|
183
|
-
[pkg, base]
|
184
|
-
end
|
178
|
+
# Others are in an annotation module with a designated group.
|
179
|
+
pkg == CORE_PKG ? [CORE_GROUP, jname] : [klass.annotation_module.group, base]
|
185
180
|
end
|
186
181
|
|
187
182
|
# @param (see #annotation_entity_id)
|
@@ -213,7 +208,7 @@ module CaTissue
|
|
213
208
|
end
|
214
209
|
|
215
210
|
# @param (see #recursive_associated_entity_id)
|
216
|
-
# @return [Integer, nil] the directly associated entity id, if any
|
211
|
+
# @return @return [Integer, nil] the directly associated entity id, if any
|
217
212
|
def nonrecursive_associated_entity_id(eid, role)
|
218
213
|
logger.debug { "Finding entity id #{eid} #{role} associated entity id..." }
|
219
214
|
result = @executor.execute { |dbh| dbh.select_one(ASSN_ENTITY_ID_SQL, eid, role) }
|
@@ -16,8 +16,9 @@ module CaTissue
|
|
16
16
|
# by creating a record entry hook proxy. Even though the record entry class
|
17
17
|
# includes Java properties for each primary annotation in the annotation
|
18
18
|
# Java package, the record entry instance only references a single annotation.
|
19
|
-
# The record entry database table +dyextn_abstract_record_entry+ has foreign
|
20
|
-
# key to
|
19
|
+
# The record entry database table +dyextn_abstract_record_entry+ has a foreign
|
20
|
+
# key reference to the +ABSTRACT_FORM_CONTEXT_ID+. A separate record entry is
|
21
|
+
# created for each annotation.
|
21
22
|
#
|
22
23
|
# @param [Annotatable] hook the hook entity
|
23
24
|
# @param [Annotation] annotation the annotation entity
|
@@ -29,8 +30,7 @@ module CaTissue
|
|
29
30
|
private
|
30
31
|
|
31
32
|
# @param (see #associate)
|
32
|
-
# @return [Object] yet another association record which associates the hook to the
|
33
|
-
# annotation in the {REC_ENTRY_PKG}
|
33
|
+
# @return [Object] yet another association record which associates the hook to the annotation
|
34
34
|
def create_record_entry(hook, annotation)
|
35
35
|
# the DE integration record entry class
|
36
36
|
klass = hook.class.de_integration_proxy_class
|