Sha256: 585b43899cdcd86b110693d9602b8f47bd595df60efe71ab09da00a6303bbbaf

Contents?: true

Size: 1.09 KB

Versions: 11

Compression:

Stored size: 1.09 KB

Contents

module Hydra::ModelMixins
  module SolrDocumentExtension
    extend Deprecation
    self.deprecation_horizon = 'hydra-head 7.0.0'

    def document_type display_type = CatalogController.blacklight_config.show.display_type
      type = self.fetch(:medium_t, nil)

      type ||= self.fetch(display_type, nil) if display_type

      type.first.to_s.gsub("info:fedora/afmodel:","").gsub("Hydrangea","").gsub(/^Generic/,"")
    end
    deprecation_deprecate :document_type

    def get_person_from_role(role, opts={})
      i = 0
      while i < 10
        persons_roles = self["person_#{i}_role_t"].map{|w|w.strip.downcase} unless self["person_#{i}_role_t"].nil?
        if persons_roles and persons_roles.include?(role.downcase)
          return {:first=>self["person_#{i}_first_name_t"], :last=>self["person_#{i}_last_name_t"]}
        end
        i += 1
      end
    end
    deprecation_deprecate :get_person_from_role

    def get_file_asset_count()
      ActiveFedora::Base.count(:conditions=>"is_part_of_t:#{ActiveFedora::Base.quote_for_solr(id)}")
    end
    deprecation_deprecate :get_file_asset_count
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
hydra-core-6.5.2 lib/hydra/model_mixins/solr_document_extension.rb
hydra-core-6.5.1 lib/hydra/model_mixins/solr_document_extension.rb
hydra-core-6.4.2 lib/hydra/model_mixins/solr_document_extension.rb
hydra-core-6.5.0 lib/hydra/model_mixins/solr_document_extension.rb
hydra-core-6.5.0.rc2 lib/hydra/model_mixins/solr_document_extension.rb
hydra-core-6.4.1 lib/hydra/model_mixins/solr_document_extension.rb
hydra-core-6.4.0 lib/hydra/model_mixins/solr_document_extension.rb
hydra-core-6.4.0.rc5 lib/hydra/model_mixins/solr_document_extension.rb
hydra-core-6.4.0.rc4 lib/hydra/model_mixins/solr_document_extension.rb
hydra-core-6.4.0.rc3 lib/hydra/model_mixins/solr_document_extension.rb
hydra-core-6.4.0.rc2 lib/hydra/model_mixins/solr_document_extension.rb