[Zope3-checkins] CVS: Zope3/lib/python/Zope/App/Workflow - IProcessDefinition.py:1.1.2.1 IProcessDefinitionConfiguration.py:1.1.2.1 IProcessDefinitionImportExport.py:1.1.2.1 IProcessInstance.py:1.1.2.1 IProcessInstanceControl.py:1.1.2.1 IWorklistHandler.py:1.1.2.1 ProcessDefinition.py:1.1.2.1 ProcessDefinitionConfiguration.py:1.1.2.1 ProcessInstance.py:1.1.2.1 ProcessInstanceControl.py:1.1.2.1 Workitem.py:1.1.2.1 configure.zcml:1.1.2.3 IWorkflowProcessDefinition.py:NONE IWorkflowProcessDefinitionConfiguration.py:NONE IWorkflowProcessDefinitionImportExport.py:NONE IWorkflowProcessInstance.py:NONE IWorkflowProcessInstanceControl.py:NONE IWorkflowWorklistHandler.py:NONE WorkflowProcessDefinition.py:NONE WorkflowProcessDefinitionConfiguration.py:NONE WorkflowProcessInstance.py:NONE WorkflowProcessInstanceControl.py:NONE WorkflowWorkitem.py:NONE

Florent Guillaume fg@nuxeo.com
Thu, 5 Dec 2002 11:45:10 -0500


Update of /cvs-repository/Zope3/lib/python/Zope/App/Workflow
In directory cvs.zope.org:/tmp/cvs-serv27144

Modified Files:
      Tag: sprintathon-wf-branch
	configure.zcml 
Added Files:
      Tag: sprintathon-wf-branch
	IProcessDefinition.py IProcessDefinitionConfiguration.py 
	IProcessDefinitionImportExport.py IProcessInstance.py 
	IProcessInstanceControl.py IWorklistHandler.py 
	ProcessDefinition.py ProcessDefinitionConfiguration.py 
	ProcessInstance.py ProcessInstanceControl.py Workitem.py 
Removed Files:
      Tag: sprintathon-wf-branch
	IWorkflowProcessDefinition.py 
	IWorkflowProcessDefinitionConfiguration.py 
	IWorkflowProcessDefinitionImportExport.py 
	IWorkflowProcessInstance.py IWorkflowProcessInstanceControl.py 
	IWorkflowWorklistHandler.py WorkflowProcessDefinition.py 
	WorkflowProcessDefinitionConfiguration.py 
	WorkflowProcessInstance.py WorkflowProcessInstanceControl.py 
	WorkflowWorkitem.py 
Log Message:
Big renaming, remove the Workflow prefix in most cases. It's redundant
and makes for very long lines.


=== Added File Zope3/lib/python/Zope/App/Workflow/IProcessDefinition.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.
#
##############################################################################

"""Interfaces for workflow process definition.

$Id: IProcessDefinition.py,v 1.1.2.1 2002/12/05 16:44:38 efge Exp $
"""

from Interface import Interface
from Interface.Attribute import Attribute


class IProcessDefinition(Interface):
    """Interface for workflow process definition."""

    name = Attribute("""The name of the ProcessDefinition""")


    def createProcessInstance():
        """Create a new process instance for this process definition.

        Returns an IProcessInstance."""



=== Added File Zope3/lib/python/Zope/App/Workflow/IProcessDefinitionConfiguration.py ===
##############################################################################
#
# Copyright (c) 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.
#
##############################################################################

"""Interfaces for workflow process definition configuration.
"""

from Interface.Attribute import Attribute
from Zope.Schema import TextLine, Text
from Zope.App.OFS.Services.ConfigurationInterfaces import IConfiguration


class IProcessDefinitionConfiguration(IConfiguration):
    """Configuration for a workflow process definition.
    """

    name = TextLine(title = u"Name",
                    description = u"Name for the process definition",
                    required = True)

    path = Attribute("The physical path to the component")

    def getProcessDefinition():
        """Return the definition."""


=== Added File Zope3/lib/python/Zope/App/Workflow/IProcessDefinitionImportExport.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.
# 
##############################################################################
"""
Interface for Import Export Tool
$Id: IProcessDefinitionImportExport.py,v 1.1.2.1 2002/12/05 16:44:38 efge Exp $
"""

from Interface import Interface


class IWorkflowImportExport(Interface):
    """
    Base interface for Tool Agent
    """

    def importProcessDefinition(process_definition):
        """Import a Process Definition
        """

    def exportProcessDefinition(pd_id):
        """Export a Process Definition
        """


=== Added File Zope3/lib/python/Zope/App/Workflow/IProcessInstance.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.
#
##############################################################################

"""Interfaces for workflow process instances.

$Id: IProcessInstance.py,v 1.1.2.1 2002/12/05 16:44:38 efge Exp $
"""

from Interface import Interface
from Interface.Attribute import Attribute


class IProcessInstance(Interface):
    """Workflow process instance.

    Represents the instance of a process defined by a ProcessDefinition.
    """

    status = Attribute("The state in which the workitem is.")

    processDefinition = Attribute("The process definition.")

    def getWorkitems():
        """Get the workitems."""

    def getWorkitem(wi_id):
        """Get a workitem by id."""


=== Added File Zope3/lib/python/Zope/App/Workflow/IProcessInstanceControl.py ===
##############################################################################
#
# Copyright (c) 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.
#
##############################################################################

"""Interfaces for workflow process engine.

An engine is a way to execute a process instance.

$Id: IProcessInstanceControl.py,v 1.1.2.1 2002/12/05 16:44:38 efge Exp $
"""

from Interface import Interface
from Interface.Attribute import Attribute


class IProcessInstanceControl(Interface):
    """Interface to interact with a process instance."""

    def start():
        """Start a process instance."""

    def finish():
        """Finish a process instance."""


=== Added File Zope3/lib/python/Zope/App/Workflow/IWorklistHandler.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.
# 
##############################################################################
"""
Interface for Worklist Handler
$Id: IWorklistHandler.py,v 1.1.2.1 2002/12/05 16:44:38 efge Exp $
"""

from Interface import Interface


class IWorklistHandler(Interface):
    """Base interface for Workflow Worklist Handler."""

    def getWorkitem():
        """Return a sequence of workitem"""


=== Added File Zope3/lib/python/Zope/App/Workflow/ProcessDefinition.py ===
##############################################################################
#
# Copyright (c) 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.
#
##############################################################################

"""Implementation of workflow process definition.

$Id: ProcessDefinition.py,v 1.1.2.1 2002/12/05 16:44:38 efge Exp $
"""

from Persistence import Persistent
from Zope.App.Workflow.IProcessDefinition import \
     IProcessDefinition
## from Zope.ComponentArchitecture import getServiceManager
## from Zope.ContextWrapper import ContextMethod
## from Zope.Security.Checker import CheckerPublic
## from Zope.App.Traversing import traverse
## from Zope.App.Traversing import getPhysicalPathString
## from Zope.App.DependencyFramework.IDependable import IDependable
## from Zope.App.DependencyFramework.Exceptions import DependencyError
## from Zope.App.OFS.Container.IAddNotifiable import IAddNotifiable
## from Zope.App.OFS.Container.IDeleteNotifiable import IDeleteNotifiable
## from Zope.App.OFS.Services.Configuration import ConfigurationStatusProperty
## from Zope.App.OFS.Services.ConfigurationInterfaces import Active
## from Zope.App.OFS.Services.ConfigurationInterfaces import Registered
## from Zope.App.OFS.Services.ConfigurationInterfaces import Unregistered


class ProcessDefinition(Persistent):
    """Process definition.
    """

    __implements__ = IProcessDefinition

    def __init__(self):
        super(ProcessDefinition, self).__init__(self)

    name = None

    ############################################################
    # Implementation methods for interface
    # Zope.App.Workflow.IProcessDefinition

    def createProcessInstance(self):
        return None

    #
    ############################################################


=== Added File Zope3/lib/python/Zope/App/Workflow/ProcessDefinitionConfiguration.py ===
##############################################################################
#
# Copyright (c) 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.
#
##############################################################################

"""Implementation of workflow process definition configuration.
"""

from Persistence import Persistent
from Zope.ComponentArchitecture import getServiceManager, getAdapter
from Zope.ContextWrapper import ContextMethod
from Zope.Security.Checker import CheckerPublic
from Zope.Proxy.ContextWrapper import getWrapperContainer
from Zope.App.Traversing import traverse
from Zope.App.Traversing import getPhysicalPathString
from Zope.App.DependencyFramework.IDependable import IDependable
from Zope.App.DependencyFramework.Exceptions import DependencyError
from Zope.App.OFS.Container.IAddNotifiable import IAddNotifiable
from Zope.App.OFS.Container.IDeleteNotifiable import IDeleteNotifiable
from Zope.App.OFS.Services.Configuration import ConfigurationStatusProperty
from Zope.App.OFS.Services.ConfigurationInterfaces import Active
from Zope.App.OFS.Services.ConfigurationInterfaces import Registered
from Zope.App.OFS.Services.ConfigurationInterfaces import Unregistered

from Zope.App.Workflow.IProcessDefinitionConfiguration \
     import IProcessDefinitionConfiguration

class ProcessDefinitionConfiguration(Persistent):
    """
    """

    __implements__ = (IProcessDefinitionConfiguration,
                      IAddNotifiable, IDeleteNotifiable)

    def __init__(self, name, path, permission=None):
        self.name = name
        self.path = path
        if permission is None:
            permission = CheckerPublic
        self.permission = permission

    def __repr__(self):
        return "workflow process definition(%s, %s)" % (self.name, self.path)

    ############################################################
    # Implementation methods for interface
    # Zope.App.Workflow.IProcessDefinitionConfiguration

    def getProcessDefinition(self):
        definition = getattr(self, '_v_definition', None)
        if definition is not None:
            return definition
        definition = traverse(self, self.path) # path is absolute
        self._v_definition = definition
        return definition

    getProcessDefinition = ContextMethod(getProcessDefinition)

    ############################################################
    # IProcessDefinitionConfiguration

    name = ''

    title = u''

    description = u''

    status = ConfigurationStatusProperty('Workflows')

    def activated(self):
        pass
    #activated = ContextMethod(activated)

    def deactivated(self):
        pass
    #deactivated = ContextMethod(deactivated)

    ############################################################
    # IAddNotifiable

    def manage_afterAdd(self, configuration, container):
        "See Zope.App.OFS.Container.IAddNotifiable"
        sm = getServiceManager(configuration)
        definition = configuration.getProcessDefinition()
        dependents = getAdapter(definition, IDependable)
        objectpath = getPhysicalPathString(configuration)
        dependents.addDependent(objectpath)

    ############################################################
    # IDeleteNotifiable

    def manage_beforeDelete(self, configuration, container):
        "See Zope.App.OFS.Container.IDeleteNotifiable"
        sm = getServiceManager(self)
        definition = configuration.getProcessDefinition()
        dependents = getAdapter(definition, IDependable)
        objectpath = getPhysicalPathString(self)
        objectstatus = self.status
        if objectstatus == Active:
            raise DependencyError("Can't delete active configurations")
        elif objectstatus == Registered:
            self.status = Unregistered
        dependents.removeDependent(objectpath)

    manage_beforeDelete = ContextMethod(manage_beforeDelete)

    #
    ############################################################


=== Added File Zope3/lib/python/Zope/App/Workflow/ProcessInstance.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.Workflow.IProcessInstance import IProcessInstance

class ProcessInstance:

    __implements__ =  IProcessInstance

    ############################################################
    # Implementation methods for interface
    # Zope.App.Workflow.IProcessInstance.IProcessInstance

    def listActiveWorkitems(self):
        '''See interface IProcessInstance'''

    def setActive(self):
        '''See interface IProcessInstance'''

    def listWorkitems(self):
        '''See interface IProcessInstance'''

    def listFailedWorkitems(self):
        '''See interface IProcessInstance'''

    def getStatus(self):
        '''See interface IProcessInstance'''

    def setCompleted(self):
        '''See interface IProcessInstance'''
    #
    ############################################################



=== Added File Zope3/lib/python/Zope/App/Workflow/ProcessInstanceControl.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 IWorkflowEngine 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/lib/python/Zope/App/Workflow/Workitem.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.Workflow.IWorkitem import IWorkitem, \
     WorkitemException, \
     INIT, BEGUN, COMPLETED, FAILED

class Workitem:

    __implements__ =  IWorkitem

    def __init__(self, process_instance):
        self._process_instance = process_instance
        self._assignee = None
        self._state = INIT

    ############################################################
    # Implementation methods for interface
    # Zope.App.Workflow.IWorkitem.IWorkitem

    def getProcessInstance(self):
        '''See interface IWorkitem'''
        return self._process_instance

    def begin(self, data=None):
        '''See interface IWorkitem'''
        if self._state is not INIT:
            raise WorkitemException
        self._state = BEGUN

    def complete(self, data=None):
        '''See interface IWorkitem'''
        if self._state is not BEGUN:
            raise WorkitemException
        self._state = COMPLETED

    def fail(self, data=None):
        '''See interface IWorkitem'''
        if self._state is not BEGUN:
            raise WorkitemException
        self._state = FAILED

    def assign(self, assignee, data=None):
        '''See interface IWorkitem'''
        if self._state in (COMPLETED, FAILED):
            raise WorkitemException
        self._assignee = assignee

    def getState(self):
        '''See interface IWorkitem'''
        return self._state

    def getAssignee(self):
        '''See interface IWorkitem'''
        return self._assignee

    #
    ############################################################


=== Zope3/lib/python/Zope/App/Workflow/configure.zcml 1.1.2.2 => 1.1.2.3 ===
--- Zope3/lib/python/Zope/App/Workflow/configure.zcml:1.1.2.2	Thu Dec  5 08:28:41 2002
+++ Zope3/lib/python/Zope/App/Workflow/configure.zcml	Thu Dec  5 11:44:38 2002
@@ -29,9 +29,9 @@
 
 <!-- Workflow Process Definition -->
 
-<content class=".WorkflowProcessDefinition.">
+<content class=".ProcessDefinition.">
   <factory
-      id="WorkflowProcessDefinition"
+      id="ProcessDefinition"
       permission="Zope.ManageServices"
       />
   <require
@@ -43,19 +43,19 @@
 <browser:menuItem
     menu="add_component"
     for="Zope.App.OFS.Container.IAdding."
-    action="WorkflowProcessDefinition"
-    title='Workflow Process Definition'
+    action="ProcessDefinition"
+    title='Process Definition'
     description="A workflow process definition" />
 
 
-<!-- Workflow Process Definition Configuration -->
+<!-- Process Definition Configuration -->
 
-<content class=".WorkflowProcessDefinitionConfiguration.">
+<content class=".ProcessDefinitionConfiguration.">
   <require
       permission="Zope.ManageServices"
-      interface=".IWorkflowProcessDefinitionConfiguration."
+      interface=".IProcessDefinitionConfiguration."
       set_schema=
-          ".IWorkflowProcessDefinitionConfiguration."
+          ".IProcessDefinitionConfiguration."
       />
   <require
       permission="Zope.ManageServices"

=== Removed File Zope3/lib/python/Zope/App/Workflow/IWorkflowProcessDefinition.py ===

=== Removed File Zope3/lib/python/Zope/App/Workflow/IWorkflowProcessDefinitionConfiguration.py ===

=== Removed File Zope3/lib/python/Zope/App/Workflow/IWorkflowProcessDefinitionImportExport.py ===

=== Removed File Zope3/lib/python/Zope/App/Workflow/IWorkflowProcessInstance.py ===

=== Removed File Zope3/lib/python/Zope/App/Workflow/IWorkflowProcessInstanceControl.py ===

=== Removed File Zope3/lib/python/Zope/App/Workflow/IWorkflowWorklistHandler.py ===

=== Removed File Zope3/lib/python/Zope/App/Workflow/WorkflowProcessDefinition.py ===

=== Removed File Zope3/lib/python/Zope/App/Workflow/WorkflowProcessDefinitionConfiguration.py ===

=== Removed File Zope3/lib/python/Zope/App/Workflow/WorkflowProcessInstance.py ===

=== Removed File Zope3/lib/python/Zope/App/Workflow/WorkflowProcessInstanceControl.py ===

=== Removed File Zope3/lib/python/Zope/App/Workflow/WorkflowWorkitem.py ===