Sha256: e5b8fa3e5c98e7fec88f298f3a7e6c1420a2c1bef000cb22f808da49d262c8d0

Contents?: true

Size: 828 Bytes

Versions: 9

Compression:

Stored size: 828 Bytes

Contents

module ActiveFedora
  class SolrDigitalObject
    attr_reader :pid, :label, :state, :ownerId, :profile, :datastreams
    
    def initialize(solr_doc)
      @pid = solr_doc[SOLR_DOCUMENT_ID]
      profile_attrs = solr_doc.keys.select { |k| k =~ /^objProfile_/ }
      @profile = {}
      profile_attrs.each do |key|
        attr_name = key.split(/_/)[1..-2].join('_')
        @profile[attr_name] = solr_doc[key].to_s
      end
      @profile['objCreateDate'] ||= Time.now.xmlschema
      @profile['objLastModDate'] ||= @profile['objCreateDate']
      
      @datastreams = {}
      @label = @profile['objLabel']
      @state = @profile['objState']
      @ownerId = @profile['objOwnerId']
    end

    def freeze
      @profile.freeze
      @datastreams.freeze
      self
    end
    
    def new?
      false
    end

  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
active-fedora-4.0.0.rc9 lib/active_fedora/solr_digital_object.rb
active-fedora-4.0.0.rc8 lib/active_fedora/solr_digital_object.rb
active-fedora-4.0.0.rc7 lib/active_fedora/solr_digital_object.rb
active-fedora-4.0.0.rc6 lib/active_fedora/solr_digital_object.rb
active-fedora-4.0.0.rc5 lib/active_fedora/solr_digital_object.rb
active-fedora-4.0.0.rc4 lib/active_fedora/solr_digital_object.rb
active-fedora-4.0.0.rc3 lib/active_fedora/solr_digital_object.rb
active-fedora-4.0.0.rc2 lib/active_fedora/solr_digital_object.rb
active-fedora-4.0.0.rc1 lib/active_fedora/solr_digital_object.rb