dor-services 6.1.1 → 6.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 770ca0435e119517c61cfe64021bfff08daae50bf6a1fca4731029c6b8532204
4
- data.tar.gz: 3a6e05fd0fb500a3a59643345faf127bcb8c2b1c69dbd2ba9f8434d08261e954
3
+ metadata.gz: e359d29da0952d875926e1ceec8e723725e8ca5df391e38c3ad1fe4543549941
4
+ data.tar.gz: 2c074e133cb69bab37024057414521d2be3b31ff4b9773bfb693bba7b25e13a7
5
5
  SHA512:
6
- metadata.gz: 80dedffd987f1bd397edb8815e33a85d8caf970c7bb587e3b2957c6b3d9d6c9b46c9cbd150286b7551e44712cfb7b4758970a444377c13c41ed38309f70080ba
7
- data.tar.gz: 05b2a3d6cf76e71c7251f2eeb6124c9823e85cf607d246649d928eb69f99916ba5f2e74cd52cea998c645dd699132fec15fe9db486b19a3715c4216051ce88f5
6
+ metadata.gz: 8f0b239aaaca59b055c5b4792d271334d2e9e7b55b2c08e606465f14037a5cb40f2cd516e18cad4f7dbe8f4e76fbfb9bf06f2e7ee29ea6eb45869953b74e8492
7
+ data.tar.gz: 970cb2f715414d67c487fdf2ec2ff409ad55c4d73230c630d37724fa44b7ca6893c6007eaa3800d897f4ac3e4ce11b82e426514555c92cd9c1c7bd1672f459ec
@@ -161,7 +161,7 @@ module Dor
161
161
  end
162
162
 
163
163
  # set a single default workflow
164
- # @param wf [String] the name of the workflow, ex. 'digitizationWF'
164
+ # @param wf_name [String] the name of the workflow, ex. 'digitizationWF'
165
165
  def default_workflow=(wf_name)
166
166
  raise ArgumentError, 'Must have a valid workflow for default' if wf_name.blank?
167
167
 
@@ -43,7 +43,7 @@ module Dor
43
43
  node ? [node['source'], node.text].join(':') : nil
44
44
  end
45
45
 
46
- # @param [String, Nil] value, or nil/empty string to delete sourceId node
46
+ # @param [String, Nil] value The value to set or a nil/empty string to delete sourceId node
47
47
  # @return [String, Nil] The same value, as per Ruby convention for assignment operators
48
48
  # @note The actual values assigned will have leading/trailing whitespace stripped.
49
49
  def sourceId=(value)
@@ -62,7 +62,7 @@ module Dor
62
62
  end
63
63
 
64
64
  # Convenience method to set the catkey
65
- # @param [String] catkey the new source identifier
65
+ # @param [String] val the new source identifier
66
66
  # @return [String] same value, as per Ruby assignment convention
67
67
  def catkey=(val)
68
68
  # if there was already a catkey in the record, store that in the "previous" spot (assuming there is no change)
@@ -40,6 +40,7 @@ module Dor
40
40
 
41
41
  attr_reader :datastream, :force, :object, :required, :filename
42
42
 
43
+ # @return [String] datastream name (dsid)
43
44
  def datastream_name
44
45
  datastream.dsid
45
46
  end
@@ -72,7 +73,6 @@ module Dor
72
73
  end
73
74
 
74
75
  # Tries to find a file for the datastream.
75
- # @param [String] datastream name of a datastream
76
76
  # @return [String, nil] path to datastream or nil
77
77
  def find_metadata_file
78
78
  druid = DruidTools::Druid.new(object.pid, Dor::Config.stacks.local_workspace_root)
@@ -39,7 +39,7 @@ module Dor
39
39
  end
40
40
 
41
41
  # Use the dor-indexing-app service to reindex a pid
42
- # @param [String] `pid` the druid
42
+ # @param [String] pid the druid
43
43
  # @raise [ReindexError] on failure
44
44
  def self.reindex_pid_remotely(pid)
45
45
  pid = "druid:#{pid}" unless pid =~ /^druid:/
@@ -10,6 +10,7 @@ module Dor
10
10
  @object = object
11
11
  end
12
12
 
13
+ # @return [Nokogiri::XML::Document] A copy of the descriptiveMetadata of the object, to be modified
13
14
  def doc
14
15
  @doc ||= object.descMetadata.ng_xml.dup(NOKOGIRI_DEEP_COPY)
15
16
  end
@@ -40,8 +41,6 @@ module Dor
40
41
  end
41
42
 
42
43
  # Create MODS accessCondition statements from rightsMetadata
43
- # @param [Nokogiri::XML::Document] doc Document representing the descriptiveMetadata of the object
44
- # @note this method modifies the passed in doc
45
44
  def add_access_conditions!
46
45
  # clear out any existing accessConditions
47
46
  doc.xpath('//mods:accessCondition', 'mods' => 'http://www.loc.gov/mods/v3').each(&:remove)
@@ -80,7 +79,6 @@ module Dor
80
79
  end
81
80
 
82
81
  # expand constituent relations into relatedItem references -- see JUMBO-18
83
- # @param [Nokogiri::XML] doc public MODS XML being built
84
82
  # @return [Void]
85
83
  def add_constituent_relations!
86
84
  object.public_relationships.search('//rdf:RDF/rdf:Description/fedora:isConstituentOf',
@@ -116,9 +114,7 @@ module Dor
116
114
 
117
115
  # Adds to desc metadata a relatedItem with information about the collection this object belongs to.
118
116
  # For use in published mods and mods-to-DC conversion.
119
- # @param [Nokogiri::XML::Document] doc A copy of the descriptiveMetadata of the object, to be modified
120
117
  # @return [Void]
121
- # @note this method modifies the passed in doc
122
118
  def add_collection_reference!
123
119
  collections = object.public_relationships.search('//rdf:RDF/rdf:Description/fedora:isMemberOfCollection',
124
120
  'fedora' => 'info:fedora/fedora-system:def/relations-external#',
@@ -112,7 +112,7 @@ module Dor
112
112
  workflow_priority = params[:workflow_priority] ? params[:workflow_priority].to_i : 0
113
113
 
114
114
  seed_datastreams(Array(params[:seed_datastream]), new_item)
115
- Array(params[:initiate_workflow]).each { |workflow_id| new_item.create_workflow(workflow_id, !new_item.new_record?, workflow_priority) }
115
+ initiate_workflow(workflows: Array(params[:initiate_workflow]), item: new_item, priority: workflow_priority)
116
116
 
117
117
  new_item.class.ancestors.select { |x| x.respond_to?(:to_class_uri) && x != ActiveFedora::Base }.each do |parent_class|
118
118
  new_item.add_relationship(:has_model, parent_class.to_class_uri)
@@ -179,6 +179,14 @@ module Dor
179
179
  end
180
180
  end
181
181
 
182
+ def initiate_workflow(workflows:, item:, priority:)
183
+ workflows.each do |workflow_id|
184
+ Dor::CreateWorkflowService.create_workflow(item, name: workflow_id,
185
+ create_ds: !item.new_record?,
186
+ priority: priority)
187
+ end
188
+ end
189
+
182
190
  def build_desc_metadata_from_label(new_item, label)
183
191
  builder = Nokogiri::XML::Builder.new do |xml|
184
192
  xml.mods(Dor::DescMetadataDS::MODS_HEADER_CONFIG) do
@@ -7,7 +7,7 @@ module Dor
7
7
  # as that is the only robot that uses it. See also preservable concern.
8
8
  class SdrIngestService
9
9
  # @param [Dor::Item] dor_item The representation of the digital object
10
- # @param [String] agreement_id depreciated, included for backward compatability with common-accessoning
10
+ # @param [String] _agreement_id deprecated, included for backward compatability with common-accessoning
11
11
  # @return [void] Create the Moab/bag manifests for new version, export data to BagIt bag, kick off the SDR preservation workflow
12
12
  def self.transfer(dor_item, _agreement_id = nil)
13
13
  druid = dor_item.pid
@@ -37,7 +37,7 @@ module Dor
37
37
  bagger.create_tagfiles
38
38
  verify_bag_structure(bag_dir)
39
39
  # start SDR preservation workflow (but do not create the workflows datastream)
40
- dor_item.create_workflow('preservationIngestWF', false)
40
+ CreateWorkflowService.create_workflow(dor_item, name: 'preservationIngestWF', create_ds: false)
41
41
  rescue Exception => e
42
42
  raise Dor::Exception, "Error exporting new object version to bag: #{e.message}"
43
43
  end
@@ -26,7 +26,7 @@ module Dor
26
26
  { image_type: 'external', finder: "/contentMetadata/resource[@type='page' or @type='image']/externalFile[#{MIME_TYPE_FINDER}]" }
27
27
  ].freeze
28
28
 
29
- # @params [Dor::Item] object
29
+ # @param [Dor::Item] object
30
30
  def initialize(object)
31
31
  @object = object
32
32
  end
@@ -37,9 +37,9 @@ module Dor
37
37
  k = :create_workflows_ds
38
38
  if opts.key?(k)
39
39
  # During local development, Hydrus (or another app w/ local Fedora) does not want to initialize workflows datastream.
40
- work.create_workflow('versioningWF', opts[k])
40
+ CreateWorkflowService.create_workflow(work, name: 'versioningWF', create_ds: opts[k])
41
41
  else
42
- work.create_workflow('versioningWF')
42
+ CreateWorkflowService.create_workflow(work, name: 'versioningWF')
43
43
  end
44
44
 
45
45
  vmd_upd_info = opts[:vers_md_upd_info]
data/lib/dor/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Dor
4
- VERSION = '6.1.1'
4
+ VERSION = '6.1.2'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dor-services
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.1.1
4
+ version: 6.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Klein
@@ -90,14 +90,14 @@ dependencies:
90
90
  requirements:
91
91
  - - "~>"
92
92
  - !ruby/object:Gem::Version
93
- version: 0.4.0
93
+ version: '0.4'
94
94
  type: :runtime
95
95
  prerelease: false
96
96
  version_requirements: !ruby/object:Gem::Requirement
97
97
  requirements:
98
98
  - - "~>"
99
99
  - !ruby/object:Gem::Version
100
- version: 0.4.0
100
+ version: '0.4'
101
101
  - !ruby/object:Gem::Dependency
102
102
  name: equivalent-xml
103
103
  requirement: !ruby/object:Gem::Requirement