ddr-batch 1.1.0.rc1 → 1.1.0.rc2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/ddr/batch/ingest_batch_object.rb +12 -1
- data/lib/ddr/batch/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d88167f89fd5ed29f280a330a1f6fc77498b5ae8
|
4
|
+
data.tar.gz: bae0c5b380c5dfc45df4191ecfdb19b3424345f7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e26f9322c8e8d6218460d8080b85e2fddc98480beb8bde9fe5a9fd2209f8d13b7c40603fe48984ba70f1e27d9e67409a726b5831303c7c265b09aa46ecb0de50
|
7
|
+
data.tar.gz: dfd738114a802dff9b42f09a0ea3b4b1cb009036ce678dd330436cb6412dd5475e97bb578d981523a94e1d38d144e29c0bc82982c1cc2bca4d4ee5c075dfe28a
|
@@ -6,6 +6,7 @@ module Ddr::Batch
|
|
6
6
|
errors = []
|
7
7
|
errors << "#{@error_prefix} Model required for INGEST operation" unless model
|
8
8
|
errors += validate_pre_assigned_pid if pid
|
9
|
+
errors += validate_collection if model == 'Collection'
|
9
10
|
errors
|
10
11
|
end
|
11
12
|
|
@@ -34,6 +35,16 @@ module Ddr::Batch
|
|
34
35
|
return errs
|
35
36
|
end
|
36
37
|
|
38
|
+
def validate_collection
|
39
|
+
errs = []
|
40
|
+
coll = Collection.new
|
41
|
+
batch_object_attributes.each { |attr| coll = add_attribute(coll, attr) }
|
42
|
+
unless coll.valid?
|
43
|
+
coll.errors.messages.each { |k, v| errs << "#{@error_prefix} Collection #{k} #{v.join(';')}" }
|
44
|
+
end
|
45
|
+
errs
|
46
|
+
end
|
47
|
+
|
37
48
|
def ingest(user, opts = {})
|
38
49
|
repo_object = create_repository_object
|
39
50
|
if !repo_object.nil? && !repo_object.new_record?
|
@@ -89,7 +100,7 @@ module Ddr::Batch
|
|
89
100
|
batch_object_datastreams.each { |d| repo_object = populate_datastream(repo_object, d) }
|
90
101
|
batch_object_relationships.each { |r| repo_object = add_relationship(repo_object, r) }
|
91
102
|
batch_object_roles.each { |r| repo_object = add_role(repo_object, r) }
|
92
|
-
repo_object.save
|
103
|
+
repo_object.save! # Do not allow batch ingest to successfully create an invalid object
|
93
104
|
rescue Exception => e1
|
94
105
|
logger.fatal("Error in creating repository object #{repo_object.pid} for #{identifier} : #{e1}")
|
95
106
|
repo_clean = false
|
data/lib/ddr/batch/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ddr-batch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.0.
|
4
|
+
version: 1.1.0.rc2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jim Coble
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-10-
|
12
|
+
date: 2016-10-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|