Workflow: Implementing a Document Review Process ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :Author: Sebastian Bergmann :Revision: $Revision$ :Date: $Date$ :Status: Draft .. contents:: Table of Contents Introduction ============ Business enterprises need to reduce the cost of doing business and continually develop new services and products. Enterprise Content Management helps with storing business-critical content (customer data, documents, etc.) in a central repository and in a unified way. Workflow Management provides the methodologies and software that help with organizing the processes that operate on this content inside an organization. The relationship between Enterprise Content Management and Workflow Management is analogous to that of attributes (data) and methods (operations on the data) that are encapsulated in a class in object-oriented programming. The Workflow component provides a virtual machine that executes workflows represented through object graphs. These object graphs can be created programmatically through the software component's Workflow Definition API. Alternatively, a workflow definition can be loaded from an XML file. Object graph and XML file are two different but equal representations of a workflow definition that uses a backend language built on the workflow patterns. Use Case: Document Review Process ================================= A common use case for a workflow is modelling how documents are created, edited, and reviewed. A common approach to this is a five-level approval: - An author creates or edits a document. - An editor performs an initial review of the document. The editor can either send the document back to its author or approve it. - Another editor reviews the document for political correctness. The editor can either send the document back to the previous reviewer or approve it. - Another editor reviews the document for sales arguments. The editor can either send the document back to the previous reviewer or approve it. - Another editor performs a grammar check on the document. The editor can either send the document back to the previous reviewer or approve it. - Another editor performs a final review of the document. The editor can either send the document back to the previous reviewer or publish it. The figure below illustrates this document review process. .. figure:: img/approval_process.png Modelling the Document Review Process with ezcWorkflow ------------------------------------------------------ .. include:: src/approval_process.xml :literal: .. figure:: img/approval_process_workflow.png Implementing the Document Review Process with ezcWorkflow --------------------------------------------------------- Before we can implement the document review process using the Workflow component we need to create the required tables in our database. .. include:: src/schema.sql :literal: The following example shows the PHP code that is required to - Set up the eZ Components autoload mechanism. - Set up the XML-based workflow definition storage and load the workflow definition from an XML file. - Set up a database connection as well as the database-based workflow definition storage and save the workflow definition to a database. - Set up the database-based workflow executer and start the execution of the. workflow. .. include:: src/approval_process.php :literal: Conclusion ========== ... .. Local Variables: mode: rst fill-column: 79 End: vim: et syn=rst tw=79