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

Stephan Richter srichter@cosmos.phy.tufts.edu
Tue, 29 Jul 2003 20:00:55 -0400


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

Modified Files:
	__init__.py stateful.py 
Log Message:
Workflow enhancements to make them more useful. (More to come)

- ContentWorkflowsUtility has been renamed to ContentWorkflowsManager

- Specific Process Definitions can now be mapped to interfaces (later 
  content types), so that a content type only receives the workflows that
  were inteneded for it.

- Supplied a management screen for the above.

- Wrote a bunch of tests for ContentWorkflowsManager.

- Added a default screen to the Workflow Service, which lists all registered
  process definitions.


=== Zope3/src/zope/app/interfaces/workflow/__init__.py 1.15 => 1.16 ===
--- Zope3/src/zope/app/interfaces/workflow/__init__.py:1.15	Sat Jun 21 17:22:11 2003
+++ Zope3/src/zope/app/interfaces/workflow/__init__.py	Tue Jul 29 20:00:19 2003
@@ -27,31 +27,25 @@
 class IWorkflowService(Interface):
     """Workflow service.
 
-    A workflow service manages the process definitions.
-    """
+    A workflow service manages the process definitions."""
 
     def getProcessDefinitionNames():
         """Return the definition names.
 
-        Returns a sequence of names.
-        """
+        Returns a sequence of names."""
 
     def getProcessDefinition(name):
-        """Return the IProcessDefinition for the name.
-        """
+        """Return the IProcessDefinition for the name."""
 
     def queryProcessDefinition(name, default=None):
-        """Return the IProcessDefinition for the name or default.
-        """
+        """Return the IProcessDefinition for the name or default."""
 
     def createProcessInstance(definition_name):
-        """Create a process instance from a process definition.
-        """
+        """Create a process instance from a process definition."""
 
 
 class IProcessDefinitionRegistration(INamedComponentRegistration):
-    """Registration for a workflow process definition.
-    """
+    """Registration for a workflow process definition."""
 
     componentPath = ComponentPath(
         title=u"Component path",
@@ -61,37 +55,29 @@
         )
 
 
-
-
-
 class IProcessDefinition(Interface):
-    """Interface for workflow process definition.
-    """
+    """Interface for workflow process definition."""
 
     name = Attribute("""The name of the ProcessDefinition""")
 
     def createProcessInstance(definition_name):
         """Create a new process instance for this process definition.
 
-        Returns an IProcessInstance.
-        """
+        Returns an IProcessInstance."""
 
 
 class IProcessDefinitionElementContainer(IContainer):
-    """Abstract Interface for ProcessDefinitionElementContainers.
-    """
+    """Abstract Interface for ProcessDefinitionElementContainers."""
 
 
     def getProcessDefinition():
-        """Return the ProcessDefinition Object.
-        """
+        """Return the ProcessDefinition Object."""
 
 
 class IProcessInstance(Interface):
     """Workflow process instance.
 
-    Represents the instance of a process defined by a ProcessDefinition.
-    """
+    Represents the instance of a process defined by a ProcessDefinition."""
 
     status = Attribute("The status in which the workitem is.")
 
@@ -99,96 +85,69 @@
 
 
 
-
-
 class IProcessInstanceContainer(IContainer):
-    """Workflow process instance container.
-    """
-
+    """Workflow process instance container."""
 
 
 class IProcessInstanceContainerAdaptable(Interface):
-    """Marker interface for components that can be
-       adapted to a process instance container.
-    """
+    """Marker interface for components that can be adapted to a process
+    instance container."""
 
 
 class IProcessInstanceControl(Interface):
-    """Interface to interact with a process instance.
-    """
+    """Interface to interact with a process instance."""
 
     def start():
-        """Start a process instance.
-        """
+        """Start a process instance."""
 
     def finish():
-        """Finish a process instance.
-        """
-
-
+        """Finish a process instance."""
 
 
 class IWorklistHandler(Interface):
-    """Base interface for Workflow Worklist Handler.
-    """
+    """Base interface for Workflow Worklist Handler."""
 
     def getWorkitems():
-        """Return a sequence of workitem.
-        """
-
-
-
+        """Return a sequence of workitem."""
 
 
 class IProcessDefinitionImportExport(Interface):
-    """ProcessDefinition Import/Export.
-    """
+    """ProcessDefinition Import/Export."""
 
     def importProcessDefinition(context, data):
-        """Import a Process Definition
-        """
+        """Import a Process Definition"""
 
     def exportProcessDefinition(context, process_definition):
-        """Export a Process Definition
-        """
-
+        """Export a Process Definition"""
 
 
 class IGlobalProcessDefinitionImportExport(IProcessDefinitionImportExport):
-    """ Global ImportExport with additional method
-        to register import/export handlers.
-    """
+    """Global ImportExport with additional method to register import/export
+    handlers."""
 
     def addImportHandler(interface, factory):
-        """add a factory for an import handler for a certain interface.
-        """
+        """Add a factory for an import handler for a certain interface."""
 
     def addExportHandler(interface, factory):
-        """add a factory for an export handler for a certain interface.
-        """
+        """Add a factory for an export handler for a certain interface."""
 
 
 class IProcessDefinitionImportHandler(Interface):
-    """Handler for Import of ProcessDefinitions.
-    """
+    """Handler for Import of ProcessDefinitions."""
     
     def canImport(context, data):
-        """check if handler can import a processdefinition
-           based on the data given.
-        """
+        """Check if handler can import a processdefinition
+           based on the data given."""
 
     def doImport(context, data):
-        """create a ProcessDefinition from the data given.
+        """Create a ProcessDefinition from the data given.
 
-        returns a ProcessDefinition Instance.
-        """
+        Returns a ProcessDefinition Instance."""
 
 class IProcessDefinitionExportHandler(Interface):
-    """Handler for Export of ProcessDefinitions.
-    """
+    """Handler for Export of ProcessDefinitions."""
 
     def doExport(context, process_definition):
-        """export a ProcessDefinition into a specific format.
+        """Export a ProcessDefinition into a specific format.
 
-        returns the serialized value of the given ProcessDefintion.
-        """
+        Returns the serialized value of the given ProcessDefintion."""


=== Zope3/src/zope/app/interfaces/workflow/stateful.py 1.15 => 1.16 ===
--- Zope3/src/zope/app/interfaces/workflow/stateful.py:1.15	Tue Jun 24 15:01:36 2003
+++ Zope3/src/zope/app/interfaces/workflow/stateful.py	Tue Jul 29 20:00:19 2003
@@ -223,9 +223,28 @@
         """Fire a outgoing transitions."""
 
 
+class IContentProcessRegistry(Interface):
+    """Content Type <-> Process Definitions Registry
 
-class IContentWorkflowsUtility(Interface):
-    """A Content Workflows Utility.
+    This is a registry for mapping content types (interface) to workflow process
+    definitions (by name)."""
+
+    def register(iface, name):
+        """Register a new process definition (name) for the interface iface."""
+
+    def unregister(iface, name):
+        """Unregister a process (name) for a particular interface."""
+
+    def getProcessNamesForInterface(iface):
+        """Return a list of process defintion names for the particular
+        interface."""
+
+    def getInterfacesForProcessName(name):
+        """Return a list of interfaces for the particular process name."""
+
+
+class IContentWorkflowsManager(IContentProcessRegistry):
+    """A Content Workflows Manager.
 
     it associates content objects with some workflow process definitions.
     """
@@ -239,8 +258,9 @@
     def isSubscribed():
         """Return whether we are currently subscribed."""
 
-    def getProcessDefinitionNames():
-        """Get the process definition names."""
+    def getProcessDefinitionNamesForObject(object):
+        """Get the process definition names for a particular object.
 
-    def setProcessDefinitionNames(names):
-        """Set the process definition names."""
+        This method reads in all the interfaces this object implements and
+        finds then the corresponding process names using the
+        IContentProcessRegistry."""