Class: DorIndexing::Indexers::WorkflowIndexer
- Inherits:
-
Object
- Object
- DorIndexing::Indexers::WorkflowIndexer
- Defined in:
- lib/dor_indexing/indexers/workflow_indexer.rb
Overview
Indexes the object’s state for each process in a single workflow
Instance Method Summary collapse
-
#initialize(workflow:, workflow_client:) ⇒ WorkflowIndexer
constructor
A new instance of WorkflowIndexer.
-
#to_solr ⇒ Hash
The partial solr document for all the workflow processes.
Constructor Details
#initialize(workflow:, workflow_client:) ⇒ WorkflowIndexer
Returns a new instance of WorkflowIndexer.
8 9 10 11 |
# File 'lib/dor_indexing/indexers/workflow_indexer.rb', line 8 def initialize(workflow:, workflow_client:) @workflow = workflow @workflow_client = workflow_client end |
Instance Method Details
#to_solr ⇒ Hash
Returns the partial solr document for all the workflow processes.
14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/dor_indexing/indexers/workflow_indexer.rb', line 14 def to_solr WorkflowSolrDocument.new do |solr_doc| solr_doc.name = workflow_name errors = 0 # The error count is used by the Report class in Argo processes.each do |process| WorkflowProcessIndexer.new(solr_doc:, workflow_name:, process:).to_solr errors += 1 if process.status == 'error' end solr_doc.status = [workflow_name, workflow_status, errors].join('|') end end |