Skip to content
This repository has been archived by the owner on May 11, 2022. It is now read-only.

Commit

Permalink
Merge pull request #352 from sul-dlss/sdr-ingest-transfer
Browse files Browse the repository at this point in the history
SdrIngestService:  trigger new preservationIngestWF instead of sdrIngestWF
  • Loading branch information
jmartin-sul authored Apr 18, 2018
2 parents 5a8cb9e + 59bd30a commit 148ebef
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
12 changes: 8 additions & 4 deletions lib/dor/services/sdr_ingest_service.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
require 'moab/stanford'

module Dor
# Note: This should probably live in common-accessioning robot sdr-ingest-transfer
# as that is the only robot that uses it. See also preservable concern.
class SdrIngestService

# @param [Dor::Item] dor_item The representation of the digital object
# @param [String] agreement_id depreciated, included for backward compatability with common-accessoning
# @return [void] Create the moab manifests, export data to a BagIt bag, kick off the SDR ingest workflow
# @return [void] Create the Moab/bag manifests for new version, export data to BagIt bag, kick off the SDR preservation workflow
def self.transfer(dor_item, agreement_id = nil)
druid = dor_item.pid
workspace = DruidTools::Druid.new(druid, Dor::Config.sdr.local_workspace_root)
Expand Down Expand Up @@ -35,12 +37,14 @@ def self.transfer(dor_item, agreement_id = nil)
bagger.deposit_group('metadata', metadata_dir)
bagger.create_tagfiles
verify_bag_structure(bag_dir)
# Now bootstrap SDR workflow. but do not create the workflows datastream
dor_item.create_workflow('sdrIngestWF', false)
# start SDR preservation workflow (but do not create the workflows datastream)
dor_item.create_workflow('preservationIngestWF', false)
rescue Exception => e
raise Dor::Exception, 'Export failure'
raise Dor::Exception, "Error exporting new object version to bag: #{e.message}"
end

# Note: the following methods should probably all be private

# @param [String] druid The object identifier
# @return [Moab::SignatureCatalog] the catalog of all files previously ingested
def self.get_signature_catalog(druid)
Expand Down
2 changes: 1 addition & 1 deletion spec/services/sdr_ingest_service_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
before :each do
druid = 'druid:dd116zh0343'
@dor_item = double('dor_item')
expect(@dor_item).to receive(:create_workflow).with('sdrIngestWF', false)
expect(@dor_item).to receive(:create_workflow).with('preservationIngestWF', false)
allow(@dor_item).to receive(:pid).and_return(druid)
signature_catalog = Moab::SignatureCatalog.read_xml_file(@fixtures.join('sdr_repo/dd116zh0343/v0001/manifests'))
@metadata_dir = @fixtures.join('workspace/dd/116/zh/0343/dd116zh0343/metadata')
Expand Down

0 comments on commit 148ebef

Please sign in to comment.