Module: CurationConcerns::SolrDocumentBehavior
Defined Under Namespace
Classes: ModelWrapper
Instance Method Summary
collapse
#byte_order, #capture_device, #color_map, #color_space, #compression, #duration, #file_size, #file_title, #filename, #format_label, #gps_timestamp, #height, #image_producer, #last_modified, #latitude, #longitude, #orientation, #original_checksum, #page_count, #profile_name, #profile_version, #sample_rate, #scanning_software, #well_formed, #width
Instance Method Details
#collection? ⇒ Boolean
55
56
57
|
# File 'app/models/concerns/curation_concerns/solr_document_behavior.rb', line 55
def collection?
hydra_model == ::Collection
end
|
#contributor ⇒ Object
119
120
121
|
# File 'app/models/concerns/curation_concerns/solr_document_behavior.rb', line 119
def contributor
fetch(Solrizer.solr_name('contributor'), [])
end
|
#creator ⇒ Object
114
115
116
117
|
# File 'app/models/concerns/curation_concerns/solr_document_behavior.rb', line 114
def creator
descriptor = hydra_model.index_config[:creator].behaviors.first
fetch(Solrizer.solr_name('creator', descriptor), [])
end
|
#date_created ⇒ Object
Date created is indexed as a string. This allows users to enter values like: ‘Circa 1840-1844’
81
82
83
|
# File 'app/models/concerns/curation_concerns/solr_document_behavior.rb', line 81
def date_created
first(Solrizer.solr_name("date_created"))
end
|
#date_modified ⇒ Object
85
86
87
|
# File 'app/models/concerns/curation_concerns/solr_document_behavior.rb', line 85
def date_modified
date_field('date_modified')
end
|
#date_uploaded ⇒ Object
89
90
91
|
# File 'app/models/concerns/curation_concerns/solr_document_behavior.rb', line 89
def date_uploaded
date_field('date_uploaded')
end
|
#depositor(default = '') ⇒ Object
93
94
95
96
|
# File 'app/models/concerns/curation_concerns/solr_document_behavior.rb', line 93
def depositor(default = '')
val = first(Solrizer.solr_name('depositor'))
val.present? ? val : default
end
|
#description ⇒ Object
102
103
104
|
# File 'app/models/concerns/curation_concerns/solr_document_behavior.rb', line 102
def description
Array.wrap(self[Solrizer.solr_name('description')])
end
|
#embargo_release_date ⇒ Object
139
140
141
|
# File 'app/models/concerns/curation_concerns/solr_document_behavior.rb', line 139
def embargo_release_date
self[Hydra.config.permissions.embargo.release_date]
end
|
110
111
112
|
# File 'app/models/concerns/curation_concerns/solr_document_behavior.rb', line 110
def file_format
first(Solrizer.solr_name('file_format'))
end
|
#human_readable_type ⇒ Object
68
69
70
|
# File 'app/models/concerns/curation_concerns/solr_document_behavior.rb', line 68
def human_readable_type
first(Solrizer.solr_name('human_readable_type', :stored_searchable))
end
|
#hydra_model ⇒ Object
Method to return the ActiveFedora model
64
65
66
|
# File 'app/models/concerns/curation_concerns/solr_document_behavior.rb', line 64
def hydra_model
first(Solrizer.solr_name('has_model', :symbol)).constantize
end
|
#keyword ⇒ Object
135
136
137
|
# File 'app/models/concerns/curation_concerns/solr_document_behavior.rb', line 135
def keyword
fetch(Solrizer.solr_name('keyword'), [])
end
|
#label ⇒ Object
106
107
108
|
# File 'app/models/concerns/curation_concerns/solr_document_behavior.rb', line 106
def label
first(Solrizer.solr_name('label'))
end
|
#language ⇒ Object
131
132
133
|
# File 'app/models/concerns/curation_concerns/solr_document_behavior.rb', line 131
def language
fetch(Solrizer.solr_name('language'), [])
end
|
#lease_expiration_date ⇒ Object
143
144
145
|
# File 'app/models/concerns/curation_concerns/solr_document_behavior.rb', line 143
def lease_expiration_date
self[Hydra.config.permissions.lease.expiration_date]
end
|
#member_of_collection_ids ⇒ Object
177
178
179
|
# File 'app/models/concerns/curation_concerns/solr_document_behavior.rb', line 177
def member_of_collection_ids
fetch(Solrizer.solr_name('member_of_collection_ids', :symbol), [])
end
|
#mime_type ⇒ Object
151
152
153
|
# File 'app/models/concerns/curation_concerns/solr_document_behavior.rb', line 151
def mime_type
self[Solrizer.solr_name('mime_type', :stored_sortable)]
end
|
#publisher ⇒ Object
127
128
129
|
# File 'app/models/concerns/curation_concerns/solr_document_behavior.rb', line 127
def publisher
fetch(Solrizer.solr_name('publisher'), [])
end
|
#read_groups ⇒ Object
155
156
157
|
# File 'app/models/concerns/curation_concerns/solr_document_behavior.rb', line 155
def read_groups
fetch(Hydra.config.permissions.read.group, [])
end
|
#representative_id ⇒ Object
72
73
74
|
# File 'app/models/concerns/curation_concerns/solr_document_behavior.rb', line 72
def representative_id
first(Solrizer.solr_name('hasRelatedMediaFragment', :symbol))
end
|
#rights ⇒ Object
147
148
149
|
# File 'app/models/concerns/curation_concerns/solr_document_behavior.rb', line 147
def rights
fetch(Solrizer.solr_name('rights'), [])
end
|
#source ⇒ Object
159
160
161
|
# File 'app/models/concerns/curation_concerns/solr_document_behavior.rb', line 159
def source
fetch(Solrizer.solr_name('source'), [])
end
|
#subject ⇒ Object
123
124
125
|
# File 'app/models/concerns/curation_concerns/solr_document_behavior.rb', line 123
def subject
fetch(Solrizer.solr_name('subject'), [])
end
|
#suppressed? ⇒ Boolean
59
60
61
|
# File 'app/models/concerns/curation_concerns/solr_document_behavior.rb', line 59
def suppressed?
first(Solrizer.solr_name('suppressed', stored_boolean_field))
end
|
#thumbnail_id ⇒ Object
76
77
78
|
# File 'app/models/concerns/curation_concerns/solr_document_behavior.rb', line 76
def thumbnail_id
first(Solrizer.solr_name('hasRelatedImage', :symbol))
end
|
#title ⇒ Object
98
99
100
|
# File 'app/models/concerns/curation_concerns/solr_document_behavior.rb', line 98
def title
Array.wrap(self[Solrizer.solr_name('title')])
end
|
#title_or_label ⇒ Object
7
8
9
10
|
# File 'app/models/concerns/curation_concerns/solr_document_behavior.rb', line 7
def title_or_label
return label if title.blank?
title.join(', ')
end
|
#to_model ⇒ Object
Offer the source (ActiveFedora-based) model to Rails for some of the Rails methods (e.g. link_to).
51
52
53
|
# File 'app/models/concerns/curation_concerns/solr_document_behavior.rb', line 51
def to_model
@model ||= ModelWrapper.new(hydra_model, id)
end
|
#to_param ⇒ Object
12
13
14
|
# File 'app/models/concerns/curation_concerns/solr_document_behavior.rb', line 12
def to_param
id
end
|
#to_s ⇒ Object
16
17
18
|
# File 'app/models/concerns/curation_concerns/solr_document_behavior.rb', line 16
def to_s
title_or_label
end
|
#visibility ⇒ Object
163
164
165
166
167
168
169
170
171
|
# File 'app/models/concerns/curation_concerns/solr_document_behavior.rb', line 163
def visibility
@visibility ||= if read_groups.include? Hydra::AccessControls::AccessRight::PERMISSION_TEXT_VALUE_PUBLIC
Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC
elsif read_groups.include? Hydra::AccessControls::AccessRight::PERMISSION_TEXT_VALUE_AUTHENTICATED
Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_AUTHENTICATED
else
Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PRIVATE
end
end
|
#workflow_state ⇒ Object
173
174
175
|
# File 'app/models/concerns/curation_concerns/solr_document_behavior.rb', line 173
def workflow_state
first(Solrizer.solr_name('workflow_state_name', :symbol))
end
|