Class: Accession

Inherits:
JSONModel
  • Object
show all
Includes:
ASModel, Agents, AutoGenerator, Classifications, CollectionManagements, Dates, Deaccessions, DirectionalRelationships, Events, Extents, ExternalDocuments, ExternalIDs, Identifiers, Instances, MapToAspaceContainer, Publishable, ReindexTopContainers, Relationships, RightsStatements, Subjects, Transferable, UserDefineds
Defined in:
backend/app/model/accession.rb,
frontend/app/models/accession.rb

Constant Summary

Constant Summary

Constants included from Identifiers

Identifiers::MAX_LENGTH

Instance Attribute Summary (collapse)

Attributes included from Relationships

#cached_relationships

Instance Method Summary (collapse)

Methods included from MapToAspaceContainer

included, mapper_to_aspace_json, mapper_to_managed_container, #update_from_json

Methods included from ReindexTopContainers

#delete, #reindex_top_containers, #reindex_top_containers_by_any_means_necessary, #update_from_json, #update_position_only

Methods included from Publishable

db_value_for, included

Methods included from Events

included

Methods included from Transferable

#transfer_to_repository

Methods included from AutoGenerator

included, #update_from_json

Methods included from Classifications

included

Methods included from UserDefineds

included

Methods included from Instances

#eagerly_load!, included

Methods included from CollectionManagements

included

Methods included from ExternalIDs

included

Methods included from DirectionalRelationships

included, #update_from_json

Methods included from Relationships

#assimilate, #cache_relationships, included, #my_relationships, #related_records, #transfer_to_repository, #trigger_reindex_of_dependants, #update_from_json

Methods included from Agents

included

Methods included from Deaccessions

included

Methods included from RightsStatements

included

Methods included from ExternalDocuments

included

Methods included from Dates

included

Methods included from Subjects

included

Methods included from Extents

included

Methods included from Identifiers

#after_initialize, #before_validation, format, #id_0=, #id_1=, #id_2=, #id_3=, included, parse, #validate

Methods included from ASModel

all_models, included, update_publish_flag, update_suppressed_flag

Methods included from JSONModel

JSONModel, #JSONModel, add_error_handler, all, allow_unmapped_enum_value, backend_url, client_mode?, custom_validations, destroy_model, enum_default_value, enum_values, handle_error, init, load_schema, #models, models, parse_jsonmodel_ref, parse_reference, repository, repository_for, schema_src, set_repository, strict_mode, strict_mode?, with_repository

Instance Attribute Details

Returns the value of attribute resource_link



2
3
4
# File 'frontend/app/models/accession.rb', line 2

def resource_link
  @resource_link
end

Instance Method Details

- (Object) populate_from_accession(accession)



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'frontend/app/models/accession.rb', line 24

def populate_from_accession(accession)
  values = accession.to_hash(:raw)

  # Recursively remove bits that don't make sense to copy (like "lock_version" properties)
  values = JSONSchemaUtils.map_hash_with_schema(values, JSONModel(:accession).schema,
                                                [proc { |hash, schema|
                                                        hash = hash.clone
                                                   hash.delete_if {|k, v| k.to_s =~ /^(id_[0-9]|lock_version)$/}
                                                        hash
                                                 }])

  prepare_for_clone(values)

  self.update(values)
end

- (Object) ref_id



11
12
13
14
15
16
17
18
19
20
21
# File 'frontend/app/models/accession.rb', line 11

def ref_id
  ref_id = ""
  
  (0..3).each do |i|
    next if self.send("id_#{i.to_s}").blank?
    ref_id << " - " unless i === 0
    ref_id << self.send("id_#{i.to_s}")
  end
  
  ref_id
end