From d88a9aafc496175820f4bd755a3b37a19233c857 Mon Sep 17 00:00:00 2001 From: Austin Schaffer Date: Mon, 11 Dec 2017 10:51:07 -0500 Subject: [PATCH 01/13] Moved arch.obj. mapping to a class --- public/plugin_init.rb | 2 +- .../views/aeon/_aeon_request_action.html.erb | 144 ++------------ public/views/aeon/archival_object_mapper.rb | 182 ++++++++++++++++++ 3 files changed, 194 insertions(+), 134 deletions(-) create mode 100644 public/views/aeon/archival_object_mapper.rb diff --git a/public/plugin_init.rb b/public/plugin_init.rb index 789fc39..33c0ce0 100644 --- a/public/plugin_init.rb +++ b/public/plugin_init.rb @@ -2,4 +2,4 @@ AppConfig[:pui_page_custom_actions] << { 'record_type' => ['archival_object'], 'erb_partial' => 'aeon/aeon_request_action' -} \ No newline at end of file +} diff --git a/public/views/aeon/_aeon_request_action.html.erb b/public/views/aeon/_aeon_request_action.html.erb index aeacad0..3008cfa 100644 --- a/public/views/aeon/_aeon_request_action.html.erb +++ b/public/views/aeon/_aeon_request_action.html.erb @@ -1,143 +1,21 @@ -<% - showAction = false - begin - repo_code = record.resolved_repository.dig('repo_code').downcase +<% mapper = ArchivalObjectMapper.new(record) %> - repo_settings = nil - - if (AppConfig[:aeon_fulfillment].include?(repo_code)) - repo_settings = AppConfig[:aeon_fulfillment][repo_code] - end - - if (repo_settings) - puts "-- Aeon Plugin checking for top containers." - has_top_container = false - - unless record['json'].blank? || record['json']['instances'].blank? - record['json']['instances'].each do |instance| - sub_container = instance.dig('sub_container') - - next if sub_container.nil? - - top_container_uri = sub_container.dig('top_container', 'ref'); - - if (!top_container_uri.blank?) - has_top_container = true - end - end - end - - only_top_containers = (repo_settings.include?(:requests_permitted_for_containers_only) ? repo_settings[:requests_permitted_for_containers_only] : false) - - puts "-- Aeon Plugin Containers found? #{has_top_container}" - puts "-- Aeon Plugin only_top_containers? #{only_top_containers}" - - showAction = (has_top_container || !only_top_containers) - end - rescue Exception => e - puts "Failed to create Aeon Request action!!" - puts e.message - puts e.backtrace.inspect - end - %> -<% if showAction %> +<% if mapper.show_action? %> <%= form_tag "#{repo_settings[:aeon_web_url]}aeon.dll?action=11&type=200", :id => 'aeon_request_sub' do |f| %> - <% if repo_settings[:aeon_external_system_id].blank? %> - - <% else %> - - <% end %> - - <% if !AppConfig[:public_proxy_url].blank? %> - ' /> - ' /> - <% elsif !AppConfig[:public_url].blank? %> - ' /> - ' /> - <% end %> - - <% %i(uri identifier component_id title restrictions_apply level publish).each do |member_name| %> - - <% end %> - - <% creators = record['agents'] %> - <% if creators %> - - <% end %> - - <% resolved_resource = record['_resolved_resource'] %> - <% if resolved_resource %> - <% resource_obj = resolved_resource[record['resource']] %> - <% if resource_obj %> - ' /> - ' /> - <% end %> - <% end %> - - <% json = record['json'] %> - <% if json %> - <% %i(display_string language repository_processing_note).each do |member_name| %> - - <% end %> - - <% if json['dates'] %> - <% json['dates'].each do |date| %> - ' value='<%= date['expression'] %>' /> - <% end %> - <% end %> - - <% notes = json['notes'] %> - <% if notes %> - <% notes.each do |note| %> - <% if note['type'] == 'physloc' and note['content'].length > 0 %> - ' /> - <% end %> - <% end %> - <% end %> - - <% instances = json.fetch('instances') %> - <% if instances %> - <% instanceCount = 0 %> - <% instances.each do |instance| %> - <% if !instance['digital_object'] %> - <% instanceCount += 1 %> - - <% %i(instance_type created_by last_modified_by is_representative).each do |member_name| %> - - <% end %> - - ' /> - ' /> - ' /> - ' /> - - <% container = instance['sub_container'] %> - <% if container %> - <% %i(created_by last_modified_by).each do |member_name| %> - - <% end %> - - <% topContainer = container['top_container'] %> - <% if topContainer %> - ' - <% topContainer = topContainer['_resolved'] %> - <% if topContainer %> - <% %i(created_by last_modified_by type indicator restricted display_string long_display_string).each do |member_name| %> - - <% end %> - <% end %> - <% end %> - <% end %> - <% end %> - <% end %> - <% end %> + + <% mapper.map.each do |name, value| %> + <% end %> +
<%= t('actions.request') %> + + <% end %> <% else %> + -<% end %> \ No newline at end of file + +<% end %> diff --git a/public/views/aeon/archival_object_mapper.rb b/public/views/aeon/archival_object_mapper.rb new file mode 100644 index 0000000..812a1be --- /dev/null +++ b/public/views/aeon/archival_object_mapper.rb @@ -0,0 +1,182 @@ +class ArchivalObjectMapper + + attr_reader :record + + def initialize(record) + @record = record + end + + + def repo_code + self.record.resolved_repository.dig('repo_code').downcase + end + + + def repo_settings + AppConfig[:aeon_fulfillment][self.repo_code] + end + + + def show_action? + begin + if self.repo_settings + + puts "-- Aeon Plugin checking for top containers." + has_top_container = false + + if self.record['json'].present? && self.record['json']['instances'].present? + self.record['json']['instances'].each do |instance| + + sub_container = instance.dig('sub_container') + next if !sub_container + + top_container_uri = sub_container.dig('top_container', 'ref'); + + if !top_container_uri.blank? + has_top_container = true + end + end + end + + only_top_containers = self.repo_settings[:requests_permitted_for_containers_only] || false + + puts "-- Aeon Plugin Containers found? #{has_top_container}" + puts "-- Aeon Plugin only_top_containers? #{only_top_containers}" + + return (has_top_container || !only_top_containers) + end + + rescue Exception => e + puts "Failed to create Aeon Request action." + puts e.message + puts e.backtrace.inspect + + end + + return false + end + + + # Returns a hash that maps from Aeon OpenURL + # values to values in the provided record. + def map + mappings = {} + + if !self.show_action? return mappings + + mappings['SystemID'] = + if (!self.repo_settings[:aeon_external_system_id].blank?) + self.repo_settings[:aeon_external_system_id] + else + "ArchivesSpace" + end + + return_url = + if (!AppConfig[:public_proxy_url].blank?) + AppConfig[:public_proxy_url] + elsif (!AppConfig[:public_url].blank?) + AppConfig[:public_url] + else + "" + end + + mappings['ReturnLinkURL'] = "#{return_url}#{self.record['uri']}" + + mappings['ReturnLinkSystemName'] = + if (!self.repo_settings[:aeon_return_link_label].blank?) + self.repo_settings[:aeon_return_link_label] + else + "ArchivesSpace" + end + + mappings['restrictions_apply'] = self.record['restrictions_apply'] + mappings['component_id'] = self.record['component_id'] + mappings['identifier'] = self.record['identifier'] + mappings['publish'] = self.record['publish'] + mappings['level'] = self.record['level'] + mappings['title'] = self.record['title'] + mappings['uri'] = self.record['uri'] + + if record['agents'] + mappings['creators'] = self.record['agents'].map { |k| "#{k}" }.join("; ") + end + + resolved_resource = self.record['_resolved_resource'] + if resolved_resource + + resource_obj = resolved_resource[self.record['resource']] + if resource_obj + mappings['collection_id'] = "#{resource_obj[0]['id_0']} #{resource_obj[0]['id_1']} #{resource_obj[0]['id_2']} #{resource_obj[0]['id_3']}".rstrip + mappings['collection_title'] = resource_obj[0]['title'] + end + end + + json = self.record['json'] + if json + mappings['repository_processing_note'] = json['repository_processing_note'] + mappings['display_string'] = json['display_string'] + mappings['language'] = json['language'] + mappings['mapping'] = json['mapping'] + + if json['notes'] + json['notes'].each do |note| + if note['type'] == 'physloc' and note['content'].length > 0 + mappings['physical_location_note'] = note['content'].map { |cont| "#{cont}" }.join("; ") + end + end + end + + if json['dates'] + json['dates'].each do |date| + mappings["#{date['label']}_date"] = date['expression'] + end + end + + instances = json.fetch('instances') + if instances + instance_count = 0 + instances.each do |instance| + if !instance['digital_object'] + instance_count += 1 + + mappings['Request'] = "#{instance_count}" + + mappings["instance_is_representative_#{instance_count}"] = instance['is_representative'] + mappings["instance_last_modified_by_#{instance_count}"] = instance['last_modified_by'] + mappings["instance_instance_type_#{instance_count}"] = instance['instance_type'] + mappings["instance_created_by_#{instance_count}"] = instance['created_by'] + + mappings['instance_container_grandchild_indicator'] = instance['indicator_3'] + mappings['instance_container_child_indicator'] = instance['indicator_2'] + mappings['instance_container_grandchild_type'] = instance['type_3'] + mappings['instance_container_child_type'] = instance['type_2'] + + container = instance['sub_container'] + if container + mappings["instance_container_last_modified_by_#{instance_count}"] = container['last_modified_by'] + mappings["instance_container_created_by_#{instance_count}"] = container['created_by'] + + top_container = container['top_container'] + if top_container + mappings["instance_top_container_uri_#{instance_count}"] = top_container['uri'] + + top_container_resolved = top_container['_resolved'] + if top_container_resolved + mappings["instance_top_container_long_display_string_#{instance_count}"] = top_container_resolved['long_display_string'] + mappings["instance_top_container_last_modified_by_#{instance_count}"] = top_container_resolved['last_modified_by'] + mappings["instance_top_container_display_string_#{instance_count}"] = top_container_resolved['display_string'] + mappings["instance_top_container_restricted_#{instance_count}"] = top_container_resolved['restricted'] + mappings["instance_top_container_created_by_#{instance_count}"] = top_container_resolved['created_by'] + mappings["instance_top_container_indicator_#{instance_count}"] = top_container_resolved['indicator'] + mappings["instance_top_container_type_#{instance_count}"] = top_container_resolved['type'] + end + end + end + end + end + end + end + + return mappings + end +end From c9cfee7cba852cba9afd3c7c118759157c5a5859 Mon Sep 17 00:00:00 2001 From: Austin Schaffer Date: Tue, 12 Dec 2017 16:03:22 -0500 Subject: [PATCH 02/13] Stable 2.0 - Added Accession handling --- Readme.md | 8 +- public/lib/accession_mapper.rb | 62 ++++++ public/lib/archival_object_mapper.rb | 69 +++++++ public/lib/record_mapper.rb | 164 ++++++++++++++++ public/locales/en.yml | 4 + public/plugin_init.rb | 9 +- .../views/aeon/_aeon_request_action.html.erb | 48 ++++- public/views/aeon/archival_object_mapper.rb | 182 ------------------ 8 files changed, 351 insertions(+), 195 deletions(-) create mode 100644 public/lib/accession_mapper.rb create mode 100644 public/lib/archival_object_mapper.rb create mode 100644 public/lib/record_mapper.rb create mode 100644 public/locales/en.yml delete mode 100644 public/views/aeon/archival_object_mapper.rb diff --git a/Readme.md b/Readme.md index 1ff6631..809021c 100644 --- a/Readme.md +++ b/Readme.md @@ -23,7 +23,7 @@ AppConfig[:plugins] = << 'aeon_fulfillment' AppConfig[:aeon_fulfillment] = {} AppConfig[:aeon_fulfillment]['atlas'] = {} AppConfig[:aeon_fulfillment]['atlas'][:aeon_web_url] = "https://your.institution.edu/aeon/" -AppConfig[:aeon_fulfillment]['atlas'][:aeon_return_link_label] = "ArchivesSpace" +AppConfig[:aeon_fulfillment]['atlas'][:aeon_return_link_label] = "ArchivesSpace" ``` **All Aeon Fulfillment Plugin Specific Configuration Options** @@ -32,17 +32,17 @@ AppConfig[:aeon_fulfillment]['atlas'][:aeon_return_link_label] = "ArchivesSpace" AppConfig[:aeon_fulfillment]['{repo_code}'][:aeon_web_url] # (required) The text to display on the button that takes users back to ArchivesSpace -AppConfig[:aeon_fulfillment]['{repo_code}'][:aeon_return_link_label] +AppConfig[:aeon_fulfillment]['{repo_code}'][:aeon_return_link_label] # Specifies whether requests are limited to resources with top containers only. Default is false. AppConfig[:aeon_fulfillment]['{repo_code}'][:requests_permitted_for_containers_only] # The system ID to match fields against in Aeon's OpenURLMapping table. -AppConfig[:aeon_fulfillment]['{repo_code}'][:aeon_external_system_id] +AppConfig[:aeon_fulfillment]['{repo_code}'][:aeon_external_system_id] ``` **Fields imported from the resource (Incomplete list)** -- uri +- uri - identifier - component_id - title diff --git a/public/lib/accession_mapper.rb b/public/lib/accession_mapper.rb new file mode 100644 index 0000000..b53c408 --- /dev/null +++ b/public/lib/accession_mapper.rb @@ -0,0 +1,62 @@ +class AccessionMapper < RecordMapper + + def initialize(accession) + super(accession) + end + + + def show_action? + begin + if self.repo_settings + + puts "-- Aeon Plugin checking for top containers." + has_top_container = false + + if self.record['json'].present? && self.record['json']['instances'].present? + self.record['json']['instances'].each do |instance| + + sub_container = instance.dig('sub_container') + next if !sub_container + + top_container_uri = sub_container.dig('top_container', 'ref') + + if !top_container_uri.blank? + has_top_container = true + end + end + end + + only_top_containers = self.repo_settings[:requests_permitted_for_containers_only] || false + + puts "-- Aeon Plugin Containers found? #{has_top_container}" + puts "-- Aeon Plugin only_top_containers? #{only_top_containers}" + + return (has_top_container || !only_top_containers) + end + + rescue Exception => e + puts "Failed to create Aeon Request action." + puts e.message + puts e.backtrace.inspect + + end + + super + end + + + # Returns a hash that maps from Aeon OpenURL values to values in the provided record. + def map + mappings = super + + if record.use_restrictions_note && !record.use_restrictions_note.blank? + mappings['use_restrictions_note'] = record.use_restrictions_note + end + + if record.access_restrictions_note && !record.access_restrictions_note.blank? + mappings['access_restrictions_note'] = record.access_restrictions_note + end + + return mappings + end +end diff --git a/public/lib/archival_object_mapper.rb b/public/lib/archival_object_mapper.rb new file mode 100644 index 0000000..167f60f --- /dev/null +++ b/public/lib/archival_object_mapper.rb @@ -0,0 +1,69 @@ +class ArchivalObjectMapper < RecordMapper + + def initialize(archival_object) + super(archival_object) + end + + + def show_action? + begin + if self.repo_settings + + puts "-- Aeon Plugin checking for top containers." + has_top_container = false + + if self.record['json'].present? && self.record['json']['instances'].present? + self.record['json']['instances'].each do |instance| + + sub_container = instance.dig('sub_container') + next if !sub_container + + top_container_uri = sub_container.dig('top_container', 'ref') + + if !top_container_uri.blank? + has_top_container = true + end + end + end + + only_top_containers = self.repo_settings[:requests_permitted_for_containers_only] || false + + puts "-- Aeon Plugin Containers found? #{has_top_container}" + puts "-- Aeon Plugin only_top_containers? #{only_top_containers}" + + return (has_top_container || !only_top_containers) + end + + rescue Exception => e + puts "Failed to create Aeon Request action." + puts e.message + puts e.backtrace.inspect + + end + + super + end + + + def json_fields + mappings = super + + json = self.record.json + if !json + return mappings + end + + mappings['repository_processing_note'] = json['repository_processing_note'] + return mappings + end + + + # Returns a hash that maps from Aeon OpenURL values to values in the provided record. + def map + mappings = super + + mappings['component_id'] = self.record['component_id'] + + return mappings + end +end diff --git a/public/lib/record_mapper.rb b/public/lib/record_mapper.rb new file mode 100644 index 0000000..58eb3f0 --- /dev/null +++ b/public/lib/record_mapper.rb @@ -0,0 +1,164 @@ +class RecordMapper + + attr_reader :record + + def initialize(record) + @record = record + end + + def repo_code + self.record.resolved_repository.dig('repo_code').downcase + end + + def repo_settings + AppConfig[:aeon_fulfillment][self.repo_code] + end + + def show_action? + false + end + + + # Pulls data from the contained record + def map + mappings = {} + + mappings['SystemID'] = + if (!self.repo_settings[:aeon_external_system_id].blank?) + self.repo_settings[:aeon_external_system_id] + else + "ArchivesSpace" + end + + return_url = + if (!AppConfig[:public_proxy_url].blank?) + AppConfig[:public_proxy_url] + elsif (!AppConfig[:public_url].blank?) + AppConfig[:public_url] + else + "" + end + + mappings['ReturnLinkURL'] = "#{return_url}#{self.record['uri']}" + + mappings['ReturnLinkSystemName'] = + if (!self.repo_settings[:aeon_return_link_label].blank?) + self.repo_settings[:aeon_return_link_label] + else + "ArchivesSpace" + end + + # Merge in data from self.record.json + mappings = mappings.merge(self.json_fields) + + # Data pulled from self.record and self.record.raw + mappings['identifier'] = self.record.identifier || self.record['identifier'] + mappings['level'] = self.record.level || self.record['level'] + mappings['uri'] = self.record.uri || self.record['uri'] + + resolved_resource = self.record['_resolved_resource'] || self.record.resolved_resource + if resolved_resource + resource_obj = resolved_resource[self.record['resource']] + if resource_obj + mappings['collection_id'] = "#{resource_obj[0]['id_0']} #{resource_obj[0]['id_1']} #{resource_obj[0]['id_2']} #{resource_obj[0]['id_3']}".rstrip + mappings['collection_title'] = resource_obj[0]['title'] + end + end + + mappings['language'] ||= self.record['language'] + mappings['publish'] = self.record['publish'] + mappings['title'] = self.record['title'] + + if record['creators'] + mappings['creators'] = self.record['creators'].map { |k| "#{k}" }.join("; ") + end + + return mappings + end + + + # Pulls relevant data from the record's JSON property + def json_fields + + mappings = {} + + json = self.record.json + if !json + return mappings + end + + mappings['language'] = json['language'] + + if json['notes'] + json['notes'].each do |note| + if note['type'] == 'physloc' and note['content'].length > 0 + mappings['physical_location_note'] = note['content'].map { |cont| "#{cont}" }.join("; ") + end + end + end + + if json['dates'] + json['dates'].each do |date| + mappings["#{date['label']}_date"] = date['expression'] + end + end + + mappings['restrictions_apply'] = json['restrictions_apply'] + mappings['display_string'] = json['display_string'] + + instances = json.fetch('instances') + if !instances + return mappings + end + + mappings['requests'] = [] + + instance_count = 0 + instances.each do |instance| + next if instance['digital_object'] + request = {} + + instance_count += 1 + + request['Request'] = "#{instance_count}" + + request["instance_is_representative_#{instance_count}"] = instance['is_representative'] + request["instance_last_modified_by_#{instance_count}"] = instance['last_modified_by'] + request["instance_instance_type_#{instance_count}"] = instance['instance_type'] + request["instance_created_by_#{instance_count}"] = instance['created_by'] + + request['instance_container_grandchild_indicator'] = instance['indicator_3'] + request['instance_container_child_indicator'] = instance['indicator_2'] + request['instance_container_grandchild_type'] = instance['type_3'] + request['instance_container_child_type'] = instance['type_2'] + + container = instance['sub_container'] + if container + request["instance_container_last_modified_by_#{instance_count}"] = container['last_modified_by'] + request["instance_container_created_by_#{instance_count}"] = container['created_by'] + + top_container = container['top_container'] + if top_container + request["instance_top_container_uri_#{instance_count}"] = top_container['uri'] + + top_container_resolved = top_container['_resolved'] + if top_container_resolved + request["instance_top_container_long_display_string_#{instance_count}"] = top_container_resolved['long_display_string'] + request["instance_top_container_last_modified_by_#{instance_count}"] = top_container_resolved['last_modified_by'] + request["instance_top_container_display_string_#{instance_count}"] = top_container_resolved['display_string'] + request["instance_top_container_restricted_#{instance_count}"] = top_container_resolved['restricted'] + request["instance_top_container_created_by_#{instance_count}"] = top_container_resolved['created_by'] + request["instance_top_container_indicator_#{instance_count}"] = top_container_resolved['indicator'] + request["instance_top_container_type_#{instance_count}"] = top_container_resolved['type'] + end + end + end + + mappings['requests'] << request + end + + return mappings + end + + protected :json_fields +end diff --git a/public/locales/en.yml b/public/locales/en.yml new file mode 100644 index 0000000..690de31 --- /dev/null +++ b/public/locales/en.yml @@ -0,0 +1,4 @@ +en: + aeon_fulfillment: + request_record: Aeon Request + requesting_disabled: This record is not a container. diff --git a/public/plugin_init.rb b/public/plugin_init.rb index 33c0ce0..3d9d8a6 100644 --- a/public/plugin_init.rb +++ b/public/plugin_init.rb @@ -1,5 +1,12 @@ ## Register our custom page action + +require_relative 'lib/record_mapper' +require_relative 'lib/archival_object_mapper' +require_relative 'lib/accession_mapper' + AppConfig[:pui_page_custom_actions] << { - 'record_type' => ['archival_object'], + 'record_type' => ['archival_object', 'accession'], 'erb_partial' => 'aeon/aeon_request_action' } + + diff --git a/public/views/aeon/_aeon_request_action.html.erb b/public/views/aeon/_aeon_request_action.html.erb index 3008cfa..c392949 100644 --- a/public/views/aeon/_aeon_request_action.html.erb +++ b/public/views/aeon/_aeon_request_action.html.erb @@ -1,21 +1,53 @@ -<% mapper = ArchivalObjectMapper.new(record) %> +<% +mapper = case record + when ArchivalObject + ArchivalObjectMapper.new(record) + when Accession + AccessionMapper.new(record) + else + puts record.inspect + raise "This ArchivesSpace object type is not supported" + end +%> + <% if mapper.show_action? %> - <%= form_tag "#{repo_settings[:aeon_web_url]}aeon.dll?action=11&type=200", :id => 'aeon_request_sub' do |f| %> - + <%= form_tag "#{mapper.repo_settings[:aeon_web_url]}aeon.dll?action=11&type=200", :id => 'aeon_request_sub' do |f| %> + <% mapper.map.each do |name, value| %> - + <% if name.casecmp('requests').zero? %> + <% value.each do |request| %> + <% request.each do |request_param, request_value| %> + + <% end %> + <% end %> + <% else %> + + <% end %> <% end %> - - <% end %> + <% else %> <% end %> + + + + + + +
+
+ <%= record.inspect %> +
+
diff --git a/public/views/aeon/archival_object_mapper.rb b/public/views/aeon/archival_object_mapper.rb deleted file mode 100644 index 812a1be..0000000 --- a/public/views/aeon/archival_object_mapper.rb +++ /dev/null @@ -1,182 +0,0 @@ -class ArchivalObjectMapper - - attr_reader :record - - def initialize(record) - @record = record - end - - - def repo_code - self.record.resolved_repository.dig('repo_code').downcase - end - - - def repo_settings - AppConfig[:aeon_fulfillment][self.repo_code] - end - - - def show_action? - begin - if self.repo_settings - - puts "-- Aeon Plugin checking for top containers." - has_top_container = false - - if self.record['json'].present? && self.record['json']['instances'].present? - self.record['json']['instances'].each do |instance| - - sub_container = instance.dig('sub_container') - next if !sub_container - - top_container_uri = sub_container.dig('top_container', 'ref'); - - if !top_container_uri.blank? - has_top_container = true - end - end - end - - only_top_containers = self.repo_settings[:requests_permitted_for_containers_only] || false - - puts "-- Aeon Plugin Containers found? #{has_top_container}" - puts "-- Aeon Plugin only_top_containers? #{only_top_containers}" - - return (has_top_container || !only_top_containers) - end - - rescue Exception => e - puts "Failed to create Aeon Request action." - puts e.message - puts e.backtrace.inspect - - end - - return false - end - - - # Returns a hash that maps from Aeon OpenURL - # values to values in the provided record. - def map - mappings = {} - - if !self.show_action? return mappings - - mappings['SystemID'] = - if (!self.repo_settings[:aeon_external_system_id].blank?) - self.repo_settings[:aeon_external_system_id] - else - "ArchivesSpace" - end - - return_url = - if (!AppConfig[:public_proxy_url].blank?) - AppConfig[:public_proxy_url] - elsif (!AppConfig[:public_url].blank?) - AppConfig[:public_url] - else - "" - end - - mappings['ReturnLinkURL'] = "#{return_url}#{self.record['uri']}" - - mappings['ReturnLinkSystemName'] = - if (!self.repo_settings[:aeon_return_link_label].blank?) - self.repo_settings[:aeon_return_link_label] - else - "ArchivesSpace" - end - - mappings['restrictions_apply'] = self.record['restrictions_apply'] - mappings['component_id'] = self.record['component_id'] - mappings['identifier'] = self.record['identifier'] - mappings['publish'] = self.record['publish'] - mappings['level'] = self.record['level'] - mappings['title'] = self.record['title'] - mappings['uri'] = self.record['uri'] - - if record['agents'] - mappings['creators'] = self.record['agents'].map { |k| "#{k}" }.join("; ") - end - - resolved_resource = self.record['_resolved_resource'] - if resolved_resource - - resource_obj = resolved_resource[self.record['resource']] - if resource_obj - mappings['collection_id'] = "#{resource_obj[0]['id_0']} #{resource_obj[0]['id_1']} #{resource_obj[0]['id_2']} #{resource_obj[0]['id_3']}".rstrip - mappings['collection_title'] = resource_obj[0]['title'] - end - end - - json = self.record['json'] - if json - mappings['repository_processing_note'] = json['repository_processing_note'] - mappings['display_string'] = json['display_string'] - mappings['language'] = json['language'] - mappings['mapping'] = json['mapping'] - - if json['notes'] - json['notes'].each do |note| - if note['type'] == 'physloc' and note['content'].length > 0 - mappings['physical_location_note'] = note['content'].map { |cont| "#{cont}" }.join("; ") - end - end - end - - if json['dates'] - json['dates'].each do |date| - mappings["#{date['label']}_date"] = date['expression'] - end - end - - instances = json.fetch('instances') - if instances - instance_count = 0 - instances.each do |instance| - if !instance['digital_object'] - instance_count += 1 - - mappings['Request'] = "#{instance_count}" - - mappings["instance_is_representative_#{instance_count}"] = instance['is_representative'] - mappings["instance_last_modified_by_#{instance_count}"] = instance['last_modified_by'] - mappings["instance_instance_type_#{instance_count}"] = instance['instance_type'] - mappings["instance_created_by_#{instance_count}"] = instance['created_by'] - - mappings['instance_container_grandchild_indicator'] = instance['indicator_3'] - mappings['instance_container_child_indicator'] = instance['indicator_2'] - mappings['instance_container_grandchild_type'] = instance['type_3'] - mappings['instance_container_child_type'] = instance['type_2'] - - container = instance['sub_container'] - if container - mappings["instance_container_last_modified_by_#{instance_count}"] = container['last_modified_by'] - mappings["instance_container_created_by_#{instance_count}"] = container['created_by'] - - top_container = container['top_container'] - if top_container - mappings["instance_top_container_uri_#{instance_count}"] = top_container['uri'] - - top_container_resolved = top_container['_resolved'] - if top_container_resolved - mappings["instance_top_container_long_display_string_#{instance_count}"] = top_container_resolved['long_display_string'] - mappings["instance_top_container_last_modified_by_#{instance_count}"] = top_container_resolved['last_modified_by'] - mappings["instance_top_container_display_string_#{instance_count}"] = top_container_resolved['display_string'] - mappings["instance_top_container_restricted_#{instance_count}"] = top_container_resolved['restricted'] - mappings["instance_top_container_created_by_#{instance_count}"] = top_container_resolved['created_by'] - mappings["instance_top_container_indicator_#{instance_count}"] = top_container_resolved['indicator'] - mappings["instance_top_container_type_#{instance_count}"] = top_container_resolved['type'] - end - end - end - end - end - end - end - - return mappings - end -end From 4a0a3f7ebd3b5eecf945cb13b26072c41837521c Mon Sep 17 00:00:00 2001 From: Austin Schaffer Date: Wed, 13 Dec 2017 08:31:37 -0500 Subject: [PATCH 03/13] Moved show_action? into RecordMapper superclass --- public/lib/accession_mapper.rb | 41 ---------------------------- public/lib/archival_object_mapper.rb | 39 -------------------------- public/lib/record_mapper.rb | 35 ++++++++++++++++++++++++ 3 files changed, 35 insertions(+), 80 deletions(-) diff --git a/public/lib/accession_mapper.rb b/public/lib/accession_mapper.rb index b53c408..bc8fe78 100644 --- a/public/lib/accession_mapper.rb +++ b/public/lib/accession_mapper.rb @@ -4,47 +4,6 @@ def initialize(accession) super(accession) end - - def show_action? - begin - if self.repo_settings - - puts "-- Aeon Plugin checking for top containers." - has_top_container = false - - if self.record['json'].present? && self.record['json']['instances'].present? - self.record['json']['instances'].each do |instance| - - sub_container = instance.dig('sub_container') - next if !sub_container - - top_container_uri = sub_container.dig('top_container', 'ref') - - if !top_container_uri.blank? - has_top_container = true - end - end - end - - only_top_containers = self.repo_settings[:requests_permitted_for_containers_only] || false - - puts "-- Aeon Plugin Containers found? #{has_top_container}" - puts "-- Aeon Plugin only_top_containers? #{only_top_containers}" - - return (has_top_container || !only_top_containers) - end - - rescue Exception => e - puts "Failed to create Aeon Request action." - puts e.message - puts e.backtrace.inspect - - end - - super - end - - # Returns a hash that maps from Aeon OpenURL values to values in the provided record. def map mappings = super diff --git a/public/lib/archival_object_mapper.rb b/public/lib/archival_object_mapper.rb index 167f60f..e3e9f0e 100644 --- a/public/lib/archival_object_mapper.rb +++ b/public/lib/archival_object_mapper.rb @@ -5,45 +5,6 @@ def initialize(archival_object) end - def show_action? - begin - if self.repo_settings - - puts "-- Aeon Plugin checking for top containers." - has_top_container = false - - if self.record['json'].present? && self.record['json']['instances'].present? - self.record['json']['instances'].each do |instance| - - sub_container = instance.dig('sub_container') - next if !sub_container - - top_container_uri = sub_container.dig('top_container', 'ref') - - if !top_container_uri.blank? - has_top_container = true - end - end - end - - only_top_containers = self.repo_settings[:requests_permitted_for_containers_only] || false - - puts "-- Aeon Plugin Containers found? #{has_top_container}" - puts "-- Aeon Plugin only_top_containers? #{only_top_containers}" - - return (has_top_container || !only_top_containers) - end - - rescue Exception => e - puts "Failed to create Aeon Request action." - puts e.message - puts e.backtrace.inspect - - end - - super - end - def json_fields mappings = super diff --git a/public/lib/record_mapper.rb b/public/lib/record_mapper.rb index 58eb3f0..854e516 100644 --- a/public/lib/record_mapper.rb +++ b/public/lib/record_mapper.rb @@ -15,6 +15,41 @@ def repo_settings end def show_action? + begin + if self.repo_settings + + puts "-- Aeon Plugin checking for top containers." + has_top_container = false + + if self.record['json'].present? && self.record['json']['instances'].present? + self.record['json']['instances'].each do |instance| + + sub_container = instance.dig('sub_container') + next if !sub_container + + top_container_uri = sub_container.dig('top_container', 'ref') + + if top_container_uri && !top_container_uri.blank? + has_top_container = true + end + end + end + + only_top_containers = self.repo_settings[:requests_permitted_for_containers_only] || false + + puts "-- Aeon Plugin Containers found? #{has_top_container}" + puts "-- Aeon Plugin only_top_containers? #{only_top_containers}" + + return (has_top_container || !only_top_containers) + end + + rescue Exception => e + puts "Failed to create Aeon Request action." + puts e.message + puts e.backtrace.inspect + + end + false end From 2de2441f0139ec5b00013c60a976bd7cd1e3911b Mon Sep 17 00:00:00 2001 From: Austin Schaffer Date: Wed, 13 Dec 2017 08:32:43 -0500 Subject: [PATCH 04/13] Some additional mappings added/configured --- public/lib/archival_object_mapper.rb | 8 ++++++-- public/lib/record_mapper.rb | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/public/lib/archival_object_mapper.rb b/public/lib/archival_object_mapper.rb index e3e9f0e..9d57f12 100644 --- a/public/lib/archival_object_mapper.rb +++ b/public/lib/archival_object_mapper.rb @@ -5,7 +5,7 @@ def initialize(archival_object) end - + # Override for RecordMapper json_fields method. def json_fields mappings = super @@ -14,7 +14,10 @@ def json_fields return mappings end - mappings['repository_processing_note'] = json['repository_processing_note'] + if json['repository_processing_note'] && !json['repository_processing_note'].blank? + mappings['repository_processing_note'] = json['repository_processing_note'] + end + return mappings end @@ -25,6 +28,7 @@ def map mappings['component_id'] = self.record['component_id'] + return mappings end end diff --git a/public/lib/record_mapper.rb b/public/lib/record_mapper.rb index 854e516..141eb58 100644 --- a/public/lib/record_mapper.rb +++ b/public/lib/record_mapper.rb @@ -126,7 +126,7 @@ def json_fields if json['notes'] json['notes'].each do |note| - if note['type'] == 'physloc' and note['content'].length > 0 + if note['type'] == 'physloc' and !note['content'].blank? mappings['physical_location_note'] = note['content'].map { |cont| "#{cont}" }.join("; ") end end @@ -192,7 +192,7 @@ def json_fields mappings['requests'] << request end - return mappings + mappings end protected :json_fields From c706cacb4a73a60cd2b1f8e90a7a67435dc71255 Mon Sep 17 00:00:00 2001 From: Austin Schaffer Date: Tue, 2 Jan 2018 09:50:36 -0500 Subject: [PATCH 05/13] Updated the README with proper Markdown styling. --- Readme.md | 55 ++++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 42 insertions(+), 13 deletions(-) diff --git a/Readme.md b/Readme.md index 809021c..0ceb113 100644 --- a/Readme.md +++ b/Readme.md @@ -1,32 +1,54 @@ -ArchivesSpace Request Fulfillment via Aeon - Updated 20171204 -============================================================= -This plugin adds a new request button to archival objects that allows researchers to place Aeon requests for archival objects discovered via the ArchivesSpace Public User Interface. +# ArchivesSpace Request Fulfillment via Aeon - Updated 20171204 -The functionality provided by this plugin is meant to replace the existing Public UI request action functionality for archival objects. As such, it is recommended that the built in functionality be disabled by setting 'AppConfig[:pui_page_actions_request] = false' or by removing ':archival_object' from your 'AppConfig[:pui_requests_permitted_for_types]' setting. The latter will allow you to use Aeon to fulfill archival_object requests while still allowing other object types to be requested via the default email functionality. By using the 'per repository' configuration options for the built in PUI requesting functionality, it is also possible to configure some repositories to continue using the built in PUI requesting feature for archival objects while allowing other repositories to use Aeon. +This plugin adds a new request button to archival objects that allows +researchers to place Aeon requests for archival objects discovered via the +ArchivesSpace Public User Interface. + +The functionality provided by this plugin is meant to replace the existing +Public UI request action functionality for archival objects. As such, it is +recommended that the built in functionality be disabled by setting +`AppConfig[:pui_page_actions_request] = false` or by removing `:archival_object` from your `AppConfig[:pui_requests_permitted_for_types]` +setting. The latter will allow you to use Aeon to fulfill archival_object +requests while still allowing other object types to be requested via the +default email functionality. By using the 'per repository' configuration +options for the built in PUI requesting functionality, it is also possible to +configure some repositories to continue using the built in PUI requesting +feature for archival objects while allowing other repositories to use Aeon. + + +## Configuring Addon Settings + +Add the following after your list of plugins has been initialized. -**Add the following after your list of plugins has been initialized** ```ruby -AppConfig[:plugins] = << 'aeon_fulfillment' +AppConfig[:plugins] << 'aeon_fulfillment' AppConfig[:aeon_fulfillment] = {} ``` -**Add the following settings and appropriate values for EACH repository that will use the plugin. Replace '{repo_code}' with the appropriate repository code (also known as a short name) for the repository (lower-cased).** +Add the following settings and appropriate values for EACH repository that +will use the plugin. Replace `{repo_code}` with the appropriate repository +code (also known as a short name) for the repository (lower-cased). + ```ruby AppConfig[:aeon_fulfillment]['{repo_code}'] = {} AppConfig[:aeon_fulfillment]['{repo_code}'][:aeon_web_url] = "{Your aeon web url}" AppConfig[:aeon_fulfillment]['{repo_code}'][:aeon_return_link_label] = "{The text for the return link from Aeon}" ``` -For example, to configure the addon for a repository with a code of "ATLAS" add the following to config.rb +For example, to configure the addon for a repository with a code of "ATLAS" +add the following to `config.rb`. + ```ruby -AppConfig[:plugins] = << 'aeon_fulfillment' +AppConfig[:plugins] << 'aeon_fulfillment' AppConfig[:aeon_fulfillment] = {} AppConfig[:aeon_fulfillment]['atlas'] = {} AppConfig[:aeon_fulfillment]['atlas'][:aeon_web_url] = "https://your.institution.edu/aeon/" AppConfig[:aeon_fulfillment]['atlas'][:aeon_return_link_label] = "ArchivesSpace" ``` -**All Aeon Fulfillment Plugin Specific Configuration Options** + +## All Aeon Fulfillment Plugin Specific Configuration Options + ```ruby # (required) The URL to your Aeon web site AppConfig[:aeon_fulfillment]['{repo_code}'][:aeon_web_url] @@ -41,7 +63,11 @@ AppConfig[:aeon_fulfillment]['{repo_code}'][:requests_permitted_for_containers_o AppConfig[:aeon_fulfillment]['{repo_code}'][:aeon_external_system_id] ``` -**Fields imported from the resource (Incomplete list)** + +## Fields Imported from the Resource + +(Incomplete list) + - uri - identifier - component_id @@ -51,9 +77,12 @@ AppConfig[:aeon_fulfillment]['{repo_code}'][:aeon_external_system_id] - publish - creator (as a semi-colon separated string list) -Recommended OpenURL Mappings -```sql +## Recommended OpenURL Mappings + +Below is an incomplete list of Open URL mappings that should be set in Aeon. + +```sql INSERT INTO OpenURLMapping (URL_Ver, rfr_id, AeonAction, AeonFieldName, OpenURLFieldValues, AeonValue) VALUES ('Default', 'ArchivesSpace', 'Replace', 'ItemAuthor', '<#creators>', 'NULL'); INSERT INTO OpenURLMapping (URL_Ver, rfr_id, AeonAction, AeonFieldName, OpenURLFieldValues, AeonValue) VALUES ('Default', 'ArchivesSpace', 'Replace', 'ItemDate', '<#created_date>|<#Created_date>', 'NULL'); INSERT INTO OpenURLMapping (URL_Ver, rfr_id, AeonAction, AeonFieldName, OpenURLFieldValues, AeonValue) VALUES ('Default', 'ArchivesSpace', 'Replace', 'ItemTitle', '<#title>', 'NULL'); From 05f96c568580ba38ae5387d1d7b50eb5f685a034 Mon Sep 17 00:00:00 2001 From: Austin Schaffer Date: Tue, 2 Jan 2018 11:07:17 -0500 Subject: [PATCH 06/13] Added logging for plugin initialization --- public/views/aeon/_aeon_request_action.html.erb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/public/views/aeon/_aeon_request_action.html.erb b/public/views/aeon/_aeon_request_action.html.erb index c392949..04c6869 100644 --- a/public/views/aeon/_aeon_request_action.html.erb +++ b/public/views/aeon/_aeon_request_action.html.erb @@ -1,4 +1,6 @@ <% +puts "-- Initializing Aeon Plugin..." + mapper = case record when ArchivalObject ArchivalObjectMapper.new(record) @@ -39,6 +41,8 @@ mapper = case record <% end %> +<% puts "-- Finished initializing Aeon plugin." %> + From 14e1425f15344757ca74552624f17e6049aaaef6 Mon Sep 17 00:00:00 2001 From: Austin Schaffer Date: Tue, 2 Jan 2018 14:54:35 -0500 Subject: [PATCH 07/13] Changed logging from `puts` to `Rails.logger.debug` --- public/lib/record_mapper.rb | 30 ++++++++++++------- .../views/aeon/_aeon_request_action.html.erb | 16 ++++++---- 2 files changed, 29 insertions(+), 17 deletions(-) diff --git a/public/lib/record_mapper.rb b/public/lib/record_mapper.rb index 141eb58..21c7aba 100644 --- a/public/lib/record_mapper.rb +++ b/public/lib/record_mapper.rb @@ -6,6 +6,10 @@ def initialize(record) @record = record end + def logger + Rails.logger + end + def repo_code self.record.resolved_repository.dig('repo_code').downcase end @@ -16,12 +20,16 @@ def repo_settings def show_action? begin - if self.repo_settings + logger.debug "Checking for plugin settings for the repository" - puts "-- Aeon Plugin checking for top containers." + if !self.repo_settings + logger.debug "Could not find plugin settings for the repository: \"#{self.repo_code}\"." + else + logger.debug "Checking for top containers" has_top_container = false - if self.record['json'].present? && self.record['json']['instances'].present? + instances = self.record.dig('json', 'instances') + if instances self.record['json']['instances'].each do |instance| sub_container = instance.dig('sub_container') @@ -29,7 +37,7 @@ def show_action? top_container_uri = sub_container.dig('top_container', 'ref') - if top_container_uri && !top_container_uri.blank? + if top_container_uri.present? has_top_container = true end end @@ -37,16 +45,16 @@ def show_action? only_top_containers = self.repo_settings[:requests_permitted_for_containers_only] || false - puts "-- Aeon Plugin Containers found? #{has_top_container}" - puts "-- Aeon Plugin only_top_containers? #{only_top_containers}" + logger.debug "Containers found? #{has_top_container}" + logger.debug "only_top_containers? #{only_top_containers}" return (has_top_container || !only_top_containers) end rescue Exception => e - puts "Failed to create Aeon Request action." - puts e.message - puts e.backtrace.inspect + logger.error "Failed to create Aeon Request action." + logger.error e.message + logger.error e.backtrace.inspect end @@ -192,8 +200,8 @@ def json_fields mappings['requests'] << request end - mappings + return mappings end - protected :json_fields + protected :json_fields, :logger end diff --git a/public/views/aeon/_aeon_request_action.html.erb b/public/views/aeon/_aeon_request_action.html.erb index 04c6869..5b420e7 100644 --- a/public/views/aeon/_aeon_request_action.html.erb +++ b/public/views/aeon/_aeon_request_action.html.erb @@ -1,5 +1,7 @@ <% -puts "-- Initializing Aeon Plugin..." +logger = Rails.logger + +logger.debug "Initializing Aeon Plugin..." mapper = case record when ArchivalObject @@ -7,12 +9,13 @@ mapper = case record when Accession AccessionMapper.new(record) else - puts record.inspect - raise "This ArchivesSpace object type is not supported" + message = "This ArchivesSpace object type is not supported by this plugin." + logger.error record.inspect + logger.error message + raise message end %> - <% if mapper.show_action? %> <%= form_tag "#{mapper.repo_settings[:aeon_web_url]}aeon.dll?action=11&type=200", :id => 'aeon_request_sub' do |f| %> @@ -41,11 +44,12 @@ mapper = case record <% end %> -<% puts "-- Finished initializing Aeon plugin." %> +<% + logger.debug "Finished initializing Aeon plugin." +%> - From 5e737fabc3c1659711a85d05c6dd622df08863b0 Mon Sep 17 00:00:00 2001 From: Austin Schaffer Date: Tue, 2 Jan 2018 14:55:06 -0500 Subject: [PATCH 08/13] Updated yml organization --- public/locales/en.yml | 7 ++++--- public/views/aeon/_aeon_request_action.html.erb | 6 +++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/public/locales/en.yml b/public/locales/en.yml index 690de31..48965f8 100644 --- a/public/locales/en.yml +++ b/public/locales/en.yml @@ -1,4 +1,5 @@ en: - aeon_fulfillment: - request_record: Aeon Request - requesting_disabled: This record is not a container. + plugins: + aeon_fulfillment: + request_button_label: Aeon Request + requesting_disabled: This record cannot be sent in a request. diff --git a/public/views/aeon/_aeon_request_action.html.erb b/public/views/aeon/_aeon_request_action.html.erb index 5b420e7..7cd2372 100644 --- a/public/views/aeon/_aeon_request_action.html.erb +++ b/public/views/aeon/_aeon_request_action.html.erb @@ -31,15 +31,15 @@ mapper = case record <% end %> <% end %> - <% end %> <% else %> <% end %> From 20f3c6d7c4dc946e800b50d6e27c84895116d58b Mon Sep 17 00:00:00 2001 From: Austin Schaffer Date: Tue, 2 Jan 2018 17:07:24 -0500 Subject: [PATCH 09/13] added additional mappings --- public/lib/record_mapper.rb | 143 +++++++++++------- .../views/aeon/_aeon_request_action.html.erb | 5 +- 2 files changed, 96 insertions(+), 52 deletions(-) diff --git a/public/lib/record_mapper.rb b/public/lib/record_mapper.rb index 21c7aba..652c6bc 100644 --- a/public/lib/record_mapper.rb +++ b/public/lib/record_mapper.rb @@ -30,7 +30,7 @@ def show_action? instances = self.record.dig('json', 'instances') if instances - self.record['json']['instances'].each do |instance| + instances.each do |instance| sub_container = instance.dig('sub_container') next if !sub_container @@ -66,6 +66,19 @@ def show_action? def map mappings = {} + mappings = mappings + .merge(self.system_information) + .merge(self.json_fields) + .merge(self.record_fields) + + return mappings + end + + + # Pulls data from AppConfig and ASpace System + def system_information + mappings = {} + mappings['SystemID'] = if (!self.repo_settings[:aeon_external_system_id].blank?) self.repo_settings[:aeon_external_system_id] @@ -91,14 +104,24 @@ def map "ArchivesSpace" end - # Merge in data from self.record.json - mappings = mappings.merge(self.json_fields) + mappings['repo_name'] = + + return mappings + end + + + # Pulls data from self.record + def record_fields + mappings = {} - # Data pulled from self.record and self.record.raw mappings['identifier'] = self.record.identifier || self.record['identifier'] mappings['level'] = self.record.level || self.record['level'] mappings['uri'] = self.record.uri || self.record['uri'] + mappings['language'] ||= self.record['language'] + mappings['publish'] = self.record['publish'] + mappings['title'] = self.record['title'] + resolved_resource = self.record['_resolved_resource'] || self.record.resolved_resource if resolved_resource resource_obj = resolved_resource[self.record['resource']] @@ -108,12 +131,30 @@ def map end end - mappings['language'] ||= self.record['language'] - mappings['publish'] = self.record['publish'] - mappings['title'] = self.record['title'] + resolved_repository = self.record.resolved_repository + if resolved_repository + mappings['repo_code'] = resolved_repository['repo_code'] + mappings['repo_name'] = resolved_repository['name'] + end if record['creators'] - mappings['creators'] = self.record['creators'].map { |k| "#{k}" }.join("; ") + mappings['creators'] = self.record['creators'] + .select { |cr| cr.present? } + .map { |cr| cr.strip } + .join("; ") + end + + if record.notes + accessrestrict = record.notes['accessrestrict'] + if accessrestrict + arSubnotes = accessrestrict['subnotes'] + if arSubnotes + mappings['accessrestrict'] = arSubnotes + .select { |arSubnote| arSubnote['content'].present? } + .map { |arSubnote| arSubnote['content'].strip } + .join("; ") + end + end end return mappings @@ -154,54 +195,54 @@ def json_fields return mappings end - mappings['requests'] = [] - - instance_count = 0 - instances.each do |instance| - next if instance['digital_object'] - request = {} - - instance_count += 1 - - request['Request'] = "#{instance_count}" - - request["instance_is_representative_#{instance_count}"] = instance['is_representative'] - request["instance_last_modified_by_#{instance_count}"] = instance['last_modified_by'] - request["instance_instance_type_#{instance_count}"] = instance['instance_type'] - request["instance_created_by_#{instance_count}"] = instance['created_by'] - - request['instance_container_grandchild_indicator'] = instance['indicator_3'] - request['instance_container_child_indicator'] = instance['indicator_2'] - request['instance_container_grandchild_type'] = instance['type_3'] - request['instance_container_child_type'] = instance['type_2'] - - container = instance['sub_container'] - if container - request["instance_container_last_modified_by_#{instance_count}"] = container['last_modified_by'] - request["instance_container_created_by_#{instance_count}"] = container['created_by'] - - top_container = container['top_container'] - if top_container - request["instance_top_container_uri_#{instance_count}"] = top_container['uri'] - - top_container_resolved = top_container['_resolved'] - if top_container_resolved - request["instance_top_container_long_display_string_#{instance_count}"] = top_container_resolved['long_display_string'] - request["instance_top_container_last_modified_by_#{instance_count}"] = top_container_resolved['last_modified_by'] - request["instance_top_container_display_string_#{instance_count}"] = top_container_resolved['display_string'] - request["instance_top_container_restricted_#{instance_count}"] = top_container_resolved['restricted'] - request["instance_top_container_created_by_#{instance_count}"] = top_container_resolved['created_by'] - request["instance_top_container_indicator_#{instance_count}"] = top_container_resolved['indicator'] - request["instance_top_container_type_#{instance_count}"] = top_container_resolved['type'] + mappings['requests'] = instances + .select{ |instance| !instance['digital_object'] } + .each_with_index + .map { |instance, i| + request = {} + + instance_count = i + 1 + + request['Request'] = "#{instance_count}" + + request["instance_is_representative_#{instance_count}"] = instance['is_representative'] + request["instance_last_modified_by_#{instance_count}"] = instance['last_modified_by'] + request["instance_instance_type_#{instance_count}"] = instance['instance_type'] + request["instance_created_by_#{instance_count}"] = instance['created_by'] + + request['instance_container_grandchild_indicator'] = instance['indicator_3'] + request['instance_container_child_indicator'] = instance['indicator_2'] + request['instance_container_grandchild_type'] = instance['type_3'] + request['instance_container_child_type'] = instance['type_2'] + + container = instance['sub_container'] + if container + request["instance_container_last_modified_by_#{instance_count}"] = container['last_modified_by'] + request["instance_container_created_by_#{instance_count}"] = container['created_by'] + + top_container = container['top_container'] + if top_container + request["instance_top_container_uri_#{instance_count}"] = top_container['uri'] + + top_container_resolved = top_container['_resolved'] + if top_container_resolved + request["instance_top_container_long_display_string_#{instance_count}"] = top_container_resolved['long_display_string'] + request["instance_top_container_last_modified_by_#{instance_count}"] = top_container_resolved['last_modified_by'] + request["instance_top_container_display_string_#{instance_count}"] = top_container_resolved['display_string'] + request["instance_top_container_restricted_#{instance_count}"] = top_container_resolved['restricted'] + request["instance_top_container_created_by_#{instance_count}"] = top_container_resolved['created_by'] + request["instance_top_container_indicator_#{instance_count}"] = top_container_resolved['indicator'] + request["instance_top_container_type_#{instance_count}"] = top_container_resolved['type'] + end end end - end - mappings['requests'] << request - end + return request + } return mappings end - protected :json_fields, :logger + + protected :json_fields, :record_fields, :system_information, :logger end diff --git a/public/views/aeon/_aeon_request_action.html.erb b/public/views/aeon/_aeon_request_action.html.erb index 7cd2372..37433bb 100644 --- a/public/views/aeon/_aeon_request_action.html.erb +++ b/public/views/aeon/_aeon_request_action.html.erb @@ -55,7 +55,10 @@ mapper = case record
-
+
+ <%= @result.inspect %> +
+
<%= record.inspect %>
From 91c7422ccb81d4af3d256d8da60721cc63de9123 Mon Sep 17 00:00:00 2001 From: Austin Schaffer Date: Thu, 11 Jan 2018 10:44:08 -0500 Subject: [PATCH 10/13] Final changes to logging and mapping before version increment --- public/lib/accession_mapper.rb | 8 +++-- public/lib/archival_object_mapper.rb | 5 ++- public/lib/record_mapper.rb | 49 +++++++++++++--------------- 3 files changed, 30 insertions(+), 32 deletions(-) diff --git a/public/lib/accession_mapper.rb b/public/lib/accession_mapper.rb index bc8fe78..a76eff4 100644 --- a/public/lib/accession_mapper.rb +++ b/public/lib/accession_mapper.rb @@ -5,17 +5,19 @@ def initialize(accession) end # Returns a hash that maps from Aeon OpenURL values to values in the provided record. - def map + def record_fields mappings = super - if record.use_restrictions_note && !record.use_restrictions_note.blank? + if record.use_restrictions_note && record.use_restrictions_note.present? mappings['use_restrictions_note'] = record.use_restrictions_note end - if record.access_restrictions_note && !record.access_restrictions_note.blank? + if record.access_restrictions_note && record.access_restrictions_note.present? mappings['access_restrictions_note'] = record.access_restrictions_note end + mappings['language'] = self.record['language'] + return mappings end end diff --git a/public/lib/archival_object_mapper.rb b/public/lib/archival_object_mapper.rb index 9d57f12..f648bcc 100644 --- a/public/lib/archival_object_mapper.rb +++ b/public/lib/archival_object_mapper.rb @@ -14,7 +14,7 @@ def json_fields return mappings end - if json['repository_processing_note'] && !json['repository_processing_note'].blank? + if json['repository_processing_note'] && json['repository_processing_note'].present? mappings['repository_processing_note'] = json['repository_processing_note'] end @@ -23,12 +23,11 @@ def json_fields # Returns a hash that maps from Aeon OpenURL values to values in the provided record. - def map + def record_fields mappings = super mappings['component_id'] = self.record['component_id'] - return mappings end end diff --git a/public/lib/record_mapper.rb b/public/lib/record_mapper.rb index 652c6bc..fcfd00f 100644 --- a/public/lib/record_mapper.rb +++ b/public/lib/record_mapper.rb @@ -6,10 +6,6 @@ def initialize(record) @record = record end - def logger - Rails.logger - end - def repo_code self.record.resolved_repository.dig('repo_code').downcase end @@ -20,12 +16,12 @@ def repo_settings def show_action? begin - logger.debug "Checking for plugin settings for the repository" + puts "Aeon Fulfillment Plugin -- Checking for plugin settings for the repository" if !self.repo_settings - logger.debug "Could not find plugin settings for the repository: \"#{self.repo_code}\"." + puts "Aeon Fulfillment Plugin -- Could not find plugin settings for the repository: \"#{self.repo_code}\"." else - logger.debug "Checking for top containers" + puts "Aeon Fulfillment Plugin -- Checking for top containers" has_top_container = false instances = self.record.dig('json', 'instances') @@ -45,16 +41,16 @@ def show_action? only_top_containers = self.repo_settings[:requests_permitted_for_containers_only] || false - logger.debug "Containers found? #{has_top_container}" - logger.debug "only_top_containers? #{only_top_containers}" + puts "Aeon Fulfillment Plugin -- Containers found? #{has_top_container}" + puts "Aeon Fulfillment Plugin -- only_top_containers? #{only_top_containers}" return (has_top_container || !only_top_containers) end rescue Exception => e - logger.error "Failed to create Aeon Request action." - logger.error e.message - logger.error e.backtrace.inspect + puts "Aeon Fulfillment Plugin -- Failed to create Aeon Request action." + puts e.message + puts e.backtrace.inspect end @@ -104,8 +100,6 @@ def system_information "ArchivesSpace" end - mappings['repo_name'] = - return mappings end @@ -115,12 +109,10 @@ def record_fields mappings = {} mappings['identifier'] = self.record.identifier || self.record['identifier'] - mappings['level'] = self.record.level || self.record['level'] - mappings['uri'] = self.record.uri || self.record['uri'] - - mappings['language'] ||= self.record['language'] mappings['publish'] = self.record['publish'] + mappings['level'] = self.record.level || self.record['level'] mappings['title'] = self.record['title'] + mappings['uri'] = self.record.uri || self.record['uri'] resolved_resource = self.record['_resolved_resource'] || self.record.resolved_resource if resolved_resource @@ -182,9 +174,14 @@ def json_fields end if json['dates'] - json['dates'].each do |date| - mappings["#{date['label']}_date"] = date['expression'] - end + json['dates'] + .select { |date| date['expression'].present? } + .group_by { |date| date['label'] } + .each { |label, dates| + mappings["#{label}_date"] = dates + .map { |date| date['expression'] } + .join("; ") + } end mappings['restrictions_apply'] = json['restrictions_apply'] @@ -210,10 +207,10 @@ def json_fields request["instance_instance_type_#{instance_count}"] = instance['instance_type'] request["instance_created_by_#{instance_count}"] = instance['created_by'] - request['instance_container_grandchild_indicator'] = instance['indicator_3'] - request['instance_container_child_indicator'] = instance['indicator_2'] - request['instance_container_grandchild_type'] = instance['type_3'] - request['instance_container_child_type'] = instance['type_2'] + request["instance_container_grandchild_indicator_#{instance_count}"] = instance['indicator_3'] + request["instance_container_child_indicator_#{instance_count}"] = instance['indicator_2'] + request["instance_container_grandchild_type_#{instance_count}"] = instance['type_3'] + request["instance_container_child_type_#{instance_count}"] = instance['type_2'] container = instance['sub_container'] if container @@ -244,5 +241,5 @@ def json_fields end - protected :json_fields, :record_fields, :system_information, :logger + protected :json_fields, :record_fields, :system_information end From 6557cbe5b84c5b6c1d3bdf8133522964815949f8 Mon Sep 17 00:00:00 2001 From: Austin Schaffer Date: Thu, 11 Jan 2018 10:45:01 -0500 Subject: [PATCH 11/13] Changes to logging for Ruby partial Removed a debug feature --- .../views/aeon/_aeon_request_action.html.erb | 28 ++++--------------- 1 file changed, 5 insertions(+), 23 deletions(-) diff --git a/public/views/aeon/_aeon_request_action.html.erb b/public/views/aeon/_aeon_request_action.html.erb index 37433bb..e43c130 100644 --- a/public/views/aeon/_aeon_request_action.html.erb +++ b/public/views/aeon/_aeon_request_action.html.erb @@ -1,7 +1,5 @@ <% -logger = Rails.logger - -logger.debug "Initializing Aeon Plugin..." +puts "Aeon Fulfillment Plugin -- Initializing Plugin..." mapper = case record when ArchivalObject @@ -9,16 +7,15 @@ mapper = case record when Accession AccessionMapper.new(record) else - message = "This ArchivesSpace object type is not supported by this plugin." - logger.error record.inspect - logger.error message + message = "Aeon Fulfillment Plugin -- This ArchivesSpace object type is not supported by this plugin." + puts record.inspect + puts message raise message end %> <% if mapper.show_action? %> <%= form_tag "#{mapper.repo_settings[:aeon_web_url]}aeon.dll?action=11&type=200", :id => 'aeon_request_sub' do |f| %> - <% mapper.map.each do |name, value| %> <% if name.casecmp('requests').zero? %> <% value.each do |request| %> @@ -45,20 +42,5 @@ mapper = case record <% end %> <% - logger.debug "Finished initializing Aeon plugin." + puts "Aeon Fulfillment Plugin -- Finished initializing plugin." %> - - - - - -
-
- <%= @result.inspect %> -
-
- <%= record.inspect %> -
-
From d9fa7860857e413f1aefa68eaee143621f74bc2d Mon Sep 17 00:00:00 2001 From: Austin Schaffer Date: Thu, 11 Jan 2018 10:45:29 -0500 Subject: [PATCH 12/13] Updated Readme --- Readme.md | 244 +++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 212 insertions(+), 32 deletions(-) diff --git a/Readme.md b/Readme.md index 0ceb113..d9d880a 100644 --- a/Readme.md +++ b/Readme.md @@ -1,4 +1,27 @@ -# ArchivesSpace Request Fulfillment via Aeon - Updated 20171204 +# ArchivesSpace Request Fulfillment via Aeon + +**Version:** 20180111 + +**Last Updated:** January 11, 2018 + + +## Table of Contents + +1. [ArchivesSpace Request Fulfillment via Aeon](#archivesspace-request-fulfillment-via-aeon) + 1. [Table of Contents](#table-of-contents) + 2. [Overview](#overview) + 3. [Changelog](#changelog) + 4. [Configuring Addon Settings](#configuring-addon-settings) + 1. [All Aeon Fulfillment Plugin Specific Configuration Options](#all-aeon-fulfillment-plugin-specific-configuration-options) + 2. [Example Configuration](#example-configuration) + 5. [Imported Fields](#imported-fields) + 1. [Common Fields](#common-fields) + 2. [Archival Object Fields](#archival-object-fields) + 3. [Accession Fields](#accession-fields) + 6. [OpenURL Mappings](#openurl-mappings) + + +## Overview This plugin adds a new request button to archival objects that allows researchers to place Aeon requests for archival objects discovered via the @@ -7,27 +30,51 @@ ArchivesSpace Public User Interface. The functionality provided by this plugin is meant to replace the existing Public UI request action functionality for archival objects. As such, it is recommended that the built in functionality be disabled by setting -`AppConfig[:pui_page_actions_request] = false` or by removing `:archival_object` from your `AppConfig[:pui_requests_permitted_for_types]` +`AppConfig[:pui_page_actions_request] = false` or by removing `:archival_object` from your `AppConfig[:pui_requests_permitted_for_types]` setting. The latter will allow you to use Aeon to fulfill archival_object -requests while still allowing other object types to be requested via the +requests, while still allowing other object types to be requested via the default email functionality. By using the 'per repository' configuration options for the built in PUI requesting functionality, it is also possible to configure some repositories to continue using the built in PUI requesting feature for archival objects while allowing other repositories to use Aeon. +This addon has been tested on version 2.2.0 of ArchivesSpace. Future releases +of ArchivesSpace may cause changes in the functionality of this addon. + + +## Changelog + +- **20170809** + - Initial release of ArchivesSpace addon. + - Added support for sending requests for Archival Objects to Aeon +- **20171110** + - Added readme to include configuration resources + - Removed an unused control +- **20171204** + - Changes to readme and configuration resources + - Bug fixes +- **20180111** + - Moved core functionality out of the `.erb` + - Added support for sending requests for Accessions to Aeon + - Bug fixes + ## Configuring Addon Settings -Add the following after your list of plugins has been initialized. +In order to configure this addon, you will need to modify the +`config/config.rb` file of your ArchivesSpace installation. To enable the +plugin, you will need to add the following to the configuration file. ```ruby AppConfig[:plugins] << 'aeon_fulfillment' AppConfig[:aeon_fulfillment] = {} ``` -Add the following settings and appropriate values for EACH repository that -will use the plugin. Replace `{repo_code}` with the appropriate repository -code (also known as a short name) for the repository (lower-cased). +Next, you will need to add the appropriate settings appropriate values for +each repository that will use the plugin. In the sample below, replace +`{repo_code}` with the repository code for each repository. The repo_code is +also known as the repository's short name. The repo_code must be written using +lower-case. ```ruby AppConfig[:aeon_fulfillment]['{repo_code}'] = {} @@ -35,8 +82,8 @@ AppConfig[:aeon_fulfillment]['{repo_code}'][:aeon_web_url] = "{Your aeon web url AppConfig[:aeon_fulfillment]['{repo_code}'][:aeon_return_link_label] = "{The text for the return link from Aeon}" ``` -For example, to configure the addon for a repository with a code of "ATLAS" -add the following to `config.rb`. +For example, to configure the addon for a repository that has the short name +"ATLAS", add the following to `config.rb`. ```ruby AppConfig[:plugins] << 'aeon_fulfillment' @@ -46,45 +93,178 @@ AppConfig[:aeon_fulfillment]['atlas'][:aeon_web_url] = "https://your.institution AppConfig[:aeon_fulfillment]['atlas'][:aeon_return_link_label] = "ArchivesSpace" ``` - -## All Aeon Fulfillment Plugin Specific Configuration Options +This plugin configuration can also be formatted using the implicit form of a +Ruby hash. ```ruby -# (required) The URL to your Aeon web site -AppConfig[:aeon_fulfillment]['{repo_code}'][:aeon_web_url] +AppConfig[:plugins] << 'aeon_fulfillment' +AppConfig[:aeon_fulfillment] = { + "atlas" => { + :aeon_web_url => "https://your.institution.edu/aeon/", + :aeon_external_system_id => "ArchivesSpace" + }, + "test-repo" => { + :aeon_web_url => "https://your.institution.edu/aeon/", + :aeon_external_system_id => "ArchivesSpace Test Tepo" + } +} +``` + + +### All Aeon Fulfillment Plugin Specific Configuration Options + +- **:aeon\_web\_url**. (Required). This setting specifies the web url that + points to an Aeon installation. The addon will send requests to this url, + after adding the external requests endpoint (`aeon.dll?action=11&type=200`) + to the end. + +- **:aeon\_return\_link\_label**. (Required). This setting specifies the text + that will display on the button that takes users back to ArchivesSpace. -# (required) The text to display on the button that takes users back to ArchivesSpace -AppConfig[:aeon_fulfillment]['{repo_code}'][:aeon_return_link_label] +- **:requests\_permitted\_for\_containers\_only**. This settings specifies + whether requests are limited to resources with top containers only. The + default for this setting is false. -# Specifies whether requests are limited to resources with top containers only. Default is false. -AppConfig[:aeon_fulfillment]['{repo_code}'][:requests_permitted_for_containers_only] +- **:aeon\_external\_system\_id**. This setting specifies the System ID, which + is used by Aeon to determine which mapping rules to use from its + OpenURLMapping table. Each repository configuration can have their own + System ID or they can have a duplicate System ID. -# The system ID to match fields against in Aeon's OpenURLMapping table. -AppConfig[:aeon_fulfillment]['{repo_code}'][:aeon_external_system_id] + +### Example Configuration + +```ruby +AppConfig[:plugins] << "aeon_fulfillment" + +AppConfig[:aeon_fulfillment] = { + "special research collections" => { + :aeon_web_url => "https://your.institution.edu/aeon/", + :aeon_return_link_label => "Back to ArchivesSpace", + :aeon_external_system_id => "ArchivesSpace", + :requests_permitted_for_containers_only => true + }, + "test special collections" => { + :aeon_web_url => "https://your.institution.edu/aeon/", + :aeon_return_link_label => "Back to ArchivesSpace", + :aeon_external_system_id => "ArchivesSpace Test", + :requests_permitted_for_containers_only => false + } +} ``` -## Fields Imported from the Resource +## Imported Fields + +This addon builds a form that is sent to Aeon through the external requests +(`aeon.dll?action=11&type=200`) endpoint of your Aeon installation. Below are +the names of the fields as they will appear in the request. + +### Common Fields + +These fields are imported from both Archival Object records and Accession +records. + +- `SystemID` +- `ReturnLinkURL` +- `ReturnLinkSystemName` +- `identifier` +- `publish` (true/false value) +- `level` +- `title` +- `uri` +- `collection_id` +- `collection_title` +- `repo_code` +- `repo_name` +- `language` +- `restrictions_apply` (true/false value) +- `display_string` +- `creators` + - semi-colon (`;`) separated string list +- `accessrestrict` + - semi-colon (`;`) separated string list + - contains the content from `accessrestrict` subnotes +- `physical_location_note` + - semi-colon (`;`) separated string list + - contains the content from `physloc` notes +- `{date_label}_date` + - semi-colon (`;`) separated string list + - contains the content from the `expression`s of the record's related + dates + - The plugin will group all of the related dates of each record based on + the date's label. For each distinct date label of the dates that are + linked to the record, the request to Aeon will contain a distinct date + parameter. Some examples of what to expect for the name of this field + include `creation_date`, `event_date`, and `other_date`. The full list + of values that could appear in place of the `{date_label}` placeholder + is controlled by the `date_label` enumeration of your ArchivesSpace + installation. + +The following fields are common to both Accession records and Archival Object +records, but are based on the number of instances associated with the record. +The number of requests sent to Aeon is equal to the number of instances +associated with the record. If there are no instances, only one request will +be sent to Aeon. All of these fields are dependant on the number of instances, +and the values of each may differ from instance to instance. + +- `instance_is_representative` +- `instance_last_modified_by` +- `instance_instance_type` +- `instance_created_by` +- `instance_container_grandchild_indicator` +- `instance_container_child_indicator` +- `instance_container_grandchild_type` +- `instance_container_child_type` +- `instance_container_last_modified_by` +- `instance_container_created_by` +- `instance_top_container_uri` +- `instance_top_container_long_display_string` +- `instance_top_container_last_modified_by` +- `instance_top_container_display_string` +- `instance_top_container_restricted` +- `instance_top_container_created_by` +- `instance_top_container_indicator` +- `instance_top_container_type` + +### Archival Object Fields + +The following fields are specific to requests made for Archival Object +records. + +- `repository_processing_note` +- `component_id` + +### Accession Fields + +The following fields are specific to requests made for Accession records. + +- `use_restrictions_note` +- `access_restrictions_note` +- `language` + - This field is also present on most Archival Object requests, but it is + mapped from a different location for Accession requests. + + +## OpenURL Mappings -(Incomplete list) +Below is a list of recommended Open URL mappings that should be set in Aeon. -- uri -- identifier -- component_id -- title -- restrictions_apply -- level -- publish -- creator (as a semi-colon separated string list) +The `rfr_id` column should exactly match the configured +`:aeon_external_system_id` for each repository. Multiple repositories can have +the same or different System IDs. +The `AeonFieldName` column should exactly match an Aeon field name. -## Recommended OpenURL Mappings +Each value in the `OpenURLFieldValues` should contain a `<#replacement-tag>` +that has a name that matches one of the field names from the [Imported Fields](#imported-fields) +section. -Below is an incomplete list of Open URL mappings that should be set in Aeon. +For more information on configuring Aeon for this system, please visit the [Submitting Requests via OpenURL](https://prometheus.atlas-sys.com/display/aeon/Submitting+Requests+via+OpenURL) +page of our documentation at https://prometheus.atlas-sys.com. ```sql INSERT INTO OpenURLMapping (URL_Ver, rfr_id, AeonAction, AeonFieldName, OpenURLFieldValues, AeonValue) VALUES ('Default', 'ArchivesSpace', 'Replace', 'ItemAuthor', '<#creators>', 'NULL'); -INSERT INTO OpenURLMapping (URL_Ver, rfr_id, AeonAction, AeonFieldName, OpenURLFieldValues, AeonValue) VALUES ('Default', 'ArchivesSpace', 'Replace', 'ItemDate', '<#created_date>|<#Created_date>', 'NULL'); +INSERT INTO OpenURLMapping (URL_Ver, rfr_id, AeonAction, AeonFieldName, OpenURLFieldValues, AeonValue) VALUES ('Default', 'ArchivesSpace', 'Replace', 'ItemDate', '<#creation_date>', 'NULL'); INSERT INTO OpenURLMapping (URL_Ver, rfr_id, AeonAction, AeonFieldName, OpenURLFieldValues, AeonValue) VALUES ('Default', 'ArchivesSpace', 'Replace', 'ItemTitle', '<#title>', 'NULL'); INSERT INTO OpenURLMapping (URL_Ver, rfr_id, AeonAction, AeonFieldName, OpenURLFieldValues, AeonValue) VALUES ('Default', 'ArchivesSpace', 'Replace', 'ItemNumber', '<#barcode_1-container>', 'NULL'); INSERT INTO OpenURLMapping (URL_Ver, rfr_id, AeonAction, AeonFieldName, OpenURLFieldValues, AeonValue) VALUES ('Default', 'ArchivesSpace', 'Replace', 'Location', '<#instance_top_container_long_display_string>', 'NULL'); From 3fda27dd196d6ec1de5d96b1ead5d392be918ef4 Mon Sep 17 00:00:00 2001 From: Austin Schaffer Date: Thu, 11 Jan 2018 10:49:58 -0500 Subject: [PATCH 13/13] Updated readme --- Readme.md | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/Readme.md b/Readme.md index d9d880a..5398d02 100644 --- a/Readme.md +++ b/Readme.md @@ -11,8 +11,8 @@ 1. [Table of Contents](#table-of-contents) 2. [Overview](#overview) 3. [Changelog](#changelog) - 4. [Configuring Addon Settings](#configuring-addon-settings) - 1. [All Aeon Fulfillment Plugin Specific Configuration Options](#all-aeon-fulfillment-plugin-specific-configuration-options) + 4. [Configuring Plugin Settings](#configuring-plugin-settings) + 1. [All Aeon Fulfillment Plugin Configuration Options](#all-aeon-fulfillment-plugin-configuration-options) 2. [Example Configuration](#example-configuration) 5. [Imported Fields](#imported-fields) 1. [Common Fields](#common-fields) @@ -38,14 +38,14 @@ options for the built in PUI requesting functionality, it is also possible to configure some repositories to continue using the built in PUI requesting feature for archival objects while allowing other repositories to use Aeon. -This addon has been tested on version 2.2.0 of ArchivesSpace. Future releases -of ArchivesSpace may cause changes in the functionality of this addon. +This plugin has been tested on version 2.2.0 of ArchivesSpace. Future releases +of ArchivesSpace may cause changes in the functionality of this plugin. ## Changelog - **20170809** - - Initial release of ArchivesSpace addon. + - Initial release of this ArchivesSpace plugin - Added support for sending requests for Archival Objects to Aeon - **20171110** - Added readme to include configuration resources @@ -59,9 +59,9 @@ of ArchivesSpace may cause changes in the functionality of this addon. - Bug fixes -## Configuring Addon Settings +## Configuring Plugin Settings -In order to configure this addon, you will need to modify the +In order to configure this plugin, you will need to modify the `config/config.rb` file of your ArchivesSpace installation. To enable the plugin, you will need to add the following to the configuration file. @@ -82,7 +82,7 @@ AppConfig[:aeon_fulfillment]['{repo_code}'][:aeon_web_url] = "{Your aeon web url AppConfig[:aeon_fulfillment]['{repo_code}'][:aeon_return_link_label] = "{The text for the return link from Aeon}" ``` -For example, to configure the addon for a repository that has the short name +For example, to configure the plugin for a repository that has the short name "ATLAS", add the following to `config.rb`. ```ruby @@ -110,11 +110,10 @@ AppConfig[:aeon_fulfillment] = { } ``` - -### All Aeon Fulfillment Plugin Specific Configuration Options +### All Aeon Fulfillment Plugin Configuration Options - **:aeon\_web\_url**. (Required). This setting specifies the web url that - points to an Aeon installation. The addon will send requests to this url, + points to an Aeon installation. The plugin will send requests to this url, after adding the external requests endpoint (`aeon.dll?action=11&type=200`) to the end. @@ -130,7 +129,6 @@ AppConfig[:aeon_fulfillment] = { OpenURLMapping table. Each repository configuration can have their own System ID or they can have a duplicate System ID. - ### Example Configuration ```ruby @@ -155,7 +153,7 @@ AppConfig[:aeon_fulfillment] = { ## Imported Fields -This addon builds a form that is sent to Aeon through the external requests +This plugin builds a form that is sent to Aeon through the external requests (`aeon.dll?action=11&type=200`) endpoint of your Aeon installation. Below are the names of the fields as they will appear in the request.