Sha256: 81ecfe50fa57abd3155a1e620729e2f3158e7936bef48d3852f182766d991e8d

Contents?: true

Size: 1.62 KB

Versions: 1

Compression:

Stored size: 1.62 KB

Contents

class MockCurationConcern < ActiveFedora::Base
  class MetadataDatastream < ActiveFedora::NtriplesRDFDatastream
  map_predicates do |map|
    map.title(in: RDF::DC) do |index|
      index.as :searchable, :displayable
    end
    map.created(in: RDF::DC)
    map.creator(in: RDF::DC) do |index|
      index.as :searchable, :facetable, :displayable
    end
    map.date_uploaded(to: "dateSubmitted", in: RDF::DC) do |index|
      index.type :date
      index.as :searchable, :displayable, :sortable
    end
    map.date_modified(to: "modified", in: RDF::DC) do |index|
      index.type :date
      index.as :searchable, :displayable, :sortable
    end
    map.part(:to => "hasPart", in: RDF::DC)
    map.identifier({in: RDF::DC})
  end
end
  include Hydra::ModelMixins::CommonMetadata
  include Sufia::ModelMethods
  include Sufia::Noid
  include Sufia::GenericFile::Permissions
  include CurationConcern::Embargoable
  include CurationConcern::WithAccessRight

  has_metadata name: "properties", type: PropertiesDatastream, control_group: 'M'
  delegate_to :properties, [:relative_path, :depositor], unique: true

  has_metadata name: "descMetadata", type: MockCurationConcern::MetadataDatastream, control_group: 'M'

  delegate_to(
    :descMetadata,
    [
      :title,
      :date_uploaded,
      :date_modified,
      :creator,
      :identifier,
    ],
    unique: true
  )

  has_many :generic_files, property: :is_part_of

  after_destroy :after_destroy_cleanup
  def after_destroy_cleanup
    generic_files.each(&:destroy)
  end

  def human_readable_type
    self.class.to_s.demodulize.titleize
  end
  def to_param
    pid.split(':').last
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
curate-0.1.0 spec/support/mock_curation_concern.rb