Sha256: c8b4ff7fe0dacf5c52f35092dc6ad8dc5d12a2b6e4457d218a7ae5f9a96869f9

Contents?: true

Size: 869 Bytes

Versions: 16

Compression:

Stored size: 869 Bytes

Contents

module ActiveFedora
  module RDF
    #
    # Mixin for adding datastream persistence to an ActiveTriples::Resource 
    # descendant so that it may be used to back an ActiveFedora::RDFDatastream.
    #
    # @see ActiveFedora::RDFDatastream.resource_class
    # @see ActiveFedora::Rdf::ObjectResource
    #
    module Persistence
      extend ActiveSupport::Concern

      BASE_URI = 'info:fedora/'

      included do
        configure :base_uri => BASE_URI unless base_uri
        attr_accessor :datastream
      end
     
      # Overrides ActiveTriples::Resource
      def persist!
        return false unless datastream and datastream.respond_to? :digital_object
        @persisted ||= datastream.digital_object.save
      end

      # Overrides ActiveTriples::Resource
      def persisted?
        @persisted ||= (not datastream.new?)
      end

    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
active-fedora-8.7.0 lib/active_fedora/rdf/persistence.rb
active-fedora-8.6.0 lib/active_fedora/rdf/persistence.rb
active-fedora-8.5.0 lib/active_fedora/rdf/persistence.rb
active-fedora-8.4.2 lib/active_fedora/rdf/persistence.rb
active-fedora-8.4.1 lib/active_fedora/rdf/persistence.rb
active-fedora-8.4.0 lib/active_fedora/rdf/persistence.rb
active-fedora-8.3.0 lib/active_fedora/rdf/persistence.rb
active-fedora-8.2.2 lib/active_fedora/rdf/persistence.rb
active-fedora-8.2.1 lib/active_fedora/rdf/persistence.rb
active-fedora-8.2.0 lib/active_fedora/rdf/persistence.rb
active-fedora-8.1.0 lib/active_fedora/rdf/persistence.rb
active-fedora-8.0.1 lib/active_fedora/rdf/persistence.rb
active-fedora-8.0.0 lib/active_fedora/rdf/persistence.rb
active-fedora-8.0.0.rc3 lib/active_fedora/rdf/persistence.rb
active-fedora-8.0.0.rc2 lib/active_fedora/rdf/persistence.rb
active-fedora-8.0.0.rc1 lib/active_fedora/rdf/persistence.rb