Class: DigitalObject
- Includes:
- ASModel, Agents, Assessments::LinkedRecord, AutoGenerator, Classifications, CollectionManagements, ComponentsAddChildren, Dates, DigitalObjectTrees, Events, Extents, ExternalDocuments, ExternalIDs, FileVersions, LangMaterials, MetadataRights, Notes, Publishable, RepresentativeFileVersion, RightsStatements, Subjects, Trees, UserDefineds
- Defined in:
- backend/app/model/digital_object.rb,
public/app/models/digital_object.rb
Direct Known Subclasses
Constant Summary
Constants included from Trees
Constants included from JSONModel
JSONModel::REFERENCE_KEY_REGEX
Constants inherited from Record
Instance Attribute Summary collapse
-
#cite ⇒ Object
readonly
Returns the value of attribute cite.
-
#cite_item ⇒ Object
readonly
Returns the value of attribute cite_item.
-
#cite_item_description ⇒ Object
readonly
Returns the value of attribute cite_item_description.
-
#linked_instances ⇒ Object
readonly
Returns the value of attribute linked_instances.
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
Class Method Summary collapse
Instance Method Summary collapse
-
#breadcrumb ⇒ Object
-
#delete ⇒ Object
-
#finding_aid ⇒ Object
-
#initialize(*args) ⇒ DigitalObject
constructor
A new instance of DigitalObject.
-
#root_node_uri ⇒ Object
Methods included from RepresentativeFileVersion
Methods included from Assessments::LinkedRecord
Methods included from Publishable
Methods included from Events
Methods included from ComponentsAddChildren
Methods included from UserDefineds
Methods included from MetadataRights
Methods included from CollectionManagements
Methods included from FileVersions
Methods included from ExternalIDs
Methods included from RightsStatements
Methods included from Notes
included, #persistent_id_context, #update_from_json
Methods included from DigitalObjectTrees
#build_node_query, #load_node_properties, #load_root_properties, #set_file_version
Methods included from Trees
#adopt_children, #apply_exclusions_to_descendants, #assimilate, #build_node_query, #children, #children?, included, #load_node_properties, #load_root_properties, #ordered_records, #partial_tree, #transfer_to_repository, #tree, #trigger_index_of_entire_tree, #update_from_json
Methods included from Agents
Methods included from ExternalDocuments
Methods included from Classifications
Methods included from Dates
Methods included from LangMaterials
Methods included from Extents
Methods included from Subjects
Methods included from AutoGenerator
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) ⇒ DigitalObject
Returns a new instance of DigitalObject.
5 6 7 8 9 10 11 12 13 |
# File 'public/app/models/digital_object.rb', line 5 def initialize(*args) super @linked_instances = parse_linked_instances # ANW-921: Refactored citation modal, keep cite in case used by others @cite = parse_cite_string("") @cite_item = parse_cite_string("item") @cite_item_description = parse_cite_string("description") end |
Instance Attribute Details
#cite ⇒ Object (readonly)
Returns the value of attribute cite
3 4 5 |
# File 'public/app/models/digital_object.rb', line 3 def cite @cite end |
#cite_item ⇒ Object (readonly)
Returns the value of attribute cite_item
3 4 5 |
# File 'public/app/models/digital_object.rb', line 3 def cite_item @cite_item end |
#cite_item_description ⇒ Object (readonly)
Returns the value of attribute cite_item_description
3 4 5 |
# File 'public/app/models/digital_object.rb', line 3 def cite_item_description @cite_item_description end |
#linked_instances ⇒ Object (readonly)
Returns the value of attribute linked_instances
3 4 5 |
# File 'public/app/models/digital_object.rb', line 3 def linked_instances @linked_instances end |
Class Method Details
.sequel_to_jsonmodel(objs, opts = {}) ⇒ Object
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'backend/app/model/digital_object.rb', line 56 def self.sequel_to_jsonmodel(objs, opts = {}) jsons = super relationships = find_relationship(:instance_do_link).find_by_participant_ids(self, objs.map(&:id)) instances = Instance.filter(:id => relationships.map {|relationship| relationship[:instance_id]}).all relationship_to_instance = Hash[relationships.map {|relationship| [relationship, instances.select {|instance| relationship[:instance_id] == instance.id}] }] jsons.zip(objs).each do |json, obj| json["linked_instances"] = [] relationships.each do |relationship| next unless relationship.relates_to?(obj) instances = relationship_to_instance[relationship] instances.each do |link| uri = self.uri_for(:resource, link[:resource_id]) if link[:resource_id] uri = self.uri_for(:archival_object, link[:archival_object_id]) if link[:archival_object_id] uri = self.uri_for(:accession, link[:accession_id]) if link[:accession_id] if uri.nil? raise "Digital Object Instance not linked to either a resource, archival object or accession" end json["linked_instances"].push({"ref" => uri}) end end end jsons end |
Instance Method Details
#breadcrumb ⇒ Object
25 26 27 28 29 30 31 32 33 |
# File 'public/app/models/digital_object.rb', line 25 def [ { :uri => '', :type => 'digital_object', :crumb => display_string } ] end |
#delete ⇒ Object
91 92 93 94 |
# File 'backend/app/model/digital_object.rb', line 91 def delete (:instance_do_link).map {|sub| sub.delete } super end |
#finding_aid ⇒ Object
15 16 17 18 19 |
# File 'public/app/models/digital_object.rb', line 15 def finding_aid # as this shares the same template as resources, # be clear that this object doesn't have a finding aid nil end |
#root_node_uri ⇒ Object
21 22 23 |
# File 'public/app/models/digital_object.rb', line 21 def root_node_uri uri end |