BPM-Engine

 view release on metacpan or  search on metacpan

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

package BPM::Engine::ProcessRunner;
BEGIN {
    $BPM::Engine::ProcessRunner::VERSION   = '0.01';
    $BPM::Engine::ProcessRunner::AUTHORITY = 'cpan:SITETECH';
    }

use Moose;
use MooseX::StrictConstructor;
use DateTime;
use BPM::Engine::Types qw/Bool ArrayRef HashRef CodeRef Exception Row/;
use BPM::Engine::Exceptions qw/throw_model throw_abstract throw_runner/;
use BPM::Engine::Util::ExpressionEvaluator;
use namespace::autoclean;    # -also => [qr/^_/];

with qw/
    MooseX::Traits
    BPM::Engine::Role::WithLogger
    BPM::Engine::Role::WithCallback
    /;

BEGIN {
    for my $event (qw/start continue complete execute/) {
        for my $entity (qw/process activity transition task/) {
            __PACKAGE__->meta->add_method(
                "cb_$event\_$entity" => sub {
                    my $self = shift;
                    return 1 unless $self->has_callback;
                    return $self->call_callback($self, $entity, $event, @_);
                    }
                    );
            }
        }
    }

has '+_trait_namespace' => (default => 'BPM::Engine::Plugin');

# DEPRECATED
#has 'engine' => (
#    is       => 'ro',
#    isa      => 'BPM::Engine',
#    weak_ref => 1,
#    );

has 'process' => (
    is         => 'ro',
    isa        => Row['Process'],
    lazy_build => 1,
    );

has 'process_instance' => (
    is       => 'ro',
    isa      => Row['ProcessInstance'],
    required => 1,
    );

has 'graph' => (
    is         => 'rw',
    lazy_build => 1,
    );

has 'stash' => ( # heap
    is      => 'rw',
    isa     => HashRef,
    default => sub { {} },
    #traits => [qw(MergeHashRef)],
    );

has 'dryrun' => ( # simulate
    is            => 'ro',
    isa           => Bool,
    default       => 0,
    #documentation => 'Make a dry-run and do not execute any tasks [Default: False]',
    );



( run in 0.674 second using v1.01-cache-2.11-cpan-39bf76dae61 )