Skip to content

Commit

Permalink
change rms_import_stamp to rms_import_batch
Browse files Browse the repository at this point in the history
  • Loading branch information
jambun committed Oct 24, 2015
1 parent abe3a86 commit f10a653
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ like this:

## How to use it

### RMS Import Stamp
### rms_import_batch

Resource Component (Archival Object) records have a new field
'RMS Import Stamp' (rms_import_stamp). A value in this field is used
rms_import_batch. A value in this field is used
to identify a batch of imported records. The importer sets the value to
today's date (YYYY-MM-DD). This value is indexed, allowing a search like this:

rms_import_stamp_u_sstr:2015-10-24
rms_import_batch_u_sstr:2015-10-24

To return all records imported on October 24, 2015.

8 changes: 4 additions & 4 deletions backend/converters/rm_export_converter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def run
box_uris = {}
resource_uris = {}

rms_import_stamp = Date.today.strftime('%Y-%m-%d')
today = Date.today.strftime('%Y-%m-%d')

Zip::File.open(@input_file) do |zip_file|
zip_file.each do |entry|
Expand Down Expand Up @@ -137,7 +137,7 @@ def run
:container_locations => [{
:ref => loc_uri,
:status => "current",
:start_date => rms_import_stamp,
:start_date => today,
}],
}
}
Expand All @@ -157,7 +157,7 @@ def run
:instances => [instance],
:parent => {:ref => JSONModel::JSONModel(:archival_object).uri_for(parent.id, :repo_id => parent.repo_id)},
:resource => {:ref => resource_uris[values_map["BOXN"]]},
:rms_import_stamp => rms_import_stamp,
:rms_import_batch => today,
})

@batch << ao_json
Expand Down Expand Up @@ -193,7 +193,7 @@ def run
:external_ids => [external_id],
:parent => {:ref => box_uris[values_map["BOXN"]]},
:resource => {:ref => resource_uris[values_map["BOXN"]]},
:rms_import_stamp => rms_import_stamp,
:rms_import_batch => today,
})
end
rescue StopIteration
Expand Down
4 changes: 2 additions & 2 deletions backend/model/archival_object_ext.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
class ArchivalObject < Sequel::Model(:archival_object)

def update_from_json(json, opts = {}, apply_nested_records = true)
# make sure we don't blat rms_import_stamp
# make sure we don't blat rms_import_batch
# if the update is coming from the frontend
# currently not sending it in a hidden to avoid overriding the template
# also also I probably need to worry about obscuring other update_from_json's
# sheesh - ready to be led on this one!
json["rms_import_stamp"] ||= self[:rms_import_stamp]
json["rms_import_batch"] ||= self[:rms_import_batch]
super
end

Expand Down
2 changes: 1 addition & 1 deletion indexer/aspace_rms_indexer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class CommonIndexer

indexer.add_document_prepare_hook {|doc, record|
if record['record']['jsonmodel_type'] == 'archival_object'
doc['rms_import_stamp_u_sstr'] = record['record']['rms_import_stamp']
doc['rms_import_batch_u_sstr'] = record['record']['rms_import_batch']
end
}

Expand Down
2 changes: 1 addition & 1 deletion migrations/001_add_rms_import_date.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

up do
alter_table(:archival_object) do
add_column(:rms_import_stamp, String, :null => true)
add_column(:rms_import_batch, String, :null => true)
end
end

Expand Down
2 changes: 1 addition & 1 deletion schemas/archival_object_ext.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"rms_import_stamp" => {"type" => "string", "required" => false},
"rms_import_batch" => {"type" => "string", "required" => false},
}

0 comments on commit f10a653

Please sign in to comment.