BPM-Engine

 view release on metacpan or  search on metacpan

lib/BPM/Engine/ProcessRunner.pm  view on Meta::CPAN

sub _signal_upstream_orjoins_if_in_split_branch {
    my ($self, @blocked) = @_;

    my @deferred = $self->process_instance->activity_instances->deferred->all;

    foreach my $instance (@deferred) {

        $self->debug("runner: _run Pushing db instance "
                . $instance->activity->activity_uid
                . " to deferred queue");

        my $graph = $self->graph;

        foreach my $block (@blocked) {
            my $tr   = $block->[0];
            my $ai   = $block->[1];
            my $a_to = $tr->to_activity;
            if ($graph->is_reachable($a_to->id, $instance->activity->id)) {
                $self->_defer_push([$instance->activity, $instance]);
                }
            }

        }
    }

__PACKAGE__->meta->make_immutable;

1;
__END__

=pod

=encoding utf-8

=head1 NAME

BPM::Engine::ProcessRunner - Runs workflow processes

=head1 VERSION

0.01

=head1 SYNOPSIS

    use BPM::Engine::ProcessRunner;

    my $callback = sub {
        my($runner, $entity, $action, $node, $instance) = @_;
        ...        
        return 1;
        };

    my $runner = BPM::Engine::ProcessRunner->new(
        process_instance => $instance,
        callback         => $callback,
        );
  
    $runner->start_process();

    # somewhere else, after completing a task, 
    # from an asynchronous task handler...
  
    $runner->complete_activity($activity, $instance, 1);

=head1 DESCRIPTION

Implements the workflow enactment logic.

=head1 CALLBACKS

The methods in this package emit callback events to a callback handler that may 
be passed to the constructor. If no callback handler is specified, the default 
return values are applied for these event calls.

The following callback actions are emitted for a process event:

=over 4

=item I<start_process>

Arguments: $process, $process_instance

=item I<start_activity>

Arguments: $activity, $instance

=item I<continue_activity>

Arguments: $activity, $instance

=item I<execute_activity>

Argments: $activity, $instance

On this event, the callback should return false if the workflow process should
be interrupted, true (default) if otherwise, which executes the activity and
progresses the workflow.

=item I<execute_task>

Argments: $task, $activity_instance

Returning true (default) will assume the task completed and call
C<complete_activity()> within ProcessRunner. Return false to halt the process
thread.

=item I<complete_activity>

Arguments: $activity, $instance

=item I<execute_transition>

Arguments: $transition, $from_instance

=item I<complete_process>

Arguments: $process, $process_instance

Returning true (default) will set the process state to C<closed.comleted>.

=back



( run in 0.903 second using v1.01-cache-2.11-cpan-f56aa216473 )