[Zope3-checkins] CVS: Zope3/lib/python/Zope/App/Workflow/Stateful - IProcessDefinition.py:1.1.2.1 IProcessInstance.py:1.1.2.1 IState.py:1.1.2.1 ITransition.py:1.1.2.1 ProcessDefinition.py:1.1.2.1

Grégoire Weber zope@i-con.ch
Thu, 5 Dec 2002 10:50:38 -0500


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

Added Files:
      Tag: sprintathon-wf-branch
	IProcessDefinition.py IProcessInstance.py IState.py 
	ITransition.py ProcessDefinition.py 
Log Message:
first versions for stateful workflow implementation


=== Added File Zope3/lib/python/Zope/App/Workflow/Stateful/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 statefull workflow process definition.

$Id: IProcessDefinition.py,v 1.1.2.1 2002/12/05 15:50:37 gregweb Exp $
"""

from Interface import Interface
from Interface.Attribute import Attribute

from Zope.App.Workflow.IWorkflowProcessDefinition \
     import IWorkflowProcessDefinition

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

    def addState(name, state):
        """Add a IState to the process definition"""

    def removeState(name):
        """Remove a state from the process definition

        Raises ValueError exception if trying to delete the
        initial state."""

    def getStateNames():
        """Get the state names."""

    def getInitialStateName():
        """Get the name of the initial state."""

    def addTransition(name, transition):
        """Add a ITransition to the process definition."""
    
    def removeTransition(name):
        """Remove a transition from the process definition."""

    def getTransitionNames():
        """Get the transition names."""



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

"""Interface for statefull workflow process instances.

$Id: IProcessInstance.py,v 1.1.2.1 2002/12/05 15:50:37 gregweb Exp $
"""

from Interface import Interface
from Interface.Attribute import Attribute

from Zope.App.Workflow.IWorkflowProcessInstance \
    import IWorkflowProcessInstance


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

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

    def getOutgoingTransitions():
        """Get the outgoing transitions."""

    def fireTransition(id):
        """Fire a outgoing transitions"""


    ##### these are from IWorkflowProcessInstance, we don't really use them
    ##### cleanup IWorkflowProcessInstance ???

    # replaced bygetOutgoingTransitions
    def getWorkitems():
        """Get the workitems."""

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


=== Added File Zope3/lib/python/Zope/App/Workflow/Stateful/IState.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 state of a statefull workflow process definition.

$Id: IState.py,v 1.1.2.1 2002/12/05 15:50:37 gregweb Exp $
"""

from Interface import Interface
from Interface.Attribute import Attribute


class IState(Interface):
    """Interface for state of a statefull workflow process definition."""

    def addOutgoingTransition(name):
        """Add an outgoing transition."""

    def deleteOutgoingTransition(name):
        """Delete an outgoing transition."""



=== Added File Zope3/lib/python/Zope/App/Workflow/Stateful/ITransition.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 a workflow transition.

$Id: ITransition.py,v 1.1.2.1 2002/12/05 15:50:37 gregweb Exp $
"""

from Interface import Interface
from Interface.Attribute import Attribute

class ITransition(Interface):
    """Interface for a statefull workflow transition."""

    destinationState = Attribute("name of the destination state")
    condition = Attribute("""The condition that has evaluated to decide if \
                             to fire the condition or not""")
                             


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

"""Statefull workflow process definition.

$Id: ProcessDefinition.py,v 1.1.2.1 2002/12/05 15:50:37 gregweb Exp $
"""

from Persistence import Persistent
from Zope.App.Workflow.IWorkflowProcessDefinition import \
     IWorkflowProcessDefinition
from Zope.App.Workflow.Statefull.IProcessDefinition import \
     IProcessDefinition

### GWr: cleanup
## 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):
    """Statefull workflow process definition."""

    __implements__ = IProcessDefinition

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

    name = None

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

    def createProcessInstance(self):
        return None

    def addState(self, state):
        pass

    def setInitialState(self, id):
        pass

    def deleteState(self, id):
        pass

    def getStateNames(self):
        return None

    def addTransition(self, transition):
        pass
        
    def deleteTransition(self, id):
        pass

    def getTransitionNames(self):
        return None

    def getInitialStateName(self):
        return None


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