Class: FedoraMigrate::Mover
- Inherits:
-
Object
- Object
- FedoraMigrate::Mover
- Includes:
- Hooks, MigrationOptions
- Defined in:
- lib/fedora_migrate/mover.rb
Direct Known Subclasses
ContentMover, DatastreamMover, DatesMover, ObjectMover, PermissionsMover, RDFDatastreamMover, RelsExtDatastreamMover
Instance Attribute Summary collapse
-
#report ⇒ Object
Returns the value of attribute report.
-
#source ⇒ Object
Returns the value of attribute source.
-
#target ⇒ Object
Returns the value of attribute target.
Attributes included from MigrationOptions
Class Method Summary collapse
Instance Method Summary collapse
- #id_component(object = nil) ⇒ Object
-
#initialize(*args) ⇒ Mover
constructor
A new instance of Mover.
- #migrate ⇒ Object
- #post_initialize ⇒ Object
- #results_report ⇒ Object
- #save ⇒ Object
- #target_errors ⇒ Object
Methods included from Hooks
#after_datastream_migration, #after_object_migration, #after_rdf_datastream_migration, #before_datastream_migration, #before_object_migration, #before_rdf_datastream_migration
Methods included from MigrationOptions
#application_creates_versions?, #blacklist, #conversion_options, #forced?, #not_forced?
Constructor Details
#initialize(*args) ⇒ Mover
Returns a new instance of Mover.
9 10 11 12 13 14 15 |
# File 'lib/fedora_migrate/mover.rb', line 9 def initialize *args @source = args[0] @target = args[1] @options = args[2] @report = results_report post_initialize end |
Instance Attribute Details
#report ⇒ Object
Returns the value of attribute report.
7 8 9 |
# File 'lib/fedora_migrate/mover.rb', line 7 def report @report end |
#source ⇒ Object
Returns the value of attribute source.
7 8 9 |
# File 'lib/fedora_migrate/mover.rb', line 7 def source @source end |
#target ⇒ Object
Returns the value of attribute target.
7 8 9 |
# File 'lib/fedora_migrate/mover.rb', line 7 def target @target end |
Class Method Details
.id_component(object) ⇒ Object
46 47 48 49 50 |
# File 'lib/fedora_migrate/mover.rb', line 46 def self.id_component object return object.pid.split(/:/).last if object.kind_of?(Rubydora::DigitalObject) return object.to_s.split(/:/).last if object.respond_to?(:to_s) nil end |
Instance Method Details
#id_component(object = nil) ⇒ Object
40 41 42 43 44 |
# File 'lib/fedora_migrate/mover.rb', line 40 def id_component object=nil object ||= source raise FedoraMigrate::Errors::MigrationError, "can't get the id component without an object" if object.nil? self.class.id_component(object) end |
#migrate ⇒ Object
24 25 26 |
# File 'lib/fedora_migrate/mover.rb', line 24 def migrate report end |
#post_initialize ⇒ Object
17 18 |
# File 'lib/fedora_migrate/mover.rb', line 17 def post_initialize end |
#results_report ⇒ Object
20 21 22 |
# File 'lib/fedora_migrate/mover.rb', line 20 def results_report [] end |
#save ⇒ Object
28 29 30 |
# File 'lib/fedora_migrate/mover.rb', line 28 def save raise FedoraMigrate::Errors::MigrationError, "Failed to save target: #{target_errors}" unless target.save end |
#target_errors ⇒ Object
32 33 34 35 36 37 38 |
# File 'lib/fedora_migrate/mover.rb', line 32 def target_errors if target.respond_to?(:errors) target.errors..join(" -- ") else target.inspect end end |