Class: Collection

Inherits:
ActiveFedora::Base show all
Includes:
CurationConcern::CollectionModel, Hydra::Collection, Hydra::Collections::Collectible, Hydra::Derivatives
Defined in:
app/repository_models/collection.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from CurationConcern::CollectionModel

#add_member, #add_relationship, #remove_member, #to_s

Methods included from CurationConcern::HumanReadableType

#human_readable_type

Methods included from ActiveFedora::Base::SoftDeleteBehavior

#exists?

Instance Attribute Details

#fileObject

Returns the value of attribute file.



12
13
14
# File 'app/repository_models/collection.rb', line 12

def file
  @file
end

#mime_typeObject

Returns the value of attribute mime_type.



11
12
13
# File 'app/repository_models/collection.rb', line 11

def mime_type
  @mime_type
end

Instance Method Details

#add_profile_imageObject



22
23
24
25
26
27
28
# File 'app/repository_models/collection.rb', line 22

def add_profile_image
  if file
    self.content.content = file
    self.mime_type = file.content_type
    generate_derivatives
  end
end

#can_be_member_of_collection?(collection) ⇒ Boolean

Returns:

  • (Boolean)


18
19
20
# File 'app/repository_models/collection.rb', line 18

def can_be_member_of_collection?(collection)
  collection == self ? false : true
end

#representativeObject



42
43
44
# File 'app/repository_models/collection.rb', line 42

def representative
  to_param
end

#representative_image_urlObject



30
31
32
# File 'app/repository_models/collection.rb', line 30

def representative_image_url
  generate_thumbnail_url if self.thumbnail.content.present?
end

#to_solr(solr_doc = {}, opts = {}) ⇒ Object



34
35
36
37
38
39
40
# File 'app/repository_models/collection.rb', line 34

def to_solr(solr_doc={}, opts={})
  super(solr_doc, opts)
  Solrizer.set_field(solr_doc, 'generic_type', 'Collection', :facetable)
  solr_doc[Solrizer.solr_name('representative', :stored_searchable)] = self.representative
  solr_doc[Solrizer.solr_name('representative_image_url', :stored_searchable)] = self.representative_image_url
  solr_doc
end