[Zope3-checkins] CVS: Zope3/src/zope/app/workflow - __init__.py:1.2 workflowactivityinfo.py:1.2 workflowengine.py:1.2 workflowevents.py:1.2 workflowprocessinstance.py:1.2 workflowservice.py:1.2 workflowworkitem.py:1.2

Jim Fulton jim@zope.com
Wed, 25 Dec 2002 09:14:01 -0500


Update of /cvs-repository/Zope3/src/zope/app/workflow
In directory cvs.zope.org:/tmp/cvs-serv15352/src/zope/app/workflow

Added Files:
	__init__.py workflowactivityinfo.py workflowengine.py 
	workflowevents.py workflowprocessinstance.py 
	workflowservice.py workflowworkitem.py 
Log Message:
Grand renaming:

- Renamed most files (especially python modules) to lower case.

- Moved views and interfaces into separate hierarchies within each
  project, where each top-level directory under the zope package
  is a separate project.

- Moved everything to src from lib/python.

  lib/python will eventually go away. I need access to the cvs
  repository to make this happen, however.

There are probably some bits that are broken. All tests pass
and zope runs, but I haven't tried everything. There are a number
of cleanups I'll work on tomorrow.



=== Zope3/src/zope/app/workflow/__init__.py 1.1 => 1.2 ===
--- /dev/null	Wed Dec 25 09:14:01 2002
+++ Zope3/src/zope/app/workflow/__init__.py	Wed Dec 25 09:13:30 2002
@@ -0,0 +1,2 @@
+#
+# This file is necessary to make this directory a package.


=== Zope3/src/zope/app/workflow/workflowactivityinfo.py 1.1 => 1.2 ===
--- /dev/null	Wed Dec 25 09:14:01 2002
+++ Zope3/src/zope/app/workflow/workflowactivityinfo.py	Wed Dec 25 09:13:30 2002
@@ -0,0 +1,68 @@
+##############################################################################
+#
+# 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
+
+    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


=== Zope3/src/zope/app/workflow/workflowengine.py 1.1 => 1.2 ===
--- /dev/null	Wed Dec 25 09:14:01 2002
+++ Zope3/src/zope/app/workflow/workflowengine.py	Wed Dec 25 09:13:30 2002
@@ -0,0 +1,27 @@
+##############################################################################
+#
+# 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
+
+    def getProcessInstance(self, process_id):
+        '''See interface IWorkflowEngine'''
+
+    def getWorklist(self, user, process_instance=None):
+        '''See interface IWorkflowEngine'''
+
+    def listProcessInstances(self):
+        '''See interface IWorkflowEngine'''


=== Zope3/src/zope/app/workflow/workflowevents.py 1.1 => 1.2 ===
--- /dev/null	Wed Dec 25 09:14:01 2002
+++ Zope3/src/zope/app/workflow/workflowevents.py	Wed Dec 25 09:13:30 2002
@@ -0,0 +1,63 @@
+##############################################################################
+#
+# 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
+
+
+class WorkflowActionAssignedEvent(WorkflowActionEvent):
+
+
+    __implements__ =  IWorkflowActionAssignedEvent
+
+
+class WorkflowActionBegunEvent(WorkflowActionEvent):
+
+
+    __implements__ =  IWorkflowActionBegunEvent
+
+
+class WorkflowActionCompletedEvent(WorkflowActionEvent):
+
+    __implements__ =  IWorkflowActionCompletedEvent
+
+
+class WorkflowActionSuspendedEvent(WorkflowActionEvent):
+
+    __implements__ =  IWorkflowActionSuspendedEvent
+
+
+class WorkflowActionExceptionEvent(WorkflowActionEvent):
+
+    __implements__ =  IWorkflowActionExceptionEvent


=== Zope3/src/zope/app/workflow/workflowprocessinstance.py 1.1 => 1.2 ===
--- /dev/null	Wed Dec 25 09:14:01 2002
+++ Zope3/src/zope/app/workflow/workflowprocessinstance.py	Wed Dec 25 09:13:30 2002
@@ -0,0 +1,36 @@
+##############################################################################
+#
+# 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
+
+    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'''


=== Zope3/src/zope/app/workflow/workflowservice.py 1.1 => 1.2 ===
--- /dev/null	Wed Dec 25 09:14:01 2002
+++ Zope3/src/zope/app/workflow/workflowservice.py	Wed Dec 25 09:13:30 2002
@@ -0,0 +1,49 @@
+##############################################################################
+#
+# 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
+
+    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


=== Zope3/src/zope/app/workflow/workflowworkitem.py 1.1 => 1.2 ===
--- /dev/null	Wed Dec 25 09:14:01 2002
+++ Zope3/src/zope/app/workflow/workflowworkitem.py	Wed Dec 25 09:13:30 2002
@@ -0,0 +1,61 @@
+##############################################################################
+#
+# 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
+
+    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