Module: Hyrax::SolrDocumentBehavior
Defined Under Namespace
Classes: ModelWrapper
Instance Method Summary
collapse
#alpha_channels, #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
#end_note_format, #endnote_filename, #export_as_endnote, #persistent_url
#private?, #public?, #registered?
Instance Method Details
#admin_set? ⇒ Boolean
78
79
80
|
# File 'app/models/concerns/hyrax/solr_document_behavior.rb', line 78
def admin_set?
hydra_model == ::AdminSet
end
|
#collection? ⇒ Boolean
66
67
68
|
# File 'app/models/concerns/hyrax/solr_document_behavior.rb', line 66
def collection?
hydra_model == ::Collection
end
|
#collection_type_gid ⇒ Object
115
116
117
|
# File 'app/models/concerns/hyrax/solr_document_behavior.rb', line 115
def collection_type_gid
first('collection_type_gid_ssim')
end
|
#creator ⇒ Object
92
93
94
95
96
97
98
99
|
# File 'app/models/concerns/hyrax/solr_document_behavior.rb', line 92
def creator
descriptor = if hydra_model == AdminSet
hydra_model.index_config[:creator].behaviors.first
else
:stored_searchable
end
fetch(Solrizer.solr_name('creator', descriptor), [])
end
|
#depositor(default = '') ⇒ Object
87
88
89
90
|
# File 'app/models/concerns/hyrax/solr_document_behavior.rb', line 87
def depositor(default = '')
val = first(Solrizer.solr_name('depositor'))
val.present? ? val : default
end
|
#file_set? ⇒ Boolean
72
73
74
|
# File 'app/models/concerns/hyrax/solr_document_behavior.rb', line 72
def file_set?
hydra_model == ::FileSet
end
|
#hydra_model ⇒ Object
Method to return the ActiveFedora model
83
84
85
|
# File 'app/models/concerns/hyrax/solr_document_behavior.rb', line 83
def hydra_model
first(Solrizer.solr_name('has_model', :symbol)).constantize
end
|
#itemtype ⇒ Object
Add a schema.org itemtype
11
12
13
14
|
# File 'app/models/concerns/hyrax/solr_document_behavior.rb', line 11
def itemtype
types = resource_type || []
ResourceTypesService.microdata_type(types.first)
end
|
#title_or_label ⇒ Object
16
17
18
19
|
# File 'app/models/concerns/hyrax/solr_document_behavior.rb', line 16
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).
60
61
62
|
# File 'app/models/concerns/hyrax/solr_document_behavior.rb', line 60
def to_model
@model ||= ModelWrapper.new(hydra_model, id)
end
|
#to_param ⇒ Object
21
22
23
|
# File 'app/models/concerns/hyrax/solr_document_behavior.rb', line 21
def to_param
id
end
|
#to_s ⇒ Object
25
26
27
|
# File 'app/models/concerns/hyrax/solr_document_behavior.rb', line 25
def to_s
title_or_label
end
|
#visibility ⇒ Object
101
102
103
104
105
106
107
108
109
110
111
112
113
|
# File 'app/models/concerns/hyrax/solr_document_behavior.rb', line 101
def visibility
@visibility ||= if embargo_release_date.present?
Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_EMBARGO
elsif lease_expiration_date.present?
Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_LEASE
elsif public?
Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC
elsif registered?
Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_AUTHENTICATED
else
Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PRIVATE
end
end
|