Module: Dor::Shelvable
- Extended by:
- ActiveSupport::Concern
- Includes:
- Itemizable
- Included in:
- BasicItem
- Defined in:
- lib/dor/models/shelvable.rb
Constant Summary
Constants included from Itemizable
Itemizable::DIFF_FILENAME, Itemizable::DIFF_QUERY
Instance Method Summary collapse
-
#shelve ⇒ Object
Push file changes for shelve-able files into the stacks.
Methods included from Itemizable
#clear_diff_cache, #get_content_diff
Instance Method Details
#shelve ⇒ Object
Push file changes for shelve-able files into the stacks
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/dor/models/shelvable.rb', line 9 def shelve inventory_diff_xml = self.get_content_diff(:shelve) inventory_diff = Moab::FileInventoryDifference.parse(inventory_diff_xml) content_group_diff = inventory_diff.group_difference("content") deltas = content_group_diff.file_deltas if content_group_diff.rename_require_temp_files(deltas[:renamed]) triplets = content_group_diff.rename_tempfile_triplets(deltas[:renamed]) DigitalStacksService.rename_in_stacks self.pid, triplets.collect{|old,new,temp| [old,temp]} DigitalStacksService.rename_in_stacks self.pid, triplets.collect{|old,new,temp| [temp,new]} else DigitalStacksService.rename_in_stacks self.pid, deltas[:renamed] end DigitalStacksService.shelve_to_stacks self.pid, deltas[:modified] + deltas[:added] + deltas[:copyadded].collect{|old,new| new} DigitalStacksService.remove_from_stacks self.pid, deltas[:deleted] + deltas[:copydeleted] end |