Sha256: 63d26309c2b0afa7728b40c88fcf4c66179506267b916aed948fce6a46701ddc

Contents?: true

Size: 1.16 KB

Versions: 13

Compression:

Stored size: 1.16 KB

Contents

# frozen_string_literal: true
module Hyrax
  module Actors
    ##
    # @deprecated
    #
    # Responsible for generating the workflow for the given curation_concern.
    # Done through direct collaboration with the configured Hyrax::Actors::InitializeWorkflowActor.workflow_factory
    #
    # @see Hyrax::Actors::InitializeWorkflowActor.workflow_factory
    # @see Hyrax::Workflow::WorkflowFactory for default workflow factory
    class InitializeWorkflowActor < AbstractActor
      class_attribute :workflow_factory
      self.workflow_factory = ::Hyrax::Workflow::WorkflowFactory

      # @param [Hyrax::Actors::Environment] env
      # @return [Boolean] true if create was successful
      def create(env)
        Deprecation.warn('Use Hyrax::Listeners::WorkflowListener instead.')
        next_actor.create(env) && create_workflow(env)
      end

      private

      # @return [TrueClass]
      def create_workflow(env)
        # if the entity exists, this is already initialized
        Sipity::Entity(env.curation_concern)
        true
      rescue Sipity::ConversionError
        workflow_factory.create(env.curation_concern, env.attributes, env.user)
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
hyrax-3.6.0 app/actors/hyrax/actors/initialize_workflow_actor.rb
hyrax-3.5.0 app/actors/hyrax/actors/initialize_workflow_actor.rb
hyrax-3.4.2 app/actors/hyrax/actors/initialize_workflow_actor.rb
hyrax-3.4.1 app/actors/hyrax/actors/initialize_workflow_actor.rb
hyrax-3.4.0 app/actors/hyrax/actors/initialize_workflow_actor.rb
hyrax-3.3.0 app/actors/hyrax/actors/initialize_workflow_actor.rb
hyrax-3.2.0 app/actors/hyrax/actors/initialize_workflow_actor.rb
hyrax-3.1.0 app/actors/hyrax/actors/initialize_workflow_actor.rb
hyrax-3.0.2 app/actors/hyrax/actors/initialize_workflow_actor.rb
hyrax-3.0.1 app/actors/hyrax/actors/initialize_workflow_actor.rb
hyrax-3.0.0 app/actors/hyrax/actors/initialize_workflow_actor.rb
hyrax-3.0.0.pre.rc4 app/actors/hyrax/actors/initialize_workflow_actor.rb
hyrax-3.0.0.pre.rc3 app/actors/hyrax/actors/initialize_workflow_actor.rb