- Added a switch to allow the use of non-WebGUI objects with the Workflow

engine.
This commit is contained in:
JT Smith 2009-02-08 21:20:32 +00:00
parent d32137b5db
commit be42bb0856
3 changed files with 20 additions and 9 deletions

View file

@ -343,11 +343,15 @@ sub run {
$self->session->errorHandler->info("Running workflow activity ".$activity->getId.", which is a ".(ref $activity).", for instance ".$self->getId.".");
my $class = $self->get("className");
my $method = $self->get("methodName");
my $params = $self->get("parameters");
my $status = "";
my $object = undef;
my @params;
unless ($self->get('noSession')) {
push @params, $self->session;
}
push @params, $self->get("parameters");
if ($class && $method) {
$object = eval { WebGUI::Pluggable::instanciate($class, $method, [$self->session, $params]) };
$object = eval { WebGUI::Pluggable::instanciate($class, $method, \@params) };
if ($@) {
$self->session->errorHandler->error(
q{Error on workflow instance '} . $self->getId . q{': }. $@
@ -434,6 +438,10 @@ be constructed unless both className and methodName are true.
A hashref of parameters to be passed into the constructor for className. Note that the system will always pass in the session as the first argument.
=head4 noSession
Normally a reference to the session is the first property passed into methodName(), and then the parameters are passed in. If you're using an object that doesn't need/want a WebGUI::Session object then set noSession to 1. Defaults to 0.
=head4 currentActivityId
The unique id of the activity in the workflow that needs to be executed next. If blank, it will execute the first activity in the workflow.
@ -451,6 +459,7 @@ A boolean, that if set to 1 will not inform Spectre of the change in settings.
sub set {
my ($self, $properties, $skipNotify) = @_;
$self->{_data}{lastUpdate} = time();
$self->{_data}{noSession} = (exists $properties->{noSession}) ? $properties->{noSession} : $self->{_data}{noSession};
$self->{_data}{priority} = $properties->{priority} || $self->{_data}{priority} || 2;
$self->{_data}{lastStatus} = $properties->{lastStatus} || $self->{_data}{lastStatus};
$self->{_data}{workflowId} = $properties->{workflowId} || $self->{_data}{workflowId};