Class: Ddr::Models::Base
- Inherits:
-
ActiveFedora::Base
- Object
- ActiveFedora::Base
- Ddr::Models::Base
- Extended by:
- Deprecation
- Includes:
- Describable, EventLoggable, FileManagement, FixityCheckable, Governable, HasAdminMetadata, HasThumbnail, Indexing, Hydra::Validations
- Defined in:
- lib/ddr/models/base.rb
Direct Known Subclasses
Constant Summary collapse
- INGEST =
Lifecycle events
"ingest.repo_object"
- UPDATE =
"update.repo_object"
- DELETE =
"delete.repo_object"
- DEACCESSION =
"deaccession.repo_object"
Constants included from Index::Fields
Index::Fields::ACCESS_ROLE, Index::Fields::ACTIVE_FEDORA_MODEL, Index::Fields::ADMIN_SET, Index::Fields::ADMIN_SET_FACET, Index::Fields::ADMIN_SET_TITLE, Index::Fields::AFFILIATION, Index::Fields::AFFILIATION_FACET, Index::Fields::ALEPH_ID, Index::Fields::ALL_TEXT, Index::Fields::ARRANGER_FACET, Index::Fields::ASPACE_ID, Index::Fields::ATTACHED_FILES_HAVING_CONTENT, Index::Fields::BOX_NUMBER_FACET, Index::Fields::CATEGORY_FACET, Index::Fields::COLLECTION_FACET, Index::Fields::COLLECTION_TITLE, Index::Fields::COLLECTION_URI, Index::Fields::COMPANY_FACET, Index::Fields::COMPOSER_FACET, Index::Fields::CONTENT_CONTROL_GROUP, Index::Fields::CONTENT_CREATE_DATE, Index::Fields::CONTENT_SIZE, Index::Fields::CONTENT_SIZE_HUMAN, Index::Fields::CONTRIBUTOR_FACET, Index::Fields::CREATOR_FACET, Index::Fields::DATE_FACET, Index::Fields::DATE_SORT, Index::Fields::DC_IS_PART_OF, Index::Fields::DEPOSITOR, Index::Fields::DISPLAY_FORMAT, Index::Fields::DOI, Index::Fields::EAD_ID, Index::Fields::ENGRAVER_FACET, Index::Fields::EXTRACTED_TEXT, Index::Fields::FOLDER_FACET, Index::Fields::FORMAT_FACET, Index::Fields::GENRE_FACET, Index::Fields::HAS_MODEL, Index::Fields::ID, Index::Fields::IDENTIFIER_ALL, Index::Fields::ILLUSTRATED_FACET, Index::Fields::ILLUSTRATOR_FACET, Index::Fields::INGESTED_BY, Index::Fields::INGESTION_DATE, Index::Fields::INSTRUMENTATION_FACET, Index::Fields::INTERNAL_URI, Index::Fields::INTERVIEWER_NAME_FACET, Index::Fields::IS_ATTACHED_TO, Index::Fields::IS_EXTERNAL_TARGET_FOR, Index::Fields::IS_FORMAT_OF, Index::Fields::IS_GOVERNED_BY, Index::Fields::IS_LOCKED, Index::Fields::IS_MEMBER_OF, Index::Fields::IS_MEMBER_OF_COLLECTION, Index::Fields::IS_PART_OF, Index::Fields::LANGUAGE_FACET, Index::Fields::LANGUAGE_NAME, Index::Fields::LAST_FIXITY_CHECK_ON, Index::Fields::LAST_FIXITY_CHECK_OUTCOME, Index::Fields::LAST_VIRUS_CHECK_ON, Index::Fields::LAST_VIRUS_CHECK_OUTCOME, Index::Fields::LICENSE, Index::Fields::LITHOGRAPHER_FACET, Index::Fields::LOCAL_ID, Index::Fields::LYRICIST_FACET, Index::Fields::MEDIA_MAJOR_TYPE, Index::Fields::MEDIA_SUB_TYPE, Index::Fields::MEDIA_TYPE, Index::Fields::MEDIUM_FACET, Index::Fields::MULTIRES_IMAGE_FILE_PATH, Index::Fields::NESTED_PATH, Index::Fields::NESTED_PATH_TEXT, Index::Fields::OBJECT_CREATE_DATE, Index::Fields::OBJECT_MODIFIED_DATE, Index::Fields::OBJECT_PROFILE, Index::Fields::OBJECT_STATE, Index::Fields::PERFORMER_FACET, Index::Fields::PERMANENT_ID, Index::Fields::PERMANENT_URL, Index::Fields::PLACEMENT_COMPANY_FACET, Index::Fields::POLICY_ROLE, Index::Fields::PRODUCER_FACET, Index::Fields::PRODUCT_FACET, Index::Fields::PUBLICATION_FACET, Index::Fields::PUBLISHER_FACET, Index::Fields::RESEARCH_HELP_CONTACT, Index::Fields::RESOURCE_ROLE, Index::Fields::RIGHTS_NOTE, Index::Fields::ROLL_NUMBER_FACET, Index::Fields::SERIES_FACET, Index::Fields::SETTING_FACET, Index::Fields::SPATIAL_FACET, Index::Fields::STREAMABLE_MEDIA_TYPE, Index::Fields::STRUCTURE, Index::Fields::STRUCTURE_SOURCE, Index::Fields::SUBJECT_FACET, Index::Fields::SUBSERIES_FACET, Index::Fields::TECHMD_COLOR_SPACE, Index::Fields::TECHMD_CREATING_APPLICATION, Index::Fields::TECHMD_CREATION_TIME, Index::Fields::TECHMD_FILE_SIZE, Index::Fields::TECHMD_FITS_DATETIME, Index::Fields::TECHMD_FITS_VERSION, Index::Fields::TECHMD_FORMAT_LABEL, Index::Fields::TECHMD_FORMAT_VERSION, Index::Fields::TECHMD_ICC_PROFILE_NAME, Index::Fields::TECHMD_ICC_PROFILE_VERSION, Index::Fields::TECHMD_IMAGE_HEIGHT, Index::Fields::TECHMD_IMAGE_WIDTH, Index::Fields::TECHMD_MD5, Index::Fields::TECHMD_MEDIA_TYPE, Index::Fields::TECHMD_MODIFICATION_TIME, Index::Fields::TECHMD_PRONOM_IDENTIFIER, Index::Fields::TECHMD_VALID, Index::Fields::TECHMD_WELL_FORMED, Index::Fields::TEMPORAL_FACET, Index::Fields::TITLE, Index::Fields::TONE_FACET, Index::Fields::TYPE_FACET, Index::Fields::VOLUME_FACET, Index::Fields::WORKFLOW_STATE, Index::Fields::YEAR_FACET
Instance Method Summary collapse
-
#adapt_to_cmodel ⇒ Object
See ActiveFedora overrides in engine initializers.
- #association_query(association) ⇒ Object
- #copy_admin_policy_or_permissions_from(other) ⇒ Object
- #copy_admin_policy_or_roles_from(other) ⇒ Object
- #datastream_history ⇒ Object
- #datastreams_changed ⇒ Object
- #datastreams_having_content ⇒ Object (also: #attached_files_having_content, #datastreams_to_validate)
- #deaccession ⇒ Object
- #has_extracted_text? ⇒ Boolean
-
#model_pid ⇒ Object
e.g., “Collection duke:1”.
- #new_datastreams_having_content ⇒ Object
- #parent_id ⇒ Object
- #publishable? ⇒ Boolean
- #rights_statement ⇒ Object (also: #effective_license)
- #save(options = {}) ⇒ Object
Methods included from HasAdminMetadata
#copy_resource_roles_from, #effective_permissions, #finding_aid, #grant_roles_to_creator, #inherited_roles, #lock, #lock!, #locked?, #research_help, #roles, #unlock, #unlock!, #workflow
Methods included from Indexing
#admin_set_facet, #admin_set_title, #all_identifiers, #associated_collection, #collection_facet, #collection_title, const_missing, #date_sort, #index_fields, #language_name, #title_display, #to_solr, #year_facet
Methods included from Index::Fields
const_missing, descmd, get, techmd
Methods included from FileManagement
#add_external_datastream, #add_external_file, #add_file, #add_file_datastream, #external_datastream_file_paths, #external_datastreams
Methods included from FixityCheckable
#fixity_check, #fixity_checks, #last_fixity_check, #last_fixity_check_on, #last_fixity_check_outcome
Methods included from EventLoggable
#events, #has_events?, #notify_event, #update_events
Methods included from HasThumbnail
#copy_thumbnail_from, #thumbnail_changed?
Methods included from Governable
#copy_admin_policy_from, #inherited_permissions, #inherited_rights
Methods included from Describable
#desc_metadata_attributes, #desc_metadata_terms, #desc_metadata_values, #desc_metadata_vocabs, #has_desc_metadata?, #set_desc_metadata, #set_desc_metadata_values
Instance Method Details
#adapt_to_cmodel ⇒ Object
See ActiveFedora overrides in engine initializers
76 77 78 79 80 |
# File 'lib/ddr/models/base.rb', line 76 def adapt_to_cmodel super rescue ::TypeError raise ContentModelError, "Cannot adapt to nil content model." end |
#association_query(association) ⇒ Object
64 65 66 67 |
# File 'lib/ddr/models/base.rb', line 64 def association_query(association) # XXX Ideally we would include a clause to limit by AF model, but this should suffice ActiveFedora::SolrService.construct_query_for_rel(reflections[association].[:property] => internal_uri) end |
#copy_admin_policy_or_permissions_from(other) ⇒ Object
54 55 56 57 58 |
# File 'lib/ddr/models/base.rb', line 54 def (other) Deprecation.warn(self.class, "`copy_admin_policy_or_permissions_from` is deprecated." \ " Use `copy_admin_policy_or_roles_from` instead.") copy_admin_policy_or_roles_from(other) end |
#copy_admin_policy_or_roles_from(other) ⇒ Object
60 61 62 |
# File 'lib/ddr/models/base.rb', line 60 def copy_admin_policy_or_roles_from(other) copy_resource_roles_from(other) unless copy_admin_policy_from(other) end |
#datastream_history ⇒ Object
109 110 111 112 113 |
# File 'lib/ddr/models/base.rb', line 109 def datastream_history datastreams_having_content.each_with_object({}) do |(dsid, ds), memo| memo[dsid] = ds.version_history end end |
#datastreams_changed ⇒ Object
94 95 96 |
# File 'lib/ddr/models/base.rb', line 94 def datastreams_changed datastreams.select { |dsid, ds| ds.changed? } end |
#datastreams_having_content ⇒ Object Also known as: attached_files_having_content, datastreams_to_validate
102 103 104 |
# File 'lib/ddr/models/base.rb', line 102 def datastreams_having_content datastreams.select { |dsid, ds| ds.has_content? } end |
#deaccession ⇒ Object
48 49 50 51 52 |
# File 'lib/ddr/models/base.rb', line 48 def deaccession run_callbacks :deaccession do delete end end |
#has_extracted_text? ⇒ Boolean
82 83 84 |
# File 'lib/ddr/models/base.rb', line 82 def has_extracted_text? false end |
#model_pid ⇒ Object
e.g., “Collection duke:1”
70 71 72 |
# File 'lib/ddr/models/base.rb', line 70 def model_pid [self.class.to_s, pid].join(" ") end |
#new_datastreams_having_content ⇒ Object
98 99 100 |
# File 'lib/ddr/models/base.rb', line 98 def new_datastreams_having_content datastreams.select { |dsid, ds| ds.new? && ds.has_content? } end |
#parent_id ⇒ Object
115 116 117 118 119 |
# File 'lib/ddr/models/base.rb', line 115 def parent_id parent.id rescue NoMethodError nil end |
#publishable? ⇒ Boolean
86 87 88 |
# File 'lib/ddr/models/base.rb', line 86 def publishable? raise NotImplementedError, "Must be implemented by subclasses" end |
#rights_statement ⇒ Object Also known as: effective_license
42 43 44 |
# File 'lib/ddr/models/base.rb', line 42 def rights_statement RightsStatement.call(self) end |
#save(options = {}) ⇒ Object
90 91 92 |
# File 'lib/ddr/models/base.rb', line 90 def save(={}) cache.with() { super } end |