apache > lenya
 

Workflow Implementation

Important Classes

org.apache.lenya.workflow The actual workflow API. It defines the workflow model.

  • Workflow - A workflow object describes a workflow schema.
  • WorkflowInstance - A workflow instance.
  • Situation - The environment of the workflow before the invocation of an event.

org.apache.lenya.workflow.impl A basic abstract implementation of the API.

  • WorkflowInstanceImpl - Basic implementation of a workflow instance.
  • History - The history of a workflow instance. Use a history object to restore

the state of a workflow instance.

org.apache.lenya.cms.workflow Some CMS-specific workflow implementation classes.

  • WorkflowFactory - A factory to build all workflow-related objects.
  • WorkflowDocument - A workflow instance wrapper for a CMS document.
  • CMSHistory - CMS-specific workflow instance history.
  • CMSSituation - CMS-specific environment situation.

Obtaining Workflow Instance and Situation Objects

Use the WorkflowFactory to obtain workflow-related objects:

Document document = new DefaultDocument(
        publication, pageEnvelope.getDocumentId());

WorkflowFactory factory = WorkflowFactory.newInstance();

if (factory.hasWorkflow(document)) {
            
    WorkflowInstance instance;
    Situation situation;
            
    try {
        instance = factory.buildInstance(document);
        situation = factory.buildSituation(objectModel);
    }
    catch (WorkflowException e) {
        ...
    }
      
    ...
}