Sha256: c4c52a4bd557f4bcc16b1caf96b334bad6180aa48ec07051deb0b8f4d519028b

Contents?: true

Size: 774 Bytes

Versions: 6

Compression:

Stored size: 774 Bytes

Contents

require_relative './persistence_base'
require_relative './collection'
require_relative './file_datastream'

class CommonRepositoryModel::Data < CommonRepositoryModel::PersistenceBase
  belongs_to(
    :collection,
    class_name: 'CommonRepositoryModel::Collection',
    property: :is_part_of
  )

  has_file_datastream(
    name: "content",
    type: CommonRepositoryModel::FileDatastream
  )

  has_metadata name: "properties", type: ActiveFedora::SimpleDatastream do |m|
    m.field :slot_name, :string
    m.field :md5_checksum, :string
  end
  delegate :slot_name, unique: true, to: :properties
  delegate :md5_checksum, unique: true, to: :properties
  validates :slot_name, presence: true

  def content=(file)
    add_file_datastream(file, dsid: "content")
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
common_repository_model-0.0.6 lib/common_repository_model/data.rb
common_repository_model-0.0.5 lib/common_repository_model/data.rb
common_repository_model-0.0.4 lib/common_repository_model/data.rb
common_repository_model-0.0.3 lib/common_repository_model/data.rb
common_repository_model-0.0.2 lib/common_repository_model/data.rb
common_repository_model-0.0.1 lib/common_repository_model/data.rb