Class: Identifier::Local::CatalogNumber
- Inherits:
-
Identifier::Local
- Object
- Identifier
- Identifier::Local
- Identifier::Local::CatalogNumber
- Includes:
- Shared::DwcOccurrenceHooks
- Defined in:
- app/models/identifier/local/catalog_number.rb
Overview
The Identifier that identifies a collection object. Examples include barcodes printed on labels.
Does not imply an accessioning process.
Constant Summary collapse
- TARGETS =
%w{CollectionObject Container Extract}
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
Instance Method Details
#assigned_to_valid_object ⇒ Object (private)
28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'app/models/identifier/local/catalog_number.rb', line 28 def assigned_to_valid_object type_issue = identifier_object_type && !TARGETS.include?(identifier_object_type) object_issue = identifier_object && TARGETS.none? { |c| identifier_object.kind_of?(c.constantize) } if type_issue || object_issue errors.add(:identifier_object_type, "only assignable to #{TARGETS.join(', ')} ") end end |
#dwc_occurrences ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'app/models/identifier/local/catalog_number.rb', line 15 def dwc_occurrences # TODO: CONTAINERS UNION 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 |