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
- #get_source_objects ⇒ 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.
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 |
#result ⇒ Object
Returns the value of attribute result.
6 7 8 |
# File 'lib/fedora_migrate/repository_migrator.rb', line 6 def result @result end |
#source ⇒ Object
Returns the value of attribute source.
6 7 8 |
# File 'lib/fedora_migrate/repository_migrator.rb', line 6 def source @source 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
51 52 53 |
# File 'lib/fedora_migrate/repository_migrator.rb', line 51 def failures report.failed_objects.count end |
#get_source_objects ⇒ Object
47 48 49 |
# File 'lib/fedora_migrate/repository_migrator.rb', line 47 def get_source_objects FedoraMigrate.source.connection.search(nil).collect { |o| (o) }.compact end |
#initialize_report ⇒ Object
32 33 34 35 36 |
# File 'lib/fedora_migrate/repository_migrator.rb', line 32 def initialize_report @result = SingleObjectReport.new @result.status = false report.save(source.pid, @result) end |
#migrate_current_object ⇒ Object
26 27 28 29 30 |
# File 'lib/fedora_migrate/repository_migrator.rb', line 26 def migrate_current_object return unless migration_required? initialize_report migrate_object end |
#migrate_objects ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/fedora_migrate/repository_migrator.rb', line 18 def migrate_objects source_objects.each do |object| @source = object migrate_current_object end report.reload end |
#migrate_relationships ⇒ Object
38 39 40 41 42 43 44 45 |
# File 'lib/fedora_migrate/repository_migrator.rb', line 38 def migrate_relationships return "Relationship migration halted because #{failures.to_s} 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 |