Class: Identifier::Local::RecordNumber

Inherits:
Identifier::Local show all
Includes:
Shared::DwcOccurrenceHooks
Defined in:
app/models/identifier/local/record_number.rb

Overview

The Identifier that identifies a collection object as recorded by the collector, typically in the field. 1:1 with dwc:recordNumber. Typically used in Botany

Does not imply an accessioning process.

Constant Summary

Constants included from Shared::DualAnnotator

Shared::DualAnnotator::ALWAYS_COMMUNITY

Instance Attribute Summary

Attributes inherited from Identifier

#cached, #cached_numeric_identifier, #identifier, #identifier_object_id, #namespace_id, #project_id, #type

Instance Method Summary collapse

Methods inherited from Identifier::Local

#build_cached, build_cached_prefix, #increment_identifier, #is_local?, #is_virtual?, update_cached, #with_namespaced_identifier

Methods inherited from Identifier

#build_cached, #build_cached_numeric_identifier, #is_global?, #is_local?, prototype_identifier, #set_cached, #type_name

Methods included from Shared::IsData

#errors_excepting, #full_error_messages_excepting, #identical, #is_community?, #is_destroyable?, #is_editable?, #is_in_use?, #is_in_users_projects?, #metamorphosize, #similar

Methods included from Shared::Labels

#labeled?

Methods included from Housekeeping

#has_polymorphic_relationship?

Methods included from Shared::PolymorphicAnnotator

#annotated_object_is_persisted?

Methods inherited from ApplicationRecord

transaction_with_retry

Instance Method Details

#assigned_to_collection_objectObject (private)



23
24
25
# File 'app/models/identifier/local/record_number.rb', line 23

def assigned_to_collection_object
  errors.add(:identifier_object_type, 'only assignable to CollectionObject') if (identifier_object_type && identifier_object_type != 'CollectionObject') || (identifier_object && !identifier_object.kind_of?(CollectionObject))
end

#dwc_occurrencesObject



13
14
15
16
17
18
19
# File 'app/models/identifier/local/record_number.rb', line 13

def dwc_occurrences
  DwcOccurrence
    .joins("JOIN collection_objects co on dwc_occurrence_object_id = co.id AND dwc_occurrence_object_type = 'CollectionObject'")
    .joins("JOIN identifiers i on i.identifier_object_id = co.id AND i.identifier_object_type = 'CollectionObject'")
    .where(i: {id:})
    .distinct
end