Sha256: a8639b43d20e4a6c33a7c4c3d04ca011df04cd5de27af25b51aa942f6c2edb2d

Contents?: true

Size: 1.87 KB

Versions: 37

Compression:

Stored size: 1.87 KB

Contents

module ActiveFedora

  #This class represents a Fedora datastream
  class Datastream < Rubydora::Datastream
    attr_writer :digital_object
    attr_accessor :last_modified

    def initialize(digital_object=nil, dsid=nil, options={})
      ## When you use the versions feature of rubydora (0.5.x), you need to have a 3 argument constructor
      super
    end

    alias_method :realLabel, :label

    def label
      Array(realLabel).first
    end
    alias_method :dsLabel, :label

    def inspect
      "#<#{self.class} @pid=\"#{digital_object ? pid : nil}\" @dsid=\"#{dsid}\" @controlGroup=\"#{controlGroup}\" changed=\"#{changed?}\" @mimeType=\"#{mimeType}\" >"
    end

    #compatibility method for rails' url generators. This method will 
    #urlescape escape dots, which are apparently
    #invalid characters in a dsid.
    def to_param
      dsid.gsub(/\./, '%2e')
    end
    
    # @abstract Override this in your concrete datastream class. 
    # @return [boolean] does this datastream contain metadata (not file data)
    def metadata?
      false
    end

    def validate_content_present
      has_content?
    end
    
    def save
      super
      self
    end

    def create
      super
      self
    end

    # serializes any changed data into the content field
    def serialize!
    end
    
    def solrize_profile # :nodoc:
      profile_hash = {}
      profile.each_pair do |property,value|
        if property =~ /Date/
          value = Time.parse(value) unless value.is_a?(Time)
          value = value.xmlschema
        end
        profile_hash[property] = value
      end
      profile_hash
    end
    
    def profile_from_hash(profile_hash)
      profile_hash.each_pair do |key,value|
        profile[key] = value
      end
    end
    
    def to_solr(solr_doc = Hash.new)
      solr_doc
    end
  end
  
  class DatastreamConcurrencyException < Exception # :nodoc:
  end
end

Version data entries

37 entries across 37 versions & 1 rubygems

Version Path
active-fedora-6.8.0 lib/active_fedora/datastream.rb
active-fedora-6.7.8 lib/active_fedora/datastream.rb
active-fedora-6.7.7 lib/active_fedora/datastream.rb
active-fedora-6.7.6 lib/active_fedora/datastream.rb
active-fedora-6.7.5 lib/active_fedora/datastream.rb
active-fedora-6.7.4 lib/active_fedora/datastream.rb
active-fedora-7.0.0.pre2 lib/active_fedora/datastream.rb
active-fedora-7.0.0.pre1 lib/active_fedora/datastream.rb
active-fedora-6.7.3 lib/active_fedora/datastream.rb
active-fedora-6.7.2 lib/active_fedora/datastream.rb
active-fedora-6.7.1 lib/active_fedora/datastream.rb
active-fedora-6.7.0 lib/active_fedora/datastream.rb
active-fedora-6.7.0.rc1 lib/active_fedora/datastream.rb
active-fedora-6.6.1 lib/active_fedora/datastream.rb
active-fedora-6.6.0 lib/active_fedora/datastream.rb
active-fedora-6.6.0.rc5 lib/active_fedora/datastream.rb
active-fedora-6.6.0.rc4 lib/active_fedora/datastream.rb
active-fedora-6.6.0.rc3 lib/active_fedora/datastream.rb
active-fedora-6.6.0.rc2 lib/active_fedora/datastream.rb
active-fedora-6.6.0.rc1 lib/active_fedora/datastream.rb