Module: Hyrax::WorkflowIndexer
- Included in:
- Indexers::PcdmObjectIndexer
- Defined in:
- app/indexers/concerns/hyrax/workflow_indexer.rb
Instance Method Summary collapse
-
#index_workflow_fields(solr_document) ⇒ Object
Write the workflow roles and state so one can see where the document moves to next.
-
#to_solr ⇒ Object
Write the workflow roles and state into the solr_document.
-
#workflow_roles(entity) ⇒ Array<String>
Get the workflow roles for the entity.
Instance Method Details
#index_workflow_fields(solr_document) ⇒ Object
Write the workflow roles and state so one can see where the document moves to next
15 16 17 18 19 20 21 |
# File 'app/indexers/concerns/hyrax/workflow_indexer.rb', line 15 def index_workflow_fields(solr_document) entity = Sipity::Entity(resource) solr_document['actionable_workflow_roles_ssim'] = workflow_roles(entity).map { |role| "#{entity.workflow..source_id}-#{entity.workflow.name}-#{role}" } solr_document['workflow_state_name_ssim'] = entity.workflow_state.name if entity.workflow_state rescue Sipity::ConversionError nil end |
#to_solr ⇒ Object
Write the workflow roles and state into the solr_document
7 8 9 10 11 |
# File 'app/indexers/concerns/hyrax/workflow_indexer.rb', line 7 def to_solr super.tap do |solr_doc| index_workflow_fields(solr_doc) end end |
#workflow_roles(entity) ⇒ Array<String>
Get the workflow roles for the entity
26 27 28 |
# File 'app/indexers/concerns/hyrax/workflow_indexer.rb', line 26 def workflow_roles(entity) Hyrax::Workflow::PermissionQuery.scope_roles_associated_with_the_given_entity(entity: entity) end |