bulkrax 3.0.0.beta7 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/jobs/bulkrax/create_relationships_job.rb +10 -12
- data/app/jobs/bulkrax/export_work_job.rb +1 -0
- data/app/models/bulkrax/exporter.rb +2 -1
- data/app/models/bulkrax/importer.rb +1 -1
- data/app/models/concerns/bulkrax/import_behavior.rb +2 -0
- data/app/parsers/bulkrax/csv_parser.rb +21 -13
- data/lib/bulkrax/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7810d87388103e4ff6d160e6acb64a492dcfcf16a23f93ad6848f6cc97f2d9db
|
|
4
|
+
data.tar.gz: 75bee56959564774f20cda642b6c732cd9cb8a4fbd19222222fbac429effc949
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 74297cb60a695e46fa97389b6a9a23124c816304d636267e72585a286f370c923aefe0e10727d3a215fc8d7a1eefa579cb84cd3b84b8e8f65a72619c0c10176e
|
|
7
|
+
data.tar.gz: 57e62164db12eb01bbfa200d612ecd0439099e257d760009b289644e93fd043e7edc3f95c08f023fed2746abfc2c57fac996b542abc0cf724794dc78bc422ddc
|
|
@@ -82,18 +82,18 @@ module Bulkrax
|
|
|
82
82
|
# Work-Collection membership is added to the child as member_of_collection_ids
|
|
83
83
|
# This is adding the reverse relationship, from the child to the parent
|
|
84
84
|
def collection_parent_work_child
|
|
85
|
-
child_records[:works].
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
85
|
+
child_work_ids = child_records[:works].map(&:id)
|
|
86
|
+
parent_record.reindex_extent = Hyrax::Adapters::NestingIndexAdapter::LIMITED_REINDEX
|
|
87
|
+
|
|
88
|
+
parent_record.add_member_objects(child_work_ids)
|
|
89
|
+
ImporterRun.find(importer_run_id).increment!(:processed_relationships, child_work_ids.count) # rubocop:disable Rails/SkipsModelValidations
|
|
90
90
|
end
|
|
91
91
|
|
|
92
92
|
# Collection-Collection membership is added to the as member_ids
|
|
93
93
|
def collection_parent_collection_child
|
|
94
94
|
child_records[:collections].each do |child_record|
|
|
95
95
|
::Hyrax::Collections::NestedCollectionPersistenceService.persist_nested_collection_for(parent: parent_record, child: child_record)
|
|
96
|
-
|
|
96
|
+
ImporterRun.find(importer_run_id).increment!(:processed_relationships) # rubocop:disable Rails/SkipsModelValidations
|
|
97
97
|
end
|
|
98
98
|
end
|
|
99
99
|
|
|
@@ -103,14 +103,12 @@ module Bulkrax
|
|
|
103
103
|
child_records[:works].each_with_index do |child_record, i|
|
|
104
104
|
records_hash[i] = { id: child_record.id }
|
|
105
105
|
end
|
|
106
|
-
attrs = {
|
|
107
|
-
|
|
108
|
-
}
|
|
109
|
-
parent_record.reindex_extent = Hyrax::Adapters::NestingIndexAdapter::LIMITED_REINDEX if parent_record.respond_to?(:reindex_extent)
|
|
106
|
+
attrs = { work_members_attributes: records_hash }
|
|
107
|
+
parent_record.try(:reindex_extent=, Hyrax::Adapters::NestingIndexAdapter::LIMITED_REINDEX)
|
|
110
108
|
env = Hyrax::Actors::Environment.new(parent_record, Ability.new(user), attrs)
|
|
109
|
+
|
|
111
110
|
Hyrax::CurationConcern.actor.update(env)
|
|
112
|
-
|
|
113
|
-
Bulkrax::ImporterRun.find(importer_run_id).increment!(:processed_relationships) # rubocop:disable Rails/SkipsModelValidations
|
|
111
|
+
ImporterRun.find(importer_run_id).increment!(:processed_relationships, child_records[:works].count) # rubocop:disable Rails/SkipsModelValidations
|
|
114
112
|
end
|
|
115
113
|
|
|
116
114
|
def reschedule(parent_identifier:, importer_run_id:)
|
|
@@ -96,7 +96,8 @@ module Bulkrax
|
|
|
96
96
|
end
|
|
97
97
|
|
|
98
98
|
def current_run
|
|
99
|
-
|
|
99
|
+
total = self.limit || parser.total
|
|
100
|
+
@current_run ||= self.exporter_runs.create!(total_work_entries: total, enqueued_records: total)
|
|
100
101
|
end
|
|
101
102
|
|
|
102
103
|
def last_run
|
|
@@ -142,7 +142,7 @@ module Bulkrax
|
|
|
142
142
|
|
|
143
143
|
def import_objects(types_array = nil)
|
|
144
144
|
self.only_updates ||= false
|
|
145
|
-
types = types_array || %w[work
|
|
145
|
+
types = types_array || %w[collection work file_set relationship]
|
|
146
146
|
if parser.class == Bulkrax::CsvParser
|
|
147
147
|
parser.create_objects(types)
|
|
148
148
|
else
|
|
@@ -23,20 +23,28 @@ module Bulkrax
|
|
|
23
23
|
@collections = []
|
|
24
24
|
@works = []
|
|
25
25
|
@file_sets = []
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
26
|
+
|
|
27
|
+
if model_field_mappings.map { |mfm| mfm.to_sym.in?(records.first.keys) }.any?
|
|
28
|
+
records.map do |r|
|
|
29
|
+
model_field_mappings.map(&:to_sym).each do |model_mapping|
|
|
30
|
+
next unless r.key?(model_mapping)
|
|
31
|
+
|
|
32
|
+
if r[model_mapping].casecmp('collection').zero?
|
|
33
|
+
@collections << r
|
|
34
|
+
elsif r[model_mapping].casecmp('fileset').zero?
|
|
35
|
+
@file_sets << r
|
|
36
|
+
else
|
|
37
|
+
@works << r
|
|
38
|
+
end
|
|
34
39
|
end
|
|
35
40
|
end
|
|
41
|
+
@collections = @collections.flatten.compact.uniq
|
|
42
|
+
@file_sets = @file_sets.flatten.compact.uniq
|
|
43
|
+
@works = @works.flatten.compact.uniq
|
|
44
|
+
else # if no model is specified, assume all records are works
|
|
45
|
+
@works = records.flatten.compact.uniq
|
|
36
46
|
end
|
|
37
|
-
|
|
38
|
-
@file_sets = @file_sets.flatten.compact.uniq
|
|
39
|
-
@works = @works.flatten.compact.uniq
|
|
47
|
+
|
|
40
48
|
true
|
|
41
49
|
end
|
|
42
50
|
|
|
@@ -110,7 +118,7 @@ module Bulkrax
|
|
|
110
118
|
|
|
111
119
|
def create_objects(types_array = nil)
|
|
112
120
|
index = 0
|
|
113
|
-
(types_array || %w[work
|
|
121
|
+
(types_array || %w[collection work file_set relationship]).each do |type|
|
|
114
122
|
if type.eql?('relationship')
|
|
115
123
|
ScheduleRelationshipsJob.set(wait: 5.minutes).perform_later(importer_id: importerexporter.id)
|
|
116
124
|
next
|
|
@@ -262,7 +270,7 @@ module Bulkrax
|
|
|
262
270
|
# Changed to grep as wc -l counts blank lines, and ignores the final unescaped line (which may or may not contain data)
|
|
263
271
|
def total
|
|
264
272
|
@total = importer.parser_fields['total'] || 0 if importer?
|
|
265
|
-
@total =
|
|
273
|
+
@total = limit || current_record_ids.count if exporter?
|
|
266
274
|
|
|
267
275
|
return @total || 0
|
|
268
276
|
rescue StandardError
|
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: 3.0.
|
|
4
|
+
version: 3.0.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Rob Kaufman
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2022-05-
|
|
11
|
+
date: 2022-05-19 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rails
|
|
@@ -393,9 +393,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
393
393
|
version: '0'
|
|
394
394
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
395
395
|
requirements:
|
|
396
|
-
- - "
|
|
396
|
+
- - ">="
|
|
397
397
|
- !ruby/object:Gem::Version
|
|
398
|
-
version:
|
|
398
|
+
version: '0'
|
|
399
399
|
requirements: []
|
|
400
400
|
rubygems_version: 3.1.4
|
|
401
401
|
signing_key:
|