Class: AgentSoftware
- Inherits:
-
Sequel::Model
- Object
- Sequel::Model
- AgentSoftware
- Includes:
- ASModel, AgentManager::Mixin, ExternalDocuments, Notes, Publishable, RecordableCataloging, RightsStatements
- Defined in:
- backend/app/model/agent_software.rb
Class Method Summary (collapse)
-
+ (Object) archivesspace_record
-
+ (Object) ensure_correctly_versioned_archivesspace_record
Create the agent record that represents the system itself, or update it if it exists but the build version has changed.
-
+ (Object) system_role
Instance Method Summary (collapse)
Methods included from RightsStatements
Methods included from Publishable
Methods included from Notes
included, #persistent_id_context, #update_from_json
Methods included from RecordableCataloging
Methods included from AgentManager::Mixin
#before_save, included, #linked_agent_roles, #update_from_json, #validate
Methods included from ExternalDocuments
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
Class Method Details
+ (Object) archivesspace_record
35 36 37 |
# File 'backend/app/model/agent_software.rb', line 35 def self.archivesspace_record AgentSoftware[:system_role => system_role] end |
+ (Object) ensure_correctly_versioned_archivesspace_record
Create the agent record that represents the system itself, or update it if it exists but the build version has changed
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'backend/app/model/agent_software.rb', line 42 def self.ensure_correctly_versioned_archivesspace_record if AgentSoftware[:system_role => system_role].nil? json = JSONModel(:agent_software).from_hash( :publish => false, :names => [{ :software_name => 'ArchivesSpace', :version => ASConstants.VERSION, :source => 'local', :rules => 'local', :sort_name_auto_generate => true }]) AgentSoftware.create_from_json(json, :system_generated => true, :system_role => system_role) else as_sequel = AgentSoftware[:system_role => system_role] if as_sequel.name_software[0].version != ASConstants.VERSION as_sequel.name_software[0].version = ASConstants.VERSION as_sequel.name_software[0].save end end end |
+ (Object) system_role
21 22 23 |
# File 'backend/app/model/agent_software.rb', line 21 def self.system_role "archivesspace_agent" end |
Instance Method Details
- (Object) delete
26 27 28 29 30 31 32 |
# File 'backend/app/model/agent_software.rb', line 26 def delete if self.system_role == self.class.system_role raise AccessDeniedException.new("Can't delete the system's own agent") end super end |