bulkrax 8.0.0 → 8.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/concerns/loggable.rb +25 -0
- data/app/factories/bulkrax/object_factory_interface.rb +7 -15
- data/app/factories/bulkrax/valkyrize-hyku.code-workspace +19 -0
- data/app/jobs/bulkrax/import_file_set_job.rb +18 -17
- data/app/models/concerns/bulkrax/file_factory.rb +5 -1
- data/app/models/concerns/bulkrax/has_matchers.rb +12 -1
- data/db/migrate/20240307053156_add_index_to_metadata_bulkrax_identifier.rb +1 -1
- data/lib/bulkrax/version.rb +1 -1
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0c787263cc1d6eece0eee9e403e317670cc5d4a86c0a9d08f5ef069ffd0489c9
|
4
|
+
data.tar.gz: c52e09a8c5e263e4e641a4bede55acf22d9ea5c254d33c18347f08e535ef3ea6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b2abb43af9365afee05600fa60ddb7d3424a76070e29ca5e9a707f94da6abb3d94893c34715a793f2ce8be5882d6e9fa96ede1f807e17e6ccdd4eb9d890a5006
|
7
|
+
data.tar.gz: eef45e1ac6d6a06e3eb3dd9a29b37f85b0d79c6b3bc3cd6a57f15935f57e68cc7ae549095bc3e73100a08e957f24c5f6a428f9330f1bea986a8dcb3f535cb6dd
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Loggable
|
4
|
+
extend ActiveSupport::Concern
|
5
|
+
|
6
|
+
def log_created(obj)
|
7
|
+
log_action('Created', obj)
|
8
|
+
end
|
9
|
+
|
10
|
+
def log_updated(obj)
|
11
|
+
log_action('Updated', obj)
|
12
|
+
end
|
13
|
+
|
14
|
+
def log_deleted_fs(obj)
|
15
|
+
msg = "Deleted All Files from #{obj.id}"
|
16
|
+
Rails.logger.info("#{msg} (#{Array(obj.attributes[work_identifier]).first})")
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def log_action(action, obj)
|
22
|
+
msg = "#{action} #{obj.class.model_name.human} #{obj.id}"
|
23
|
+
Rails.logger.info("#{msg} (#{Array(obj.attributes[work_identifier]).first})")
|
24
|
+
end
|
25
|
+
end
|
@@ -20,6 +20,7 @@ module Bulkrax
|
|
20
20
|
class ObjectFactoryInterface
|
21
21
|
extend ActiveModel::Callbacks
|
22
22
|
include DynamicRecordLookup
|
23
|
+
include Loggable
|
23
24
|
|
24
25
|
# We're inheriting from an ActiveRecord exception as that is something we
|
25
26
|
# know will be here; and something that the main_app will be expect to be
|
@@ -224,6 +225,12 @@ module Bulkrax
|
|
224
225
|
id
|
225
226
|
read_groups
|
226
227
|
visibility
|
228
|
+
visibility_during_embargo
|
229
|
+
embargo_release_date
|
230
|
+
visibility_after_embargo
|
231
|
+
visibility_during_lease
|
232
|
+
lease_expiration_date
|
233
|
+
visibility_after_lease
|
227
234
|
work_members_attributes
|
228
235
|
]
|
229
236
|
|
@@ -398,21 +405,6 @@ module Bulkrax
|
|
398
405
|
self.class.add_user_to_collection_permissions(**arguments)
|
399
406
|
end
|
400
407
|
|
401
|
-
def log_created(obj)
|
402
|
-
msg = "Created #{klass.model_name.human} #{obj.id}"
|
403
|
-
Rails.logger.info("#{msg} (#{Array(attributes[work_identifier]).first})")
|
404
|
-
end
|
405
|
-
|
406
|
-
def log_updated(obj)
|
407
|
-
msg = "Updated #{klass.model_name.human} #{obj.id}"
|
408
|
-
Rails.logger.info("#{msg} (#{Array(attributes[work_identifier]).first})")
|
409
|
-
end
|
410
|
-
|
411
|
-
def log_deleted_fs(obj)
|
412
|
-
msg = "Deleted All Files from #{obj.id}"
|
413
|
-
Rails.logger.info("#{msg} (#{Array(attributes[work_identifier]).first})")
|
414
|
-
end
|
415
|
-
|
416
408
|
private
|
417
409
|
|
418
410
|
def apply_depositor_metadata
|
@@ -0,0 +1,19 @@
|
|
1
|
+
{
|
2
|
+
"folders": [
|
3
|
+
{
|
4
|
+
"path": "../../../../../hyku"
|
5
|
+
},
|
6
|
+
{
|
7
|
+
"path": "../../../../hyrax"
|
8
|
+
},
|
9
|
+
{
|
10
|
+
"path": "../../.."
|
11
|
+
},
|
12
|
+
{
|
13
|
+
"path": "../../../../iiif_print"
|
14
|
+
}
|
15
|
+
],
|
16
|
+
"settings": {
|
17
|
+
"github.copilot.inlineSuggest.enable": true
|
18
|
+
}
|
19
|
+
}
|
@@ -16,7 +16,12 @@ module Bulkrax
|
|
16
16
|
# e.g. "parents" or "parents_1"
|
17
17
|
parent_identifier = (entry.raw_metadata[entry.related_parents_raw_mapping] || entry.raw_metadata["#{entry.related_parents_raw_mapping}_1"])&.strip
|
18
18
|
|
19
|
-
|
19
|
+
begin
|
20
|
+
validate_parent!(parent_identifier)
|
21
|
+
rescue MissingParentError => e
|
22
|
+
handle_retry(entry, importer_run_id, e)
|
23
|
+
return
|
24
|
+
end
|
20
25
|
|
21
26
|
entry.build
|
22
27
|
if entry.succeeded?
|
@@ -32,17 +37,6 @@ module Bulkrax
|
|
32
37
|
entry.save!
|
33
38
|
entry.importer.current_run = ImporterRun.find(importer_run_id)
|
34
39
|
entry.importer.record_status
|
35
|
-
|
36
|
-
rescue MissingParentError => e
|
37
|
-
# try waiting for the parent record to be created
|
38
|
-
entry.import_attempts += 1
|
39
|
-
entry.save!
|
40
|
-
if entry.import_attempts < 5
|
41
|
-
ImportFileSetJob.set(wait: (entry.import_attempts + 1).minutes).perform_later(entry_id, importer_run_id)
|
42
|
-
else
|
43
|
-
ImporterRun.decrement_counter(:enqueued_records, importer_run_id) # rubocop:disable Rails/SkipsModelValidations
|
44
|
-
entry.set_status_info(e)
|
45
|
-
end
|
46
40
|
end
|
47
41
|
|
48
42
|
private
|
@@ -54,14 +48,9 @@ module Bulkrax
|
|
54
48
|
return if parent_identifier.blank?
|
55
49
|
|
56
50
|
find_parent_record(parent_identifier)
|
57
|
-
check_parent_exists!(parent_identifier)
|
58
51
|
check_parent_is_a_work!(parent_identifier)
|
59
52
|
end
|
60
53
|
|
61
|
-
def check_parent_exists!(parent_identifier)
|
62
|
-
raise MissingParentError, %(Unable to find a record with the identifier "#{parent_identifier}") if parent_record.nil?
|
63
|
-
end
|
64
|
-
|
65
54
|
def check_parent_is_a_work!(parent_identifier)
|
66
55
|
case parent_record
|
67
56
|
when Bulkrax.collection_model_class, Bulkrax.file_model_class
|
@@ -72,6 +61,18 @@ module Bulkrax
|
|
72
61
|
|
73
62
|
def find_parent_record(parent_identifier)
|
74
63
|
_, @parent_record = find_record(parent_identifier, importer_run_id)
|
64
|
+
raise MissingParentError, %(Unable to find a record with the identifier "#{parent_identifier}") unless parent_record
|
65
|
+
end
|
66
|
+
|
67
|
+
def handle_retry(entry, importer_run_id, e)
|
68
|
+
entry.import_attempts += 1
|
69
|
+
entry.save!
|
70
|
+
if entry.import_attempts < 5
|
71
|
+
ImportFileSetJob.set(wait: (entry.import_attempts + 1).minutes).perform_later(entry.id, importer_run_id)
|
72
|
+
else
|
73
|
+
ImporterRun.decrement_counter(:enqueued_records, importer_run_id) # rubocop:disable Rails/SkipsModelValidations
|
74
|
+
entry.set_status_info(e)
|
75
|
+
end
|
75
76
|
end
|
76
77
|
end
|
77
78
|
end
|
@@ -32,6 +32,8 @@ module Bulkrax
|
|
32
32
|
end
|
33
33
|
|
34
34
|
class InnerWorkings
|
35
|
+
include Loggable
|
36
|
+
|
35
37
|
def initialize(object_factory:)
|
36
38
|
@object_factory = object_factory
|
37
39
|
end
|
@@ -119,7 +121,7 @@ module Bulkrax
|
|
119
121
|
def destroy_existing_files
|
120
122
|
return unless object.present? && object.file_sets.present?
|
121
123
|
object.file_sets.each do |fs|
|
122
|
-
Hyrax::Actors::FileSetActor.new(fs,
|
124
|
+
Hyrax::Actors::FileSetActor.new(fs, user).destroy
|
123
125
|
end
|
124
126
|
@object = object.reload
|
125
127
|
log_deleted_fs(object)
|
@@ -155,6 +157,8 @@ module Bulkrax
|
|
155
157
|
end
|
156
158
|
|
157
159
|
def ordered_file_sets
|
160
|
+
return [] if object.blank?
|
161
|
+
|
158
162
|
Bulkrax.object_factory.ordered_file_sets_for(object)
|
159
163
|
end
|
160
164
|
|
@@ -148,7 +148,18 @@ module Bulkrax
|
|
148
148
|
end
|
149
149
|
|
150
150
|
def fields_that_are_always_multiple
|
151
|
-
%w[
|
151
|
+
@fields_that_are_always_multiple = %w[
|
152
|
+
id
|
153
|
+
delete
|
154
|
+
model
|
155
|
+
visibility
|
156
|
+
visibility_during_embargo
|
157
|
+
embargo_release_date
|
158
|
+
visibility_after_embargo
|
159
|
+
visibility_during_lease
|
160
|
+
lease_expiration_date
|
161
|
+
visibility_after_lease
|
162
|
+
]
|
152
163
|
end
|
153
164
|
|
154
165
|
def fields_that_are_always_singular
|
@@ -1,4 +1,4 @@
|
|
1
|
-
class AddIndexToMetadataBulkraxIdentifier < ActiveRecord::Migration[
|
1
|
+
class AddIndexToMetadataBulkraxIdentifier < ActiveRecord::Migration[5.2]
|
2
2
|
def up
|
3
3
|
return unless table_exists?(:orm_resources)
|
4
4
|
return if index_exists?(:orm_resources, "(((metadata -> 'bulkrax_identifier'::text) ->> 0))", name: 'index_on_bulkrax_identifier')
|
data/lib/bulkrax/version.rb
CHANGED
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: 8.
|
4
|
+
version: 8.1.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-
|
11
|
+
date: 2024-06-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -334,6 +334,7 @@ files:
|
|
334
334
|
- app/assets/stylesheets/bulkrax/application.css
|
335
335
|
- app/assets/stylesheets/bulkrax/coderay.scss
|
336
336
|
- app/assets/stylesheets/bulkrax/import_export.scss
|
337
|
+
- app/concerns/loggable.rb
|
337
338
|
- app/controllers/bulkrax/application_controller.rb
|
338
339
|
- app/controllers/bulkrax/entries_controller.rb
|
339
340
|
- app/controllers/bulkrax/exporters_controller.rb
|
@@ -344,6 +345,7 @@ files:
|
|
344
345
|
- app/factories/bulkrax/object_factory.rb
|
345
346
|
- app/factories/bulkrax/object_factory_interface.rb
|
346
347
|
- app/factories/bulkrax/valkyrie_object_factory.rb
|
348
|
+
- app/factories/bulkrax/valkyrize-hyku.code-workspace
|
347
349
|
- app/helpers/bulkrax/application_helper.rb
|
348
350
|
- app/helpers/bulkrax/exporters_helper.rb
|
349
351
|
- app/helpers/bulkrax/importers_helper.rb
|
@@ -513,7 +515,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
513
515
|
- !ruby/object:Gem::Version
|
514
516
|
version: '0'
|
515
517
|
requirements: []
|
516
|
-
rubygems_version: 3.
|
518
|
+
rubygems_version: 3.4.10
|
517
519
|
signing_key:
|
518
520
|
specification_version: 4
|
519
521
|
summary: Import and export tool for Hyrax and Hyku
|