dor-services 6.0.5 → 6.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/dor-services.rb +27 -12
- data/lib/dor/config.rb +45 -42
- data/lib/dor/datastreams/administrative_metadata_ds.rb +137 -44
- data/lib/dor/datastreams/content_metadata_ds.rb +42 -42
- data/lib/dor/datastreams/datastream_spec_solrizer.rb +1 -1
- data/lib/dor/datastreams/default_object_rights_ds.rb +185 -44
- data/lib/dor/datastreams/desc_metadata_ds.rb +36 -28
- data/lib/dor/datastreams/embargo_metadata_ds.rb +12 -14
- data/lib/dor/datastreams/events_ds.rb +10 -10
- data/lib/dor/datastreams/geo_metadata_ds.rb +4 -5
- data/lib/dor/datastreams/identity_metadata_ds.rb +14 -14
- data/lib/dor/datastreams/rights_metadata_ds.rb +23 -23
- data/lib/dor/datastreams/role_metadata_ds.rb +61 -15
- data/lib/dor/datastreams/simple_dublin_core_ds.rb +8 -8
- data/lib/dor/datastreams/version_metadata_ds.rb +10 -12
- data/lib/dor/datastreams/workflow_definition_ds.rb +6 -6
- data/lib/dor/datastreams/workflow_ds.rb +13 -13
- data/lib/dor/exceptions.rb +2 -2
- data/lib/dor/indexers/data_indexer.rb +1 -7
- data/lib/dor/indexers/describable_indexer.rb +1 -1
- data/lib/dor/indexers/identifiable_indexer.rb +0 -2
- data/lib/dor/indexers/processable_indexer.rb +55 -28
- data/lib/dor/indexers/releasable_indexer.rb +2 -2
- data/lib/dor/models/admin_policy_object.rb +4 -4
- data/lib/dor/models/concerns/assembleable.rb +4 -0
- data/lib/dor/models/concerns/contentable.rb +27 -69
- data/lib/dor/models/concerns/describable.rb +14 -29
- data/lib/dor/models/concerns/editable.rb +20 -334
- data/lib/dor/models/concerns/embargoable.rb +7 -11
- data/lib/dor/models/concerns/eventable.rb +5 -1
- data/lib/dor/models/concerns/geoable.rb +4 -4
- data/lib/dor/models/concerns/governable.rb +18 -87
- data/lib/dor/models/concerns/identifiable.rb +15 -75
- data/lib/dor/models/concerns/itemizable.rb +9 -11
- data/lib/dor/models/concerns/preservable.rb +4 -0
- data/lib/dor/models/concerns/processable.rb +30 -129
- data/lib/dor/models/concerns/publishable.rb +6 -55
- data/lib/dor/models/concerns/releaseable.rb +14 -227
- data/lib/dor/models/concerns/rightsable.rb +3 -3
- data/lib/dor/models/concerns/shelvable.rb +4 -49
- data/lib/dor/models/concerns/versionable.rb +21 -44
- data/lib/dor/models/set.rb +1 -1
- data/lib/dor/models/workflow_object.rb +2 -2
- data/lib/dor/services/ability.rb +77 -0
- data/lib/dor/services/cleanup_reset_service.rb +1 -3
- data/lib/dor/services/create_workflow_service.rb +51 -0
- data/lib/dor/services/creative_commons_license_service.rb +31 -0
- data/lib/dor/services/datastream_builder.rb +90 -0
- data/lib/dor/services/digital_stacks_service.rb +3 -21
- data/lib/dor/services/dublin_core_service.rb +40 -0
- data/lib/dor/services/file_metadata_merge_service.rb +67 -0
- data/lib/dor/services/indexing_service.rb +8 -4
- data/lib/dor/services/merge_service.rb +5 -5
- data/lib/dor/services/metadata_handlers/catalog_handler.rb +1 -1
- data/lib/dor/services/metadata_service.rb +6 -8
- data/lib/dor/{models/concerns → services}/mods2dc.xslt +0 -0
- data/lib/dor/services/ontology.rb +35 -0
- data/lib/dor/services/open_data_license_service.rb +20 -0
- data/lib/dor/services/public_desc_metadata_service.rb +21 -14
- data/lib/dor/services/public_xml_service.rb +6 -6
- data/lib/dor/services/publish_metadata_service.rb +100 -0
- data/lib/dor/services/registration_service.rb +43 -46
- data/lib/dor/services/release_tag_service.rb +251 -0
- data/lib/dor/services/reset_workspace_service.rb +1 -3
- data/lib/dor/services/sdr_ingest_service.rb +5 -7
- data/lib/dor/services/search_service.rb +10 -10
- data/lib/dor/services/secondary_file_name_service.rb +10 -0
- data/lib/dor/services/shelving_service.rb +67 -0
- data/lib/dor/services/status_service.rb +121 -0
- data/lib/dor/services/suri_service.rb +3 -5
- data/lib/dor/services/tag_service.rb +100 -0
- data/lib/dor/services/technical_metadata_service.rb +5 -4
- data/lib/dor/services/version_service.rb +84 -0
- data/lib/dor/utils/ng_tidy.rb +1 -1
- data/lib/dor/utils/sdr_client.rb +25 -9
- data/lib/dor/version.rb +1 -1
- data/lib/dor/workflow/document.rb +13 -13
- data/lib/dor/workflow/process.rb +71 -26
- data/lib/tasks/rdoc.rake +1 -1
- metadata +77 -51
- data/config/certs/robots-dor-dev.crt +0 -29
- data/config/certs/robots-dor-dev.key +0 -27
- data/config/dev_console_env.rb +0 -80
@@ -6,351 +6,37 @@ module Dor
|
|
6
6
|
extend ActiveSupport::Concern
|
7
7
|
|
8
8
|
included do
|
9
|
-
belongs_to :agreement_object, :
|
9
|
+
belongs_to :agreement_object, property: :referencesAgreement, class_name: 'Dor::Item'
|
10
10
|
end
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
# only display undeprecated entries, except where a deprecated entry is already in use by an object. e.g., an APO
|
15
|
-
# that already specifies "by_sa" for its default license code could continue displaying that in a list of license options
|
16
|
-
# for editing, preferably with the deprecation warning. but other deprecated entries would be omitted in such a
|
17
|
-
# selectbox.
|
18
|
-
# TODO: seems like Editable is not the most semantically appropriate place for these mappings? though they're used
|
19
|
-
# by methods that live in Editable.
|
20
|
-
# TODO: need some way to do versioning. for instance, what happens when a new version of an existing license comes
|
21
|
-
# out, since it will presumably use the same license code, but a different title and URI?
|
22
|
-
CREATIVE_COMMONS_USE_LICENSES = {
|
23
|
-
'by' => { :human_readable => 'Attribution 3.0 Unported',
|
24
|
-
:uri => 'https://creativecommons.org/licenses/by/3.0/' },
|
25
|
-
'by-sa' => { :human_readable => 'Attribution Share Alike 3.0 Unported',
|
26
|
-
:uri => 'https://creativecommons.org/licenses/by-sa/3.0/' },
|
27
|
-
'by_sa' => { :human_readable => 'Attribution Share Alike 3.0 Unported',
|
28
|
-
:uri => 'https://creativecommons.org/licenses/by-sa/3.0/',
|
29
|
-
:deprecation_warning => 'license code "by_sa" was a typo in argo, prefer "by-sa"' },
|
30
|
-
'by-nd' => { :human_readable => 'Attribution No Derivatives 3.0 Unported',
|
31
|
-
:uri => 'https://creativecommons.org/licenses/by-nd/3.0/' },
|
32
|
-
'by-nc' => { :human_readable => 'Attribution Non-Commercial 3.0 Unported',
|
33
|
-
:uri => 'https://creativecommons.org/licenses/by-nc/3.0/' },
|
34
|
-
'by-nc-sa' => { :human_readable => 'Attribution Non-Commercial Share Alike 3.0 Unported',
|
35
|
-
:uri => 'https://creativecommons.org/licenses/by-nc-sa/3.0/' },
|
36
|
-
'by-nc-nd' => { :human_readable => 'Attribution Non-Commercial, No Derivatives 3.0 Unported',
|
37
|
-
:uri => 'https://creativecommons.org/licenses/by-nc-nd/3.0/' },
|
38
|
-
'pdm' => { :human_readable => 'Public Domain Mark 1.0',
|
39
|
-
:uri => 'https://creativecommons.org/publicdomain/mark/1.0/' }
|
40
|
-
}.freeze
|
41
|
-
OPEN_DATA_COMMONS_USE_LICENSES = {
|
42
|
-
'pddl' => { :human_readable => 'Open Data Commons Public Domain Dedication and License 1.0',
|
43
|
-
:uri => 'http://opendatacommons.org/licenses/pddl/1.0/' },
|
44
|
-
'odc-by' => { :human_readable => 'Open Data Commons Attribution License 1.0',
|
45
|
-
:uri => 'http://opendatacommons.org/licenses/by/1.0/' },
|
46
|
-
'odc-odbl' => { :human_readable => 'Open Data Commons Open Database License 1.0',
|
47
|
-
:uri => 'http://opendatacommons.org/licenses/odbl/1.0/' }
|
48
|
-
}.freeze
|
12
|
+
CREATIVE_COMMONS_USE_LICENSES = ActiveSupport::Deprecation::DeprecatedConstantProxy.new('CREATIVE_COMMONS_USE_LICENSES', 'Dor::CreativeCommonsLicenseService')
|
13
|
+
OPEN_DATA_COMMONS_USE_LICENSES = ActiveSupport::Deprecation::DeprecatedConstantProxy.new('OPEN_DATA_COMMONS_USE_LICENSES', 'Dor::OpenDataLicenseService')
|
49
14
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
roleMetadata.ng_xml_will_change!
|
58
|
-
group = type == :workgroup ? 'group' : 'person'
|
59
|
-
nodes = xml.search('/roleMetadata/role[@type=\'' + role + '\']')
|
60
|
-
if nodes.length > 0
|
61
|
-
group_node = Nokogiri::XML::Node.new(group, xml)
|
62
|
-
id_node = Nokogiri::XML::Node.new('identifier', xml)
|
63
|
-
group_node.add_child(id_node)
|
64
|
-
id_node.content = entity
|
65
|
-
id_node['type'] = type.to_s
|
66
|
-
nodes.first.add_child(group_node)
|
67
|
-
else
|
68
|
-
node = Nokogiri::XML::Node.new('role', xml)
|
69
|
-
node['type'] = role
|
70
|
-
group_node = Nokogiri::XML::Node.new(group, xml)
|
71
|
-
node.add_child group_node
|
72
|
-
id_node = Nokogiri::XML::Node.new('identifier', xml)
|
73
|
-
group_node.add_child(id_node)
|
74
|
-
id_node.content = entity
|
75
|
-
id_node['type'] = type.to_s
|
76
|
-
xml.search('/roleMetadata').first.add_child(node)
|
77
|
-
end
|
78
|
-
end
|
79
|
-
|
80
|
-
# remove all people groups and roles from the APO role metadata datastream
|
81
|
-
def purge_roles
|
82
|
-
roleMetadata.ng_xml.search('/roleMetadata/role').each do |node|
|
83
|
-
node.remove
|
84
|
-
end
|
85
|
-
end
|
86
|
-
|
87
|
-
def mods_title
|
88
|
-
descMetadata.term_values(:title_info, :main_title).first
|
89
|
-
end
|
90
|
-
|
91
|
-
def mods_title=(val)
|
92
|
-
descMetadata.update_values({ [:title_info, :main_title] => val })
|
93
|
-
end
|
94
|
-
|
95
|
-
# get all collections listed for this APO, used during registration
|
96
|
-
# @return [Array] array of pids
|
97
|
-
def default_collections
|
98
|
-
administrativeMetadata.term_values(:registration, :default_collection)
|
99
|
-
end
|
100
|
-
|
101
|
-
# Add a collection to the listing of collections for items governed by this apo.
|
102
|
-
# @param val [String] pid of the collection, ex. druid:ab123cd4567
|
103
|
-
def add_default_collection(val)
|
104
|
-
xml = administrativeMetadata.ng_xml
|
105
|
-
administrativeMetadata.ng_xml_will_change!
|
106
|
-
reg = xml.search('//administrativeMetadata/registration').first
|
107
|
-
unless reg
|
108
|
-
reg = Nokogiri::XML::Node.new('registration', xml)
|
109
|
-
xml.search('/administrativeMetadata').first.add_child(reg)
|
110
|
-
end
|
111
|
-
node = Nokogiri::XML::Node.new('collection', xml)
|
112
|
-
node['id'] = val
|
113
|
-
reg.add_child(node)
|
114
|
-
end
|
115
|
-
|
116
|
-
def remove_default_collection(val)
|
117
|
-
xml = administrativeMetadata.ng_xml
|
118
|
-
administrativeMetadata.ng_xml_will_change!
|
119
|
-
xml.search('//administrativeMetadata/registration/collection[@id=\'' + val + '\']').remove
|
120
|
-
end
|
121
|
-
|
122
|
-
# Get all roles defined in the role metadata, and the people or groups in those roles. Groups are prefixed with 'workgroup:'
|
123
|
-
# @return [Hash] role => ['person','group'] ex. {"dor-apo-manager" => ["workgroup:dlss:developers", "sunetid:lmcrae"]
|
124
|
-
def roles
|
125
|
-
roles = {}
|
126
|
-
roleMetadata.ng_xml.search('/roleMetadata/role').each do |role|
|
127
|
-
roles[role['type']] = []
|
128
|
-
role.search('identifier').each do |entity|
|
129
|
-
roles[role['type']] << entity['type'] + ':' + entity.text
|
130
|
-
end
|
131
|
-
end
|
132
|
-
roles
|
133
|
-
end
|
134
|
-
|
135
|
-
def metadata_source
|
136
|
-
administrativeMetadata.metadata_source.first
|
137
|
-
end
|
138
|
-
|
139
|
-
def metadata_source=(val)
|
140
|
-
if administrativeMetadata.descMetadata.nil?
|
141
|
-
administrativeMetadata.ng_xml_will_change!
|
142
|
-
administrativeMetadata.add_child_node(administrativeMetadata, :descMetadata)
|
143
|
-
end
|
144
|
-
administrativeMetadata.update_values({ [:descMetadata, :source] => val })
|
145
|
-
end
|
15
|
+
delegate :add_roleplayer, :purge_roles, :roles, to: :roleMetadata
|
16
|
+
delegate :mods_title, :mods_title=, to: :descMetadata
|
17
|
+
delegate :default_collections, :add_default_collection, :remove_default_collection,
|
18
|
+
:metadata_source, :metadata_source=,
|
19
|
+
:default_workflows, :default_workflow=,
|
20
|
+
:desc_metadata_source, :desc_metadata_source=,
|
21
|
+
:desc_metadata_format, :desc_metadata_format=, to: :administrativeMetadata
|
146
22
|
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
def copyright_statement
|
156
|
-
defaultObjectRights.copyright.first
|
157
|
-
end
|
158
|
-
|
159
|
-
def copyright_statement=(val)
|
160
|
-
defaultObjectRights.update_term!(:copyright, val.nil? ? '' : val)
|
161
|
-
end
|
162
|
-
|
163
|
-
def creative_commons_license
|
164
|
-
defaultObjectRights.creative_commons.first
|
165
|
-
end
|
166
|
-
|
167
|
-
def creative_commons_license_human
|
168
|
-
defaultObjectRights.creative_commons_human.first
|
169
|
-
end
|
170
|
-
|
171
|
-
def open_data_commons_license
|
172
|
-
defaultObjectRights.open_data_commons.first
|
173
|
-
end
|
174
|
-
|
175
|
-
def open_data_commons_license_human
|
176
|
-
defaultObjectRights.open_data_commons_human.first
|
177
|
-
end
|
178
|
-
|
179
|
-
def use_license
|
180
|
-
return creative_commons_license unless creative_commons_license.blank?
|
181
|
-
return open_data_commons_license unless open_data_commons_license.blank?
|
182
|
-
|
183
|
-
nil
|
184
|
-
end
|
185
|
-
|
186
|
-
def use_license_uri
|
187
|
-
return defaultObjectRights.creative_commons.uri.first unless defaultObjectRights.creative_commons.uri.blank?
|
188
|
-
return defaultObjectRights.open_data_commons.uri.first unless defaultObjectRights.open_data_commons.uri.blank?
|
189
|
-
|
190
|
-
nil
|
191
|
-
end
|
192
|
-
|
193
|
-
def use_license_human
|
194
|
-
return creative_commons_license_human unless creative_commons_license_human.blank?
|
195
|
-
return open_data_commons_license_human unless open_data_commons_license_human.blank?
|
196
|
-
|
197
|
-
nil
|
198
|
-
end
|
199
|
-
|
200
|
-
def creative_commons_license=(use_license_machine)
|
201
|
-
defaultObjectRights.initialize_term!(:creative_commons)
|
202
|
-
defaultObjectRights.creative_commons = use_license_machine
|
203
|
-
defaultObjectRights.creative_commons.uri = CREATIVE_COMMONS_USE_LICENSES[use_license_machine][:uri]
|
204
|
-
end
|
205
|
-
|
206
|
-
def creative_commons_license_human=(use_license_human)
|
207
|
-
defaultObjectRights.initialize_term!(:creative_commons_human)
|
208
|
-
defaultObjectRights.creative_commons_human = use_license_human
|
209
|
-
end
|
210
|
-
|
211
|
-
def open_data_commons_license=(use_license_machine)
|
212
|
-
defaultObjectRights.initialize_term!(:open_data_commons)
|
213
|
-
defaultObjectRights.open_data_commons = use_license_machine
|
214
|
-
defaultObjectRights.open_data_commons.uri = OPEN_DATA_COMMONS_USE_LICENSES[use_license_machine][:uri]
|
215
|
-
end
|
216
|
-
|
217
|
-
def open_data_commons_license_human=(use_license_human)
|
218
|
-
defaultObjectRights.initialize_term!(:open_data_commons_human)
|
219
|
-
defaultObjectRights.open_data_commons_human = use_license_human
|
220
|
-
end
|
221
|
-
|
222
|
-
# @param [String|Symbol] use_license_machine The machine code for the desired Use License
|
223
|
-
# If set to `:none` then Use License is removed
|
224
|
-
def use_license=(use_license_machine)
|
225
|
-
if use_license_machine.blank? || use_license_machine == :none
|
226
|
-
# delete use license by directly removing the XML used to define the use license
|
227
|
-
defaultObjectRights.update_term!(:creative_commons, ' ')
|
228
|
-
defaultObjectRights.update_term!(:creative_commons_human, ' ')
|
229
|
-
defaultObjectRights.update_term!(:open_data_commons, ' ')
|
230
|
-
defaultObjectRights.update_term!(:open_data_commons_human, ' ')
|
231
|
-
elsif CREATIVE_COMMONS_USE_LICENSES.include? use_license_machine
|
232
|
-
self.creative_commons_license = use_license_machine
|
233
|
-
self.creative_commons_license_human = CREATIVE_COMMONS_USE_LICENSES[use_license_machine][:human_readable]
|
234
|
-
elsif OPEN_DATA_COMMONS_USE_LICENSES.include? use_license_machine
|
235
|
-
self.open_data_commons_license = use_license_machine
|
236
|
-
self.open_data_commons_license_human = OPEN_DATA_COMMONS_USE_LICENSES[use_license_machine][:human_readable]
|
237
|
-
else
|
238
|
-
fail ArgumentError, "'#{use_license_machine}' is not a valid license code"
|
239
|
-
end
|
240
|
-
end
|
241
|
-
|
242
|
-
# @return [String] A description of the rights defined in the default object rights datastream. Can be one of
|
243
|
-
# RightsMetadataDS::RIGHTS_TYPE_CODES.keys (so this is essentially the inverse of RightsMetadataDS.upd_rights_xml_for_rights_type).
|
244
|
-
def default_rights
|
245
|
-
xml = defaultObjectRights.ng_xml
|
246
|
-
machine_read_access = xml.search('//rightsMetadata/access[@type="read"]/machine')
|
247
|
-
machine_discover_access = xml.search('//rightsMetadata/access[@type="discover"]/machine')
|
248
|
-
|
249
|
-
machine_read_access_node = machine_read_access.length == 1 ? machine_read_access.first : nil
|
250
|
-
machine_discover_access_node = machine_discover_access.length == 1 ? machine_discover_access.first : nil
|
251
|
-
|
252
|
-
if machine_read_access_node && machine_read_access_node.search('./group[text()="Stanford" or text()="stanford"]').length == 1
|
253
|
-
if machine_read_access_node.search('./group[@rule="no-download"]').length == 1
|
254
|
-
'stanford-nd'
|
255
|
-
else
|
256
|
-
'stanford'
|
257
|
-
end
|
258
|
-
elsif machine_read_access_node && machine_read_access_node.search('./world').length == 1
|
259
|
-
if machine_read_access_node.search('./world[@rule="no-download"]').length == 1
|
260
|
-
'world-nd'
|
261
|
-
else
|
262
|
-
'world'
|
263
|
-
end
|
264
|
-
elsif machine_read_access_node && machine_read_access_node.search('./location[text()="spec"]').length == 1
|
265
|
-
'loc:spec'
|
266
|
-
elsif machine_read_access_node && machine_read_access_node.search('./location[text()="music"]').length == 1
|
267
|
-
'loc:music'
|
268
|
-
elsif machine_discover_access_node && machine_discover_access_node.search('./world').length == 1
|
269
|
-
# if it's not stanford restricted, world readable, or location restricted, but it is world discoverable, it's "citation only"
|
270
|
-
'none'
|
271
|
-
elsif machine_discover_access_node && machine_discover_access_node.search('./none').length == 1
|
272
|
-
# if it's not even discoverable, it's "dark"
|
273
|
-
'dark'
|
274
|
-
else
|
275
|
-
# if none of the above, the rights xml structure is unsupported/unintelligible
|
276
|
-
nil
|
277
|
-
end
|
278
|
-
end
|
279
|
-
|
280
|
-
# Set the rights in default object rights
|
281
|
-
# @param rights [String] Stanford, World, Dark, or None
|
282
|
-
def default_rights=(rights)
|
283
|
-
rights = rights.downcase
|
284
|
-
raise(ArgumentError, "Unrecognized rights value '#{rights}'") unless RightsMetadataDS.valid_rights_type? rights
|
285
|
-
|
286
|
-
rights_xml = defaultObjectRights.ng_xml
|
287
|
-
defaultObjectRights.ng_xml_will_change!
|
288
|
-
RightsMetadataDS.upd_rights_xml_for_rights_type(rights_xml, rights)
|
289
|
-
end
|
290
|
-
|
291
|
-
def desc_metadata_format
|
292
|
-
administrativeMetadata.metadata_format.first
|
293
|
-
end
|
294
|
-
|
295
|
-
def desc_metadata_format=(format)
|
296
|
-
# create the node if it isnt there already
|
297
|
-
unless administrativeMetadata.metadata_format.first
|
298
|
-
administrativeMetadata.ng_xml_will_change!
|
299
|
-
administrativeMetadata.add_child_node(administrativeMetadata.ng_xml.root, :metadata_format)
|
300
|
-
end
|
301
|
-
administrativeMetadata.update_values({ [:metadata_format] => format })
|
302
|
-
end
|
303
|
-
|
304
|
-
def desc_metadata_source
|
305
|
-
administrativeMetadata.metadata_source.first
|
306
|
-
end
|
307
|
-
|
308
|
-
def desc_metadata_source=(source)
|
309
|
-
# create the node if it isnt there already
|
310
|
-
unless administrativeMetadata.metadata_source.first
|
311
|
-
administrativeMetadata.ng_xml_will_change!
|
312
|
-
administrativeMetadata.add_child_node(administrativeMetadata.ng_xml.root, :metadata_source)
|
313
|
-
end
|
314
|
-
administrativeMetadata.update_values({ [:metadata_source] => format })
|
315
|
-
end
|
316
|
-
|
317
|
-
# List of default workflows, used to provide choices at registration
|
318
|
-
# @return [Array] and array of pids, ex ['druid:ab123cd4567']
|
319
|
-
def default_workflows
|
320
|
-
administrativeMetadata.term_values(:registration, :workflow_id)
|
321
|
-
end
|
322
|
-
|
323
|
-
# set a single default workflow
|
324
|
-
# @param wf [String] the name of the workflow, ex. 'digitizationWF'
|
325
|
-
def default_workflow=(wf)
|
326
|
-
fail ArgumentError, 'Must have a valid workflow for default' if wf.blank?
|
327
|
-
|
328
|
-
xml = administrativeMetadata.ng_xml
|
329
|
-
administrativeMetadata.ng_xml_will_change!
|
330
|
-
nodes = xml.search('//registration/workflow')
|
331
|
-
if nodes.first
|
332
|
-
nodes.first['id'] = wf
|
333
|
-
else
|
334
|
-
nodes = xml.search('//registration')
|
335
|
-
unless nodes.first
|
336
|
-
reg_node = Nokogiri::XML::Node.new('registration', xml)
|
337
|
-
xml.root.add_child(reg_node)
|
338
|
-
end
|
339
|
-
nodes = xml.search('//registration')
|
340
|
-
wf_node = Nokogiri::XML::Node.new('workflow', xml)
|
341
|
-
wf_node['id'] = wf
|
342
|
-
nodes.first.add_child(wf_node)
|
343
|
-
end
|
344
|
-
end
|
23
|
+
delegate :use_statement, :use_statement=,
|
24
|
+
:copyright_statement, :copyright_statement=,
|
25
|
+
:creative_commons_license, :creative_commons_license_human,
|
26
|
+
:open_data_commons_license, :open_data_commons_license_human,
|
27
|
+
:use_license, :use_license_uri, :use_license_human,
|
28
|
+
:creative_commons_license=, :creative_commons_license_human=,
|
29
|
+
:open_data_commons_license=, :open_data_commons_license_human=,
|
30
|
+
:use_license=, :default_rights, :default_rights=, to: :defaultObjectRights
|
345
31
|
|
346
32
|
def agreement
|
347
33
|
agreement_object ? agreement_object.pid : ''
|
348
34
|
end
|
349
35
|
|
350
36
|
def agreement=(val)
|
351
|
-
|
37
|
+
raise ArgumentError, 'agreement must have a valid druid' if val.blank?
|
352
38
|
|
353
|
-
self.agreement_object = Dor.find val.to_s, :
|
39
|
+
self.agreement_object = Dor.find val.to_s, cast: true
|
354
40
|
end
|
355
41
|
end
|
356
42
|
end
|
@@ -5,7 +5,7 @@ module Dor
|
|
5
5
|
extend ActiveSupport::Concern
|
6
6
|
|
7
7
|
included do
|
8
|
-
has_metadata :
|
8
|
+
has_metadata name: 'embargoMetadata', type: Dor::EmbargoMetadataDS, label: 'Embargo metadata'
|
9
9
|
end
|
10
10
|
|
11
11
|
# These methods manipulate the object for embargo purposes
|
@@ -25,7 +25,7 @@ module Dor
|
|
25
25
|
rights_md = datastreams['rightsMetadata']
|
26
26
|
rights_xml = rights_md.ng_xml
|
27
27
|
rights_md.ng_xml_will_change!
|
28
|
-
rights_xml.xpath("//rightsMetadata/access[@type='read']").each
|
28
|
+
rights_xml.xpath("//rightsMetadata/access[@type='read']").each(&:remove)
|
29
29
|
|
30
30
|
# Replace rights <access> nodes with those from embargoMetadta
|
31
31
|
release_access = embargo_md.release_access_node
|
@@ -38,7 +38,7 @@ module Dor
|
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
41
|
-
add_event('embargo', release_agent, 'Embargo released')
|
41
|
+
events.add_event('embargo', release_agent, 'Embargo released')
|
42
42
|
end
|
43
43
|
|
44
44
|
def release_20_pct_vis_embargo(release_agent = 'unknown')
|
@@ -50,7 +50,7 @@ module Dor
|
|
50
50
|
rights_md = datastreams['rightsMetadata']
|
51
51
|
rights_xml = rights_md.ng_xml
|
52
52
|
rights_md.ng_xml_will_change!
|
53
|
-
rights_xml.xpath("//rightsMetadata/access[@type='read']").each
|
53
|
+
rights_xml.xpath("//rightsMetadata/access[@type='read']").each(&:remove)
|
54
54
|
|
55
55
|
# Replace rights <access> nodes with 1 machine/world node
|
56
56
|
access_sibling = rights_xml.at_xpath('//rightsMetadata/access[last()]')
|
@@ -60,16 +60,12 @@ module Dor
|
|
60
60
|
rights_xml.root.add_child(world_doc.root.clone)
|
61
61
|
end
|
62
62
|
|
63
|
-
add_event('embargo', release_agent, '20% Visibility Embargo released')
|
63
|
+
events.add_event('embargo', release_agent, '20% Visibility Embargo released')
|
64
64
|
end
|
65
65
|
|
66
66
|
def update_embargo(new_date)
|
67
|
-
if embargoMetadata.status != 'embargoed'
|
68
|
-
|
69
|
-
end
|
70
|
-
if new_date.past?
|
71
|
-
raise ArgumentError, 'You cannot set the embargo date to a past date.'
|
72
|
-
end
|
67
|
+
raise ArgumentError, 'You cannot change the embargo date of an item that is not embargoed.' if embargoMetadata.status != 'embargoed'
|
68
|
+
raise ArgumentError, 'You cannot set the embargo date to a past date.' if new_date.past?
|
73
69
|
|
74
70
|
updated = false
|
75
71
|
rightsMetadata.ng_xml.search('//embargoReleaseDate').each do |node|
|
@@ -2,13 +2,17 @@
|
|
2
2
|
|
3
3
|
module Dor
|
4
4
|
module Eventable
|
5
|
+
extend Deprecation
|
5
6
|
extend ActiveSupport::Concern
|
7
|
+
self.deprecation_horizon = 'dor-services version 7.0.0'
|
8
|
+
|
6
9
|
included do
|
7
|
-
has_metadata :
|
10
|
+
has_metadata name: 'events', type: Dor::EventsDS, label: 'Events'
|
8
11
|
end
|
9
12
|
|
10
13
|
def add_event(*args)
|
11
14
|
datastreams['events'].add_event *args
|
12
15
|
end
|
16
|
+
deprecation_deprecate add_event: 'call item.events.add_event instead.'
|
13
17
|
end
|
14
18
|
end
|
@@ -5,10 +5,10 @@ module Dor
|
|
5
5
|
extend ActiveSupport::Concern
|
6
6
|
|
7
7
|
included do
|
8
|
-
has_metadata :
|
9
|
-
:
|
10
|
-
:
|
11
|
-
:
|
8
|
+
has_metadata name: 'geoMetadata',
|
9
|
+
type: Dor::GeoMetadataDS,
|
10
|
+
label: 'Geographic Information Metadata in ISO 19139',
|
11
|
+
control_group: 'M'
|
12
12
|
end
|
13
13
|
end
|
14
14
|
end
|