Module: ASModel

Includes:
JSONModel
Included in:
ASDate, Accession, AgentContact, AgentCorporateEntity, AgentFamily, AgentPerson, AgentRelationshipAssociative, AgentRelationshipEarlierlater, AgentRelationshipParentchild, AgentRelationshipSubordinatesuperior, AgentSoftware, ArchivalObject, Classification, ClassificationTerm, CollectionManagement, Container, ContainerLocation, ContainerProfile, Deaccession, DefaultValues, DigitalObject, DigitalObjectComponent, Enumeration, EnumerationValue, Event, Extent, ExternalDocument, ExternalId, FileVersion, Group, Instance, Job, JobCreatedRecord, JobModifiedRecord, Location, NameAuthorityId, NameCorporateEntity, NameFamily, NamePerson, NameSoftware, Note, NoteBibliography, NoteDigitalObject, NoteIndex, NoteIndexItem, NoteMultipart, NoteOrderedlist, NoteSinglepart, Permission, Preference, RdeTemplate, Repository, Resource, RevisionStatement, RightsStatement, SubContainer, Subject, Telephone, Term, TopContainer, 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_database_mapping.rb

Defined Under Namespace

Modules: CRUD, DatabaseMapping, ModelScoping, RepositoryTransfers, SequelHooks

Constant Summary

@@all_models =
[]

Class Method Summary (collapse)

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

Class Method Details

+ (Object) all_models



16
17
18
# File 'backend/app/model/ASModel.rb', line 16

def self.all_models
  @@all_models
end

+ (Object) included(base)



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'backend/app/model/ASModel.rb', line 20

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

  base.extend(JSONModel)

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

  @@all_models << base
end

+ (Object) update_publish_flag(dataset, val)



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

+ (Object) update_suppressed_flag(dataset, val)

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