Module: Dor::Itemizable

Extended by:
ActiveSupport::Concern, Deprecation
Included in:
Item
Defined in:
lib/dor/models/concerns/itemizable.rb

Constant Summary collapse

DIFF_FILENAME =
'cm_inv_diff'

Instance Method Summary collapse

Instance Method Details

#clear_diff_cacheObject

Deletes all cm_inv_diff files in the workspace for the Item

Raises:

  • (ArgumentError)


19
20
21
22
23
24
25
# File 'lib/dor/models/concerns/itemizable.rb', line 19

def clear_diff_cache
  raise ArgumentError, 'Missing Dor::Config.stacks.local_workspace_root' if Dor::Config.stacks.local_workspace_root.nil?

  druid = DruidTools::Druid.new(pid, Dor::Config.stacks.local_workspace_root)
  diff_pattern = File.join(druid.temp_dir, DIFF_FILENAME + '.*')
  FileUtils.rm_f Dir.glob(diff_pattern)
end

#get_content_diff(subset = :all, version = nil) ⇒ Moab::FileInventoryDifference

Retrieves file difference manifest for contentMetadata from SDR

Parameters:

  • subset (Symbol) (defaults to: :all)

    keyword for file attributes :shelve, :preserve, :publish. Default is :all.

  • version (String) (defaults to: nil)

Returns:

  • (Moab::FileInventoryDifference)

    XML contents of cm_inv_diff manifest

Raises:



33
34
35
36
37
38
39
# File 'lib/dor/models/concerns/itemizable.rb', line 33

def get_content_diff(subset = :all, version = nil)
  raise Dor::ParameterError, 'Missing Dor::Config.stacks.local_workspace_root' if Dor::Config.stacks.local_workspace_root.nil?

  raise Dor::Exception, 'Missing contentMetadata datastream' if !respond_to?(:contentMetadata) || .nil?

  Sdr::Client.get_content_diff(pid, .content, subset.to_s, version)
end