1 17 18 19 20 package org.apache.lenya.cms.workflow; 21 22 import org.apache.lenya.cms.publication.Document; 23 import org.apache.lenya.workflow.Event; 24 import org.apache.lenya.workflow.Situation; 25 import org.apache.lenya.workflow.WorkflowException; 26 import org.apache.lenya.workflow.impl.WorkflowImpl; 27 import org.apache.lenya.workflow.impl.WorkflowInstanceImpl; 28 29 public class WorkflowDocument extends WorkflowInstanceImpl { 30 31 38 protected WorkflowDocument(Document document) throws WorkflowException { 39 assert document != null; 40 this.document = document; 41 } 42 43 private Document document; 44 45 49 public Document getDocument() { 50 return document; 51 } 52 53 61 public void invoke(Situation situation, String eventName) 62 throws WorkflowException { 63 assert eventName != null; 64 65 Event event = ((WorkflowImpl) getWorkflow()).getEvent(eventName); 66 invoke(situation, event); 67 } 68 69 72 protected WorkflowImpl getWorkflow(String workflowName) 73 throws WorkflowException { 74 assert workflowName != null && !"".equals(workflowName); 75 WorkflowImpl workflow = (WorkflowImpl) WorkflowFactory.buildWorkflow(document.getPublication(), 76 workflowName); 77 78 return workflow; 79 } 80 } 81 | Popular Tags |