Class: Ddr::Component

Inherits:
Resource
  • Object
show all
Includes:
Captionable, Embargoable, HasContent, HasDerivedImage, HasExtractedText, HasIntermediateFile, HasMultiresImage, HasParent, HasStructMetadata, Streamable
Defined in:
app/models/ddr/component.rb

Constant Summary

Constants inherited from Resource

Resource::FILE_FIELDS

Constants included from HasAdminMetadata

HasAdminMetadata::TERMS

Instance Method Summary collapse

Methods included from Streamable

#streamable_media_extension, #streamable_media_path, #streamable_media_type

Methods included from HasStructMetadata

#structure

Methods included from HasParent

#has_parent?, #parent, #publishable?

Methods included from HasMultiresImage

#multires_image_file_path

Methods included from HasIntermediateFile

#intermediate_extension, #intermediate_path, #intermediate_type

Methods included from HasDerivedImage

#derived_image_file_path

Methods included from HasContent

#content_human_size, #content_major_type, #content_size, #content_sub_type, #content_type, #image?, #pdf?, #techmd

Methods included from Embargoable

#embargo, #embargoed?

Methods included from Captionable

#caption_extension, #caption_path, #caption_type

Methods inherited from Resource

attachable_files, #attached_files_having_content, can_be_streamable?, canonical_model_name, captionable?, common_model_name, #embargo, #embargoed?, governable?, #has_admin_policy?, #has_file?, metadata_fields, #publishable?, #rights_statement, tableized_name, #title_display, #values

Methods included from HasThumbnail

#thumbnail_path

Methods included from HasAdminMetadata

#effective_permissions, #effective_roles, #finding_aid, #locked?, #nonpublishable?, #policy_roles, #published?, #research_help, #resource_roles, term_names, #unpublished?

Methods included from Governable

#admin_policy, #admin_policy=

Methods included from Describable

default_indexers, #desc_metadata_terms, #desc_metadata_vocabs, #has_desc_metadata?, indexers, indexers_for, #set_desc_metadata, #set_desc_metadata_values, term_names, vocabularies

Instance Method Details

#collectionObject



22
23
24
# File 'app/models/ddr/component.rb', line 22

def collection
  self.parent.parent rescue nil
end

#collection_idObject



26
27
28
# File 'app/models/ddr/component.rb', line 26

def collection_id
  self.collection.id rescue nil
end

#inherited_rolesObject



34
35
36
37
38
39
40
# File 'app/models/ddr/component.rb', line 34

def inherited_roles
  if has_parent?
    super | parent.policy_roles
  else
    super
  end
end

#targetObject



30
31
32
# File 'app/models/ddr/component.rb', line 30

def target
  Ddr.query_service.find_by(id: target_id) if target_id
end