Class: Accession
- Includes:
- ASModel, Agents, Assessments::LinkedRecord, AutoGenerator, Classifications, CollectionManagements, Dates, Deaccessions, DirectionalRelationships, Events, Extents, ExternalDocuments, ExternalIDs, Identifiers, Instances, LangMaterials, MetadataRights, Publishable, ReindexTopContainers, RepresentativeFileVersion, RightsStatements, Subjects, Transferable, UserDefineds
- Defined in:
- backend/app/model/accession.rb,
frontend/app/models/accession.rb,
public/app/models/accession.rb
Constant Summary
Constants included from Identifiers
Constants included from JSONModel
JSONModel::REFERENCE_KEY_REGEX
Constants inherited from Record
Instance Attribute Summary collapse
-
#access_restrictions_note ⇒ Object
readonly
Returns the value of attribute access_restrictions_note.
-
#language ⇒ Object
readonly
Returns the value of attribute language.
-
#provenance ⇒ Object
readonly
Returns the value of attribute provenance.
-
#related_accessions ⇒ Object
readonly
Returns the value of attribute related_accessions.
-
#related_resources ⇒ Object
readonly
Returns the value of attribute related_resources.
-
#resource_link ⇒ Object
Returns the value of attribute resource_link.
-
#script ⇒ Object
readonly
Returns the value of attribute script.
-
#use_restrictions_note ⇒ Object
readonly
Returns the value of attribute use_restrictions_note.
Attributes inherited from Record
#agents, #classifications, #container_display, #container_summary_for_badge, #container_titles_and_uris, #criteria, #dates, #display_string, #extents, #external_documents, #full, #identifier, #json, #lang_materials, #level, #linked_digital_objects, #notes, #other_level, #primary_type, #raw, #repository_information, #resolved_repository, #resolved_resource, #resolved_top_container, #subjects, #uri
Instance Method Summary collapse
-
#access_restrictions_apply? ⇒ Boolean
-
#acquisition_type ⇒ Object
-
#content_description ⇒ Object
-
#deaccessions ⇒ Object
-
#initialize(*args) ⇒ Accession
constructor
A new instance of Accession.
-
#inventory ⇒ Object
-
#populate_from_accession(accession) ⇒ Object
-
#ref_id ⇒ Object
-
#restrictions_apply? ⇒ Boolean
-
#use_restrictions_apply? ⇒ Boolean
Methods included from RepresentativeFileVersion
Methods included from Assessments::LinkedRecord
Methods included from ReindexTopContainers
#accession_instance_root_record_update, #ao_instance_root_record_update, #delete, #reindex_top_containers, #reindex_top_containers_by_any_means_necessary, #resource_instance_update, #set_parent_and_position, #set_root, #update_from_json
Methods included from Publishable
Methods included from Events
Methods included from Transferable
Methods included from AutoGenerator
Methods included from Classifications
Methods included from UserDefineds
Methods included from Instances
Methods included from MetadataRights
Methods included from CollectionManagements
Methods included from ExternalIDs
Methods included from DirectionalRelationships
Methods included from Agents
Methods included from Deaccessions
Methods included from RightsStatements
Methods included from ExternalDocuments
Methods included from Dates
Methods included from Subjects
Methods included from LangMaterials
Methods included from Extents
Methods included from Identifiers
#after_initialize, #before_validation, format, #format_multipart_identifier, #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, check_valid_refs, 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_publish_flags!, set_repository, strict_mode, strict_mode?, validate_schema, with_repository
Methods inherited from Record
#[], #dig, #note, #parse_full_title, #request_item
Methods included from PrefixHelper
app_prefix, #app_prefix, app_prefix_js, #app_prefix_js
Methods included from RecordHelper
#badge_for_type, #icon_for_type, #record_class_for_type, #record_for_type, #record_from_resolved_json
Methods included from JsonHelper
#merge_notes, #process_json_notes
Methods included from ManipulateNode
#inheritance, #process_mixed_content, #strip_mixed_content
Constructor Details
#initialize(*args) ⇒ Accession
Returns a new instance of Accession.
7 8 9 10 11 12 13 14 |
# File 'public/app/models/accession.rb', line 7 def initialize(*args) super = = @use_restrictions_note = json['use_restrictions_note'] @access_restrictions_note = json['access_restrictions_note'] end |
Instance Attribute Details
#access_restrictions_note ⇒ Object (readonly)
Returns the value of attribute access_restrictions_note
3 4 5 |
# File 'public/app/models/accession.rb', line 3 def access_restrictions_note @access_restrictions_note end |
#language ⇒ Object (readonly)
Returns the value of attribute language
3 4 5 |
# File 'public/app/models/accession.rb', line 3 def language @language end |
#provenance ⇒ Object (readonly)
Returns the value of attribute provenance
3 4 5 |
# File 'public/app/models/accession.rb', line 3 def provenance @provenance end |
#related_accessions ⇒ Object (readonly)
Returns the value of attribute related_accessions
3 4 5 |
# File 'public/app/models/accession.rb', line 3 def end |
#related_resources ⇒ Object (readonly)
Returns the value of attribute related_resources
3 4 5 |
# File 'public/app/models/accession.rb', line 3 def end |
#resource_link ⇒ Object
Returns the value of attribute resource_link
2 3 4 |
# File 'frontend/app/models/accession.rb', line 2 def resource_link @resource_link end |
#script ⇒ Object (readonly)
Returns the value of attribute script
3 4 5 |
# File 'public/app/models/accession.rb', line 3 def script @script end |
#use_restrictions_note ⇒ Object (readonly)
Returns the value of attribute use_restrictions_note
3 4 5 |
# File 'public/app/models/accession.rb', line 3 def use_restrictions_note @use_restrictions_note end |
Instance Method Details
#access_restrictions_apply? ⇒ Boolean
63 64 65 |
# File 'public/app/models/accession.rb', line 63 def access_restrictions_apply? json['access_restrictions'] end |
#acquisition_type ⇒ Object
16 17 18 19 20 |
# File 'public/app/models/accession.rb', line 16 def acquisition_type if json['acquisition_type'] I18n.t("enumerations.accession_acquisition_type.#{json['acquisition_type']}", :default => json['acquisition_type']) end end |
#content_description ⇒ Object
27 28 29 |
# File 'public/app/models/accession.rb', line 27 def content_description json['content_description'] end |
#deaccessions ⇒ Object
22 23 24 25 |
# File 'public/app/models/accession.rb', line 22 def deaccessions return '' unless AppConfig[:pui_display_deaccessions] ASUtils.wrap(json['deaccessions']) end |
#inventory ⇒ Object
31 32 33 |
# File 'public/app/models/accession.rb', line 31 def inventory json['inventory'] end |
#populate_from_accession(accession) ⇒ Object
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 |
#ref_id ⇒ Object
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 |
#restrictions_apply? ⇒ Boolean
51 52 53 |
# File 'public/app/models/accession.rb', line 51 def restrictions_apply? json['restrictions_apply'] end |
#use_restrictions_apply? ⇒ Boolean
67 68 69 |
# File 'public/app/models/accession.rb', line 67 def use_restrictions_apply? json['use_restrictions'] end |