Module: Worthwhile::GenericFileBase
- Extended by:
- ActiveSupport::Concern
- Includes:
- Hydra::AccessControls::Embargoable, Sufia::GenericFile::Audit, Sufia::GenericFile::Characterization, Sufia::GenericFile::Derivatives, Sufia::GenericFile::Metadata, Sufia::GenericFile::MimeTypes, Sufia::GenericFile::Versions, Sufia::GenericFile::WebForm, Sufia::ModelMethods, Sufia::Noid, Sufia::Permissions::Readable, Worthwhile::GenericFile::VersionedContent
- Included in:
- GenericFile
- Defined in:
- app/models/concerns/worthwhile/generic_file_base.rb
Instance Method Summary
collapse
#current_version_id, #latest_version, #versions
Instance Method Details
#copy_permissions_from(obj) ⇒ Object
39
40
41
|
# File 'app/models/concerns/worthwhile/generic_file_base.rb', line 39
def copy_permissions_from(obj)
self.datastreams['rightsMetadata'].ng_xml = obj.datastreams['rightsMetadata'].ng_xml
end
|
#human_readable_type ⇒ Object
31
32
33
|
# File 'app/models/concerns/worthwhile/generic_file_base.rb', line 31
def human_readable_type
self.class.to_s.demodulize.titleize
end
|
#remove_representative_relationship ⇒ Object
49
50
51
52
53
54
|
# File 'app/models/concerns/worthwhile/generic_file_base.rb', line 49
def remove_representative_relationship
return unless ActiveFedora::Base.exists?(batch)
return unless batch.representative == self.pid
batch.representative = nil
batch.save
end
|
#representative ⇒ Object
35
36
37
|
# File 'app/models/concerns/worthwhile/generic_file_base.rb', line 35
def representative
to_param
end
|
#to_solr(solr_doc = {}) ⇒ Object
56
57
58
59
60
61
62
|
# File 'app/models/concerns/worthwhile/generic_file_base.rb', line 56
def to_solr(solr_doc = {})
super.tap do |solr_doc|
solr_doc['height_isi'] = Integer(height.first) if height.present?
solr_doc['width_isi'] = Integer(width.first) if width.present?
end
end
|
#update_parent_representative_if_empty(obj) ⇒ Object
43
44
45
46
47
|
# File 'app/models/concerns/worthwhile/generic_file_base.rb', line 43
def update_parent_representative_if_empty(obj)
return unless obj.representative.blank?
obj.representative = self.pid
obj.save
end
|