Sha256: 170160bc301509cc8a71da60b4625919eb9365bbf5a7ff66aa5bbfe87f860228

Contents?: true

Size: 944 Bytes

Versions: 30

Compression:

Stored size: 944 Bytes

Contents

module ActiveFedora
  # This is the base class for ldp containers, it is not an ldp:BasicContainer
  class Container < ActiveFedora::Base
    property :membership_resource, predicate: ::RDF::Vocab::LDP.membershipResource
    property :has_member_relation, predicate: ::RDF::Vocab::LDP.hasMemberRelation
    property :is_member_of_relation, predicate: ::RDF::Vocab::LDP.isMemberOfRelation
    property :contained, predicate: ::RDF::Vocab::LDP.contains

    def parent
      @parent || raise("Parent hasn't been set on #{self.class}")
    end

    def parent=(parent)
      @parent = parent
      self.membership_resource = [::RDF::URI(parent.uri)]
    end

    def mint_id
      "#{id}/#{SecureRandom.uuid}"
    end

    def self.find_or_initialize(id)
      find(id)
    rescue ActiveFedora::ObjectNotFoundError
      new(id)
    end

    private

      # Don't allow directly setting contained
      def contained=(*_args)
      end
  end
end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
active-fedora-9.7.3 lib/active_fedora/containers/container.rb
active-fedora-11.0.0.rc2 lib/active_fedora/containers/container.rb
active-fedora-11.0.0.rc1 lib/active_fedora/containers/container.rb
active-fedora-10.1.0 lib/active_fedora/containers/container.rb
active-fedora-10.1.0.rc1 lib/active_fedora/containers/container.rb
active-fedora-9.7.2 lib/active_fedora/containers/container.rb
active-fedora-10.0.0 lib/active_fedora/containers/container.rb
active-fedora-10.0.0.beta4 lib/active_fedora/containers/container.rb
active-fedora-10.0.0.beta3 lib/active_fedora/containers/container.rb
active-fedora-10.0.0.beta2 lib/active_fedora/containers/container.rb
active-fedora-10.0.0.beta1 lib/active_fedora/containers/container.rb
active-fedora-9.13.0 lib/active_fedora/containers/container.rb
active-fedora-9.12.0 lib/active_fedora/containers/container.rb
active-fedora-9.11.0 lib/active_fedora/containers/container.rb
active-fedora-9.10.4 lib/active_fedora/containers/container.rb
active-fedora-9.10.3 lib/active_fedora/containers/container.rb
active-fedora-9.10.2 lib/active_fedora/containers/container.rb
active-fedora-9.10.1 lib/active_fedora/containers/container.rb
active-fedora-9.10.0 lib/active_fedora/containers/container.rb
active-fedora-9.10.0.pre2 lib/active_fedora/containers/container.rb