mirror of
https://github.com/status-im/spiff-arena.git
synced 2025-02-25 07:55:16 +00:00
73886584b Merge pull request #315 from sartography/feature/new-task-states a04fdd311 Merge remote-tracking branch 'origin/main' into feature/new-task-states 3d376bf9a documentation and comment updates 7e368ee4b copy edit e7b9fe91c typo eceef15a7 Called elements (#316) 5a0fd2774 add serialization migration 7211e67ee Merge pull request #314 from sartography/bugfix/data-object-references 403acc1f5 use same data objects & references in subprocesses after deserialization c54091dee add two more states to spiff fa04a14a7 clean up script engine a little bit 162a1c5f5 override create parser in spiff package to allow duplicate process names 98a1b37e0 Merge pull request #312 from sartography/bugfix/run-boundary-events-from-engine-steps 067d6a723 do not execute boundary events in catch 1c877dd76 send external events to top level workflow git-subtree-dir: SpiffWorkflow git-subtree-split: 73886584b17c7d11a9713d0c4526ed41e411fc45
52 lines
1.6 KiB
Python
52 lines
1.6 KiB
Python
# -*- coding: utf-8 -*-
|
|
|
|
# Copyright (C) 2012 Matthew Hampton
|
|
#
|
|
# This library is free software; you can redistribute it and/or
|
|
# modify it under the terms of the GNU Lesser General Public
|
|
# License as published by the Free Software Foundation; either
|
|
# version 2.1 of the License, or (at your option) any later version.
|
|
#
|
|
# This library is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
# Lesser General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU Lesser General Public
|
|
# License along with this library; if not, write to the Free Software
|
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
|
# 02110-1301 USA
|
|
|
|
from .BpmnSpecMixin import BpmnSpecMixin
|
|
from ...specs.Simple import Simple
|
|
|
|
|
|
class ScriptEngineTask(Simple, BpmnSpecMixin):
|
|
"""Task Spec for a bpmn:scriptTask node"""
|
|
|
|
def _execute(self, task):
|
|
"""Please override for specific Implementations, see ScriptTask below for an example"""
|
|
pass
|
|
|
|
def _run_hook(self, task):
|
|
return self._execute(task)
|
|
|
|
|
|
class ScriptTask(ScriptEngineTask):
|
|
|
|
def __init__(self, wf_spec, name, script, **kwargs):
|
|
"""
|
|
Constructor.
|
|
|
|
:param script: the script that must be executed by the script engine.
|
|
"""
|
|
super(ScriptTask, self).__init__(wf_spec, name, **kwargs)
|
|
self.script = script
|
|
|
|
@property
|
|
def spec_type(self):
|
|
return 'Script Task'
|
|
|
|
def _execute(self, task):
|
|
return task.workflow.script_engine.execute(task, self.script)
|