bulkrax 2.0.1 → 2.0.2
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c862fc4eef8cf2d892ab2c3dd635ed6070d887b87104b007dc5dd7fffdd5fd51
|
4
|
+
data.tar.gz: 7e735123366e3e7998d2e99ccdaf97047560e2e8fc8695a69e21da8abb6234a0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5b6bb1cd44e421a22cb93df50aea16292da25e3d4e124797ec2024ad17fb8d239033c1c89d9cec7984fd3dff575278443489b59523fe46e328f63a8f265be826
|
7
|
+
data.tar.gz: 43d65c3c6ef09d07cb677dfd35b2476eaa8e32c8d5ddcbddfd1a55b25541a882f3611414d38d351b134763723181ce2a15ab926e0a306cb8157e1417763b97b8
|
@@ -9,7 +9,7 @@ module Bulkrax
|
|
9
9
|
# Use identifier set by CsvParser#unique_collection_identifier, which falls back
|
10
10
|
# on the Collection's first title if record[source_identifier] is not present
|
11
11
|
def add_identifier
|
12
|
-
self.parsed_metadata[work_identifier] = self.identifier
|
12
|
+
self.parsed_metadata[work_identifier] = [self.identifier].flatten
|
13
13
|
end
|
14
14
|
|
15
15
|
def add_collection_type_gid
|
@@ -11,9 +11,9 @@ module Bulkrax
|
|
11
11
|
unless self.importerexporter.validate_only
|
12
12
|
raise CollectionsCreatedError unless collections_created?
|
13
13
|
@item = factory.run!
|
14
|
+
parent_jobs if self.parsed_metadata[related_parents_parsed_mapping].present?
|
15
|
+
child_jobs if self.parsed_metadata[related_children_parsed_mapping].present?
|
14
16
|
end
|
15
|
-
parent_jobs if self.parsed_metadata[related_parents_parsed_mapping].present?
|
16
|
-
child_jobs if self.parsed_metadata[related_children_parsed_mapping].present?
|
17
17
|
rescue RSolr::Error::Http, CollectionsCreatedError => e
|
18
18
|
raise e
|
19
19
|
rescue StandardError => e
|
@@ -26,12 +26,16 @@ module Bulkrax
|
|
26
26
|
|
27
27
|
def parent_jobs
|
28
28
|
self.parsed_metadata[related_parents_parsed_mapping].each do |parent_identifier|
|
29
|
+
next if parent_identifier.blank?
|
30
|
+
|
29
31
|
CreateRelationshipsJob.perform_later(entry_identifier: self.identifier, parent_identifier: parent_identifier, importer_run: self.last_run)
|
30
32
|
end
|
31
33
|
end
|
32
34
|
|
33
35
|
def child_jobs
|
34
36
|
self.parsed_metadata[related_children_parsed_mapping].each do |child_identifier|
|
37
|
+
next if child_identifier.blank?
|
38
|
+
|
35
39
|
CreateRelationshipsJob.perform_later(entry_identifier: self.identifier, child_identifier: child_identifier, importer_run: self.last_run)
|
36
40
|
end
|
37
41
|
end
|
@@ -25,7 +25,7 @@ module Bulkrax
|
|
25
25
|
# retrieve a list of unique collections
|
26
26
|
records.map do |r|
|
27
27
|
collections = []
|
28
|
-
r[collection_field_mapping].split(/\s*[;|]\s*/).each { |title| collections << { title: title } } if r[collection_field_mapping].present?
|
28
|
+
r[collection_field_mapping].split(/\s*[;|]\s*/).each { |title| collections << { title: title, from_collection_field_mapping: true } } if r[collection_field_mapping].present?
|
29
29
|
model_field_mappings.each do |model_mapping|
|
30
30
|
collections << r if r[model_mapping.to_sym]&.downcase == 'collection'
|
31
31
|
end
|
@@ -74,8 +74,28 @@ module Bulkrax
|
|
74
74
|
collections.each_with_index do |collection, index|
|
75
75
|
next if collection.blank?
|
76
76
|
break if records.find_index(collection).present? && limit_reached?(limit, records.find_index(collection))
|
77
|
-
|
78
|
-
|
77
|
+
ActiveSupport::Deprecation.warn(
|
78
|
+
'Creating Collections using the collection_field_mapping will no longer be supported as of Bulkrax version 3.0.' \
|
79
|
+
' Please configure Bulkrax to use related_parents_field_mapping and related_children_field_mapping instead.'
|
80
|
+
)
|
81
|
+
|
82
|
+
## BEGIN
|
83
|
+
# Add required metadata to collections being imported using the collection_field_mapping, which only have a :title
|
84
|
+
# TODO: Remove once collection_field_mapping is removed
|
85
|
+
metadata = if collection.delete(:from_collection_field_mapping)
|
86
|
+
uci = unique_collection_identifier(collection)
|
87
|
+
{
|
88
|
+
title: [collection[:title]],
|
89
|
+
work_identifier => uci,
|
90
|
+
source_identifier => uci,
|
91
|
+
visibility: 'open',
|
92
|
+
collection_type_gid: ::Hyrax::CollectionType.find_or_create_default_collection_type.gid
|
93
|
+
}
|
94
|
+
end
|
95
|
+
collection_hash = metadata.presence || collection
|
96
|
+
## END
|
97
|
+
|
98
|
+
new_entry = find_or_create_entry(collection_entry_class, collection_hash[source_identifier], 'Bulkrax::Importer', collection_hash)
|
79
99
|
# TODO: add support for :delete option
|
80
100
|
ImportCollectionJob.perform_now(new_entry.id, current_run.id)
|
81
101
|
increment_counters(index, true)
|
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: 2.0.
|
4
|
+
version: 2.0.2
|
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-01-
|
11
|
+
date: 2022-01-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|