module Hydra::Works::CollectionBehavior

8) Hydra::Works::Collection can have descriptive metadata 9) Hydra::Works::Collection can have access metadata

Public Class Methods

type_validator() click to toggle source
Calls superclass method
# File lib/hydra/works/models/concerns/collection_behavior.rb, line 20
def self.type_validator
  Hydra::PCDM::Validators::CompositeValidator.new(
    super,
    Hydra::Works::NotFileSetValidator
  )
end

Public Instance Methods

child_collection_ids() click to toggle source
# File lib/hydra/works/models/concerns/collection_behavior.rb, line 43
def child_collection_ids
  collection_ids + member_collection_ids
end
child_collections() click to toggle source
# File lib/hydra/works/models/concerns/collection_behavior.rb, line 39
def child_collections
  collections + member_collections
end
child_work_ids() click to toggle source
# File lib/hydra/works/models/concerns/collection_behavior.rb, line 51
def child_work_ids
  work_ids + member_work_ids
end
child_works() click to toggle source
# File lib/hydra/works/models/concerns/collection_behavior.rb, line 47
def child_works
  works + member_works
end
collection?() click to toggle source

@return [Boolean] whether this instance is a Hydra::Works Collection.

# File lib/hydra/works/models/concerns/collection_behavior.rb, line 92
def collection?
  true
end
file_set?() click to toggle source

@return [Boolean] whether this instance is a Hydra::Works::FileSet.

# File lib/hydra/works/models/concerns/collection_behavior.rb, line 102
def file_set?
  false
end
member_collection_ids() click to toggle source
# File lib/hydra/works/models/concerns/collection_behavior.rb, line 77
def member_collection_ids
  member_collections.map(&:id)
end
member_collections() click to toggle source
# File lib/hydra/works/models/concerns/collection_behavior.rb, line 71
def member_collections
  return [] if id.nil?
  member_objects = ActiveFedora::Base.where('member_of_collection_ids_ssim' => id)
  member_objects.select(&:collection?).to_a
end
member_work_ids() click to toggle source
# File lib/hydra/works/models/concerns/collection_behavior.rb, line 87
def member_work_ids
  member_works.map(&:id)
end
member_works() click to toggle source
# File lib/hydra/works/models/concerns/collection_behavior.rb, line 81
def member_works
  return [] if id.nil?
  member_objects = ActiveFedora::Base.where('member_of_collection_ids_ssim' => id)
  member_objects.select(&:work?).to_a
end
ordered_work_ids() click to toggle source
# File lib/hydra/works/models/concerns/collection_behavior.rb, line 59
def ordered_work_ids
  ordered_works.map(&:id)
end
ordered_works() click to toggle source
# File lib/hydra/works/models/concerns/collection_behavior.rb, line 55
def ordered_works
  ordered_members.to_a.select(&:work?)
end
parent_collection_ids() click to toggle source
# File lib/hydra/works/models/concerns/collection_behavior.rb, line 35
def parent_collection_ids
  in_collection_ids + member_of_collection_ids
end
parent_collections() click to toggle source
# File lib/hydra/works/models/concerns/collection_behavior.rb, line 31
def parent_collections
  in_collections + member_of_collections
end
work?() click to toggle source

@return [Boolean] whether this instance is a Hydra::Works Generic Work.

# File lib/hydra/works/models/concerns/collection_behavior.rb, line 97
def work?
  false
end
work_ids() click to toggle source
# File lib/hydra/works/models/concerns/collection_behavior.rb, line 67
def work_ids
  works.map(&:id)
end
works() click to toggle source
# File lib/hydra/works/models/concerns/collection_behavior.rb, line 63
def works
  members.select(&:work?)
end