dor-services 6.8.0 → 7.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/config/config_defaults.yml +0 -27
  3. data/config/dev_console_env.rb.example +0 -17
  4. data/lib/dor-services.rb +9 -73
  5. data/lib/dor/config.rb +1 -30
  6. data/lib/dor/datastreams/content_metadata_ds.rb +8 -0
  7. data/lib/dor/datastreams/desc_metadata_ds.rb +19 -0
  8. data/lib/dor/datastreams/identity_metadata_ds.rb +65 -0
  9. data/lib/dor/datastreams/rights_metadata_ds.rb +14 -2
  10. data/lib/dor/datastreams/workflow_definition_ds.rb +1 -1
  11. data/lib/dor/datastreams/workflow_ds.rb +0 -15
  12. data/lib/dor/indexers/identifiable_indexer.rb +8 -4
  13. data/lib/dor/indexers/releasable_indexer.rb +7 -1
  14. data/lib/dor/models/abstract.rb +143 -8
  15. data/lib/dor/models/admin_policy_object.rb +0 -3
  16. data/lib/dor/models/collection.rb +0 -2
  17. data/lib/dor/models/concerns/embargoable.rb +7 -60
  18. data/lib/dor/models/etd.rb +100 -0
  19. data/lib/dor/models/item.rb +12 -28
  20. data/lib/dor/models/part.rb +18 -0
  21. data/lib/dor/models/set.rb +0 -2
  22. data/lib/dor/services/collection_service.rb +36 -0
  23. data/lib/dor/services/embargo_service.rb +93 -0
  24. data/lib/dor/services/ontology.rb +0 -18
  25. data/lib/dor/services/public_desc_metadata_service.rb +7 -11
  26. data/lib/dor/services/search_service.rb +0 -40
  27. data/lib/dor/version.rb +1 -1
  28. data/lib/dor/workflow/document.rb +0 -7
  29. metadata +15 -78
  30. data/lib/dor/models/concerns/assembleable.rb +0 -18
  31. data/lib/dor/models/concerns/contentable.rb +0 -185
  32. data/lib/dor/models/concerns/describable.rb +0 -82
  33. data/lib/dor/models/concerns/eventable.rb +0 -18
  34. data/lib/dor/models/concerns/geoable.rb +0 -14
  35. data/lib/dor/models/concerns/governable.rb +0 -101
  36. data/lib/dor/models/concerns/identifiable.rb +0 -172
  37. data/lib/dor/models/concerns/itemizable.rb +0 -42
  38. data/lib/dor/models/concerns/preservable.rb +0 -46
  39. data/lib/dor/models/concerns/processable.rb +0 -86
  40. data/lib/dor/models/concerns/publishable.rb +0 -76
  41. data/lib/dor/models/concerns/releaseable.rb +0 -118
  42. data/lib/dor/models/concerns/rightsable.rb +0 -25
  43. data/lib/dor/models/concerns/shelvable.rb +0 -15
  44. data/lib/dor/models/concerns/versionable.rb +0 -72
  45. data/lib/dor/services/ability.rb +0 -77
  46. data/lib/dor/services/cleanup_reset_service.rb +0 -103
  47. data/lib/dor/services/datastream_builder.rb +0 -96
  48. data/lib/dor/services/decommission_service.rb +0 -31
  49. data/lib/dor/services/digital_stacks_service.rb +0 -125
  50. data/lib/dor/services/dublin_core_service.rb +0 -45
  51. data/lib/dor/services/file_metadata_merge_service.rb +0 -71
  52. data/lib/dor/services/indexing_service.rb +0 -131
  53. data/lib/dor/services/merge_service.rb +0 -105
  54. data/lib/dor/services/public_xml_service.rb +0 -116
  55. data/lib/dor/services/publish_metadata_service.rb +0 -99
  56. data/lib/dor/services/reset_workspace_service.rb +0 -27
  57. data/lib/dor/services/sdr_ingest_service.rb +0 -172
  58. data/lib/dor/services/secondary_file_name_service.rb +0 -10
  59. data/lib/dor/services/shelving_service.rb +0 -69
  60. data/lib/dor/services/technical_metadata_service.rb +0 -232
  61. data/lib/dor/services/version_service.rb +0 -84
  62. data/lib/dor/utils/sdr_client.rb +0 -94
@@ -1,42 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'fileutils'
4
- require 'uri'
5
-
6
- module Dor
7
- module Itemizable
8
- extend ActiveSupport::Concern
9
- extend Deprecation
10
- self.deprecation_horizon = 'dor-services version 7.0.0'
11
-
12
- included do
13
- has_metadata name: 'contentMetadata', type: Dor::ContentMetadataDS, label: 'Content Metadata', control_group: 'M'
14
- end
15
-
16
- DIFF_FILENAME = 'cm_inv_diff'
17
-
18
- # Deletes all cm_inv_diff files in the workspace for the Item
19
- def clear_diff_cache
20
- raise ArgumentError, 'Missing Dor::Config.stacks.local_workspace_root' if Dor::Config.stacks.local_workspace_root.nil?
21
-
22
- druid = DruidTools::Druid.new(pid, Dor::Config.stacks.local_workspace_root)
23
- diff_pattern = File.join(druid.temp_dir, DIFF_FILENAME + '.*')
24
- FileUtils.rm_f Dir.glob(diff_pattern)
25
- end
26
- deprecation_deprecate clear_diff_cache: 'No longer used by any DLSS code and will be removed without replacement'
27
-
28
- # Retrieves file difference manifest for contentMetadata from SDR
29
- #
30
- # @param [Symbol] subset keyword for file attributes :shelve, :preserve, :publish. Default is :all.
31
- # @param [String] version
32
- # @return [Moab::FileInventoryDifference] XML contents of cm_inv_diff manifest
33
- def get_content_diff(subset = :all, version = nil)
34
- raise Dor::ParameterError, 'Missing Dor::Config.stacks.local_workspace_root' if Dor::Config.stacks.local_workspace_root.nil?
35
-
36
- raise Dor::Exception, 'Missing contentMetadata datastream' if !respond_to?(:contentMetadata) || contentMetadata.nil?
37
-
38
- Sdr::Client.get_content_diff(pid, contentMetadata.content, subset.to_s, version)
39
- end
40
- deprecation_deprecate get_content_diff: 'Use Sdr::Client.get_content_diff instead'
41
- end
42
- end
@@ -1,46 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Dor
4
- module Preservable
5
- extend ActiveSupport::Concern
6
- extend Deprecation
7
- self.deprecation_horizon = 'dor-services version 7.0.0'
8
-
9
- included do
10
- has_metadata name: 'provenanceMetadata', type: ProvenanceMetadataDS, label: 'Provenance Metadata'
11
- end
12
-
13
- # This is invoked by Robots::DorRepo::Accession::ProvenanceMetadata in common-accessioning
14
- # as well as Argo's ItemsController#fix_missing_provenance
15
- def build_provenanceMetadata_datastream(workflow_id, event_text)
16
- workflow_provenance = create_workflow_provenance(workflow_id, event_text)
17
- ds = datastreams['provenanceMetadata']
18
- ds.label ||= 'Provenance Metadata'
19
- ds.ng_xml = workflow_provenance
20
- ds.save
21
- end
22
-
23
- def sdr_ingest_transfer(agreement_id)
24
- SdrIngestService.transfer(self, agreement_id)
25
- end
26
- deprecation_deprecate sdr_ingest_transfer: 'Use SdrIngestService.transfer instead'
27
-
28
- private
29
-
30
- # @return [Nokogiri::Document]
31
- def create_workflow_provenance(workflow_id, event_text)
32
- builder = Nokogiri::XML::Builder.new do |xml|
33
- xml.provenanceMetadata(objectId: pid) do
34
- xml.agent(name: 'DOR') do
35
- xml.what(object: pid) do
36
- xml.event(who: "DOR-#{workflow_id}", when: Time.new.iso8601) do
37
- xml.text(event_text)
38
- end
39
- end
40
- end
41
- end
42
- end
43
- builder.doc
44
- end
45
- end
46
- end
@@ -1,86 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'equivalent-xml'
4
-
5
- module Dor
6
- module Processable
7
- extend ActiveSupport::Concern
8
- extend Deprecation
9
- self.deprecation_horizon = 'dor-services version 7.0.0'
10
-
11
- included do
12
- has_metadata name: 'workflows',
13
- type: Dor::WorkflowDs,
14
- label: 'Workflows',
15
- control_group: 'E',
16
- autocreate: true
17
- end
18
-
19
- STEPS = ActiveSupport::Deprecation::DeprecatedConstantProxy.new('STEPS', 'Dor::StatusService::STEPS')
20
-
21
- # The ContentMetadata and DescMetadata robot are allowed to build the
22
- # datastream by reading a file from the /dor/workspace that matches the
23
- # datastream name. This allows assembly or pre-assembly to prebuild the
24
- # datastreams from templates or using other means
25
- # (like the assembly-objectfile gem) and then have those datastreams picked
26
- # up and added to the object during accessionWF.
27
- #
28
- # This method builds that datastream using the content of a file if such a file
29
- # exists and is newer than the object's current datastream (see above); otherwise,
30
- # builds the datastream by calling build_fooMetadata_datastream.
31
- # @param [String] datastream name of a datastream (e.g. "fooMetadata")
32
- # @param [Boolean] force overwrite existing datastream
33
- # @param [Boolean] is_required
34
- # @return [ActiveFedora::Datastream]
35
- def build_datastream(datastream, force = false, is_required = false)
36
- ds = datastreams[datastream]
37
- builder = Dor::DatastreamBuilder.new(object: self,
38
- datastream: ds,
39
- force: force,
40
- required: is_required)
41
- builder.build
42
-
43
- ds
44
- end
45
- deprecation_deprecate build_datastream: 'Use Dor::DatastreamBuilder instead'
46
-
47
- def cleanup
48
- CleanupService.cleanup(self)
49
- end
50
- deprecation_deprecate cleanup: 'Use CleanupService.cleanup instead'
51
-
52
- # @return [Hash{Symbol => Object}] including :current_version, :status_code and :status_time
53
- def status_info
54
- StatusService.status_info(self)
55
- end
56
- deprecation_deprecate status_info: 'Use StatusService.status_info instead'
57
-
58
- # @param [Boolean] include_time
59
- # @return [String] single composed status from status_info
60
- def status(include_time = false)
61
- StatusService.status(self, include_time)
62
- end
63
- deprecation_deprecate status: 'Use StatusService.status instead'
64
-
65
- def milestones
66
- StatusService.new(self).milestones
67
- end
68
- deprecation_deprecate status_info: 'Use StatusService#milestones instead'
69
-
70
- # Initilizes workflow for the object in the workflow service
71
- # It will set the priorty of the new workflow to the current_priority if it is > 0
72
- # It will set lane_id from the item's APO default workflow lane
73
- # @param [String] name of the workflow to be initialized
74
- # @param [Boolean] create_ds create a 'workflows' datastream in Fedora for the object
75
- # @param [Integer] priority the workflow's priority level
76
- def create_workflow(name, create_ds = true, priority = 0)
77
- CreateWorkflowService.create_workflow(self, name: name, create_ds: create_ds, priority: priority)
78
- end
79
- deprecation_deprecate create_workflow: 'Use Dor::Services::Client.object(object_identifier).workflow.create(wf_name:) instead'
80
-
81
- def initialize_workflow(name, create_ds = true, priority = 0)
82
- warn 'WARNING: initialize_workflow is deprecated, use create_workflow instead'
83
- create_workflow(name, create_ds, priority)
84
- end
85
- end
86
- end
@@ -1,76 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'dor/datastreams/content_metadata_ds'
4
- require 'fileutils'
5
-
6
- module Dor
7
- module Publishable
8
- extend Deprecation
9
- extend ActiveSupport::Concern
10
- self.deprecation_horizon = 'dor-services version 7.0.0'
11
-
12
- # Compute the thumbnail for this object following the rules at https://consul.stanford.edu/display/chimera/The+Rules+of+Thumb
13
- # Used by PublicXmlService
14
- # @return [String] the computed thumb filename, with the druid prefix and a slash in front of it, e.g. oo000oo0001/filenamewith space.jp2
15
- def thumb
16
- ThumbnailService.new(self).thumb
17
- end
18
- deprecation_deprecate :thumb
19
-
20
- # Return a URI encoded version of the thumb image for use by indexers (leaving the extension of the filename)
21
- # @return [String] URI encoded version of the thumb with the druid prefix, e.g. oo000oo0001%2Ffilenamewith%20space.jp2
22
- def encoded_thumb
23
- thumb_image = thumb # store the result locally, so we don't have to compute each time we use it below
24
- return unless thumb_image
25
-
26
- thumb_druid = thumb_image.split('/').first # the druid (before the first slash)
27
- thumb_filename = thumb_image.split(/#{pid_regex}[\/]/).last # everything after the druid
28
- "#{thumb_druid}%2F#{ERB::Util.url_encode(thumb_filename)}"
29
- end
30
- deprecation_deprecate :encoded_thumb
31
-
32
- # Return a full qualified thumbnail image URL if the thumb is computable
33
- # @return [String] fully qualified image URL for the computed thumbnail, e.g. https://stacks.stanford.edu/image/iiif/oo000oo0001%2Ffilenamewith%20space/full
34
- def thumb_url
35
- return unless encoded_thumb
36
-
37
- thumb_basename = File.basename(encoded_thumb, File.extname(encoded_thumb)) # strip the extension for URL generation
38
- "https://#{Dor::Config.stacks.host}/image/iiif/#{thumb_basename}/full/!400,400/0/default.jpg"
39
- end
40
- deprecation_deprecate :thumb_url
41
-
42
- # strips away the relationships that should not be shown in public desc metadata
43
- # @return [Nokogiri::XML]
44
- def public_relationships
45
- include_elements = ['fedora:isMemberOf', 'fedora:isMemberOfCollection', 'fedora:isConstituentOf']
46
- rels_doc = Nokogiri::XML(datastreams['RELS-EXT'].content)
47
- rels_doc.xpath('/rdf:RDF/rdf:Description/*', 'rdf' => 'http://www.w3.org/1999/02/22-rdf-syntax-ns#').each do |rel|
48
- unless include_elements.include?([rel.namespace.prefix, rel.name].join(':'))
49
- rel.next_sibling.remove if rel.next_sibling.content.strip.empty?
50
- rel.remove
51
- end
52
- end
53
- rels_doc
54
- end
55
-
56
- # Generate the public .xml for a PURL page.
57
- # @return [xml] The public xml for the item
58
- def public_xml
59
- PublicXmlService.new(self).to_xml
60
- end
61
- deprecation_deprecate public_xml: 'Use PublicXmlService#to_xml instead'
62
-
63
- # Copies this object's public_xml to the Purl document cache if it is world discoverable
64
- # otherwise, it prunes the object's metadata from the document cache
65
- def publish_metadata
66
- PublishMetadataService.publish(self)
67
- end
68
- deprecation_deprecate publish_metadata: 'use Dor::PublishMetadataService.publish(obj) instead or use publish_metadata_remotely'
69
-
70
- # Call dor services app to have it publish the metadata
71
- def publish_metadata_remotely
72
- Dor::Services::Client.object(pid).publish
73
- end
74
- deprecation_deprecate publish_metadata_remotely: 'Use Dor::Services::Client.object(object_identifier).publish instead'
75
- end
76
- end
@@ -1,118 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'open-uri'
4
- require 'retries'
5
-
6
- module Dor
7
- module Releaseable
8
- extend ActiveSupport::Concern
9
- extend Deprecation
10
- self.deprecation_horizon = 'dor-services version 7.0.0'
11
-
12
- # Add release tags to an item and initialize the item release workflow
13
- # Each tag should be of the form !{:tag => 'Fitch : Batch2', :what => 'self', :to => 'Searchworks', :who => 'petucket', :release => true}
14
- # @param release_tags [Hash, Array<Hash>] hash of a single release tag or an array of many such hashes
15
- # @raise [ArgumentError] Raised if the tags are improperly supplied
16
- def add_release_nodes_and_start_releaseWF(release_tags)
17
- release_tags = [release_tags] unless release_tags.is_a?(Array)
18
-
19
- # Add in each tag
20
- release_tags.each do |r_tag|
21
- add_release_node(r_tag[:release], r_tag)
22
- end
23
-
24
- # Save item to dor so the robots work with the latest data
25
- save
26
- create_workflow('releaseWF')
27
- end
28
- deprecation_deprecate add_release_nodes_and_start_releaseWF: 'No longer used by any DLSS code'
29
-
30
- # Called in Dor::UpdateMarcRecordService (in dor-services-app too)
31
- # Determine projects in which an item is released
32
- # @param [Boolean] skip_live_purl set true to skip requesting from purl backend
33
- # @return [Hash{String => Boolean}] all namespaces, keys are Project name Strings, values are Boolean
34
- def released_for(skip_live_purl = false)
35
- releases.released_for(skip_live_purl: skip_live_purl)
36
- end
37
-
38
- # Helper method to get the release tags as a nodeset
39
- # @return [Nokogiri::XML::NodeSet] all release tags and their attributes
40
- delegate :release_tags, to: :releases
41
- deprecation_deprecate release_tags: 'use ReleaseTagService#release_tags instead'
42
-
43
- # Take a hash of tags as obtained via Dor::Item.release_tags and returns the newest tag for each namespace
44
- # @param tags [Hash] a hash of tags obtained via Dor::Item.release_tags or matching format
45
- # @return [Hash] a hash of latest tags for each to value
46
- def get_newest_release_tag(tags)
47
- releases.newest_release_tag(tags)
48
- end
49
- deprecation_deprecate get_newest_release_tag: 'use ReleaseTagService#newest_release_tag instead'
50
-
51
- def releases
52
- @releases ||= ReleaseTagService.for(self)
53
- end
54
-
55
- # Determine if the supplied tag is a valid release tag that meets all requirements
56
- #
57
- # @param attrs [hash] A hash of attributes for the tag, must contain: :when, a ISO 8601 timestamp; :who, to identify who or what added the tag; and :to, a string identifying the release target
58
- # @raise [RuntimeError] Raises an error of the first fault in the release tag
59
- # @return [Boolean] Returns true if no errors found
60
- def valid_release_attributes_and_tag(tag, attrs = {})
61
- raise ArgumentError, ':when is not iso8601' if attrs[:when].match('\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z').nil?
62
-
63
- %i[who to what].each do |check_attr|
64
- raise ArgumentError, "#{check_attr} not supplied as a String" if attrs[check_attr].class != String
65
- end
66
-
67
- what_correct = false
68
- %w(self collection).each do |allowed_what_value|
69
- what_correct = true if attrs[:what] == allowed_what_value
70
- end
71
- raise ArgumentError, ':what must be self or collection' unless what_correct
72
- raise ArgumentError, 'the value set for this tag is not a boolean' if !!tag != tag # rubocop:disable Style/DoubleNegation
73
-
74
- true
75
- end
76
- deprecation_deprecate valid_release_attributes_and_tag: 'No longer used by any DLSS code'
77
-
78
- # Add a release node for the item
79
- # Will use the current time if timestamp not supplied. You can supply a timestap for correcting history, etc if desired
80
- # Timestamp will be calculated by the function
81
- #
82
- # @param release [Boolean] True or false for the release node
83
- # @param attrs [hash] A hash of any attributes to be placed onto the tag
84
- # @return [Nokogiri::XML::Element] the tag added if successful
85
- # @raise [ArgumentError] Raised if attributes are improperly supplied
86
- #
87
- # @example
88
- # item.add_release_node(true,{:what=>'self',:to=>'Searchworks',:who=>'petucket'})
89
- def add_release_node(release, attrs = {})
90
- allowed_release_attributes = %i[what to who when] # any other release attributes sent in will be rejected and not stored
91
- identity_metadata_ds = identityMetadata
92
- attrs.delete_if { |key, _value| !allowed_release_attributes.include?(key) }
93
- attrs[:when] = Time.now.utc.iso8601 if attrs[:when].nil? # add the timestamp
94
- valid_release_attributes(release, attrs)
95
- identity_metadata_ds.add_value(:release, release.to_s, attrs)
96
- end
97
- deprecation_deprecate add_release_node: 'No longer used by any DLSS code'
98
-
99
- # Determine if the supplied tag is a valid release node that meets all requirements
100
- #
101
- # @param tag [Boolean] True or false for the release node
102
- # @param attrs [hash] A hash of attributes for the tag, must contain :when, a ISO 8601 timestamp and :who to identify who or what added the tag, :to,
103
- # @raise [ArgumentError] Raises an error of the first fault in the release tag
104
- # @return [Boolean] Returns true if no errors found
105
- def valid_release_attributes(tag, attrs = {})
106
- raise ArgumentError, ':when is not iso8601' if attrs[:when].match('\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z').nil?
107
-
108
- %i[who to what].each do |check_attr|
109
- raise ArgumentError, "#{check_attr} not supplied as a String" if attrs[check_attr].class != String
110
- end
111
- raise ArgumentError, ':what must be self or collection' unless %w(self collection).include? attrs[:what]
112
- raise ArgumentError, 'the value set for this tag is not a boolean' unless [true, false].include? tag
113
-
114
- true
115
- end
116
- deprecation_deprecate valid_release_attributes: 'No longer used by any DLSS code'
117
- end
118
- end
@@ -1,25 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Dor
4
- module Rightsable
5
- extend ActiveSupport::Concern
6
-
7
- included do
8
- has_metadata name: 'rightsMetadata', type: Dor::RightsMetadataDS, label: 'Rights metadata'
9
- end
10
-
11
- def build_rightsMetadata_datastream(ds)
12
- content_ds = admin_policy_object.datastreams['defaultObjectRights']
13
- ds.dsLabel = 'Rights Metadata'
14
- ds.ng_xml = content_ds.ng_xml.clone
15
- end
16
-
17
- def world_doc
18
- Nokogiri::XML::Builder.new do |xml|
19
- xml.access(type: 'read') do
20
- xml.machine { xml.world }
21
- end
22
- end.doc
23
- end
24
- end
25
- end
@@ -1,15 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Dor
4
- module Shelvable
5
- extend Deprecation
6
- extend ActiveSupport::Concern
7
- self.deprecation_horizon = 'dor-services version 7.0.0'
8
-
9
- # Push file changes for shelve-able files into the stacks
10
- def shelve
11
- ShelvingService.shelve(self)
12
- end
13
- deprecation_deprecate shelve: 'Use ShelvingService.shelve(work) instead'
14
- end
15
- end
@@ -1,72 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Dor
4
- module Versionable
5
- extend ActiveSupport::Concern
6
- extend Deprecation
7
- self.deprecation_horizon = 'dor-services version 7.0.0'
8
-
9
- included do
10
- has_metadata name: 'versionMetadata', type: Dor::VersionMetadataDS, label: 'Version Metadata', autocreate: true
11
- end
12
-
13
- # Increments the version number and initializes versioningWF for the object
14
- # @param [Hash] opts optional params
15
- # @option opts [Boolean] :assume_accessioned If true, does not check whether object has been accessioned.
16
- # @option opts [Boolean] :create_workflows_ds If false, create_workflow() will not initialize the workflows datastream.
17
- # @option opts [Hash] :vers_md_upd_info If present, used to add to the events datastream and set the desc and significance on the versionMetadata datastream
18
- # @raise [Dor::Exception] if the object hasn't been accessioned, or if a version is already opened
19
- def open_new_version(opts = {})
20
- VersionService.open(self, opts)
21
- end
22
- deprecation_deprecate open_new_version: 'Use Dor::Services::Client.object(object_identifier).open_new_version(**params) instead'
23
-
24
- def current_version
25
- versionMetadata.current_version_id
26
- end
27
-
28
- # Sets versioningWF:submit-version to completed and initiates accessionWF for the object
29
- # @param [Hash] opts optional params
30
- # @option opts [String] :description describes the version change
31
- # @option opts [Symbol] :significance which part of the version tag to increment
32
- # :major, :minor, :admin (see Dor::VersionTag#increment)
33
- # @option opts [String] :version_num version number to archive rows with. Otherwise, current version is used
34
- # @option opts [Boolean] :start_accesion set to true if you want accessioning to start (default), false otherwise
35
- # @raise [Dor::Exception] if the object hasn't been opened for versioning, or if accessionWF has
36
- # already been instantiated or the current version is missing a tag or description
37
- def close_version(opts = {})
38
- VersionService.close(self, opts)
39
- end
40
- deprecation_deprecate close_version: 'Use Dor::Services::Client.object(object_identifier).close_version(**params) instead'
41
-
42
- # @return [Boolean] true if 'opened' lifecycle is active, false otherwise
43
- def new_version_open?
44
- VersionService.new(self).open?
45
- end
46
- deprecation_deprecate new_version_open?: 'Use VersionService.open? instead'
47
-
48
- # This is used by Argo and the MergeService
49
- # @return [Boolean] true if the object is in a state that allows it to be modified.
50
- # States that will allow modification are: has not been submitted for accessioning, has an open version or has sdr-ingest set to hold
51
- def allows_modification?
52
- if Dor::Config.workflow.client.lifecycle('dor', pid, 'submitted') &&
53
- !VersionService.new(self).open? &&
54
- Dor::Config.workflow.client.workflow_status('dor', pid, 'accessionWF', 'sdr-ingest-transfer') != 'hold'
55
- false
56
- else
57
- true
58
- end
59
- end
60
-
61
- # Following chart of processes on this consul page: https://consul.stanford.edu/display/chimera/Versioning+workflows
62
- def start_version
63
- open_new_version
64
- end
65
- deprecation_deprecate start_version: 'Use Dor::Services::Client.object(object_identifier).open_new_version(**params) instead'
66
-
67
- def submit_version
68
- close_version
69
- end
70
- deprecation_deprecate submit_version: 'Use Dor::Services::Client.object(object_identifier).close_version(**params) instead'
71
- end
72
- end