Method: Hyrax::Workflow::WorkflowImporter.load_workflow_for

Defined in:
app/services/hyrax/workflow/workflow_importer.rb

.load_workflow_for(permission_template:, logger: default_logger) ⇒ TrueClass, FalseClass

Note:

I’d like to deprecate .load_workflows but for now that is beyond the scope of what I’m after. So I will use its magic instead

Load all of the workflows for the given permission_template



34
35
36
37
38
39
40
41
42
43
44
45
# File 'app/services/hyrax/workflow/workflow_importer.rb', line 34

def self.load_workflow_for(permission_template:, logger: default_logger)
  workflow_config_filenames = Dir.glob(path_to_workflow_files)
  if workflow_config_filenames.none?
    logger.info("Unable to load workflows for #{permission_template.class} ID=#{permission_template.id}. No workflows were found in #{path_to_workflow_files}")
    return false
  end
  workflow_config_filenames.each do |config|
    logger.info "Loading permission_template ID=#{permission_template.id} with workflow config #{config}"
    generate_from_json_file(path: config, permission_template: permission_template, logger: default_logger)
  end
  true
end