dor-services 5.1.1 → 5.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/dor-services.rb +1 -2
- data/lib/dor/config.rb +5 -6
- data/lib/dor/datastreams/content_metadata_ds.rb +17 -20
- data/lib/dor/datastreams/datastream_spec_solrizer.rb +1 -1
- data/lib/dor/datastreams/desc_metadata_ds.rb +7 -7
- data/lib/dor/datastreams/embargo_metadata_ds.rb +2 -7
- data/lib/dor/datastreams/events_ds.rb +9 -9
- data/lib/dor/datastreams/identity_metadata_ds.rb +29 -34
- data/lib/dor/datastreams/rights_metadata_ds.rb +1 -1
- data/lib/dor/datastreams/role_metadata_ds.rb +0 -1
- data/lib/dor/datastreams/simple_dublin_core_ds.rb +12 -13
- data/lib/dor/datastreams/version_metadata_ds.rb +11 -15
- data/lib/dor/datastreams/workflow_definition_ds.rb +18 -22
- data/lib/dor/datastreams/workflow_ds.rb +24 -36
- 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 +2 -2
- data/lib/dor/models/assembleable.rb +2 -2
- data/lib/dor/models/collection.rb +1 -0
- data/lib/dor/models/contentable.rb +3 -3
- data/lib/dor/models/describable.rb +16 -13
- data/lib/dor/models/editable.rb +3 -3
- data/lib/dor/models/embargoable.rb +2 -2
- data/lib/dor/models/eventable.rb +2 -2
- data/lib/dor/models/geoable.rb +14 -18
- data/lib/dor/models/governable.rb +1 -1
- data/lib/dor/models/identifiable.rb +36 -57
- data/lib/dor/models/itemizable.rb +6 -6
- data/lib/dor/models/presentable.rb +12 -12
- data/lib/dor/models/preservable.rb +2 -5
- data/lib/dor/models/processable.rb +19 -25
- data/lib/dor/models/publishable.rb +2 -2
- data/lib/dor/models/releaseable.rb +165 -212
- data/lib/dor/models/shelvable.rb +10 -14
- data/lib/dor/models/upgradable.rb +11 -11
- data/lib/dor/models/versionable.rb +16 -21
- data/lib/dor/models/workflow_object.rb +3 -3
- data/lib/dor/services/cleanup_reset_service.rb +32 -27
- data/lib/dor/services/digital_stacks_service.rb +3 -3
- data/lib/dor/services/merge_service.rb +4 -8
- data/lib/dor/services/metadata_handlers/catalog_handler.rb +1 -1
- data/lib/dor/services/metadata_handlers/mdtoolkit_handler.rb +4 -6
- data/lib/dor/services/metadata_service.rb +20 -22
- data/lib/dor/services/registration_service.rb +6 -8
- data/lib/dor/services/reset_workspace_service.rb +14 -16
- data/lib/dor/services/sdr_ingest_service.rb +2 -6
- data/lib/dor/services/search_service.rb +3 -3
- data/lib/dor/services/suri_service.rb +2 -3
- data/lib/dor/services/technical_metadata_service.rb +2 -3
- data/lib/dor/utils/ng_tidy.rb +6 -6
- 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 +27 -33
- data/lib/dor/workflow/graph.rb +34 -37
- data/lib/dor/workflow/process.rb +8 -8
- data/lib/tasks/rdoc.rake +5 -5
- metadata +4 -11
- data/bin/dor-indexer +0 -108
- data/bin/dor-indexerd +0 -73
- 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 -78
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MTIxOTE5NDBmNGMxNDI2OTg5ZWZiMzVhYWFlNmNlYWVkMjI0MTljZg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YjMzM2M1ZThjYjZmZjdjMjJjY2VlODM3OTYzMDg1MjZiOTNjMDE4Yg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YzBjMzFiOTU0YmY3OGE5ZDA1NzZlYWM5ZjYwNTMxYmU3MDM4MzkwOWI0MzVi
|
10
|
+
N2UyM2U5MTUxMzJjNjFjMjRkM2U3NTFjNWFhMDVkYTg5M2UyYmUxYzkzOTQ2
|
11
|
+
MGM5MTYxMDM1ZTIyY2U0MDYwNDJkODhiNDc4YWZiZjlhNTNkZTc=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NmE4ZjZjNjMwYTM1YTBhY2Q0MzJmZjQxNGZkOGVhMzUxYWQ0MTRmNDYwMTYy
|
14
|
+
NDgxNWVmMzFlOTAwMDkzOTNiMWE4MjQ1ZmJhNjc0NGFlMTY1NzI5MzQ5MDVk
|
15
|
+
NWU1NmJlZWNmODIzNjA1NDVmNzJmODcwNDA5ZDFiZmQ3ZjRlN2I=
|
data/lib/dor-services.rb
CHANGED
@@ -42,7 +42,7 @@ module Dor
|
|
42
42
|
doc_version = Gem::Version.new(doc_version)
|
43
43
|
object_type = Array(solr_doc[ActiveFedora::SolrService.solr_name('objectType', :symbol)]).first
|
44
44
|
object_class = registered_classes[object_type] || ActiveFedora::Base
|
45
|
-
if opts[:lightweight]
|
45
|
+
if opts[:lightweight] && doc_version >= Gem::Version.new('3.1.0')
|
46
46
|
begin
|
47
47
|
object_class.load_instance_from_solr solr_doc['id'], solr_doc
|
48
48
|
rescue Exception => e
|
@@ -115,7 +115,6 @@ module Dor
|
|
115
115
|
autoload :Releaseable, 'dor/models/releaseable'
|
116
116
|
autoload :Rightsable, 'dor/models/rightsable'
|
117
117
|
|
118
|
-
|
119
118
|
# ActiveFedora Classes
|
120
119
|
autoload :Abstract, 'dor/models/item'
|
121
120
|
autoload :Item, 'dor/models/item'
|
data/lib/dor/config.rb
CHANGED
@@ -70,7 +70,7 @@ module Dor
|
|
70
70
|
}
|
71
71
|
},
|
72
72
|
:sdr => {
|
73
|
-
:rest_client => Confstruct.deferred { |c| config.make_rest_client c.url }
|
73
|
+
:rest_client => Confstruct.deferred { |c| config.make_rest_client c.url }
|
74
74
|
},
|
75
75
|
:gsearch => {
|
76
76
|
:rest_client => Confstruct.deferred { |c| config.make_rest_client c.rest_url },
|
@@ -88,13 +88,12 @@ module Dor
|
|
88
88
|
config[:stomp][:host] ||= URI.parse(config.fedora.url).host rescue nil
|
89
89
|
|
90
90
|
[:cert_file, :key_file, :key_pass].each do |key|
|
91
|
+
next unless config.fedora[key].present?
|
91
92
|
stack = Kernel.caller.dup
|
92
93
|
stack.shift while stack[0] =~ %r{(active_support/callbacks|dor/config|dor-services)\.rb}
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
config.fedora.delete(key)
|
97
|
-
end
|
94
|
+
ActiveSupport::Deprecation.warn "Dor::Config -- fedora.#{key} is deprecated. Please use ssl.#{key} instead.", stack
|
95
|
+
config.ssl[key] = config.fedora[key] unless config.ssl[key].present?
|
96
|
+
config.fedora.delete(key)
|
98
97
|
end
|
99
98
|
|
100
99
|
if ActiveFedora.respond_to?(:configurator)
|
@@ -9,7 +9,7 @@ module Dor
|
|
9
9
|
t.stacks :path => '/contentMetadata/@stacks', :index_as => [:not_searchable]
|
10
10
|
t.resource(:index_as => [:not_searchable]) do
|
11
11
|
t.id_ :path => { :attribute => 'id' }
|
12
|
-
t.sequence :path => { :attribute => 'sequence' }#, :data_type => :integer
|
12
|
+
t.sequence :path => { :attribute => 'sequence' } #, :data_type => :integer
|
13
13
|
t.type_ :path => { :attribute => 'type' }, :index_as => [:displayable]
|
14
14
|
t.attribute(:path => 'attr', :index_as => [:not_searchable]) do
|
15
15
|
t.name :path => { :attribute => 'name' }, :index_as => [:not_searchable]
|
@@ -18,19 +18,19 @@ module Dor
|
|
18
18
|
t.id_ :path => { :attribute => 'id' }
|
19
19
|
t.mimeType :path => { :attribute => 'mimeType' }, :index_as => [:displayable]
|
20
20
|
t.dataType :path => { :attribute => 'dataType' }, :index_as => [:displayable]
|
21
|
-
t.size :path => { :attribute => 'size' }, :index_as => [:displayable]#, :data_type => :long
|
22
|
-
t.shelve :path => { :attribute => 'shelve' }, :index_as => [:not_searchable]#, :data_type => :boolean
|
23
|
-
t.publish :path => { :attribute => 'publish' }, :index_as => [:not_searchable]#, :data_type => :boolean
|
24
|
-
t.preserve :path => { :attribute => 'preserve' }, :index_as => [:not_searchable]#, :data_type => :boolean
|
21
|
+
t.size :path => { :attribute => 'size' }, :index_as => [:displayable] #, :data_type => :long
|
22
|
+
t.shelve :path => { :attribute => 'shelve' }, :index_as => [:not_searchable] #, :data_type => :boolean
|
23
|
+
t.publish :path => { :attribute => 'publish' }, :index_as => [:not_searchable] #, :data_type => :boolean
|
24
|
+
t.preserve :path => { :attribute => 'preserve' }, :index_as => [:not_searchable] #, :data_type => :boolean
|
25
25
|
t.checksum do
|
26
26
|
t.type_ :path => { :attribute => 'type' }
|
27
27
|
end
|
28
28
|
end
|
29
29
|
t.shelved_file(:path => 'file', :attributes => {:shelve=>'yes'}, :index_as => [:not_searchable]) do
|
30
|
-
t.id_ :path => { :attribute => 'id' }, :index_as => [:displayable, :
|
30
|
+
t.id_ :path => { :attribute => 'id' }, :index_as => [:displayable, :stored_searchable]
|
31
31
|
end
|
32
32
|
end
|
33
|
-
t.shelved_file_id :proxy => [:resource, :shelved_file, :id], :index_as => [:displayable, :
|
33
|
+
t.shelved_file_id :proxy => [:resource, :shelved_file, :id], :index_as => [:displayable, :stored_searchable]
|
34
34
|
end
|
35
35
|
|
36
36
|
def public_xml
|
@@ -75,7 +75,7 @@ module Dor
|
|
75
75
|
|
76
76
|
max = xml.search('//resource').map{ |node| node['sequence'].to_i }.max
|
77
77
|
#renumber all of the resources that will come after the newly added one
|
78
|
-
while max>position
|
78
|
+
while max>position
|
79
79
|
node=xml.search('//resource[@sequence=\'' + position + '\']')
|
80
80
|
node.first[sequence]=max+1 if node.length>0
|
81
81
|
max-=1
|
@@ -113,7 +113,7 @@ module Dor
|
|
113
113
|
res=xml.search('//resource[@sequence=\''+position.to_s+'\']')
|
114
114
|
break if res.length==0
|
115
115
|
res['sequence']=position.to_s
|
116
|
-
position
|
116
|
+
position+=1
|
117
117
|
end
|
118
118
|
self.content=xml.to_s
|
119
119
|
self.save
|
@@ -168,20 +168,17 @@ module Dor
|
|
168
168
|
preserved_size=0
|
169
169
|
counts = Hash.new(0) # default count is zero
|
170
170
|
resource_type_counts = Hash.new(0) # default count is zero
|
171
|
-
first_shelved_image=nil
|
171
|
+
first_shelved_image = nil
|
172
172
|
|
173
173
|
doc.xpath('contentMetadata/resource').sort { |a,b| a['sequence'].to_i <=> b['sequence'].to_i }.each do |resource|
|
174
|
-
counts['resource']+=1
|
175
|
-
resource_type_counts[resource['type']]+=1 if resource['type']
|
174
|
+
counts['resource'] += 1
|
175
|
+
resource_type_counts[resource['type']] += 1 if resource['type']
|
176
176
|
resource.xpath('file').each do |file|
|
177
|
-
counts['content_file']+=1
|
177
|
+
counts['content_file'] += 1
|
178
178
|
preserved_size += file['size'].to_i if file['preserve'] == 'yes'
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
first_shelved_image=file['id']
|
183
|
-
end
|
184
|
-
end
|
179
|
+
next unless file['shelve'] == 'yes'
|
180
|
+
counts['shelved_file'] += 1
|
181
|
+
first_shelved_image ||= file['id'] if file['id'].match(/jp2$/)
|
185
182
|
end
|
186
183
|
end
|
187
184
|
solr_doc["content_type_ssim" ] = doc.root['type']
|
@@ -216,7 +213,7 @@ module Dor
|
|
216
213
|
def update_resource_label resource_name, new_label
|
217
214
|
node = singular_node('//resource[@id=\''+resource_name+'\']')
|
218
215
|
labels = node.xpath('./label')
|
219
|
-
if(labels.length==0)
|
216
|
+
if (labels.length==0)
|
220
217
|
#create a label
|
221
218
|
label_node = Nokogiri::XML::Node.new('label',self.ng_xml)
|
222
219
|
label_node.content=new_label
|
@@ -12,19 +12,19 @@ class DescMetadataDS < ActiveFedora::OmDatastream
|
|
12
12
|
end
|
13
13
|
end
|
14
14
|
t.subject(:index_as => [:not_searchable]) do
|
15
|
-
t.geographic :index_as => [:stored_searchable]
|
16
|
-
t.topic :index_as => [:stored_searchable]
|
15
|
+
t.geographic :index_as => [:symbol, :stored_searchable]
|
16
|
+
t.topic :index_as => [:symbol, :stored_searchable]
|
17
17
|
t.temporal :index_as => [:stored_searchable]
|
18
18
|
end
|
19
19
|
t.title_info(:path=>"titleInfo") {
|
20
|
-
t.main_title(:index_as=>[:
|
20
|
+
t.main_title(:index_as=>[:symbol], :path=>"title", :label=>"title") {
|
21
21
|
t.main_title_lang(:path=>{:attribute=> "xml:lang"})
|
22
22
|
}
|
23
23
|
}
|
24
|
-
t.coordinates :index_as => [:
|
25
|
-
t.extent :index_as => [:
|
26
|
-
t.scale :index_as => [:
|
27
|
-
t.topic :index_as => [:stored_searchable]
|
24
|
+
t.coordinates :index_as => [:symbol]
|
25
|
+
t.extent :index_as => [:symbol]
|
26
|
+
t.scale :index_as => [:symbol]
|
27
|
+
t.topic :index_as => [:symbol, :stored_searchable]
|
28
28
|
t.abstract :index_as => [:stored_searchable]
|
29
29
|
end
|
30
30
|
|
@@ -9,7 +9,7 @@ class EmbargoMetadataDS < ActiveFedora::OmDatastream
|
|
9
9
|
t.embargo_status(:path => 'status', :index_as => [:symbol])
|
10
10
|
t.release_date(:path => "releaseDate", :index_as => [:dateable])
|
11
11
|
t.release_access(:path => "releaseAccess")
|
12
|
-
t.twenty_pct_status( :path => "twentyPctVisibilityStatus", :index_as => [:
|
12
|
+
t.twenty_pct_status( :path => "twentyPctVisibilityStatus", :index_as => [:symbol])
|
13
13
|
t.twenty_pct_release_date(:path => "twentyPctVisibilityReleaseDate")
|
14
14
|
end
|
15
15
|
|
@@ -96,15 +96,10 @@ class EmbargoMetadataDS < ActiveFedora::OmDatastream
|
|
96
96
|
find_by_terms(:release_access).first
|
97
97
|
end
|
98
98
|
|
99
|
-
# @return [Nokogiri::XML::Element] The releaseAccess node
|
100
|
-
def release_access_node
|
101
|
-
find_by_terms(:release_access).first
|
102
|
-
end
|
103
|
-
|
104
99
|
# Sets the embargaAccess node
|
105
100
|
# @param [Nokogiri::XML::Document] new_doc Document that will replace the existing releaseAccess node
|
106
101
|
def release_access_node=(new_doc)
|
107
|
-
if(new_doc.root.name != 'releaseAccess')
|
102
|
+
if (new_doc.root.name != 'releaseAccess')
|
108
103
|
raise "Trying to replace releaseAccess with a non-releaseAccess document"
|
109
104
|
end
|
110
105
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Dor
|
2
2
|
class EventsDS < ActiveFedora::OmDatastream
|
3
3
|
before_create :ensure_non_versionable
|
4
|
-
|
4
|
+
|
5
5
|
set_terminology do |t|
|
6
6
|
t.root(:path => 'events')
|
7
7
|
t.event do
|
@@ -11,30 +11,30 @@ class EventsDS < ActiveFedora::OmDatastream
|
|
11
11
|
t.message :path => 'text()', :index_as => [:displayable, :not_searchable]
|
12
12
|
end
|
13
13
|
end
|
14
|
-
|
15
|
-
# Default EventsDS xml
|
14
|
+
|
15
|
+
# Default EventsDS xml
|
16
16
|
def self.xml_template
|
17
17
|
builder = Nokogiri::XML::Builder.new do |xml|
|
18
18
|
xml.events
|
19
19
|
end
|
20
20
|
return builder.doc
|
21
21
|
end
|
22
|
-
|
22
|
+
|
23
23
|
def ensure_non_versionable
|
24
24
|
self.versionable = 'false'
|
25
25
|
end
|
26
|
-
|
26
|
+
|
27
27
|
# Adds an event to the datastream
|
28
28
|
# @param [String] type a tag used to group events together. Sets the type attribute for the event
|
29
29
|
# @param [String] who who is responsible for this event. Sets the who attribute for the event
|
30
30
|
# @param [String] message what happened. Sets the content of the event with this message
|
31
31
|
def add_event(type, who, message)
|
32
|
-
ev = ng_xml.create_element 'event', message,
|
32
|
+
ev = ng_xml.create_element 'event', message,
|
33
33
|
:type => type, :who => who, :when => Time.now.xmlschema
|
34
34
|
ng_xml.root.add_child(ev)
|
35
35
|
ng_xml_will_change!
|
36
36
|
end
|
37
|
-
|
37
|
+
|
38
38
|
# Finds events with the desired type attribute
|
39
39
|
# @param [String] tag events where type == tag will be returned
|
40
40
|
# @yield [who, timestamp, message] The values of the current event
|
@@ -46,7 +46,7 @@ class EventsDS < ActiveFedora::OmDatastream
|
|
46
46
|
block.call(node['who'], Time.parse(node['when']), node.content)
|
47
47
|
end
|
48
48
|
end
|
49
|
-
|
49
|
+
|
50
50
|
# Returns all the events in the datastream
|
51
51
|
# @yield [type, who, timestamp, message] The values of the current event
|
52
52
|
# @yieldparam [String] type tag for this particular event. Value of the 'type' attribute
|
@@ -58,6 +58,6 @@ class EventsDS < ActiveFedora::OmDatastream
|
|
58
58
|
block.call(node['type'], node['who'], Time.parse(node['when']), node.content)
|
59
59
|
end
|
60
60
|
end
|
61
|
-
|
61
|
+
|
62
62
|
end
|
63
63
|
end
|
@@ -1,10 +1,10 @@
|
|
1
1
|
module Dor
|
2
|
-
class IdentityMetadataDS < ActiveFedora::OmDatastream
|
2
|
+
class IdentityMetadataDS < ActiveFedora::OmDatastream
|
3
3
|
include SolrDocHelper
|
4
|
-
|
4
|
+
|
5
5
|
set_terminology do |t|
|
6
6
|
t.root(:path=>"identityMetadata")
|
7
|
-
t.objectId
|
7
|
+
t.objectId :index_as => [:symbol]
|
8
8
|
t.objectType :index_as => [:symbol]
|
9
9
|
t.objectLabel
|
10
10
|
t.citationCreator
|
@@ -16,53 +16,48 @@ class IdentityMetadataDS < ActiveFedora::OmDatastream
|
|
16
16
|
t.tag :index_as => [:symbol]
|
17
17
|
t.citationTitle
|
18
18
|
t.objectCreator :index_as => [:stored_searchable, :symbol]
|
19
|
-
t.adminPolicy
|
19
|
+
t.adminPolicy :index_as => [:not_searchable]
|
20
20
|
end
|
21
|
-
|
21
|
+
|
22
22
|
define_template :value do |builder,name,value,attrs|
|
23
23
|
builder.send(name.to_sym, value, attrs)
|
24
24
|
end
|
25
|
-
|
25
|
+
|
26
26
|
def self.xml_template
|
27
27
|
Nokogiri::XML('<identityMetadata/>')
|
28
|
-
end
|
29
|
-
|
28
|
+
end
|
29
|
+
|
30
30
|
def add_value(name, value, attrs={})
|
31
31
|
add_child_node(ng_xml.root, :value, name, value, attrs)
|
32
32
|
end
|
33
|
-
|
33
|
+
|
34
34
|
def objectId
|
35
35
|
self.find_by_terms(:objectId).text
|
36
36
|
end
|
37
|
-
|
37
|
+
|
38
38
|
def sourceId
|
39
39
|
node = self.find_by_terms(:sourceId).first
|
40
40
|
node ? [node['source'],node.text].join(':') : nil
|
41
41
|
end
|
42
|
-
|
42
|
+
|
43
43
|
def sourceId=(value)
|
44
44
|
node = self.find_by_terms(:sourceId).first
|
45
|
-
unless value.present?
|
45
|
+
unless value.present? # so setting it to '' is the same as removal: worth documenting maybe?
|
46
46
|
node.remove unless node.nil?
|
47
|
-
nil
|
48
|
-
else
|
49
|
-
(source,val) = value.split(/:/,2)
|
50
|
-
unless source.present? and value.present?
|
51
|
-
raise ArgumentError, "Source ID must follow the format namespace:value"
|
52
|
-
end
|
53
|
-
node = ng_xml.root.add_child('<sourceId/>').first if node.nil?
|
54
|
-
node['source'] = source
|
55
|
-
node.content = val
|
56
|
-
node
|
47
|
+
return nil
|
57
48
|
end
|
49
|
+
(source, val) = value.split(/:/, 2)
|
50
|
+
raise ArgumentError, "Source ID must follow the format namespace:value, not '#{value}'" unless source.present? && val.present?
|
51
|
+
node ||= ng_xml.root.add_child('<sourceId/>').first
|
52
|
+
node['source'] = source
|
53
|
+
node.content = val
|
54
|
+
node
|
58
55
|
end
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
result << node.content
|
63
|
-
end
|
64
|
-
result
|
56
|
+
|
57
|
+
def tags
|
58
|
+
self.ng_xml.search('//tag').collect(&:content)
|
65
59
|
end
|
60
|
+
|
66
61
|
def otherId(type = nil)
|
67
62
|
result = self.find_by_terms(:otherId).to_a
|
68
63
|
if type.nil?
|
@@ -73,13 +68,13 @@ class IdentityMetadataDS < ActiveFedora::OmDatastream
|
|
73
68
|
end
|
74
69
|
|
75
70
|
def add_otherId(other_id)
|
76
|
-
(name,val) = other_id.split(/:/,2)
|
71
|
+
(name, val) = other_id.split(/:/, 2)
|
77
72
|
node = ng_xml.root.add_child('<otherId/>').first
|
78
73
|
node['name'] = name
|
79
74
|
node.content = val
|
80
75
|
node
|
81
76
|
end
|
82
|
-
|
77
|
+
|
83
78
|
def to_solr(solr_doc=Hash.new, *args)
|
84
79
|
super(solr_doc, *args)
|
85
80
|
|
@@ -102,21 +97,21 @@ class IdentityMetadataDS < ActiveFedora::OmDatastream
|
|
102
97
|
add_solr_value(solr_doc, "identifier", qid, :symbol, [:stored_searchable])
|
103
98
|
add_solr_value(solr_doc, "#{name}_id", id, :symbol, [])
|
104
99
|
}
|
105
|
-
|
100
|
+
|
106
101
|
# do some stuff to make tags in general and project tags specifically more easily searchable and facetable
|
107
102
|
self.find_by_terms(:tag).each { |tag|
|
108
103
|
(prefix, rest) = tag.text.split(/:/, 2)
|
109
104
|
prefix = prefix.downcase.strip.gsub(/\s/,'_')
|
110
105
|
unless rest.nil?
|
111
|
-
# this part will index a value in a field specific to the tag, e.g. registered_by_tag_*,
|
106
|
+
# this part will index a value in a field specific to the tag, e.g. registered_by_tag_*,
|
112
107
|
# book_tag_*, project_tag_*, remediated_by_tag_*, etc. project_tag_* and registered_by_tag_*
|
113
|
-
# definitley get used, but most don't. we can limit the prefixes that get solrized if things
|
108
|
+
# definitley get used, but most don't. we can limit the prefixes that get solrized if things
|
114
109
|
# get out of hand.
|
115
110
|
add_solr_value(solr_doc, "#{prefix}_tag", rest.strip, :symbol, [])
|
116
111
|
end
|
117
112
|
|
118
113
|
# solrize each possible prefix for the tag, inclusive of the full tag.
|
119
|
-
# e.g., for a tag such as "A : B : C", this will solrize to an _ssim field
|
114
|
+
# e.g., for a tag such as "A : B : C", this will solrize to an _ssim field
|
120
115
|
# that contains ["A", "A : B", "A : B : C"].
|
121
116
|
tag_parts = tag.text.split(/:/)
|
122
117
|
progressive_tag_prefix = ''
|
@@ -65,7 +65,7 @@ module Dor
|
|
65
65
|
# slight misnomer: also sets discover rights!
|
66
66
|
# TODO: convert xpath reads to dra_object calls
|
67
67
|
def set_read_rights(rights)
|
68
|
-
raise(ArgumentError, "Argument '#{rights}' is not a recognized value") unless
|
68
|
+
raise(ArgumentError, "Argument '#{rights}' is not a recognized value") unless %w(world stanford none dark).include? rights
|
69
69
|
rights_xml = self.ng_xml
|
70
70
|
if (rights_xml.search('//rightsMetadata/access[@type=\'read\']').length==0)
|
71
71
|
raise('The rights metadata stream doesnt contain an entry for machine read permissions. Consider populating it from the APO before trying to change it.')
|
@@ -24,25 +24,24 @@ class SimpleDublinCoreDs < ActiveFedora::OmDatastream
|
|
24
24
|
def to_solr(solr_doc=Hash.new, *args)
|
25
25
|
# There are a whole bunch of namespace-related things that can go
|
26
26
|
# wrong with this terminology. Until it's fixed in OM, ignore them all.
|
27
|
-
begin
|
28
|
-
doc = super solr_doc, *args
|
29
27
|
|
30
|
-
|
31
|
-
add_solr_value(doc, 'dc_creator', self.creator.first, :string, [:stored_sortable, :stored_searchable])
|
28
|
+
doc = super solr_doc, *args
|
32
29
|
|
33
|
-
|
30
|
+
add_solr_value(doc, 'dc_title', self.title.first, :string, [:stored_sortable, :stored_searchable])
|
31
|
+
add_solr_value(doc, 'dc_creator', self.creator.first, :string, [:stored_sortable, :stored_searchable])
|
34
32
|
|
35
|
-
|
33
|
+
identifiers = {}
|
36
34
|
|
37
|
-
|
38
|
-
add_solr_value(doc, "dc_identifier_#{ns}", val, :string, [:stored_sortable, :stored_searchable])
|
39
|
-
end
|
35
|
+
self.identifier.each { |i| ns, val = i.split(":"); identifiers[ns] ||= val }
|
40
36
|
|
41
|
-
|
42
|
-
|
43
|
-
warn "ERROR in SimpleDublinCoreDs to_solr()! #{e}"
|
44
|
-
solr_doc
|
37
|
+
identifiers.each do |ns, val|
|
38
|
+
add_solr_value(doc, "dc_identifier_#{ns}", val, :string, [:stored_sortable, :stored_searchable])
|
45
39
|
end
|
40
|
+
|
41
|
+
return doc
|
42
|
+
rescue Exception => e
|
43
|
+
warn "ERROR in SimpleDublinCoreDs to_solr()! #{e}"
|
44
|
+
solr_doc
|
46
45
|
end
|
47
46
|
end
|
48
47
|
end
|