Module: ASModel

Includes:
JSONModel
Included in:
ASDate, Accession, AgentAlternateSet, AgentContact, AgentConventionsDeclaration, AgentCorporateEntity, AgentFamily, AgentFunction, AgentGender, AgentIdentifier, AgentMaintenanceHistory, AgentOccupation, AgentOtherAgencyCodes, AgentPerson, AgentPlace, AgentRecordControl, AgentRecordIdentifier, AgentRelationshipAssociative, AgentRelationshipEarlierlater, AgentRelationshipFamily, AgentRelationshipHierarchical, AgentRelationshipIdentity, AgentRelationshipParentchild, AgentRelationshipSubordinatesuperior, AgentRelationshipTemporal, AgentResource, AgentSoftware, AgentSources, AgentTopic, ArchivalObject, ArkName, Assessment, Classification, ClassificationTerm, CollectionManagement, ContainerLocation, ContainerProfile, CustomReportTemplate, Deaccession, DefaultValues, DigitalObject, DigitalObjectComponent, Enumeration, EnumerationValue, Event, Extent, ExternalDocument, ExternalId, FileVersion, Group, Instance, Job, JobCreatedRecord, JobModifiedRecord, LangMaterial, LanguageAndScript, Location, LocationFunction, LocationProfile, MetadataRightsDeclaration, NameAuthorityId, NameCorporateEntity, NameFamily, NamePerson, NameSoftware, Note, NoteBibliography, NoteDigitalObject, NoteIndex, NoteIndexItem, NoteLangMaterial, NoteMultipart, NoteOrderedlist, NoteSinglepart, OAIConfig, ParallelNameCorporateEntity, ParallelNameFamily, ParallelNamePerson, ParallelNameSoftware, Permission, Preference, RdeTemplate, Repository, RequiredFields, Resource, RevisionStatement, RightsStatement, RightsStatementAct, RightsStatementExternalDocument, StructuredDateLabel, StructuredDateRange, StructuredDateSingle, SubContainer, Subject, Telephone, Term, TopContainer, UsedLanguage, User, UserDefined, Vocabulary
Defined in:
backend/app/model/ASModel.rb,
backend/app/model/ASModel_crud.rb,
backend/app/model/ASModel_sequel.rb,
backend/app/model/ASModel_scoping.rb,
backend/app/model/ASModel_transfers.rb,
backend/app/model/ASModel_change_tracking.rb,
backend/app/model/ASModel_database_mapping.rb

Defined Under Namespace

Modules: CRUD, ChangeTracking, ClassMethods, DatabaseMapping, ModelScoping, RepositoryTransfers, SequelHooks

Constant Summary collapse

@@all_models =
[]

Constants included from JSONModel

JSONModel::REFERENCE_KEY_REGEX

Class Method Summary collapse

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

Class Method Details

.all_modelsObject



19
20
21
# File 'backend/app/model/ASModel.rb', line 19

def self.all_models
  @@all_models
end

.included(base) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'backend/app/model/ASModel.rb', line 23

def self.included(base)
  base.instance_eval do
    plugin :optimistic_locking
    plugin :validation_helpers
    plugin :after_initialize
  end

  base.extend(JSONModel)

  base.include(ChangeTracking)
  base.include(CRUD)
  base.include(RepositoryTransfers)
  base.include(DatabaseMapping)
  base.include(SequelHooks)
  base.include(ModelScoping)
  base.include(ObjectGraph)
  base.include(Relationships)

  base.extend(ClassMethods)

  @@all_models << base
end

.update_publish_flag(dataset, val) ⇒ Object



10
11
12
13
# File 'backend/app/model/ASModel_scoping.rb', line 10

def self.update_publish_flag(dataset, val)
  dataset.update(:publish => (val ? 1 : 0),
                 :system_mtime => Time.now)
end

.update_suppressed_flag(dataset, val) ⇒ Object

Code that keeps the records of different repositories isolated and hiding suppressed records.



4
5
6
7
# File 'backend/app/model/ASModel_scoping.rb', line 4

def self.update_suppressed_flag(dataset, val)
  dataset.update(:suppressed => (val ? 1 : 0),
                 :system_mtime => Time.now)
end