dor-services 5.25.0 → 5.26.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 46e3ff972a83b4179a404ade467d7faeb01d853a
4
- data.tar.gz: 18ae1967c9357b69c59cd095070856eb8914b9b0
3
+ metadata.gz: 4ee1ac53d79f9351390da0d4cea40d8c02023b14
4
+ data.tar.gz: 9fffeb1b5b2a23035f6434d13ac1ebd49aa495a3
5
5
  SHA512:
6
- metadata.gz: a444e2762bf1be1c121a3745ad625be500fdc5b05b01e90ed243795a9fabfd02652a4f8e1cff95ea3b0c30acf5b51eff79bb49363469293ca4f071af985e3f2f
7
- data.tar.gz: 6276d8db063539fc266a972ba7f01a050fd1469dc45da97e8186f7320db1b7735eb98f413fe87a914d323f16e49d6770c9f5fc5bb975e962b93b4cd5d7143151
6
+ metadata.gz: 4338c7285c6cb9a6a5d92e1345b4fda6dcebcec0f8d5db3920501c29f847b0fbf4109feae1ed8f14beadd41f5aa98d72baaa2000a976803263869237d3df1c57
7
+ data.tar.gz: c8f10cc204a30e8b37df54025acd1e9f6d8bc0105b8e87f951a6e15adace82464ae716aadfebf4b95b9375c3b244dfd25d482ac0c51a12f5b480fbcf33e15f1e
@@ -19,6 +19,7 @@ module Dor
19
19
  t.mimeType :path => { :attribute => 'mimeType' }, :index_as => [:displayable]
20
20
  t.dataType :path => { :attribute => 'dataType' }, :index_as => [:displayable]
21
21
  t.size :path => { :attribute => 'size' }, :index_as => [:displayable] # , :data_type => :long
22
+ t.role :path => { :attribute => 'role' }, :index_as => [:not_searchable]
22
23
  t.shelve :path => { :attribute => 'shelve' }, :index_as => [:not_searchable] # , :data_type => :boolean
23
24
  t.publish :path => { :attribute => 'publish' }, :index_as => [:not_searchable] # , :data_type => :boolean
24
25
  t.preserve :path => { :attribute => 'preserve' }, :index_as => [:not_searchable] # , :data_type => :boolean
@@ -85,6 +86,7 @@ module Dor
85
86
  shelved_size = 0
86
87
  counts = Hash.new(0) # default count is zero
87
88
  resource_type_counts = Hash.new(0) # default count is zero
89
+ file_roles = ::Set.new
88
90
  mime_types = ::Set.new
89
91
  first_shelved_image = nil
90
92
 
@@ -95,10 +97,12 @@ module Dor
95
97
  counts['content_file'] += 1
96
98
  preserved_size += file['size'].to_i if file['preserve'] == 'yes'
97
99
  shelved_size += file['size'].to_i if file['shelve'] == 'yes'
98
- next unless file['shelve'] == 'yes'
99
- counts['shelved_file'] += 1
100
- first_shelved_image ||= file['id'] if file['id'] =~ /jp2$/
100
+ if file['shelve'] == 'yes'
101
+ counts['shelved_file'] += 1
102
+ first_shelved_image ||= file['id'] if file['id'] =~ /jp2$/
103
+ end
101
104
  mime_types << file['mimetype']
105
+ file_roles << file['role'] if file['role']
102
106
  end
103
107
  end
104
108
  solr_doc['content_type_ssim' ] = doc.root['type']
@@ -109,6 +113,7 @@ module Dor
109
113
  solr_doc['preserved_size_dbtsi' ] = preserved_size # double (trie) to support very large sizes
110
114
  solr_doc['shelved_size_dbtsi' ] = shelved_size # double (trie) to support very large sizes
111
115
  solr_doc['resource_types_ssim' ] = resource_type_counts.keys if resource_type_counts.size > 0
116
+ solr_doc['content_file_roles_ssim' ] = file_roles.to_a if file_roles.size > 0
112
117
  resource_type_counts.each do |key, count|
113
118
  solr_doc["#{key}_resource_count_itsi"] = count
114
119
  end
@@ -145,6 +150,7 @@ module Dor
145
150
  end
146
151
  file_node['size' ] = file[:size ] if file[:size ]
147
152
  file_node['mimetype'] = file[:mime_type] if file[:mime_type]
153
+ file_node['role'] = file[:role] if file[:role]
148
154
  file_node
149
155
  end
150
156
 
@@ -206,6 +212,7 @@ module Dor
206
212
  file_node.add_child(checksum_node)
207
213
  }
208
214
  file_node['size'] = file[:size] if file[:size]
215
+ file_node['role'] = file[:role] if file[:role]
209
216
  end
210
217
  ng_xml.search('//contentMetadata').first.add_child(node)
211
218
  node
@@ -235,12 +242,15 @@ module Dor
235
242
  # @param [String] publish
236
243
  # @param [String] shelve
237
244
  # @param [String] preserve
238
- def update_attributes(file_name, publish, shelve, preserve)
245
+ def update_attributes(file_name, publish, shelve, preserve, attributes = {})
239
246
  self.ng_xml_will_change!
240
247
  file_node = ng_xml.search('//file[@id=\'' + file_name + '\']').first
241
248
  file_node['publish' ] = publish
242
249
  file_node['shelve' ] = shelve
243
250
  file_node['preserve'] = preserve
251
+ attributes.each do |key, value|
252
+ file_node[key] = value
253
+ end
244
254
  end
245
255
 
246
256
  # @param file [Object] some hash-like file
@@ -260,7 +270,7 @@ module Dor
260
270
  checksum_node.content = file[algo]
261
271
  }
262
272
 
263
- [:size, :shelve, :preserve, :publish].each { |x|
273
+ [:size, :shelve, :preserve, :publish, :role].each { |x|
264
274
  file_node[x.to_s] = file[x] if file[x]
265
275
  }
266
276
  end
@@ -206,8 +206,8 @@ module Dor
206
206
  end
207
207
 
208
208
  # Clears RELS-EXT relationships, sets the isGovernedBy relationship to the SDR Graveyard APO
209
- # @param [String] tag optional String of text that is concatenated to the identityMetadata/tag "Decomissioned : "
210
- def decomission(tag)
209
+ # @param [String] tag optional String of text that is concatenated to the identityMetadata/tag "Decommissioned : "
210
+ def decommission(tag)
211
211
  # remove isMemberOf and isMemberOfCollection relationships
212
212
  clear_relationship :is_member_of
213
213
  clear_relationship :is_member_of_collection
@@ -223,6 +223,9 @@ module Dor
223
223
  add_tag "Decommissioned : #{tag}"
224
224
  end
225
225
 
226
+ alias_method :decomission, :decommission
227
+ deprecate decomission: 'Use decommission instead'
228
+
226
229
  # Adds a RELS-EXT constituent relationship to the given druid
227
230
  # @param [String] druid the parent druid of the constituent relationship
228
231
  # e.g.: <fedora:isConstituentOf rdf:resource="info:fedora/druid:hj097bm8879" />
@@ -6,7 +6,7 @@ module Dor
6
6
  merge_service = Dor::MergeService.new primary_druid, secondary_druids, tag, logger
7
7
  merge_service.check_objects_editable
8
8
  merge_service.move_metadata_and_content
9
- merge_service.decomission_secondaries
9
+ merge_service.decommission_secondaries
10
10
  # kick off commonAccessioning for the primary?
11
11
  end
12
12
 
@@ -58,11 +58,11 @@ module Dor
58
58
  end
59
59
  end
60
60
 
61
- def decomission_secondaries
61
+ def decommission_secondaries
62
62
  @secondary_objs.each do |secondary_obj|
63
63
  begin
64
64
  @current_secondary = secondary_obj
65
- @current_secondary.decomission @tag
65
+ @current_secondary.decommission @tag
66
66
  @current_secondary.save
67
67
 
68
68
  unshelve
@@ -70,11 +70,13 @@ module Dor
70
70
  Dor::CleanupService.cleanup_by_druid @current_secondary.pid
71
71
  Dor::Config.workflow.client.archive_active_workflow 'dor', @current_secondary.pid
72
72
  rescue => e
73
- @logger.error "Unable to decomission #{@current_secondary.pid} with primary object #{@primary.pid}: #{e.inspect}"
73
+ @logger.error "Unable to decommission #{@current_secondary.pid} with primary object #{@primary.pid}: #{e.inspect}"
74
74
  @logger.error e.backtrace.join("\n")
75
75
  end
76
76
  end
77
77
  end
78
+ alias_method :decomission_secondaries, :decommission_secondaries
79
+ deprecate decomission_secondaries: 'Use decommission_secondaries instead'
78
80
 
79
81
  # Remove content from stacks
80
82
  # TODO: might set workflow status in future for robot to do
data/lib/dor/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Dor
2
- VERSION = '5.25.0'.freeze
2
+ VERSION = '5.26.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dor-services
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.25.0
4
+ version: 5.26.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Klein
@@ -14,7 +14,7 @@ authors:
14
14
  autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
- date: 2017-09-25 00:00:00.000000000 Z
17
+ date: 2018-02-07 00:00:00.000000000 Z
18
18
  dependencies:
19
19
  - !ruby/object:Gem::Dependency
20
20
  name: active-fedora
@@ -684,7 +684,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
684
684
  version: 1.3.6
685
685
  requirements: []
686
686
  rubyforge_project:
687
- rubygems_version: 2.6.12
687
+ rubygems_version: 2.6.11
688
688
  signing_key:
689
689
  specification_version: 4
690
690
  summary: Ruby implmentation of DOR services used by the SULAIR Digital Library