Class: FedoraMigrate::ContentMover
- Includes:
- DatastreamVerification
- Defined in:
- lib/fedora_migrate/content_mover.rb
Defined Under Namespace
Classes: Report
Instance Attribute Summary
Attributes included from DatastreamVerification
Attributes inherited from Mover
Attributes included from MigrationOptions
Instance Method Summary collapse
- #insert_date_created_by_application ⇒ Object
- #migrate ⇒ Object
- #move_content ⇒ Object
- #report_results ⇒ Object
- #results_report ⇒ Object
- #sparql_insert ⇒ Object
Methods included from DatastreamVerification
#has_matching_checksums?, #has_matching_nokogiri_checksums?, #valid?
Methods inherited from Mover
#id_component, id_component, #initialize, #post_initialize, #save, #target_errors
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?, #conversion_options, #forced?, #not_forced?
Constructor Details
This class inherits a constructor from FedoraMigrate::Mover
Instance Method Details
#insert_date_created_by_application ⇒ Object
38 39 40 41 42 |
# File 'lib/fedora_migrate/content_mover.rb', line 38 def insert_date_created_by_application result = perform_sparql_insert report.original_date = source.createDate.iso8601 report.error = "There was a problem with sparql #{result.status} #{result.body}" unless result.status == 204 end |
#migrate ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/fedora_migrate/content_mover.rb', line 13 def migrate return report if nil_source move_content report_results insert_date_created_by_application super end |
#move_content ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/fedora_migrate/content_mover.rb', line 25 def move_content target.content = source.content target.original_name = source.label.try(:gsub, /"/, '\"') target.mime_type = source.mimeType save report.error = "Failed checksum" unless valid? end |
#report_results ⇒ Object
33 34 35 36 |
# File 'lib/fedora_migrate/content_mover.rb', line 33 def report_results report.name = target.original_name report.mime_type = target.mime_type end |
#results_report ⇒ Object
21 22 23 |
# File 'lib/fedora_migrate/content_mover.rb', line 21 def results_report Report.new end |
#sparql_insert ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/fedora_migrate/content_mover.rb', line 44 def sparql_insert <<-EOF PREFIX premis: <http://www.loc.gov/premis/rdf/v1#> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> DELETE WHERE { ?s premis:hasDateCreatedByApplication ?o } ; INSERT { <> premis:hasDateCreatedByApplication "#{source.createDate.iso8601}"^^xsd:dateTime . } WHERE { } EOF end |