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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2c090fcbdee8f9e2e6861a5b5a79cb0766ae420c
4
- data.tar.gz: f441540385d72a68ca2ab832f519481c3a77a58b
3
+ metadata.gz: d88167f89fd5ed29f280a330a1f6fc77498b5ae8
4
+ data.tar.gz: bae0c5b380c5dfc45df4191ecfdb19b3424345f7
5
5
  SHA512:
6
- metadata.gz: 4b4a3c317a19cd1a03fa30c679c0a847c9c6f918e55a52248ac5eb31f9f3320e7e6b9b055cebc0ac82e28b6cc48eec66a7d031a35eb6bc7dd14e772374ed0c48
7
- data.tar.gz: 5956b006e1ac730ebbbb1d8a3d9904d6fe6a9d46ea5994e279f5aa7e3f552d90e0a2fd5d79e35972b8b5ea43f084df0a4ee82b4e446c91e7e016bc273bc937fe
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
@@ -1,5 +1,5 @@
1
1
  module Ddr
2
2
  module Batch
3
- VERSION = "1.1.0.rc1"
3
+ VERSION = "1.1.0.rc2"
4
4
  end
5
5
  end
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.rc1
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-17 00:00:00.000000000 Z
12
+ date: 2016-10-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails