Class: Resource
- Inherits:
-
ActiveFedora::Base
- Object
- ActiveFedora::Base
- Resource
- Includes:
- ActiveFedora::DatastreamCollections, ActiveFedora::FinderMethods::RepositoryMethods, Cul::Hydra::Models::Common, Cul::Hydra::Models::ImageResource, Cul::Hydra::Models::Resource
- Defined in:
- app/models/resource.rb
Constant Summary
Constants included from Cul::Hydra::Models::ImageResource
Cul::Hydra::Models::ImageResource::DEGREES_TO_EXIF_ORIENTATIONS, Cul::Hydra::Models::ImageResource::DJATOKA_BASE_URL, Cul::Hydra::Models::ImageResource::DJATOKA_THUMBNAIL_PARMS, Cul::Hydra::Models::ImageResource::EXIF_ORIENTATION_TO_DEGREES, Cul::Hydra::Models::ImageResource::EXTENT_PREDICATE, Cul::Hydra::Models::ImageResource::FORMAT_OF_PREDICATE, Cul::Hydra::Models::ImageResource::FORMAT_URI, Cul::Hydra::Models::ImageResource::IMAGE_EXT, Cul::Hydra::Models::ImageResource::LENGTH, Cul::Hydra::Models::ImageResource::LENGTH_PREDICATE, Cul::Hydra::Models::ImageResource::WIDTH, Cul::Hydra::Models::ImageResource::WIDTH_PREDICATE
Constants included from Cul::Hydra::Models::Resource
Cul::Hydra::Models::Resource::IMAGE_MIME_TYPES
Instance Method Summary collapse
- #index_type_label ⇒ Object
-
#route_as ⇒ Object
CUL_WIDTH = “purl.oclc.org/NET/CUL/RESOURCE/STILLIMAGE/BASIC/imageWidth” CUL_LENGTH = “purl.oclc.org/NET/CUL/RESOURCE/STILLIMAGE/BASIC/imageLength” FORMAT = “purl.org/dc/elements/1.1/format” MEMBER_OF = “purl.oclc.org/NET/CUL/memberOf”.
-
#set_title(new_title, opts = {}) ⇒ Object
Set the title and label on the current object.
- #set_title_and_label(new_title, opts = {}) ⇒ Object
- #thumbnail_info ⇒ Object
- #to_solr(solr_doc = Hash.new, opts = {}) ⇒ Object
Methods included from Cul::Hydra::Models::ImageResource
#length, #long, #orientation, #orientation=, #required_rotation_for_upright_display, #width, #zooming?
Methods included from Cul::Hydra::Models::Resource
Methods included from Cul::Hydra::Models::Common
#cmodel_pid, #datastreams_in_fedora, #has_desc?, #initialize, #label=, #rdf_type, #set_size_labels, #update_datastream_attributes
Instance Method Details
#index_type_label ⇒ Object
25 26 27 |
# File 'app/models/resource.rb', line 25 def index_type_label "FILE RESOURCE" end |
#route_as ⇒ Object
CUL_WIDTH = “purl.oclc.org/NET/CUL/RESOURCE/STILLIMAGE/BASIC/imageWidth”
CUL_LENGTH = "http://purl.oclc.org/NET/CUL/RESOURCE/STILLIMAGE/BASIC/imageLength"
FORMAT = "http://purl.org/dc/elements/1.1/format"
MEMBER_OF = "http://purl.oclc.org/NET/CUL/memberOf"
21 22 23 |
# File 'app/models/resource.rb', line 21 def route_as "resource" end |
#set_title(new_title, opts = {}) ⇒ Object
Set the title and label on the current object
53 54 55 56 57 58 59 60 61 62 |
# File 'app/models/resource.rb', line 53 def set_title(new_title, opts={}) if has_desc? = self.datastreams["descMetadata"] if .respond_to?(:title_values) .title_values = new_title else .title = new_title end end end |
#set_title_and_label(new_title, opts = {}) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 |
# File 'app/models/resource.rb', line 37 def set_title_and_label(new_title, opts={}) if opts[:only_if_blank] if self.label.nil? || self.label.empty? self.label = new_title self.set_title( new_title ) end else self.label = new_title set_title( new_title ) end end |
#thumbnail_info ⇒ Object
64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'app/models/resource.rb', line 64 def thumbnail_info # do the triples indicate this is a thumb? fetch if long <= 251 mime = object_relations[FORMAT].first url = {:url=>"#{ActiveFedora.fedora_config[:url]}/objects/#{self.pid}/datastreams/CONTENT/content", :mime=>mime} else if object_relations[MEMBER_OF].blank? return {:url=>image_url("cul_scv_hydra/crystal/file.png"),:mime=>'image/png'} else url = ActiveFedora::Base.find(parents.first, :cast => true).thumbnail_info end end return url end |
#to_solr(solr_doc = Hash.new, opts = {}) ⇒ Object
29 30 31 32 33 34 35 |
# File 'app/models/resource.rb', line 29 def to_solr(solr_doc = Hash.new, opts={}) super unless solr_doc["extent_ssi"] || self.datastreams["CONTENT"].nil? solr_doc["extent_ssi"] = [self.datastreams["CONTENT"].size] end solr_doc end |