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.
-
#source_objects ⇒ Object
Returns the value of attribute source_objects.
Attributes included from MigrationOptions
Instance Method Summary collapse
- #failures ⇒ Object
- #get_source_objects ⇒ Object
-
#initialize(namespace = nil, options = {}) ⇒ RepositoryMigrator
constructor
A new instance of RepositoryMigrator.
- #migrate_objects ⇒ Object
- #migrate_relationships ⇒ Object
Methods included from MigrationOptions
#application_creates_versions?, #conversion_options, #forced?, #not_forced?
Constructor Details
#initialize(namespace = nil, options = {}) ⇒ RepositoryMigrator
Returns a new instance of RepositoryMigrator.
10 11 12 13 14 15 16 |
# File 'lib/fedora_migrate/repository_migrator.rb', line 10 def initialize namespace = nil, = {} @namespace = namespace || repository_namespace @options = @report = MigrationReport.new(@options.fetch(:report, nil)) @source_objects = get_source_objects end |
Instance Attribute Details
#namespace ⇒ Object
Returns the value of attribute namespace.
6 7 8 |
# File 'lib/fedora_migrate/repository_migrator.rb', line 6 def namespace @namespace end |
#report ⇒ Object
Returns the value of attribute report.
6 7 8 |
# File 'lib/fedora_migrate/repository_migrator.rb', line 6 def report @report end |
#source_objects ⇒ Object
Returns the value of attribute source_objects.
6 7 8 |
# File 'lib/fedora_migrate/repository_migrator.rb', line 6 def source_objects @source_objects end |
Instance Method Details
#failures ⇒ Object
35 36 37 |
# File 'lib/fedora_migrate/repository_migrator.rb', line 35 def failures report.failed_objects.count end |
#get_source_objects ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/fedora_migrate/repository_migrator.rb', line 27 def get_source_objects if report.empty? FedoraMigrate.source.connection.search(nil).collect { |o| (o) }.compact else report.failed_objects.map { |o| FedoraMigrate.source.connection.find(o) } end end |
#migrate_objects ⇒ Object
18 19 20 |
# File 'lib/fedora_migrate/repository_migrator.rb', line 18 def migrate_objects source_objects.each { |source| migrate_object(source) } end |
#migrate_relationships ⇒ Object
22 23 24 25 |
# File 'lib/fedora_migrate/repository_migrator.rb', line 22 def migrate_relationships return "Relationship migration halted because #{failures.to_s} objects didn't migrate successfully." if failures > 0 && not_forced? source_objects.each { |source| migrate_relationship(source) } end |