Sha256: becfa98a5ce0ed788cae68b6cf6e8809fec12b6887c1c8315173a3c0de235724

Contents?: true

Size: 1.07 KB

Versions: 22

Compression:

Stored size: 1.07 KB

Contents

module ActiveFedora
  module FedoraAttributes

    delegate :state=, :label=, to: :inner_object

    #return the pid of the Fedora Object
    # if there is no fedora object (loaded from solr) get the instance var
    # TODO make inner_object a proxy that can hold the pid
    def pid
       @pid ||= @inner_object.pid
    end

    def id   ### Needed for the nested form helper
      self.pid
    end

    #return the owner id
    def owner_id
      Array(@inner_object.ownerId).first
    end
    
    def owner_id=(owner_id)
      @inner_object.ownerId=(owner_id)
    end

    def label
      Array(@inner_object.label).first
    end

    def state
      Array(@inner_object.state).first
    end

    #return the create_date of the inner object (unless it's a new object)
    def create_date
      @inner_object.new_record? ?  Time.now : Array(@inner_object.createdDate).first
    end

    #return the modification date of the inner object (unless it's a new object)
    def modified_date
      @inner_object.new_record? ? Time.now : Array(@inner_object.lastModifiedDate).first
    end

  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
active-fedora-8.7.0 lib/active_fedora/fedora_attributes.rb
active-fedora-8.6.0 lib/active_fedora/fedora_attributes.rb
active-fedora-8.5.0 lib/active_fedora/fedora_attributes.rb
active-fedora-8.4.2 lib/active_fedora/fedora_attributes.rb
active-fedora-8.4.1 lib/active_fedora/fedora_attributes.rb
active-fedora-7.3.1 lib/active_fedora/fedora_attributes.rb
active-fedora-7.3.0 lib/active_fedora/fedora_attributes.rb
active-fedora-8.4.0 lib/active_fedora/fedora_attributes.rb
active-fedora-8.3.0 lib/active_fedora/fedora_attributes.rb
active-fedora-8.2.2 lib/active_fedora/fedora_attributes.rb
active-fedora-8.2.1 lib/active_fedora/fedora_attributes.rb
active-fedora-8.2.0 lib/active_fedora/fedora_attributes.rb
active-fedora-7.2.0 lib/active_fedora/fedora_attributes.rb
active-fedora-8.1.0 lib/active_fedora/fedora_attributes.rb
active-fedora-8.0.1 lib/active_fedora/fedora_attributes.rb
active-fedora-8.0.0 lib/active_fedora/fedora_attributes.rb
active-fedora-8.0.0.rc3 lib/active_fedora/fedora_attributes.rb
active-fedora-8.0.0.rc2 lib/active_fedora/fedora_attributes.rb
active-fedora-8.0.0.rc1 lib/active_fedora/fedora_attributes.rb
active-fedora-7.1.2 lib/active_fedora/fedora_attributes.rb