dor-services 6.1.14 → 6.2.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/exceptions.rb +4 -0
- data/lib/dor/models/concerns/governable.rb +1 -1
- data/lib/dor/services/create_workflow_service.rb +1 -1
- data/lib/dor/services/file_metadata_merge_service.rb +4 -0
- data/lib/dor/services/merge_service.rb +10 -0
- data/lib/dor/services/public_xml_service.rb +29 -23
- data/lib/dor/utils/sdr_client.rb +3 -2
- data/lib/dor/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a9ab63108ab2c8ddd29600d7a9facf709a67dc52474d7c0de6becac108664807
|
4
|
+
data.tar.gz: 332ce5d6ceef2432a7135788bc87de7d28ec108ff9820bc5c4e253ba0f8f700a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5742a34bb7b5250df9ca07b5c2b4291f59b165acc1050dbc9f76f9bd185d4a5bd0bc961552ab20e40d13b42c631ac0c0c3c515347ae9476b2811ec5dd75f2ad0
|
7
|
+
data.tar.gz: edb36ac7a3bcce46e5d3111c4a23bf69fed05afda48c82d42f0bbcbcca564d128b180774d7cf6231e168e7b3301af40a15a552f57f226a97259e582173a1c29d
|
data/lib/dor/exceptions.rb
CHANGED
@@ -13,7 +13,7 @@ module Dor
|
|
13
13
|
def initiate_apo_workflow(name)
|
14
14
|
CreateWorkflowService.create_workflow(self, name: name, create_ds: !new_record?)
|
15
15
|
end
|
16
|
-
deprecation_deprecate initiate_apo_workflow: 'Use Dor::
|
16
|
+
deprecation_deprecate initiate_apo_workflow: 'Use Dor::Services::Client.object(object_identifier).workflow.create(wf_name:) instead'
|
17
17
|
|
18
18
|
def reset_to_apo_default
|
19
19
|
rightsMetadata.content = admin_policy_object.rightsMetadata.ng_xml
|
@@ -39,7 +39,7 @@ module Dor
|
|
39
39
|
def default_workflow_lane
|
40
40
|
return 'default' if admin_policy_object.nil? # TODO: log warning?
|
41
41
|
|
42
|
-
admin_md = admin_policy_object.administrativeMetadata
|
42
|
+
admin_md = admin_policy_object.datastreams['administrativeMetadata']
|
43
43
|
return 'default' unless admin_md.respond_to?(:default_workflow_lane) # Some APOs don't have this datastream
|
44
44
|
|
45
45
|
lane = admin_md.default_workflow_lane
|
@@ -3,6 +3,9 @@
|
|
3
3
|
module Dor
|
4
4
|
# Merges contentMetadata from several objects into one.
|
5
5
|
class FileMetadataMergeService
|
6
|
+
extend Deprecation
|
7
|
+
self.deprecation_horizon = 'dor-services version 7.0.0'
|
8
|
+
|
6
9
|
# @param [Array<String>] secondary_druids ids of the secondary objects that will get their contentMetadata merged into this one
|
7
10
|
def self.copy_file_resources(primary, secondary_druids)
|
8
11
|
merge_service = FileMetadataMergeService.new primary, secondary_druids
|
@@ -59,6 +62,7 @@ module Dor
|
|
59
62
|
end
|
60
63
|
end
|
61
64
|
end
|
65
|
+
deprecation_deprecate copy_file_resources: 'No longer used by any DLSS code'
|
62
66
|
|
63
67
|
private
|
64
68
|
|
@@ -2,6 +2,9 @@
|
|
2
2
|
|
3
3
|
module Dor
|
4
4
|
class MergeService
|
5
|
+
extend Deprecation
|
6
|
+
self.deprecation_horizon = 'dor-services version 7.0.0'
|
7
|
+
|
5
8
|
def self.merge_into_primary(primary_druid, secondary_druids, tag, logger = nil)
|
6
9
|
# TODO: test the secondary_obj to see if we've processed it already
|
7
10
|
merge_service = Dor::MergeService.new primary_druid, secondary_druids, tag, logger
|
@@ -29,12 +32,14 @@ module Dor
|
|
29
32
|
non_editable = @secondary_objs.detect { |obj| !obj.allows_modification? }
|
30
33
|
raise Dor::Exception, "Secondary object is not editable: #{non_editable.pid}" if non_editable
|
31
34
|
end
|
35
|
+
deprecation_deprecate check_objects_editable: 'No longer used by any DLSS code'
|
32
36
|
|
33
37
|
def move_metadata_and_content
|
34
38
|
FileMetadataMergeService.copy_file_resources @primary, @secondary_pids
|
35
39
|
@primary.save
|
36
40
|
copy_workspace_content
|
37
41
|
end
|
42
|
+
deprecation_deprecate move_metadata_and_content: 'No longer used by any DLSS code'
|
38
43
|
|
39
44
|
# Copies the content from the secondary object workspace to the primary object's workspace
|
40
45
|
# Depends on Dor::Config.stacks.local_workspace_root
|
@@ -59,6 +64,7 @@ module Dor
|
|
59
64
|
end
|
60
65
|
end
|
61
66
|
end
|
67
|
+
deprecation_deprecate copy_workspace_content: 'No longer used by any DLSS code'
|
62
68
|
|
63
69
|
def decommission_secondaries
|
64
70
|
@secondary_objs.each do |secondary_obj|
|
@@ -77,6 +83,8 @@ module Dor
|
|
77
83
|
end
|
78
84
|
end
|
79
85
|
end
|
86
|
+
deprecation_deprecate decommission_secondaries: 'No longer used by any DLSS code'
|
87
|
+
|
80
88
|
alias decomission_secondaries decommission_secondaries
|
81
89
|
deprecate decomission_secondaries: 'Use decommission_secondaries instead'
|
82
90
|
|
@@ -85,11 +93,13 @@ module Dor
|
|
85
93
|
def unshelve
|
86
94
|
DigitalStacksService.prune_stacks_dir @current_secondary.pid
|
87
95
|
end
|
96
|
+
deprecation_deprecate unshelve: 'No longer used by any DLSS code'
|
88
97
|
|
89
98
|
# Withdraw item from Purl
|
90
99
|
# TODO: might set workflow status in future for robot to do
|
91
100
|
def unpublish
|
92
101
|
@current_secondary.publish_metadata
|
93
102
|
end
|
103
|
+
deprecation_deprecate unpublish: 'No longer used by any DLSS code'
|
94
104
|
end
|
95
105
|
end
|
@@ -78,33 +78,39 @@ module Dor
|
|
78
78
|
result.xpath('/contentMetadata/resource/file/checksum').each(&:remove)
|
79
79
|
|
80
80
|
# support for dereferencing links via externalFile element(s) to the source (child) item - see JUMBO-19
|
81
|
-
result.xpath('/contentMetadata/resource/externalFile').each do |
|
82
|
-
|
83
|
-
src_resource_id = externalFile['resourceId']
|
84
|
-
src_druid = externalFile['objectId']
|
85
|
-
src_file_id = externalFile['fileId']
|
86
|
-
raise ArgumentError, "Malformed externalFile data: #{externalFile.inspect}" if [src_resource_id, src_file_id, src_druid].map(&:blank?).any?
|
87
|
-
|
88
|
-
# grab source item
|
89
|
-
src_item = Dor.find(src_druid)
|
90
|
-
|
91
|
-
# locate and extract the resourceId/fileId elements
|
92
|
-
doc = src_item.datastreams['contentMetadata'].ng_xml
|
93
|
-
src_resource = doc.at_xpath("//resource[@id=\"#{src_resource_id}\"]")
|
94
|
-
src_file = src_resource.at_xpath("file[@id=\"#{src_file_id}\"]")
|
95
|
-
src_image_data = src_file.at_xpath('imageData')
|
96
|
-
|
97
|
-
# always use title regardless of whether a child label is present
|
98
|
-
src_label = doc.create_element('label')
|
99
|
-
src_label.content = src_item.full_title
|
100
|
-
|
101
|
-
# add the extracted label and imageData
|
102
|
-
externalFile.add_previous_sibling(src_label)
|
103
|
-
externalFile << src_image_data unless src_image_data.nil?
|
81
|
+
result.xpath('/contentMetadata/resource/externalFile').each do |external_file|
|
82
|
+
add_data_from_src(external_file)
|
104
83
|
end
|
105
84
|
|
106
85
|
result
|
107
86
|
end
|
108
87
|
end
|
88
|
+
|
89
|
+
def add_data_from_src(external_file)
|
90
|
+
# enforce pre-conditions that resourceId, objectId, fileId are required
|
91
|
+
src_resource_id = external_file['resourceId']
|
92
|
+
src_druid = external_file['objectId']
|
93
|
+
src_file_id = external_file['fileId']
|
94
|
+
raise DataError, "Malformed externalFile data: #{external_file.to_xml}" if [src_resource_id, src_file_id, src_druid].map(&:blank?).any?
|
95
|
+
|
96
|
+
# grab source item
|
97
|
+
src_item = Dor.find(src_druid)
|
98
|
+
|
99
|
+
# locate and extract the resourceId/fileId elements
|
100
|
+
doc = src_item.contentMetadata.ng_xml
|
101
|
+
src_resource = doc.at_xpath("//resource[@id=\"#{src_resource_id}\"]")
|
102
|
+
src_file = src_resource.at_xpath("file[@id=\"#{src_file_id}\"]")
|
103
|
+
raise DataError, "Unable to find a file node with id=\"#{src_file_id}\" (child of #{object.pid})" unless src_file
|
104
|
+
|
105
|
+
src_image_data = src_file.at_xpath('imageData')
|
106
|
+
|
107
|
+
# always use title regardless of whether a child label is present
|
108
|
+
src_label = doc.create_element('label')
|
109
|
+
src_label.content = src_item.full_title
|
110
|
+
|
111
|
+
# add the extracted label and imageData
|
112
|
+
external_file.add_previous_sibling(src_label)
|
113
|
+
external_file << src_image_data unless src_image_data.nil?
|
114
|
+
end
|
109
115
|
end
|
110
116
|
end
|
data/lib/dor/utils/sdr_client.rb
CHANGED
@@ -60,9 +60,10 @@ module Sdr
|
|
60
60
|
Moab::FileInventoryDifference.parse(response)
|
61
61
|
end
|
62
62
|
|
63
|
-
# This
|
63
|
+
# This was used by Argo but is no longer used anywhere
|
64
64
|
def get_preserved_file_content(druid, filename, version)
|
65
|
-
Deprecation.warn(self, 'Sdr::Client.get_preserved_file_content is deprecated and will be removed in dor-services 7.
|
65
|
+
Deprecation.warn(self, 'Sdr::Client.get_preserved_file_content is deprecated and will be removed in dor-services 7. ' \
|
66
|
+
'Use Dor::Services::Client.object(object_identifier).files.preserved_content(filename:, version:) instead')
|
66
67
|
|
67
68
|
client["objects/#{druid}/content/#{URI.encode(filename)}?version=#{version}"].get
|
68
69
|
end
|
data/lib/dor/version.rb
CHANGED
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: 6.
|
4
|
+
version: 6.2.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: 2019-01-
|
17
|
+
date: 2019-01-23 00:00:00.000000000 Z
|
18
18
|
dependencies:
|
19
19
|
- !ruby/object:Gem::Dependency
|
20
20
|
name: active-fedora
|
@@ -695,7 +695,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
695
695
|
- !ruby/object:Gem::Version
|
696
696
|
version: 1.3.6
|
697
697
|
requirements: []
|
698
|
-
|
698
|
+
rubyforge_project:
|
699
|
+
rubygems_version: 2.7.6
|
699
700
|
signing_key:
|
700
701
|
specification_version: 4
|
701
702
|
summary: Ruby implmentation of DOR services used by the SULAIR Digital Library
|