Sha256: 1fc8adc0348cd90e0ad7f6eb5ac91677db57ec7a79bf2bb5f522b1e3554c554a

Contents?: true

Size: 818 Bytes

Versions: 11

Compression:

Stored size: 818 Bytes

Contents

module Ddr
  class Component < Resource

    include Captionable
    include Embargoable
    include HasContent
    include HasDerivedImage
    include HasExtractedText
    include HasIntermediateFile
    include HasMultiresImage
    include HasParent
    include HasStructMetadata
    include Streamable

    alias_method :item_id, :parent_id
    alias_method :item, :parent

    attribute :target_id, Valkyrie::Types::ID.optional

    self.parent_class = Ddr::Item

    def collection
      self.parent.parent rescue nil
    end

    def collection_id
      self.collection.id rescue nil
    end

    def target
      Ddr.query_service.find_by(id: target_id) if target_id
    end

    def inherited_roles
      if has_parent?
        super | parent.policy_roles
      else
        super
      end
    end

  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
ddr-core-1.10.0 app/models/ddr/component.rb
ddr-core-1.9.0 app/models/ddr/component.rb
ddr-core-1.8.0 app/models/ddr/component.rb
ddr-core-1.7.0 app/models/ddr/component.rb
ddr-core-1.6.6 app/models/ddr/component.rb
ddr-core-1.6.5 app/models/ddr/component.rb
ddr-core-1.6.4 app/models/ddr/component.rb
ddr-core-1.6.3 app/models/ddr/component.rb
ddr-core-1.6.2 app/models/ddr/component.rb
ddr-core-1.6.1 app/models/ddr/component.rb
ddr-core-1.6.0 app/models/ddr/component.rb