Class: FedoraMigrate::RepositoryMigrator
- Inherits:
-
Object
- Object
- FedoraMigrate::RepositoryMigrator
- Includes:
- MigrationOptions
- Defined in:
- lib/fedora_migrate/repository_migrator.rb
Defined Under Namespace
Classes: SingleObjectReport
Instance Attribute Summary collapse
-
#namespace ⇒ Object
Returns the value of attribute namespace.
-
#report ⇒ Object
Returns the value of attribute report.
-
#result ⇒ Object
Returns the value of attribute result.
-
#source ⇒ Object
Returns the value of attribute source.
-
#source_objects ⇒ Object
Returns the value of attribute source_objects.
Attributes included from MigrationOptions
Instance Method Summary collapse
- #failures ⇒ Object
-
#initialize(namespace = nil, options = {}) ⇒ RepositoryMigrator
constructor
A new instance of RepositoryMigrator.
- #initialize_report ⇒ Object
- #migrate_current_object ⇒ Object
- #migrate_objects ⇒ Object
- #migrate_relationships ⇒ Object
Methods included from MigrationOptions
#application_creates_versions?, #blacklist, #conversion_options, #forced?, #not_forced?
Constructor Details
#initialize(namespace = nil, options = {}) ⇒ RepositoryMigrator
Returns a new instance of RepositoryMigrator.
9 10 11 12 13 14 |
# File 'lib/fedora_migrate/repository_migrator.rb', line 9 def initialize(namespace = nil, = {}) @namespace = namespace || repository_namespace = @report = MigrationReport.new(.fetch(:report, nil)) end |
Instance Attribute Details
#namespace ⇒ Object
Returns the value of attribute namespace.
5 6 7 |
# File 'lib/fedora_migrate/repository_migrator.rb', line 5 def namespace @namespace end |
#report ⇒ Object
Returns the value of attribute report.
5 6 7 |
# File 'lib/fedora_migrate/repository_migrator.rb', line 5 def report @report end |
#result ⇒ Object
Returns the value of attribute result.
5 6 7 |
# File 'lib/fedora_migrate/repository_migrator.rb', line 5 def result @result end |
#source ⇒ Object
Returns the value of attribute source.
5 6 7 |
# File 'lib/fedora_migrate/repository_migrator.rb', line 5 def source @source end |
#source_objects ⇒ Object
Returns the value of attribute source_objects.
5 6 7 |
# File 'lib/fedora_migrate/repository_migrator.rb', line 5 def source_objects @source_objects end |
Instance Method Details
#failures ⇒ Object
49 50 51 |
# File 'lib/fedora_migrate/repository_migrator.rb', line 49 def failures report.failed_objects.count end |
#initialize_report ⇒ Object
30 31 32 33 34 |
# File 'lib/fedora_migrate/repository_migrator.rb', line 30 def initialize_report @result = SingleObjectReport.new @result.status = false report.save(source.pid, @result) end |
#migrate_current_object ⇒ Object
24 25 26 27 28 |
# File 'lib/fedora_migrate/repository_migrator.rb', line 24 def migrate_current_object return unless migration_required? initialize_report migrate_object end |
#migrate_objects ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/fedora_migrate/repository_migrator.rb', line 16 def migrate_objects source_objects.each do |object| @source = object migrate_current_object end report.reload end |
#migrate_relationships ⇒ Object
36 37 38 39 40 41 42 43 |
# File 'lib/fedora_migrate/repository_migrator.rb', line 36 def migrate_relationships return "Relationship migration halted because #{failures} objects didn't migrate successfully." if failures > 0 && not_forced? source_objects.each do |object| @source = object @result = find_or_create_single_object_report migrate_relationship unless blacklist.include?(source.pid) end end |