Class: Dor::ArchiveCriteria
- Inherits:
-
Struct
- Object
- Struct
- Dor::ArchiveCriteria
- Defined in:
- lib/dor/workflow_archiver.rb
Overview
Holds the paramaters about the workflow rows that need to be deleted
Instance Attribute Summary collapse
-
#datastream ⇒ Object
Returns the value of attribute datastream.
-
#druid ⇒ Object
Returns the value of attribute druid.
-
#repository ⇒ Object
Returns the value of attribute repository.
-
#version ⇒ Object
Returns the value of attribute version.
Instance Method Summary collapse
- #set_current_version(dor_conn) ⇒ Object
- #setup_from_query(row_hash, dor_conn) ⇒ Object
-
#to_bind_hash ⇒ Hash
Removes version from list of members, then picks out non nil members and builds a hash of column_name => column_value.
Instance Attribute Details
#datastream ⇒ Object
Returns the value of attribute datastream
8 9 10 |
# File 'lib/dor/workflow_archiver.rb', line 8 def datastream @datastream end |
#druid ⇒ Object
Returns the value of attribute druid
8 9 10 |
# File 'lib/dor/workflow_archiver.rb', line 8 def druid @druid end |
#repository ⇒ Object
Returns the value of attribute repository
8 9 10 |
# File 'lib/dor/workflow_archiver.rb', line 8 def repository @repository end |
#version ⇒ Object
Returns the value of attribute version
8 9 10 |
# File 'lib/dor/workflow_archiver.rb', line 8 def version @version end |
Instance Method Details
#set_current_version(dor_conn) ⇒ Object
28 29 30 31 32 33 34 35 36 |
# File 'lib/dor/workflow_archiver.rb', line 28 def set_current_version(dor_conn) response = dor_conn.get "/v1/objects/#{druid}/versions/current" self.version = response.body rescue Faraday::Error::ClientError => ise raise unless ise.inspect =~ /Unable to find.*in fedora/ LyberCore::Log.warn ise.inspect.to_s LyberCore::Log.warn "Moving workflow rows with version set to '1'" self.version = '1' end |
#setup_from_query(row_hash, dor_conn) ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/dor/workflow_archiver.rb', line 10 def setup_from_query(row_hash, dor_conn) self.repository = row_hash[:repository] self.druid = row_hash[:druid] self.datastream = row_hash[:datastream] set_current_version(dor_conn) self end |
#to_bind_hash ⇒ Hash
Removes version from list of members, then picks out non nil members and builds a hash of column_name => column_value
20 21 22 23 24 25 26 |
# File 'lib/dor/workflow_archiver.rb', line 20 def to_bind_hash h = {} members.reject { |mem| mem =~ /version/ }.each do |m| h[m] = send(m) if send(m) end h end |