Sha256: 9b1c05a0a739b14fda260c4ea5f830a0dced25bf99b3e8d9fa457c4a7f91cc30

Contents?: true

Size: 1.11 KB

Versions: 19

Compression:

Stored size: 1.11 KB

Contents

require 'moab_stanford'

module Dor
  module Shelvable
    extend ActiveSupport::Concern
    include Itemizable

    # Push file changes for shelve-able files into the stacks
    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

  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
dor-services-4.4.12.1 lib/dor/models/shelvable.rb
dor-services-4.8.3 lib/dor/models/shelvable.rb
dor-services-4.8.2 lib/dor/models/shelvable.rb
dor-services-4.8.1 lib/dor/models/shelvable.rb
dor-services-4.8.0 lib/dor/models/shelvable.rb
dor-services-4.7.0 lib/dor/models/shelvable.rb
dor-services-4.6.8 lib/dor/models/shelvable.rb
dor-services-4.6.7 lib/dor/models/shelvable.rb
dor-services-4.6.5 lib/dor/models/shelvable.rb
dor-services-4.6.4 lib/dor/models/shelvable.rb
dor-services-4.6.3 lib/dor/models/shelvable.rb
dor-services-4.6.2 lib/dor/models/shelvable.rb
dor-services-4.6.1 lib/dor/models/shelvable.rb
dor-services-4.6.0 lib/dor/models/shelvable.rb
dor-services-4.5.0 lib/dor/models/shelvable.rb
dor-services-4.4.13 lib/dor/models/shelvable.rb
dor-services-4.4.12 lib/dor/models/shelvable.rb
dor-services-4.4.11 lib/dor/models/shelvable.rb
dor-services-4.4.10 lib/dor/models/shelvable.rb