Sha256: 83db2a5a82b6ced6bc3f1be6051b567a3a05f65f73654853806c10f28d482b36
Contents?: true
Size: 975 Bytes
Versions: 6
Compression:
Stored size: 975 Bytes
Contents
require "active-fedora" require "active_fedora_finders" class GenericAggregator < ::ActiveFedora::Base include ::ActiveFedora::Finders include ::ActiveFedora::DatastreamCollections include ::Hydra::ModelMethods include Cul::Scv::Hydra::Models::Common include Cul::Scv::Hydra::Models::Aggregator has_many :parts, :property => :cul_member_of, :class_name=>'ActiveFedora::Base' def route_as "multipartitem" end def index_type_label riquery = Cul::Scv::Hydra::Models::MEMBER_ITQL.gsub(/%PID%/, self.pid) begin docs = Cul::Scv::Fedora.repository.find_by_itql riquery, limit: 2, format: json docs = JSON.parse(docs)['results'] rescue Exception=>e Rails.logger.warn("#{self.class.name} failed to find children with TQL: #{e.message}") docs = self.parts end if docs.size == 0 label = "EMPTY" elsif docs.size == 1 label = "SINGLE PART" else label = "MULTIPART" end label end end
Version data entries
6 entries across 6 versions & 1 rubygems