dor-services 6.8.0 → 7.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/config/config_defaults.yml +0 -27
- data/config/dev_console_env.rb.example +0 -17
- data/lib/dor-services.rb +9 -73
- data/lib/dor/config.rb +1 -30
- data/lib/dor/datastreams/content_metadata_ds.rb +8 -0
- data/lib/dor/datastreams/desc_metadata_ds.rb +19 -0
- data/lib/dor/datastreams/identity_metadata_ds.rb +65 -0
- data/lib/dor/datastreams/rights_metadata_ds.rb +14 -2
- data/lib/dor/datastreams/workflow_definition_ds.rb +1 -1
- data/lib/dor/datastreams/workflow_ds.rb +0 -15
- data/lib/dor/indexers/identifiable_indexer.rb +8 -4
- data/lib/dor/indexers/releasable_indexer.rb +7 -1
- data/lib/dor/models/abstract.rb +143 -8
- data/lib/dor/models/admin_policy_object.rb +0 -3
- data/lib/dor/models/collection.rb +0 -2
- data/lib/dor/models/concerns/embargoable.rb +7 -60
- data/lib/dor/models/etd.rb +100 -0
- data/lib/dor/models/item.rb +12 -28
- data/lib/dor/models/part.rb +18 -0
- data/lib/dor/models/set.rb +0 -2
- data/lib/dor/services/collection_service.rb +36 -0
- data/lib/dor/services/embargo_service.rb +93 -0
- data/lib/dor/services/ontology.rb +0 -18
- data/lib/dor/services/public_desc_metadata_service.rb +7 -11
- data/lib/dor/services/search_service.rb +0 -40
- data/lib/dor/version.rb +1 -1
- data/lib/dor/workflow/document.rb +0 -7
- metadata +15 -78
- data/lib/dor/models/concerns/assembleable.rb +0 -18
- data/lib/dor/models/concerns/contentable.rb +0 -185
- data/lib/dor/models/concerns/describable.rb +0 -82
- data/lib/dor/models/concerns/eventable.rb +0 -18
- data/lib/dor/models/concerns/geoable.rb +0 -14
- data/lib/dor/models/concerns/governable.rb +0 -101
- data/lib/dor/models/concerns/identifiable.rb +0 -172
- data/lib/dor/models/concerns/itemizable.rb +0 -42
- data/lib/dor/models/concerns/preservable.rb +0 -46
- data/lib/dor/models/concerns/processable.rb +0 -86
- data/lib/dor/models/concerns/publishable.rb +0 -76
- data/lib/dor/models/concerns/releaseable.rb +0 -118
- data/lib/dor/models/concerns/rightsable.rb +0 -25
- data/lib/dor/models/concerns/shelvable.rb +0 -15
- data/lib/dor/models/concerns/versionable.rb +0 -72
- data/lib/dor/services/ability.rb +0 -77
- data/lib/dor/services/cleanup_reset_service.rb +0 -103
- data/lib/dor/services/datastream_builder.rb +0 -96
- data/lib/dor/services/decommission_service.rb +0 -31
- data/lib/dor/services/digital_stacks_service.rb +0 -125
- data/lib/dor/services/dublin_core_service.rb +0 -45
- data/lib/dor/services/file_metadata_merge_service.rb +0 -71
- data/lib/dor/services/indexing_service.rb +0 -131
- data/lib/dor/services/merge_service.rb +0 -105
- data/lib/dor/services/public_xml_service.rb +0 -116
- data/lib/dor/services/publish_metadata_service.rb +0 -99
- data/lib/dor/services/reset_workspace_service.rb +0 -27
- data/lib/dor/services/sdr_ingest_service.rb +0 -172
- data/lib/dor/services/secondary_file_name_service.rb +0 -10
- data/lib/dor/services/shelving_service.rb +0 -69
- data/lib/dor/services/technical_metadata_service.rb +0 -232
- data/lib/dor/services/version_service.rb +0 -84
- data/lib/dor/utils/sdr_client.rb +0 -94
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: af6de5f57ae4ad7e16df5978e27c65131671d88f32e0c006d5ea1389015c53a0
|
4
|
+
data.tar.gz: 5c478ce40e0e5a77ea9baecc8f2403d5b3d204629b7dfe315793e1ca0a6d86d8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9ff7af6435417ea9e9b94e21ff2d986cc6fb36b31a2753a493301bc8ca0ab2dca1a7573e9999d151da645a7faaa235ee841882903221cd45eabb3cfb0ea05c01
|
7
|
+
data.tar.gz: 895a93feab7403be4f38c31708280e6978397c4641a758d815610fc767ea212059356243b32f9d649e34ec998d60a0c5d25a6427446f72cb0e9f14e10b1d78a2
|
data/config/config_defaults.yml
CHANGED
@@ -12,25 +12,11 @@
|
|
12
12
|
:solr:
|
13
13
|
:url:
|
14
14
|
:opts: {}
|
15
|
-
:solrizer: {} # deprecated
|
16
15
|
:metadata:
|
17
16
|
:catalog:
|
18
17
|
:url:
|
19
18
|
:user:
|
20
19
|
:pass:
|
21
|
-
:sdr:
|
22
|
-
:local_workspace_root: /dor/workspace
|
23
|
-
:local_export_home: /dor/export
|
24
|
-
:datastreams:
|
25
|
-
:rightsMetadata: optional
|
26
|
-
:descMetadata: required
|
27
|
-
:sourceMetadata: optional
|
28
|
-
:identityMetadata: required
|
29
|
-
:provenanceMetadata: required
|
30
|
-
:relationshipMetadata: required
|
31
|
-
:technicalMetadata: required
|
32
|
-
:contentMetadata: required
|
33
|
-
:rest_url: ""
|
34
20
|
:stacks:
|
35
21
|
:local_workspace_root: /dor
|
36
22
|
:host:
|
@@ -54,16 +40,3 @@
|
|
54
40
|
:shift_age: weekly
|
55
41
|
:dor_services:
|
56
42
|
:url:
|
57
|
-
:dor_indexing_app:
|
58
|
-
:url:
|
59
|
-
:indexing_svc:
|
60
|
-
:log: 'log/indexing_svc.log'
|
61
|
-
:log_date_format_str: '%Y-%m-%d %H:%M:%S.%L'
|
62
|
-
:log_rotation_interval: 'daily'
|
63
|
-
:goobi:
|
64
|
-
:url:
|
65
|
-
:dpg_workflow_name: 'goobiWF'
|
66
|
-
:default_goobi_workflow_name: 'Example_Workflow'
|
67
|
-
:max_tries: 3
|
68
|
-
:max_sleep_seconds: 20
|
69
|
-
:base_sleep_seconds: 2
|
@@ -44,21 +44,4 @@ Dor::Config.configure do
|
|
44
44
|
local_workspace_root '/dor/workspace'
|
45
45
|
local_export_home '/dor/export'
|
46
46
|
end
|
47
|
-
|
48
|
-
sdr do
|
49
|
-
local_workspace_root '/dor/workspace'
|
50
|
-
local_export_home '/dor/export'
|
51
|
-
datastreams do
|
52
|
-
contentMetadata 'required'
|
53
|
-
descMetadata 'required'
|
54
|
-
identityMetadata 'required'
|
55
|
-
provenanceMetadata 'required'
|
56
|
-
relationshipMetadata 'required'
|
57
|
-
rightsMetadata 'optional'
|
58
|
-
sourceMetadata 'optional'
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
accessioning_robot_sleep_time 30
|
63
|
-
|
64
47
|
end
|
data/lib/dor-services.rb
CHANGED
@@ -4,28 +4,18 @@ require 'active_fedora'
|
|
4
4
|
require 'active_fedora/version'
|
5
5
|
require 'active_support/core_ext/module/attribute_accessors'
|
6
6
|
require 'active_support/core_ext/object/blank'
|
7
|
-
require '
|
7
|
+
require 'deprecation'
|
8
8
|
|
9
9
|
module Dor
|
10
10
|
extend ActiveSupport::Autoload
|
11
11
|
@@registered_classes = {}
|
12
12
|
mattr_reader :registered_classes
|
13
|
-
INDEX_VERSION_FIELD = 'dor_services_version_ssi'
|
14
13
|
|
15
14
|
class << self
|
16
15
|
def configure(*args, &block)
|
17
16
|
Dor::Config.configure *args, &block
|
18
17
|
end
|
19
18
|
|
20
|
-
# Load an object and inspect its identityMetadata to figure out what class
|
21
|
-
# to adapt it to. This is necessary when the object is not indexed, or the
|
22
|
-
# index is missing the objectType property.
|
23
|
-
# @param [String] pid The object's PID
|
24
|
-
def load_instance(pid)
|
25
|
-
Deprecation.warn(self, 'load_instance is deprecated, use Dor.find instead')
|
26
|
-
find(pid)
|
27
|
-
end
|
28
|
-
|
29
19
|
# Load an object and inspect its identityMetadata to figure out what class
|
30
20
|
# to adapt it to.
|
31
21
|
# @param [String] pid The object's PID
|
@@ -34,27 +24,6 @@ module Dor
|
|
34
24
|
Dor::Abstract.find pid, cast: true
|
35
25
|
end
|
36
26
|
|
37
|
-
# TODO: return enumerable and lazy load_instance
|
38
|
-
# TODO: restrict fieldlist (fl) for non-:lightweight queries
|
39
|
-
def find_all(query, opts = {})
|
40
|
-
ActiveSupport::Deprecation.warn 'Dor.find_all is deprecated; use activefedora finders instead'
|
41
|
-
|
42
|
-
resp = SearchService.query query, opts
|
43
|
-
resp['response']['docs'].collect do |solr_doc|
|
44
|
-
find solr_doc['id']
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
# @deprecated
|
49
|
-
def ensure_models_loaded!
|
50
|
-
ActiveSupport::Deprecation.warn 'Dor.ensure_models_loaded! is unnecessary and has been deprecated.'
|
51
|
-
eager_load!
|
52
|
-
end
|
53
|
-
|
54
|
-
def root
|
55
|
-
File.dirname(__FILE__)
|
56
|
-
end
|
57
|
-
|
58
27
|
def logger
|
59
28
|
require 'logger'
|
60
29
|
@logger ||= if defined?(::Rails) && ::Rails.respond_to?(:logger)
|
@@ -65,10 +34,6 @@ module Dor
|
|
65
34
|
end
|
66
35
|
end
|
67
36
|
|
68
|
-
def logger
|
69
|
-
Dor.logger
|
70
|
-
end
|
71
|
-
|
72
37
|
require 'dor/version'
|
73
38
|
require 'dor/config'
|
74
39
|
require 'dor/exceptions'
|
@@ -116,34 +81,20 @@ module Dor
|
|
116
81
|
|
117
82
|
# DOR Concerns
|
118
83
|
autoload_under 'models/concerns' do
|
119
|
-
autoload :Identifiable
|
120
|
-
autoload :Itemizable
|
121
|
-
autoload :Processable
|
122
|
-
autoload :Governable
|
123
|
-
autoload :Describable
|
124
|
-
autoload :Publishable
|
125
|
-
autoload :Shelvable
|
126
84
|
autoload :Embargoable
|
127
|
-
autoload :Preservable
|
128
|
-
autoload :Assembleable
|
129
|
-
autoload :Eventable
|
130
|
-
autoload :Versionable
|
131
|
-
autoload :Contentable
|
132
|
-
autoload :Discoverable
|
133
|
-
autoload :Geoable
|
134
|
-
autoload :Releaseable
|
135
|
-
autoload :Rightsable
|
136
85
|
end
|
137
86
|
|
138
87
|
eager_autoload do
|
139
88
|
# ActiveFedora Classes
|
140
89
|
autoload_under 'models' do
|
141
90
|
autoload :Abstract
|
91
|
+
autoload :AdminPolicyObject
|
142
92
|
autoload :Agreement
|
93
|
+
autoload :Collection
|
94
|
+
autoload :Etd
|
143
95
|
autoload :Item
|
96
|
+
autoload :Part
|
144
97
|
autoload :Set
|
145
|
-
autoload :Collection
|
146
|
-
autoload :AdminPolicyObject
|
147
98
|
autoload :WorkflowObject
|
148
99
|
autoload :WorkflowSolrDocument
|
149
100
|
end
|
@@ -151,38 +102,23 @@ module Dor
|
|
151
102
|
|
152
103
|
# Services
|
153
104
|
autoload_under 'services' do
|
154
|
-
autoload :Ability
|
155
|
-
autoload :CleanupResetService
|
156
105
|
autoload :CleanupService
|
106
|
+
autoload :CollectionService
|
157
107
|
autoload :CreateWorkflowService
|
158
108
|
autoload :CreativeCommonsLicenseService
|
159
|
-
autoload :
|
160
|
-
autoload :DecommissionService
|
161
|
-
autoload :DigitalStacksService
|
162
|
-
autoload :DublinCoreService
|
163
|
-
autoload :FileMetadataMergeService
|
109
|
+
autoload :EmbargoService
|
164
110
|
autoload :IndexingService
|
165
111
|
autoload :MetadataService
|
166
|
-
autoload :MergeService
|
167
112
|
autoload :Ontology
|
168
113
|
autoload :OpenDataLicenseService
|
169
|
-
autoload :ProvenanceMetadataService
|
170
114
|
autoload :PublicDescMetadataService
|
171
|
-
autoload :
|
172
|
-
autoload :PublishMetadataService
|
173
|
-
autoload :RegistrationService
|
115
|
+
autoload :PublishedRelationshipsFilter
|
174
116
|
autoload :ReleaseTagService
|
175
|
-
autoload :ResetWorkspaceService
|
176
|
-
autoload :SdrIngestService
|
177
117
|
autoload :SearchService
|
178
|
-
autoload :SecondaryFileNameService
|
179
|
-
autoload :ShelvingService
|
180
118
|
autoload :StatusService
|
181
119
|
autoload :SuriService
|
182
120
|
autoload :TagService
|
183
|
-
autoload :TechnicalMetadataService
|
184
121
|
autoload :ThumbnailService
|
185
|
-
autoload :VersionService
|
186
122
|
end
|
187
123
|
|
188
124
|
# Workflow Classes
|
@@ -195,5 +131,5 @@ module Dor
|
|
195
131
|
eager_load!
|
196
132
|
|
197
133
|
require 'dor/utils/hydrus_shims'
|
198
|
-
require 'dor
|
134
|
+
require 'dor/workflow/client'
|
199
135
|
end
|
data/lib/dor/config.rb
CHANGED
@@ -32,25 +32,10 @@ module Dor
|
|
32
32
|
result
|
33
33
|
end
|
34
34
|
|
35
|
-
def autoconfigure(url, cert_file = Config.ssl.cert_file, key_file = Config.ssl.key_file, key_pass = Config.ssl.key_pass)
|
36
|
-
client = make_rest_client(url, cert_file, key_file, key_pass)
|
37
|
-
config = Confstruct::Configuration.symbolize_hash JSON.parse(client.get(accept: 'application/json'))
|
38
|
-
configure(config)
|
39
|
-
end
|
40
|
-
deprecation_deprecate :autoconfigure
|
41
|
-
|
42
35
|
def sanitize
|
43
36
|
dup
|
44
37
|
end
|
45
38
|
|
46
|
-
def make_rest_client(url, cert = Config.ssl.cert_file, key = Config.ssl.key_file, pass = Config.ssl.key_pass)
|
47
|
-
params = {}
|
48
|
-
params[:ssl_client_cert] = OpenSSL::X509::Certificate.new(File.read(cert)) if cert
|
49
|
-
params[:ssl_client_key] = OpenSSL::PKey::RSA.new(File.read(key), pass) if key
|
50
|
-
RestClient::Resource.new(url, params)
|
51
|
-
end
|
52
|
-
deprecation_deprecate :make_rest_client
|
53
|
-
|
54
39
|
def make_solr_connection(add_opts = {})
|
55
40
|
opts = Dor::Config.solr.opts.merge(add_opts).merge(
|
56
41
|
url: Dor::Config.solr.url
|
@@ -78,13 +63,9 @@ module Dor
|
|
78
63
|
purl_services: {
|
79
64
|
rest_client: Confstruct.deferred { |_c| RestResourceFactory.create(:purl_services) }
|
80
65
|
},
|
81
|
-
sdr: {
|
82
|
-
rest_client: Confstruct.deferred { |_c| RestResourceFactory.create(:sdr) }
|
83
|
-
},
|
84
66
|
workflow: {
|
85
67
|
client: Confstruct.deferred do |c|
|
86
|
-
Dor::
|
87
|
-
Dor::WorkflowService
|
68
|
+
@wfs ||= Dor::Workflow::Client.new(url: c.url, logger: c.client_logger, timeout: c.timeout)
|
88
69
|
end,
|
89
70
|
client_logger: Confstruct.deferred do |c|
|
90
71
|
if c.logfile && c.shift_age
|
@@ -101,16 +82,6 @@ module Dor
|
|
101
82
|
set_callback :configure, :after do |config|
|
102
83
|
configure_client!(config)
|
103
84
|
|
104
|
-
if config.solrizer.present?
|
105
|
-
stack = Kernel.caller.dup
|
106
|
-
stack.shift while stack[0] =~ %r{(active_support/callbacks|dor/config|dor-services)\.rb}
|
107
|
-
ActiveSupport::Deprecation.warn 'Dor::Config -- solrizer configuration is deprecated. Please use solr instead.', stack
|
108
|
-
|
109
|
-
config.solrizer.each do |k, v|
|
110
|
-
config.solr[k] ||= v
|
111
|
-
end
|
112
|
-
end
|
113
|
-
|
114
85
|
if config.solr.url.present?
|
115
86
|
ActiveFedora::SolrService.register
|
116
87
|
ActiveFedora::SolrService.instance.instance_variable_set :@conn, make_solr_connection
|
@@ -127,6 +127,14 @@ module Dor
|
|
127
127
|
### END: READ ONLY METHODS
|
128
128
|
### DATSTREAM WRITING METHODS
|
129
129
|
|
130
|
+
def unshelve_and_unpublish
|
131
|
+
ng_xml.xpath('/contentMetadata/resource//file').each_with_index do |file_node, index|
|
132
|
+
ng_xml_will_change! if index == 0
|
133
|
+
file_node['publish'] = 'no'
|
134
|
+
file_node['shelve'] = 'no'
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
130
138
|
# @param [Object] file
|
131
139
|
# @param [String] resource_name
|
132
140
|
# @return [Nokogiri::XML::Node] the added XML node
|
@@ -1,6 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'stanford-mods'
|
4
|
+
|
3
5
|
module Dor
|
6
|
+
# Descriptive metadata
|
4
7
|
class DescMetadataDS < ActiveFedora::OmDatastream
|
5
8
|
MODS_NS = 'http://www.loc.gov/mods/v3'
|
6
9
|
MODS_HEADER_CONFIG = {
|
@@ -61,6 +64,22 @@ module Dor
|
|
61
64
|
update_values(%i[title_info main_title] => val)
|
62
65
|
end
|
63
66
|
|
67
|
+
# intended for read-access, "as SearchWorks would see it", mostly for to_solr()
|
68
|
+
# @param [Nokogiri::XML::Document] content Nokogiri descMetadata document (overriding internal data)
|
69
|
+
# @param [boolean] ns_aware namespace awareness toggle for from_nk_node()
|
70
|
+
def stanford_mods(content = nil, ns_aware = true)
|
71
|
+
@stanford_mods ||= begin
|
72
|
+
m = Stanford::Mods::Record.new
|
73
|
+
desc = content.nil? ? ng_xml : content
|
74
|
+
m.from_nk_node(desc.root, ns_aware)
|
75
|
+
m
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
def full_title
|
80
|
+
stanford_mods.sw_title_display
|
81
|
+
end
|
82
|
+
|
64
83
|
# maintain AF < 8 indexing behavior
|
65
84
|
def prefix
|
66
85
|
''
|
@@ -1,9 +1,14 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Dor
|
4
|
+
# Object identity and source metadata
|
4
5
|
class IdentityMetadataDS < ActiveFedora::OmDatastream
|
5
6
|
include SolrDocHelper
|
6
7
|
|
8
|
+
# ids for previous and current catkeys
|
9
|
+
CATKEY_TYPE_ID = 'catkey'
|
10
|
+
PREVIOUS_CATKEY_TYPE_ID = 'previous_catkey'
|
11
|
+
|
7
12
|
set_terminology do |t|
|
8
13
|
t.root(path: 'identityMetadata')
|
9
14
|
t.objectId index_as: [:symbol]
|
@@ -42,6 +47,7 @@ module Dor
|
|
42
47
|
node = find_by_terms(:sourceId).first
|
43
48
|
node ? [node['source'], node.text].join(':') : nil
|
44
49
|
end
|
50
|
+
alias source_id sourceId
|
45
51
|
|
46
52
|
# @param [String, Nil] value The value to set or a nil/empty string to delete sourceId node
|
47
53
|
# @return [String, Nil] The same value, as per Ruby convention for assignment operators
|
@@ -61,11 +67,18 @@ module Dor
|
|
61
67
|
node['source'] = parts[0]
|
62
68
|
node.content = parts[1]
|
63
69
|
end
|
70
|
+
alias source_id= sourceId=
|
64
71
|
|
65
72
|
def tags
|
66
73
|
ng_xml.search('//tag').collect(&:content)
|
67
74
|
end
|
68
75
|
|
76
|
+
# helper method to get just the content type tag
|
77
|
+
def content_type_tag
|
78
|
+
content_tag = tags.select { |tag| tag.include?('Process : Content Type') }
|
79
|
+
content_tag.size == 1 ? content_tag[0].split(':').last.strip : ''
|
80
|
+
end
|
81
|
+
|
69
82
|
def otherId(type = nil)
|
70
83
|
result = find_by_terms(:otherId).to_a
|
71
84
|
if type.nil?
|
@@ -84,6 +97,58 @@ module Dor
|
|
84
97
|
node
|
85
98
|
end
|
86
99
|
|
100
|
+
def add_other_Id(type, val)
|
101
|
+
raise 'There is an existing entry for ' + type + ', consider using update_other_Id().' if otherId(type).length > 0
|
102
|
+
|
103
|
+
add_otherId(type + ':' + val)
|
104
|
+
end
|
105
|
+
|
106
|
+
def update_other_Id(type, new_val, val = nil)
|
107
|
+
ng_xml.search('//otherId[@name=\'' + type + '\']')
|
108
|
+
.select { |node| val.nil? || node.content == val }
|
109
|
+
.each { ng_xml_will_change! }
|
110
|
+
.each { |node| node.content = new_val }
|
111
|
+
.any?
|
112
|
+
end
|
113
|
+
|
114
|
+
def remove_other_Id(type, val = nil)
|
115
|
+
ng_xml.search('//otherId[@name=\'' + type + '\']')
|
116
|
+
.select { |node| val.nil? || node.content == val }
|
117
|
+
.each { ng_xml_will_change! }
|
118
|
+
.each(&:remove)
|
119
|
+
.any?
|
120
|
+
end
|
121
|
+
|
122
|
+
# Convenience method to get the current catkey
|
123
|
+
# @return [String] current catkey value (or nil if none found)
|
124
|
+
def catkey
|
125
|
+
otherId(CATKEY_TYPE_ID).first
|
126
|
+
end
|
127
|
+
|
128
|
+
# Convenience method to set the catkey
|
129
|
+
# @param [String] val the new source identifier
|
130
|
+
# @return [String] same value, as per Ruby assignment convention
|
131
|
+
def catkey=(val)
|
132
|
+
# if there was already a catkey in the record, store that in the "previous" spot (assuming there is no change)
|
133
|
+
add_otherId("#{PREVIOUS_CATKEY_TYPE_ID}:#{catkey}") if val != catkey && !catkey.blank?
|
134
|
+
|
135
|
+
if val.blank? # if we are setting the catkey to blank, remove the node from XML
|
136
|
+
remove_other_Id(CATKEY_TYPE_ID)
|
137
|
+
elsif catkey.blank? # if there is no current catkey, then add it
|
138
|
+
add_other_Id(CATKEY_TYPE_ID, val)
|
139
|
+
else # if there is a current catkey, update the current catkey to the new value
|
140
|
+
update_other_Id(CATKEY_TYPE_ID, val)
|
141
|
+
end
|
142
|
+
|
143
|
+
val
|
144
|
+
end
|
145
|
+
|
146
|
+
# Convenience method to get the previous catkeys (will be an array)
|
147
|
+
# @return [Array] previous catkey values (empty array if none found)
|
148
|
+
def previous_catkeys
|
149
|
+
otherId(PREVIOUS_CATKEY_TYPE_ID)
|
150
|
+
end
|
151
|
+
|
87
152
|
def to_solr(solr_doc = {}, *args)
|
88
153
|
solr_doc = super(solr_doc, *args)
|
89
154
|
|
@@ -120,7 +120,6 @@ module Dor
|
|
120
120
|
end
|
121
121
|
|
122
122
|
# @param rights [string] archetypical rights to assign: 'world', 'stanford', 'none', 'dark', etc
|
123
|
-
# Moved from Governable
|
124
123
|
# slight misnomer: also sets discover rights!
|
125
124
|
# TODO: convert xpath reads to dra_object calls
|
126
125
|
def set_read_rights(rights)
|
@@ -216,5 +215,18 @@ module Dor
|
|
216
215
|
def prefix
|
217
216
|
''
|
218
217
|
end
|
219
|
-
|
218
|
+
|
219
|
+
def rights
|
220
|
+
xml = ng_xml
|
221
|
+
if xml.search('//rightsMetadata/access[@type=\'read\']/machine/group').length == 1
|
222
|
+
'Stanford'
|
223
|
+
elsif xml.search('//rightsMetadata/access[@type=\'read\']/machine/world').length == 1
|
224
|
+
'World'
|
225
|
+
elsif xml.search('//rightsMetadata/access[@type=\'discover\']/machine/none').length == 1
|
226
|
+
'Dark'
|
227
|
+
else
|
228
|
+
'None'
|
229
|
+
end
|
230
|
+
end
|
231
|
+
end
|
220
232
|
end
|