Sha256: 824727609b40371a8bdc35508dc441e04a2217e2ef7986b2490fb2fd1704de0e

Contents?: true

Size: 545 Bytes

Versions: 62

Compression:

Stored size: 545 Bytes

Contents

module CurationConcerns
  class ParentService
    # @param [String] the id of a child FileSet
    # @return [ActiveFedora::Base] the parent object
    def self.parent_for(id)
      ids = ordered_by_ids(id)
      ActiveFedora::Base.find(ordered_by_ids(id).first) if ids.present?
    end

    def self.ordered_by_ids(id)
      if id.present?
        ActiveFedora::SolrService.query("{!join from=proxy_in_ssi to=id}ordered_targets_ssim:#{id}")
                                 .map { |x| x["id"] }
      else
        []
      end
    end
  end
end

Version data entries

62 entries across 62 versions & 1 rubygems

Version Path
curation_concerns-1.7.8 app/services/curation_concerns/parent_service.rb
curation_concerns-1.7.7 app/services/curation_concerns/parent_service.rb
curation_concerns-2.0.0 app/services/curation_concerns/parent_service.rb
curation_concerns-2.0.0.rc2 app/services/curation_concerns/parent_service.rb
curation_concerns-1.7.6 app/services/curation_concerns/parent_service.rb
curation_concerns-1.7.5 app/services/curation_concerns/parent_service.rb
curation_concerns-1.7.4 app/services/curation_concerns/parent_service.rb
curation_concerns-1.7.3 app/services/curation_concerns/parent_service.rb
curation_concerns-1.7.2 app/services/curation_concerns/parent_service.rb
curation_concerns-2.0.0.rc1 app/services/curation_concerns/parent_service.rb
curation_concerns-1.7.1 app/services/curation_concerns/parent_service.rb
curation_concerns-1.7.0 app/services/curation_concerns/parent_service.rb
curation_concerns-1.7.0.beta1 app/services/curation_concerns/parent_service.rb
curation_concerns-1.6.3 app/services/curation_concerns/parent_service.rb
curation_concerns-1.6.2 app/services/curation_concerns/parent_service.rb
curation_concerns-1.6.1 app/services/curation_concerns/parent_service.rb
curation_concerns-1.6.0 app/services/curation_concerns/parent_service.rb
curation_concerns-1.5.0 app/services/curation_concerns/parent_service.rb
curation_concerns-1.4.0 app/services/curation_concerns/parent_service.rb
curation_concerns-1.3.3 app/services/curation_concerns/parent_service.rb