dor-services 4.22.3 → 4.22.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/bin/dor-indexer +19 -20
- data/bin/dor-indexerd +2 -3
- data/config/certs/robots-dor-dev.crt +29 -0
- data/config/certs/robots-dor-dev.key +27 -0
- data/config/dev_console_env.rb +77 -0
- data/lib/dor-services.rb +3 -3
- data/lib/dor/config.rb +15 -15
- data/lib/dor/datastreams/administrative_metadata_ds.rb +5 -5
- data/lib/dor/datastreams/content_metadata_ds.rb +181 -225
- data/lib/dor/datastreams/datastream_spec_solrizer.rb +1 -1
- data/lib/dor/datastreams/default_object_rights_ds.rb +8 -10
- data/lib/dor/datastreams/desc_metadata_ds.rb +35 -34
- data/lib/dor/datastreams/embargo_metadata_ds.rb +7 -7
- data/lib/dor/datastreams/events_ds.rb +11 -11
- data/lib/dor/datastreams/geo_metadata_ds.rb +86 -86
- data/lib/dor/datastreams/identity_metadata_ds.rb +19 -19
- data/lib/dor/datastreams/role_metadata_ds.rb +3 -3
- data/lib/dor/datastreams/simple_dublin_core_ds.rb +13 -13
- data/lib/dor/datastreams/version_metadata_ds.rb +5 -5
- data/lib/dor/datastreams/workflow_definition_ds.rb +21 -21
- data/lib/dor/migrations/identifiable/assert_adminPolicy.rb +1 -1
- data/lib/dor/migrations/identifiable/fix_model_assertions.rb +1 -1
- data/lib/dor/migrations/identifiable/record_remediation.rb +2 -2
- data/lib/dor/migrations/identifiable/uriify_augmented_contentlocation_refs.rb +1 -1
- data/lib/dor/migrations/identifiable/uriify_contentlocation_refs.rb +1 -1
- data/lib/dor/migrations/processable/unify_workflows.rb +4 -4
- data/lib/dor/migrations/versionable/add_missing_version_md.rb +1 -1
- data/lib/dor/models/admin_policy_object.rb +1 -1
- data/lib/dor/models/assembleable.rb +5 -5
- data/lib/dor/models/contentable.rb +27 -27
- data/lib/dor/models/describable.rb +168 -179
- data/lib/dor/models/discoverable.rb +13 -13
- data/lib/dor/models/editable.rb +55 -55
- data/lib/dor/models/embargoable.rb +26 -26
- data/lib/dor/models/eventable.rb +3 -3
- data/lib/dor/models/geoable.rb +8 -8
- data/lib/dor/models/governable.rb +14 -14
- data/lib/dor/models/identifiable.rb +117 -143
- data/lib/dor/models/item.rb +2 -2
- data/lib/dor/models/itemizable.rb +9 -9
- data/lib/dor/models/presentable.rb +8 -8
- data/lib/dor/models/preservable.rb +4 -4
- data/lib/dor/models/processable.rb +22 -23
- data/lib/dor/models/releaseable.rb +26 -26
- data/lib/dor/models/shelvable.rb +14 -14
- data/lib/dor/models/upgradable.rb +13 -13
- data/lib/dor/models/versionable.rb +2 -2
- data/lib/dor/models/workflow_object.rb +4 -4
- data/lib/dor/services/cleanup_reset_service.rb +27 -27
- data/lib/dor/services/cleanup_service.rb +4 -7
- data/lib/dor/services/digital_stacks_service.rb +10 -10
- data/lib/dor/services/merge_service.rb +1 -1
- data/lib/dor/services/metadata_handlers/mdtoolkit_handler.rb +2 -2
- data/lib/dor/services/metadata_service.rb +20 -20
- data/lib/dor/services/registration_service.rb +27 -27
- data/lib/dor/services/reset_workspace_service.rb +15 -15
- data/lib/dor/services/sdr_ingest_service.rb +6 -6
- data/lib/dor/services/search_service.rb +2 -2
- data/lib/dor/services/suri_service.rb +5 -5
- data/lib/dor/services/technical_metadata_service.rb +2 -3
- data/lib/dor/utils/ng_tidy.rb +9 -9
- data/lib/dor/utils/predicate_patch.rb +1 -1
- data/lib/dor/utils/solr_doc_helper.rb +2 -2
- data/lib/dor/version.rb +1 -1
- data/lib/dor/workflow/document.rb +19 -19
- data/lib/dor/workflow/graph.rb +36 -36
- data/lib/dor/workflow/process.rb +12 -12
- data/lib/tasks/dor.rake +1 -1
- data/lib/tasks/rdoc.rake +3 -3
- metadata +6 -3
@@ -6,8 +6,8 @@ module Dor
|
|
6
6
|
include Upgradable
|
7
7
|
|
8
8
|
included do
|
9
|
-
has_metadata :name =>
|
10
|
-
has_metadata :name =>
|
9
|
+
has_metadata :name => 'DC', :type => SimpleDublinCoreDs, :label => 'Dublin Core Record for self object'
|
10
|
+
has_metadata :name => 'identityMetadata', :type => Dor::IdentityMetadataDS, :label => 'Identity Metadata'
|
11
11
|
end
|
12
12
|
|
13
13
|
module ClassMethods
|
@@ -18,24 +18,22 @@ module Dor
|
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
|
-
def initialize attrs={}
|
21
|
+
def initialize attrs = {}
|
22
22
|
if Dor::Config.suri.mint_ids
|
23
|
-
unless attrs[:pid]
|
24
|
-
attrs = attrs.merge!({:pid=>Dor::SuriService.mint_id, :new_object => true})
|
25
|
-
end
|
23
|
+
attrs = attrs.merge!({:pid => Dor::SuriService.mint_id, :new_object => true}) unless attrs[:pid]
|
26
24
|
end
|
27
25
|
super
|
28
26
|
end
|
29
27
|
|
30
28
|
# helper method to get the tags as an array
|
31
29
|
def tags
|
32
|
-
|
30
|
+
identityMetadata.tag
|
33
31
|
end
|
34
|
-
|
32
|
+
|
35
33
|
# helper method to get just the content type tag
|
36
34
|
def content_type_tag
|
37
|
-
content_tag=tags.select {|tag| tag.include?('Process : Content Type')}
|
38
|
-
content_tag.size == 1 ? content_tag[0].split(':').last.strip :
|
35
|
+
content_tag = tags.select {|tag| tag.include?('Process : Content Type')}
|
36
|
+
content_tag.size == 1 ? content_tag[0].split(':').last.strip : ''
|
39
37
|
end
|
40
38
|
|
41
39
|
# Syntactic sugar for identifying applied DOR Concerns
|
@@ -53,138 +51,131 @@ module Dor
|
|
53
51
|
end
|
54
52
|
end
|
55
53
|
|
56
|
-
@@collection_hash={}
|
57
|
-
@@apo_hash={}
|
58
|
-
@@hydrus_apo_hash={}
|
59
|
-
@@hydrus_collection_hash={}
|
60
|
-
def to_solr(solr_doc=
|
61
|
-
|
54
|
+
@@collection_hash = {}
|
55
|
+
@@apo_hash = {}
|
56
|
+
@@hydrus_apo_hash = {}
|
57
|
+
@@hydrus_collection_hash = {}
|
58
|
+
def to_solr(solr_doc = {}, *args)
|
59
|
+
assert_content_model
|
62
60
|
super(solr_doc)
|
63
61
|
solr_doc[Dor::INDEX_VERSION_FIELD] = Dor::VERSION
|
64
|
-
solr_doc[solr_name('indexed_at'
|
62
|
+
solr_doc[solr_name('indexed_at', :date)] = Time.now.utc.xmlschema
|
65
63
|
add_solr_value(solr_doc, 'indexed_day', Time.now.beginning_of_day.utc.xmlschema, :string, [:searchable, :facetable])
|
66
64
|
datastreams.values.each do |ds|
|
67
|
-
|
68
|
-
|
69
|
-
end
|
65
|
+
next if ds.new?
|
66
|
+
add_solr_value(solr_doc, 'ds_specs', ds.datastream_spec_string, :string, [:displayable])
|
70
67
|
end
|
71
|
-
add_solr_value(solr_doc, 'title_sort',
|
72
|
-
rels_doc = Nokogiri::XML(
|
73
|
-
apos=rels_doc.search('//rdf:RDF/rdf:Description/hydra:isGovernedBy','hydra' => 'http://projecthydra.org/ns/relations#', 'fedora' => 'info:fedora/fedora-system:def/relations-external#', 'rdf' => 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'
|
68
|
+
add_solr_value(solr_doc, 'title_sort', label, :string, [:sortable])
|
69
|
+
rels_doc = Nokogiri::XML(datastreams['RELS-EXT'].content)
|
70
|
+
apos = rels_doc.search('//rdf:RDF/rdf:Description/hydra:isGovernedBy', 'hydra' => 'http://projecthydra.org/ns/relations#', 'fedora' => 'info:fedora/fedora-system:def/relations-external#', 'rdf' => 'http://www.w3.org/1999/02/22-rdf-syntax-ns#' )
|
74
71
|
apos.each do |apo_node|
|
75
|
-
druid=apo_node['rdf:resource']
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
end
|
91
|
-
rescue
|
92
|
-
add_solr_value(solr_doc, "apo_title", druid, :string, [:searchable, :facetable])
|
72
|
+
druid = apo_node['rdf:resource']
|
73
|
+
next unless druid
|
74
|
+
druid = druid.gsub('info:fedora/','')
|
75
|
+
if @@apo_hash.has_key?(druid) || @@hydrus_apo_hash.has_key?(druid)
|
76
|
+
add_solr_value(solr_doc, 'hydrus_apo_title', @@hydrus_apo_hash[druid], :string, [:searchable, :facetable]) if @@hydrus_apo_hash.has_key? druid
|
77
|
+
add_solr_value(solr_doc, 'apo_title', @@apo_hash[druid] , :string, [:searchable, :facetable]) if @@apo_hash.has_key? druid
|
78
|
+
else
|
79
|
+
begin
|
80
|
+
apo_object = Dor.find(druid)
|
81
|
+
if apo_object.tags.include? 'Project : Hydrus'
|
82
|
+
add_solr_value(solr_doc, 'hydrus_apo_title', apo_object.label, :string, [:searchable, :facetable])
|
83
|
+
@@hydrus_apo_hash[druid] = apo_object.label
|
84
|
+
else
|
85
|
+
add_solr_value(solr_doc, 'apo_title', apo_object.label, :string, [:searchable, :facetable])
|
86
|
+
@@apo_hash[druid] = apo_object.label
|
93
87
|
end
|
88
|
+
rescue
|
89
|
+
add_solr_value(solr_doc, 'apo_title', druid, :string, [:searchable, :facetable])
|
94
90
|
end
|
95
91
|
end
|
96
92
|
end
|
97
|
-
collections=rels_doc.search('//rdf:RDF/rdf:Description/fedora:isMemberOfCollection','fedora' => 'info:fedora/fedora-system:def/relations-external#', 'rdf' => 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'
|
93
|
+
collections = rels_doc.search('//rdf:RDF/rdf:Description/fedora:isMemberOfCollection', 'fedora' => 'info:fedora/fedora-system:def/relations-external#', 'rdf' => 'http://www.w3.org/1999/02/22-rdf-syntax-ns#')
|
98
94
|
collections.each do |collection_node|
|
99
|
-
druid=collection_node['rdf:resource']
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
end
|
115
|
-
rescue
|
116
|
-
add_solr_value(solr_doc, "collection_title", druid, :string, [:searchable, :facetable])
|
95
|
+
druid = collection_node['rdf:resource']
|
96
|
+
next unless druid
|
97
|
+
druid = druid.gsub('info:fedora/', '')
|
98
|
+
if @@collection_hash.has_key?(druid) || @@hydrus_collection_hash.has_key?(druid)
|
99
|
+
add_solr_value(solr_doc, 'hydrus_collection_title', @@hydrus_collection_hash[druid], :string, [:searchable, :facetable]) if @@hydrus_collection_hash.has_key? druid
|
100
|
+
add_solr_value(solr_doc, 'collection_title', @@collection_hash[druid], :string, [:searchable, :facetable]) if @@collection_hash.has_key? druid
|
101
|
+
else
|
102
|
+
begin
|
103
|
+
collection_object = Dor.find(druid)
|
104
|
+
if collection_object.tags.include? 'Project : Hydrus'
|
105
|
+
add_solr_value(solr_doc, 'hydrus_collection_title', collection_object.label, :string, [:searchable, :facetable])
|
106
|
+
@@hydrus_collection_hash[druid] = collection_object.label
|
107
|
+
else
|
108
|
+
add_solr_value(solr_doc, 'collection_title', collection_object.label, :string, [:searchable, :facetable])
|
109
|
+
@@collection_hash[druid] = collection_object.label
|
117
110
|
end
|
111
|
+
rescue
|
112
|
+
add_solr_value(solr_doc, 'collection_title', druid, :string, [:searchable, :facetable])
|
118
113
|
end
|
119
114
|
end
|
120
115
|
end
|
121
116
|
# Fix for ActiveFedora 3.3 to ensure all date fields are properly formatted as UTC XML Schema datetime strings
|
122
|
-
solr_doc.each_pair { |k,v|
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
end
|
117
|
+
solr_doc.each_pair { |k, v|
|
118
|
+
next unless k =~ /(_dt|_date)$/
|
119
|
+
if v.is_a?(Array)
|
120
|
+
solr_doc[k] = v.collect { |t| Time.parse(t.to_s).utc.xmlschema }
|
121
|
+
else
|
122
|
+
solr_doc[k] = Time.parse(v.to_s).utc.xmlschema
|
129
123
|
end
|
130
124
|
}
|
131
|
-
|
132
125
|
solr_doc
|
133
126
|
end
|
127
|
+
|
134
128
|
def set_source_id(source_id)
|
135
|
-
|
129
|
+
identityMetadata.sourceId = source_id
|
136
130
|
end
|
137
131
|
|
138
|
-
def add_other_Id(type,val)
|
139
|
-
if
|
132
|
+
def add_other_Id(type, val)
|
133
|
+
if identityMetadata.otherId(type).length > 0
|
140
134
|
raise 'There is an existing entry for '+node_name+', consider using update_other_identifier.'
|
141
135
|
end
|
142
|
-
identity_metadata_ds =
|
136
|
+
identity_metadata_ds = identityMetadata
|
143
137
|
identity_metadata_ds.add_otherId(type+':'+val)
|
144
138
|
end
|
145
139
|
|
146
|
-
def update_other_Id(type,new_val, val=nil)
|
147
|
-
identity_metadata_ds =
|
148
|
-
ds_xml=identity_metadata_ds.ng_xml
|
149
|
-
#split the thing they sent in to find the node name
|
150
|
-
updated=false
|
140
|
+
def update_other_Id(type, new_val, val = nil)
|
141
|
+
identity_metadata_ds = identityMetadata
|
142
|
+
ds_xml = identity_metadata_ds.ng_xml
|
143
|
+
# split the thing they sent in to find the node name
|
144
|
+
updated = false
|
151
145
|
ds_xml.search('//otherId[@name=\''+type+'\']').each do |node|
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
end
|
146
|
+
next unless node.content == val || val.nil?
|
147
|
+
node.content = new_val
|
148
|
+
updated = true
|
156
149
|
end
|
157
|
-
|
150
|
+
updated
|
158
151
|
end
|
159
152
|
|
160
|
-
def remove_other_Id(type,val=nil)
|
161
|
-
ds_xml=
|
162
|
-
#split the thing they sent in to find the node name
|
163
|
-
removed=false
|
164
|
-
|
153
|
+
def remove_other_Id(type, val = nil)
|
154
|
+
ds_xml = identityMetadata.ng_xml
|
155
|
+
# split the thing they sent in to find the node name
|
156
|
+
removed = false
|
165
157
|
ds_xml.search('//otherId[@name=\''+type+'\']').each do |node|
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
end
|
158
|
+
next unless node.content === val || val.nil?
|
159
|
+
node.remove
|
160
|
+
removed = true
|
170
161
|
end
|
171
|
-
|
162
|
+
removed
|
172
163
|
end
|
173
164
|
|
174
165
|
# turns a tag string into an array with one element per tag part.
|
175
166
|
# split on ":", disregard leading and trailing whitespace on tokens.
|
176
167
|
def split_tag_to_arr(tag_str)
|
177
|
-
|
168
|
+
tag_str.split(':').map {|str| str.strip}
|
178
169
|
end
|
179
170
|
|
180
171
|
# turn a tag array back into a tag string with a standard format
|
181
172
|
def normalize_tag_arr(tag_arr)
|
182
|
-
|
173
|
+
tag_arr.join(' : ')
|
183
174
|
end
|
184
175
|
|
185
176
|
# take a tag string and return a normalized tag string
|
186
177
|
def normalize_tag(tag_str)
|
187
|
-
|
178
|
+
normalize_tag_arr(split_tag_to_arr(tag_str))
|
188
179
|
end
|
189
180
|
|
190
181
|
# take a proposed tag string and a list of the existing tags for the object being edited. if
|
@@ -192,49 +183,34 @@ module Dor
|
|
192
183
|
# explanatory message.
|
193
184
|
def validate_and_normalize_tag(tag_str, existing_tag_list)
|
194
185
|
tag_arr = validate_tag_format(tag_str)
|
195
|
-
|
196
|
-
# note that the comparison for duplicate tags is case-insensitive, but we don't change case as part of the normalized version
|
186
|
+
# note that the comparison for duplicate tags is case-insensitive, but we don't change case as part of the normalized version
|
197
187
|
# we return, because we want to preserve the user's intended case.
|
198
188
|
normalized_tag = normalize_tag_arr(tag_arr)
|
199
189
|
dupe_existing_tag = existing_tag_list.detect { |existing_tag| normalize_tag(existing_tag).downcase == normalized_tag.downcase }
|
200
|
-
if dupe_existing_tag
|
201
|
-
|
202
|
-
end
|
203
|
-
|
204
|
-
return normalized_tag
|
190
|
+
raise "An existing tag (#{dupe_existing_tag}) is the same, consider using update_tag?" if dupe_existing_tag
|
191
|
+
normalized_tag
|
205
192
|
end
|
206
|
-
|
207
|
-
#Ensure that an administrative tag meets the proper mininum format
|
208
|
-
#
|
209
|
-
|
210
|
-
#
|
211
|
-
#@return [Array] the tag split into an array via ':'
|
193
|
+
|
194
|
+
# Ensure that an administrative tag meets the proper mininum format
|
195
|
+
# @param [String] tag_str the tag
|
196
|
+
# @return [Array] the tag split into an array via ':'
|
212
197
|
def validate_tag_format(tag_str)
|
213
198
|
tag_arr = split_tag_to_arr(tag_str)
|
214
|
-
|
215
|
-
if tag_arr.
|
216
|
-
|
217
|
-
end
|
218
|
-
|
219
|
-
if tag_arr.detect {|str| str.empty?}
|
220
|
-
raise "Invalid tag structure: tag '#{tag_str}' contains empty elements"
|
221
|
-
end
|
222
|
-
|
223
|
-
return tag_arr
|
224
|
-
|
199
|
+
raise "Invalid tag structure: tag '#{tag_str}' must have at least 2 elements" if tag_arr.length < 2
|
200
|
+
raise "Invalid tag structure: tag '#{tag_str}' contains empty elements" if tag_arr.detect {|str| str.empty?}
|
201
|
+
tag_arr
|
225
202
|
end
|
226
|
-
|
227
|
-
#Add an administrative tag to an item, you will need to seperately save the item to write it to fedora
|
228
|
-
#
|
229
|
-
#@param tag [string] The tag you wish to add
|
203
|
+
|
204
|
+
# Add an administrative tag to an item, you will need to seperately save the item to write it to fedora
|
205
|
+
# @param tag [string] The tag you wish to add
|
230
206
|
def add_tag(tag)
|
231
|
-
|
232
|
-
|
233
|
-
|
207
|
+
identity_metadata_ds = identityMetadata
|
208
|
+
normalized_tag = validate_and_normalize_tag(tag, identity_metadata_ds.tags)
|
209
|
+
identity_metadata_ds.add_value(:tag, normalized_tag)
|
234
210
|
end
|
235
|
-
|
211
|
+
|
236
212
|
def remove_tag(tag)
|
237
|
-
identity_metadata_ds =
|
213
|
+
identity_metadata_ds = identityMetadata
|
238
214
|
ds_xml = identity_metadata_ds.ng_xml
|
239
215
|
removed = false
|
240
216
|
ds_xml.search('//tag').each do |node|
|
@@ -243,32 +219,30 @@ module Dor
|
|
243
219
|
removed = true
|
244
220
|
end
|
245
221
|
end
|
246
|
-
|
222
|
+
removed
|
247
223
|
end
|
248
|
-
|
249
|
-
#Removes all displayTypes from an item in preparation of adding a new display type
|
250
|
-
#
|
251
|
-
#@return Boolean True if displayTypes were removed, False if no displayTypes were removed
|
224
|
+
|
225
|
+
# Removes all displayTypes from an item in preparation of adding a new display type
|
226
|
+
# @return Boolean True if displayTypes were removed, False if no displayTypes were removed
|
252
227
|
def remove_displayTypes
|
253
228
|
removed = false
|
254
|
-
|
255
|
-
|
256
|
-
|
229
|
+
identityMetadata.ng_xml.search('//displayType').each do |node|
|
230
|
+
node.remove
|
231
|
+
removed = true
|
257
232
|
end
|
258
|
-
|
233
|
+
removed
|
259
234
|
end
|
260
235
|
|
261
236
|
def update_tag(old_tag, new_tag)
|
262
|
-
identity_metadata_ds =
|
237
|
+
identity_metadata_ds = identityMetadata
|
263
238
|
ds_xml = identity_metadata_ds.ng_xml
|
264
239
|
updated = false
|
265
240
|
ds_xml.search('//tag').each do |node|
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
end
|
241
|
+
next unless normalize_tag(node.content) == normalize_tag(old_tag)
|
242
|
+
node.content = normalize_tag(new_tag)
|
243
|
+
updated = true
|
270
244
|
end
|
271
|
-
|
245
|
+
updated
|
272
246
|
end
|
273
247
|
end
|
274
248
|
end
|
data/lib/dor/models/item.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module Dor
|
2
2
|
module BasicItem
|
3
3
|
extend ActiveSupport::Concern
|
4
|
-
|
4
|
+
|
5
5
|
include Identifiable
|
6
6
|
include Processable
|
7
7
|
include Governable
|
@@ -17,7 +17,7 @@ module Dor
|
|
17
17
|
include Geoable
|
18
18
|
include Releaseable
|
19
19
|
end
|
20
|
-
|
20
|
+
|
21
21
|
class Abstract < ::ActiveFedora::Base
|
22
22
|
include Identifiable
|
23
23
|
end
|
@@ -8,20 +8,20 @@ module Dor
|
|
8
8
|
included do
|
9
9
|
has_metadata :name => "contentMetadata", :type => Dor::ContentMetadataDS, :label => 'Content Metadata', :control_group => 'M'
|
10
10
|
end
|
11
|
-
|
11
|
+
|
12
12
|
DIFF_FILENAME = 'cm_inv_diff'
|
13
13
|
DIFF_QUERY = DIFF_FILENAME.gsub('_', '-')
|
14
14
|
|
15
15
|
# Deletes all cm_inv_diff files in the workspace for the Item
|
16
16
|
def clear_diff_cache
|
17
17
|
if Dor::Config.stacks.local_workspace_root.nil?
|
18
|
-
raise ArgumentError, 'Missing Dor::Config.stacks.local_workspace_root'
|
18
|
+
raise ArgumentError, 'Missing Dor::Config.stacks.local_workspace_root'
|
19
19
|
end
|
20
|
-
druid = DruidTools::Druid.new(
|
20
|
+
druid = DruidTools::Druid.new(pid, Dor::Config.stacks.local_workspace_root)
|
21
21
|
diff_pattern = File.join(druid.temp_dir, DIFF_FILENAME + '.*')
|
22
22
|
FileUtils.rm_f Dir.glob(diff_pattern)
|
23
23
|
end
|
24
|
-
|
24
|
+
|
25
25
|
# Retrieves file difference manifest for contentMetadata from SDR
|
26
26
|
#
|
27
27
|
# @param [String] subset keyword for file attributes :shelve, :preserve, :publish. Default is :all.
|
@@ -29,7 +29,7 @@ module Dor
|
|
29
29
|
# @return [String] XML contents of cm_inv_diff manifest
|
30
30
|
def get_content_diff(subset = :all, version = nil)
|
31
31
|
if Dor::Config.stacks.local_workspace_root.nil?
|
32
|
-
raise Dor::ParameterError, 'Missing Dor::Config.stacks.local_workspace_root'
|
32
|
+
raise Dor::ParameterError, 'Missing Dor::Config.stacks.local_workspace_root'
|
33
33
|
end
|
34
34
|
unless %w{all shelve preserve publish}.include?(subset.to_s)
|
35
35
|
raise Dor::ParameterError, "Invalid subset value: #{subset}"
|
@@ -40,17 +40,17 @@ module Dor
|
|
40
40
|
raise Dor::ParameterError, 'Missing Dor::Config.sdr.rest_client'
|
41
41
|
end
|
42
42
|
sdr_client = Dor::Config.sdr.rest_client
|
43
|
-
current_content =
|
43
|
+
current_content = datastreams['contentMetadata'].content
|
44
44
|
if current_content.nil?
|
45
45
|
raise Dor::Exception, "Missing contentMetadata datastream"
|
46
46
|
end
|
47
47
|
query_string = { :subset => subset.to_s }
|
48
48
|
query_string[:version] = version.to_s unless version.nil?
|
49
49
|
query_string = URI.encode_www_form(query_string)
|
50
|
-
sdr_query = "objects/#{
|
50
|
+
sdr_query = "objects/#{pid}/#{DIFF_QUERY}?#{query_string}"
|
51
51
|
response = sdr_client[sdr_query].post(current_content, :content_type => 'application/xml')
|
52
52
|
response
|
53
53
|
end
|
54
|
-
|
54
|
+
|
55
55
|
end
|
56
|
-
end
|
56
|
+
end
|
@@ -17,7 +17,7 @@ module Dor
|
|
17
17
|
|
18
18
|
# Bypass this method if there are no image resources in contentMetadata
|
19
19
|
def build_iiif_manifest pub_obj_doc
|
20
|
-
id =
|
20
|
+
id = pid.split(':').last
|
21
21
|
|
22
22
|
lbl_node = pub_obj_doc.at_xpath '//oai_dc:dc/dc:title', DC_NS
|
23
23
|
if lbl_node.nil?
|
@@ -32,13 +32,13 @@ module Dor
|
|
32
32
|
'@id' => "#{purl_base_uri}/iiif/manifest.json",
|
33
33
|
'label' => lbl,
|
34
34
|
'attribution' => 'Provided by the Stanford University Libraries',
|
35
|
-
'logo' => {
|
36
|
-
'@id' => "https://stacks.stanford.edu/image/iiif/wy534zh7137%2FSULAIR_rosette/full/400,/0/default.jpg",
|
37
|
-
'service' => {
|
38
|
-
'@context' => "http://iiif.io/api/image/2/context.json",
|
39
|
-
'@id' => "https://stacks.stanford.edu/image/iiif/wy534zh7137%2FSULAIR_rosette",
|
40
|
-
'profile' => "http://iiif.io/api/image/2/level1.json"
|
41
|
-
}
|
35
|
+
'logo' => {
|
36
|
+
'@id' => "https://stacks.stanford.edu/image/iiif/wy534zh7137%2FSULAIR_rosette/full/400,/0/default.jpg",
|
37
|
+
'service' => {
|
38
|
+
'@context' => "http://iiif.io/api/image/2/context.json",
|
39
|
+
'@id' => "https://stacks.stanford.edu/image/iiif/wy534zh7137%2FSULAIR_rosette",
|
40
|
+
'profile' => "http://iiif.io/api/image/2/level1.json"
|
41
|
+
}
|
42
42
|
},
|
43
43
|
'seeAlso' => {
|
44
44
|
'@id' => "#{purl_base_uri}.mods",
|