[Zope3-checkins] CVS: Zope3/src/zope/app/workflow - __init__.py:1.1.2.1 workflowactivityinfo.py:1.1.2.1 workflowengine.py:1.1.2.1 workflowevents.py:1.1.2.1 workflowprocessinstance.py:1.1.2.1 workflowservice.py:1.1.2.1 workflowworkitem.py:1.1.2.1
Jim Fulton
jim@zope.com
Mon, 23 Dec 2002 14:32:39 -0500
Update of /cvs-repository/Zope3/src/zope/app/workflow
In directory cvs.zope.org:/tmp/cvs-serv19908/zope/app/workflow
Added Files:
Tag: NameGeddon-branch
__init__.py workflowactivityinfo.py workflowengine.py
workflowevents.py workflowprocessinstance.py
workflowservice.py workflowworkitem.py
Log Message:
Initial renaming before debugging
=== Added File Zope3/src/zope/app/workflow/__init__.py ===
#
# This file is necessary to make this directory a package.
=== Added File Zope3/src/zope/app/workflow/workflowactivityinfo.py ===
##############################################################################
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
from zope.app.interfaces.workflow import IWorkflowActivityInfo
class WorkflowActivityInfo:
__implements__ = IWorkflowActivityInfo
def __init__(self, id,
title='',
category='',
action_url='',
permissions=(),
roles=(),
condition=None,
source=None,
):
self.id = id
self._title = title
self._category = category
self._action_url = action_url
self._permissions = permissions
self._roles = roles
self._condition = condition
self._source = source
############################################################
# Implementation methods for interface
# Zope.App.Workflow.IWorkflowActivityInfo
def getId(self):
'''See interface IWorkflowActivityInfo'''
return self.id
def getTitle(self):
'''See interface IWorkflowActivityInfo'''
return self._title
def getCategory(self):
'''See interface IWorkflowActivityInfo'''
return self._category
def getActionURL(self):
'''See interface IWorkflowActivityInfo'''
return self._action_url
def getPermissions(self):
'''See interface IWorkflowActivityInfo'''
return self._permissions
def getRoles(self):
'''See interface IWorkflowActivityInfo'''
return self._roles
def getCondition(self):
'''See interface IWorkflowActivityInfo'''
return self._condition
def getSource(self):
'''See interface IWorkflowActivityInfo'''
return self._source
#
############################################################
=== Added File Zope3/src/zope/app/workflow/workflowengine.py ===
##############################################################################
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
from zope.app.interfaces.workflow import IWorkflowEngine
class WorkflowEngine:
__implements__ = IWorkflowEngine
############################################################
# Implementation methods for interface
# Zope.App.Workflow.IWorkflowEngine
def getProcessInstance(self, process_id):
'''See interface IWorkflowEngine'''
def getWorklist(self, user, process_instance=None):
'''See interface IWorkflowEngine'''
def listProcessInstances(self):
'''See interface IWorkflowEngine'''
#
############################################################
=== Added File Zope3/src/zope/app/workflow/workflowevents.py ===
##############################################################################
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
from zope.app.interfaces.workflow import IWorkflowActionCreatedEvent
from zope.app.interfaces.workflow import IWorkflowActionAssignedEvent
from zope.app.interfaces.workflow import IWorkflowActionBegunEvent
from zope.app.interfaces.workflow import IWorkflowActionCompletedEvent
from zope.app.interfaces.workflow import IWorkflowActionSuspendedEvent
from zope.app.interfaces.workflow import IWorkflowActionExceptionEvent
class WorkflowActionEvent:
"""
Base class for all action-related events.
"""
def __init__( self, action ):
self._action = action
def getAction(self):
'''See interface IWorkflowActionCreatedEvent'''
return self._action
class WorkflowActionCreatedEvent( WorkflowActionEvent ):
__implements__ = IWorkflowActionCreatedEvent
############################################################
# Implementation methods for interface
# Zope.App.Workflow.IWorkflowEvents.IWorkflowActionCreatedEvent
# getAction: use inherited implementation
#
############################################################
class WorkflowActionAssignedEvent( WorkflowActionEvent ):
__implements__ = IWorkflowActionAssignedEvent
############################################################
# Implementation methods for interface
# Zope.App.Workflow.IWorkflowActionAssignedEvent
# getAction: use inherited implementation
#
############################################################
class WorkflowActionBegunEvent( WorkflowActionEvent ):
__implements__ = IWorkflowActionBegunEvent
############################################################
# Implementation methods for interface
# Zope.App.Workflow.IWorkflowActionBegunEvent
# getAction: use inherited implementation
#
############################################################
class WorkflowActionCompletedEvent( WorkflowActionEvent ):
__implements__ = IWorkflowActionCompletedEvent
############################################################
# Implementation methods for interface
# Zope.App.Workflow.IWorkflowEvents.IWorkflowActionCompletedEvent
# getAction: use inherited implementation
#
############################################################
class WorkflowActionSuspendedEvent( WorkflowActionEvent ):
__implements__ = IWorkflowActionSuspendedEvent
############################################################
# Implementation methods for interface
# Zope.App.Workflow.IWorkflowEvents.IWorkflowActionSuspendedEvent
#getAction -- use inherited
#
############################################################
class WorkflowActionExceptionEvent( WorkflowActionEvent ):
__implements__ = IWorkflowActionExceptionEvent
############################################################
# Implementation methods for interface
# Zope.App.Workflow.IWorkflowEvents.IWorkflowActionExceptionEvent
# getAction: use inherited implementation
#
############################################################
=== Added File Zope3/src/zope/app/workflow/workflowprocessinstance.py ===
##############################################################################
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
from zope.app.interfaces.workflow import IWorkflowProcessInstance
class WorkflowProcessInstance:
__implements__ = IWorkflowProcessInstance
############################################################
# Implementation methods for interface
# Zope.App.Workflow.IWorkflowProcessInstance.IWorkflowProcessInstance
def listActiveWorkitems(self):
'''See interface IWorkflowProcessInstance'''
def setActive(self):
'''See interface IWorkflowProcessInstance'''
def listWorkitems(self):
'''See interface IWorkflowProcessInstance'''
def listFailedWorkitems(self):
'''See interface IWorkflowProcessInstance'''
def getStatus(self):
'''See interface IWorkflowProcessInstance'''
def setCompleted(self):
'''See interface IWorkflowProcessInstance'''
#
############################################################
=== Added File Zope3/src/zope/app/workflow/workflowservice.py ===
##############################################################################
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
from zope.app.interfaces.workflow import IWorkflowService
class WorkflowService:
__implements__ = IWorkflowService
############################################################
# Implementation methods for interface
# Zope.App.Workflow.IWorkflowService
engines = ()
def removeEngine(self, engine):
'''See interface IWorkflowService'''
self.engines = tuple(filter(lambda x: x != engine, self.engines))
def listWorkflowEngineActions(self):
'''See interface IWorkflowService'''
result = []
for engine in self.engines:
result.extend(engine.listActions())
return result
def listEngine(self):
'''See interface IWorkflowService'''
return self.engines
def addEngine(self, engine):
'''See interface IWorkflowService'''
self.engines = self.engines + (engine,)
def getEngine(self, interface):
'''See interface IWorkflowService'''
result = []
for engine in self.engines:
if interface.isImplementedBy(engine):
result.append(engine)
return result
#
############################################################
=== Added File Zope3/src/zope/app/workflow/workflowworkitem.py ===
##############################################################################
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
from zope.app.interfaces.workflow import IWorkflowWorkitem, \
WorkflowWorkitemException, \
INIT, BEGUN, COMPLETED, FAILED
class WorkflowWorkitem:
__implements__ = IWorkflowWorkitem
def __init__(self, process_instance):
self._process_instance = process_instance
self._assignee = None
self._state = INIT
############################################################
# Implementation methods for interface
# Zope.App.Workflow.IWorkflowWorkitem.IWorkflowWorkitem
def getProcessInstance(self):
'''See interface IWorkflowWorkitem'''
return self._process_instance
def begin(self, data=None):
'''See interface IWorkflowWorkitem'''
if self._state is not INIT:
raise WorkflowWorkitemException
self._state = BEGUN
def complete(self, data=None):
'''See interface IWorkflowWorkitem'''
if self._state is not BEGUN:
raise WorkflowWorkitemException
self._state = COMPLETED
def fail(self, data=None):
'''See interface IWorkflowWorkitem'''
if self._state is not BEGUN:
raise WorkflowWorkitemException
self._state = FAILED
def assign(self, assignee, data=None):
'''See interface IWorkflowWorkitem'''
if self._state in (COMPLETED, FAILED):
raise WorkflowWorkitemException
self._assignee = assignee
def getState(self):
'''See interface IWorkflowWorkitem'''
return self._state
def getAssignee(self):
'''See interface IWorkflowWorkitem'''
return self._assignee
#
############################################################