bulkrax 7.0.0 → 8.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/bulkrax/datatables.js +1 -1
  3. data/app/controllers/bulkrax/exporters_controller.rb +1 -1
  4. data/app/controllers/bulkrax/importers_controller.rb +2 -1
  5. data/app/controllers/concerns/bulkrax/datatables_behavior.rb +15 -15
  6. data/app/factories/bulkrax/object_factory.rb +135 -163
  7. data/app/factories/bulkrax/object_factory_interface.rb +491 -0
  8. data/app/factories/bulkrax/valkyrie_object_factory.rb +402 -0
  9. data/app/helpers/bulkrax/importers_helper.rb +1 -1
  10. data/app/helpers/bulkrax/validation_helper.rb +4 -4
  11. data/app/jobs/bulkrax/create_relationships_job.rb +27 -16
  12. data/app/jobs/bulkrax/delete_job.rb +3 -2
  13. data/app/jobs/bulkrax/download_cloud_file_job.rb +16 -3
  14. data/app/jobs/bulkrax/import_file_set_job.rb +5 -2
  15. data/app/jobs/bulkrax/importer_job.rb +18 -2
  16. data/app/matchers/bulkrax/application_matcher.rb +0 -2
  17. data/app/models/bulkrax/csv_collection_entry.rb +1 -1
  18. data/app/models/bulkrax/csv_entry.rb +7 -6
  19. data/app/models/bulkrax/entry.rb +7 -11
  20. data/app/models/bulkrax/exporter.rb +2 -2
  21. data/app/models/bulkrax/importer.rb +1 -3
  22. data/app/models/bulkrax/oai_entry.rb +0 -3
  23. data/app/models/bulkrax/oai_set_entry.rb +1 -1
  24. data/app/models/bulkrax/rdf_collection_entry.rb +1 -1
  25. data/app/models/bulkrax/rdf_entry.rb +70 -69
  26. data/app/models/bulkrax/xml_entry.rb +0 -1
  27. data/app/models/concerns/bulkrax/dynamic_record_lookup.rb +2 -19
  28. data/app/models/concerns/bulkrax/export_behavior.rb +2 -2
  29. data/app/models/concerns/bulkrax/file_factory.rb +174 -118
  30. data/app/models/concerns/bulkrax/file_set_entry_behavior.rb +2 -2
  31. data/app/models/concerns/bulkrax/has_matchers.rb +28 -25
  32. data/app/models/concerns/bulkrax/import_behavior.rb +10 -17
  33. data/app/models/concerns/bulkrax/importer_exporter_behavior.rb +3 -2
  34. data/app/parsers/bulkrax/application_parser.rb +31 -7
  35. data/app/parsers/bulkrax/bagit_parser.rb +175 -174
  36. data/app/parsers/bulkrax/csv_parser.rb +15 -5
  37. data/app/parsers/bulkrax/oai_dc_parser.rb +18 -0
  38. data/app/parsers/bulkrax/parser_export_record_set.rb +18 -22
  39. data/app/parsers/bulkrax/xml_parser.rb +0 -2
  40. data/app/services/bulkrax/factory_class_finder.rb +2 -0
  41. data/app/services/bulkrax/remove_relationships_for_importer.rb +3 -1
  42. data/app/services/hyrax/custom_queries/find_by_source_identifier.rb +50 -0
  43. data/app/services/wings/custom_queries/find_by_source_identifier.rb +32 -0
  44. data/app/views/bulkrax/entries/_parsed_metadata.html.erb +2 -2
  45. data/app/views/bulkrax/entries/_raw_metadata.html.erb +2 -2
  46. data/app/views/bulkrax/entries/show.html.erb +9 -8
  47. data/app/views/bulkrax/exporters/edit.html.erb +1 -1
  48. data/app/views/bulkrax/exporters/new.html.erb +1 -1
  49. data/app/views/bulkrax/exporters/show.html.erb +4 -2
  50. data/app/views/bulkrax/importers/_browse_everything.html.erb +2 -2
  51. data/app/views/bulkrax/importers/_csv_fields.html.erb +1 -1
  52. data/app/views/bulkrax/importers/edit.html.erb +1 -1
  53. data/app/views/bulkrax/importers/new.html.erb +1 -1
  54. data/app/views/bulkrax/importers/show.html.erb +1 -1
  55. data/app/views/bulkrax/importers/upload_corrected_entries.html.erb +2 -2
  56. data/app/views/bulkrax/shared/_bulkrax_errors.html.erb +1 -1
  57. data/app/views/bulkrax/shared/_bulkrax_field_mapping.html.erb +1 -1
  58. data/config/locales/bulkrax.en.yml +7 -0
  59. data/db/migrate/20230608153601_add_indices_to_bulkrax.rb +20 -9
  60. data/db/migrate/20240307053156_add_index_to_metadata_bulkrax_identifier.rb +18 -0
  61. data/lib/bulkrax/engine.rb +23 -6
  62. data/lib/bulkrax/version.rb +1 -1
  63. data/lib/bulkrax.rb +54 -52
  64. data/lib/generators/bulkrax/templates/config/initializers/bulkrax.rb +2 -0
  65. data/lib/tasks/bulkrax_tasks.rake +1 -0
  66. data/lib/tasks/reset.rake +4 -4
  67. metadata +24 -8
  68. data/lib/bulkrax/persistence_layer/active_fedora_adapter.rb +0 -27
  69. data/lib/bulkrax/persistence_layer/valkyrie_adapter.rb +0 -8
  70. data/lib/bulkrax/persistence_layer.rb +0 -38
data/lib/tasks/reset.rake CHANGED
@@ -12,8 +12,7 @@ namespace :hyrax do
12
12
  desc 'Reset fedora / solr and corresponding database tables w/o clearing other active record tables like users'
13
13
  task works_and_collections: [:environment] do
14
14
  confirm('You are about to delete all works and collections, this is not reversable!')
15
- require 'active_fedora/cleaner'
16
- ActiveFedora::Cleaner.clean!
15
+ Bulkrax.object_factory.clean!
17
16
  Hyrax::PermissionTemplateAccess.delete_all
18
17
  Hyrax::PermissionTemplate.delete_all
19
18
  Bulkrax::PendingRelationship.delete_all
@@ -33,16 +32,17 @@ namespace :hyrax do
33
32
  Mailboxer::Conversation::OptOut.delete_all
34
33
  Mailboxer::Conversation.delete_all
35
34
  AccountElevator.switch!(Site.instance.account) if defined?(AccountElevator)
35
+
36
36
  # we need to wait till Fedora is done with its cleanup
37
37
  # otherwise creating the admin set will fail
38
- while AdminSet.exists?(AdminSet::DEFAULT_ID)
38
+ while Bulkrax.object_factory.default_admin_set_or_nil
39
39
  puts 'waiting for delete to finish before reinitializing Fedora'
40
40
  sleep 20
41
41
  end
42
42
 
43
43
  Hyrax::CollectionType.find_or_create_default_collection_type
44
44
  Hyrax::CollectionType.find_or_create_admin_set_type
45
- AdminSet.find_or_create_default_admin_set_id
45
+ Bulkrax.object_factory.find_or_create_default_admin_set
46
46
 
47
47
  collection_types = Hyrax::CollectionType.all
48
48
  collection_types.each do |c|
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bulkrax
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.0.0
4
+ version: 8.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rob Kaufman
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-03-02 00:00:00.000000000 Z
11
+ date: 2024-04-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0.4'
33
+ version: 0.4.6
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '0.4'
40
+ version: 0.4.6
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: coderay
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: marcel
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: iso8601
71
85
  requirement: !ruby/object:Gem::Requirement
@@ -328,6 +342,8 @@ files:
328
342
  - app/controllers/concerns/bulkrax/datatables_behavior.rb
329
343
  - app/controllers/concerns/bulkrax/download_behavior.rb
330
344
  - app/factories/bulkrax/object_factory.rb
345
+ - app/factories/bulkrax/object_factory_interface.rb
346
+ - app/factories/bulkrax/valkyrie_object_factory.rb
331
347
  - app/helpers/bulkrax/application_helper.rb
332
348
  - app/helpers/bulkrax/exporters_helper.rb
333
349
  - app/helpers/bulkrax/importers_helper.rb
@@ -395,6 +411,8 @@ files:
395
411
  - app/parsers/bulkrax/xml_parser.rb
396
412
  - app/services/bulkrax/factory_class_finder.rb
397
413
  - app/services/bulkrax/remove_relationships_for_importer.rb
414
+ - app/services/hyrax/custom_queries/find_by_source_identifier.rb
415
+ - app/services/wings/custom_queries/find_by_source_identifier.rb
398
416
  - app/views/bulkrax/entries/_parsed_metadata.html.erb
399
417
  - app/views/bulkrax/entries/_raw_metadata.html.erb
400
418
  - app/views/bulkrax/entries/show.html.erb
@@ -462,12 +480,10 @@ files:
462
480
  - db/migrate/20230608153601_add_indices_to_bulkrax.rb
463
481
  - db/migrate/20240208005801_denormalize_status_message.rb
464
482
  - db/migrate/20240209070952_update_identifier_index.rb
483
+ - db/migrate/20240307053156_add_index_to_metadata_bulkrax_identifier.rb
465
484
  - lib/bulkrax.rb
466
485
  - lib/bulkrax/engine.rb
467
486
  - lib/bulkrax/entry_spec_helper.rb
468
- - lib/bulkrax/persistence_layer.rb
469
- - lib/bulkrax/persistence_layer/active_fedora_adapter.rb
470
- - lib/bulkrax/persistence_layer/valkyrie_adapter.rb
471
487
  - lib/bulkrax/version.rb
472
488
  - lib/generators/bulkrax/install_generator.rb
473
489
  - lib/generators/bulkrax/templates/README
@@ -497,7 +513,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
497
513
  - !ruby/object:Gem::Version
498
514
  version: '0'
499
515
  requirements: []
500
- rubygems_version: 3.4.10
516
+ rubygems_version: 3.5.5
501
517
  signing_key:
502
518
  specification_version: 4
503
519
  summary: Import and export tool for Hyrax and Hyku
@@ -1,27 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Bulkrax
4
- module PersistenceLayer
5
- class ActiveFedoraAdapter < AbstractAdapter
6
- def self.find(id)
7
- ActiveFedora::Base.find(id)
8
- rescue ActiveFedora::ObjectNotFoundError => e
9
- raise PersistenceLayer::RecordNotFound, e.message
10
- end
11
-
12
- def self.query(q, **kwargs)
13
- ActiveFedora::SolrService.query(q, **kwargs)
14
- end
15
-
16
- def self.clean!
17
- super do
18
- ActiveFedora::Cleaner.clean!
19
- end
20
- end
21
-
22
- def self.solr_name(field_name)
23
- ActiveFedora.index_field_mapper.solr_name(field_name)
24
- end
25
- end
26
- end
27
- end
@@ -1,8 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Bulkrax
4
- module PersistenceLayer
5
- class ValkyrieAdapter < AbstractAdapter
6
- end
7
- end
8
- end
@@ -1,38 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Bulkrax
4
- ##
5
- # The target data layer where we write and read our imported {Bulkrax::Entry} objects.
6
- module PersistenceLayer
7
- # We're inheriting from an ActiveRecord exception as that is something we know will be here; and
8
- # something that the main_app will be expect to be able to handle.
9
- class ObjectNotFoundError < ActiveRecord::RecordNotFound
10
- end
11
-
12
- # We're inheriting from an ActiveRecord exception as that is something we know will be here; and
13
- # something that the main_app will be expect to be able to handle.
14
- class RecordInvalid < ActiveRecord::RecordInvalid
15
- end
16
-
17
- class AbstractAdapter
18
- # @see ActiveFedora::Base.find
19
- def self.find(id)
20
- raise NotImplementedError, "#{self}.#{__method__}"
21
- end
22
-
23
- def self.solr_name(field_name)
24
- raise NotImplementedError, "#{self}.#{__method__}"
25
- end
26
-
27
- # @yield when Rails application is running in test environment.
28
- def self.clean!
29
- return true unless Rails.env.test?
30
- yield
31
- end
32
-
33
- def self.query(q, **kwargs)
34
- raise NotImplementedError, "#{self}.#{__method__}"
35
- end
36
- end
37
- end
38
- end