[Zope3-checkins] CVS: Zope3/src/zope/app/interfaces/workflow - __init__.py:1.3.2.1 stateful.py:1.1.2.1

Sidnei da Silva sidnei@x3ng.com.br
Tue, 11 Feb 2003 09:41:52 -0500


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

Modified Files:
      Tag: paris-copypasterename-branch
	__init__.py stateful.py 
Log Message:
Updating from HEAD to make sure everything still works before merging

=== Zope3/src/zope/app/interfaces/workflow/__init__.py 1.3 => 1.3.2.1 ===
--- Zope3/src/zope/app/interfaces/workflow/__init__.py:1.3	Sun Feb  2 13:57:46 2003
+++ Zope3/src/zope/app/interfaces/workflow/__init__.py	Tue Feb 11 09:41:21 2003
@@ -19,6 +19,9 @@
 
 from zope.interface import Interface
 from zope.interface import Attribute
+from zope.interface.common.mapping \
+     import IEnumerableMapping
+from zope.app.interfaces.container import IContainer
 from zope.app.interfaces.services.configuration \
      import INamedComponentConfiguration
 
@@ -51,6 +54,12 @@
 
 
 
+class IProcessDefinitionConfiguration(INamedComponentConfiguration):
+    """Configuration for a workflow process definition.
+    """
+
+
+
 
 
 
@@ -68,13 +77,14 @@
         """
 
 
-
-class IProcessDefinitionConfiguration(INamedComponentConfiguration):
-    """Configuration for a workflow process definition.
+class IProcessDefinitionElementContainer(IContainer):
+    """Abstract Interface for ProcessDefinitionElementContainers.
     """
 
 
-
+    def getProcessDefinition():
+        """Return the ProcessDefinition Object.
+        """
 
 
 class IProcessInstance(Interface):
@@ -83,33 +93,21 @@
     Represents the instance of a process defined by a ProcessDefinition.
     """
 
-    name = Attribute("The Name of the ProcessInstance.")
-
-    status = Attribute("The state in which the workitem is.")
+    status = Attribute("The status in which the workitem is.")
 
     processDefinitionName = Attribute("The process definition Name.")
 
 
 
-class IProcessInstanceContainer(Interface):
+
+
+class IProcessInstanceContainer(IContainer):
     """Workflow process instance container.
     """
 
-    def addProcessInstance(name, pi):
-        """Add the process instance, associated to name.
-        """
 
-    def getProcessInstance(name):
-        """Get the process instance associated to the given name.
-        """
 
-    def getProcessInstanceNames():
-        """Get the names associated to all process instances.
-        """
 
-    def delProcessInstance(name):
-        """Remove the process instance associated to name.
-        """
 
 
 class IProcessInstanceContainerAdaptable(Interface):


=== Zope3/src/zope/app/interfaces/workflow/stateful.py 1.1 => 1.1.2.1 ===
--- Zope3/src/zope/app/interfaces/workflow/stateful.py:1.1	Sat Feb  1 14:17:39 2003
+++ Zope3/src/zope/app/interfaces/workflow/stateful.py	Tue Feb 11 09:41:21 2003
@@ -16,85 +16,178 @@
 
 $Id$
 """
+import zope.schema
+from zope.proxy.context import ContextProperty
+from zope.app.security.permission import PermissionField
+
 from zope.interface import Interface, Attribute
 from zope.app.interfaces.workflow import IProcessDefinition
 from zope.app.interfaces.workflow import IProcessInstance
+from zope.app.interfaces.workflow import IProcessDefinitionElementContainer
+
+
+class IState(Interface):
+    """Interface for state of a stateful workflow process definition.
+    """
+
+
+class IStatefulStatesContainer(IProcessDefinitionElementContainer):
+    """Container that stores States.
+    """
+
+
+
+class AvailableStatesField(zope.schema.TextLine):
+    """Available States.
+    """
+
+    def __allowed(self):
+        pd = self.context.getProcessDefinition()
+        return pd.getStateNames()
+
+    allowed_values = ContextProperty(__allowed)
+
+
+class ITransition(Interface):
+    """Stateful workflow transition.
+    """
+
+    sourceState = AvailableStatesField(
+        title=u"Source State",
+        description=u"Name of the source state.",
+        required=True)
+
+    destinationState = AvailableStatesField(
+        title=u"Destination State",
+        description=u"Name of the destination state.",
+        required=True)
+
+    condition = zope.schema.TextLine(
+        title=u"Condition",
+        description=u"The condition that is evaluated to decide if the condition is fired or not.",
+        required=False)
+
+    permission = PermissionField(
+        title=u"The permission needed to fire the Transition.")
+
+
+    def getSourceState():
+        """Get Source State."""
+
+    def setSourceState(source):
+        """Set Source State."""
+        
+    def getDestinationState():
+        """Get Destination State."""
+
+    def setDestinationState(destination):
+        """Set Destination State."""
+
+    def getCondition():
+        """Get Condition."""
+
+    def setCondition(condition):
+        """Set Condition."""
+
+    def getPermission():
+        """Get Permission."""
+
+    def setPermission(permission):
+        """Set Permission."""
+
+    def getProcessDefinition():
+        """Return the ProcessDefinition Object.
+        """
+
+
+
+class IStatefulTransitionsContainer(IProcessDefinitionElementContainer):
+    """Container that stores Transitions.
+    """
+
+
+
 
 class IStatefulProcessDefinition(IProcessDefinition):
     """Interface for stateful workflow process definition.
     """
 
+    # XXX How to specify permissions for RelevantData ??
+
+    relevantDataSchema = zope.schema.TextLine(
+        title=u"RelevantData Schema",
+        description=u"Dotted Name of RelevantData Schema.",
+        required=True)
+
+
+    def setRelevantDataSchema(schema):
+        """Set the Schema for RelevantData.
+        """
+
+    def getRelevantDataSchema():
+        """Return the Schema for RelevantData.
+        """
+
+
+
+    states = Attribute("State objects container.")
+
+    transitions = Attribute("Transition objects container.")
+
     def addState(name, state):
         """Add a IState to the process definition.
         """
-
+    
     def getState(name):
         """Get the named state.
         """
-
+    
     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 getTransition(name):
         """Get the named transition.
         """
-
+    
     def removeTransition(name):
         """Remove a transition from the process definition.
         """
-
+    
     def getTransitionNames():
         """Get the transition names.
         """
 
 
 
-
-class IState(Interface):
-    """Interface for state of a stateful workflow process definition.
-    """
-
-
-class ITransition(Interface):
-    """Stateful workflow transition.
-    """
-
-    destinationState = Attribute("Name of the destination state.")
-
-    condition = Attribute("""The condition that is evaluated to decide if \
-                             the condition is fired or not.""")
-
-
-class IBasicTransition(ITransition):
-    """Basic stateful workflow transition.
-    """
-
-    sourceState = Attribute("Name of the source state.")
-
-
-
-
 class IStatefulProcessInstance(IProcessInstance):
     """Workflow process instance.
 
     Represents the instance of a process defined by a
     StatefulProcessDefinition.
     """
+
+    data = Attribute("Relevant Data object.")
+
+    def initialize():
+        """Initialize the ProcessInstance.
+
+        set Initial State and create relevant Data.
+        """
 
     def getOutgoingTransitions():
         """Get the outgoing transitions.