01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: *
17: */
18: package org.apache.lenya.workflow;
19:
20: /**
21: * Manager for workflow issues. This is the main entry point for
22: * workflow-related tasks. You can safely invoke all methods for non-workflow
23: * documents.
24: *
25: * @version $Id: WorkflowManager.java 179751 2005-06-03 09:13:35Z andreas $
26: */
27: public interface WorkflowManager {
28:
29: /**
30: * The Avalon role.
31: */
32: String ROLE = WorkflowManager.class.getName();
33:
34: /**
35: * Invokes a workflow event on a document. This is the same as
36: * <code>invoke(Document, String, true)</code>.
37: * @param workflowable The workflowable.
38: * @param event The name of the event.
39: * @throws WorkflowException if the event could not be invoked in the
40: * current situation.
41: */
42: void invoke(Workflowable workflowable, String event)
43: throws WorkflowException;
44:
45: /**
46: * Invokes a workflow event on a document.
47: * @param workflowable The document.
48: * @param event The name of the event.
49: * @param force If this is set to <code>true</code>, the execution is
50: * forced, which means an exception is thrown if the workflowable in
51: * the set does not support the event. If set to
52: * <code>false</code>, non-supporting documents are ignored.
53: * @throws WorkflowException if the event could not be invoked in the
54: * current situation.
55: */
56: void invoke(Workflowable workflowable, String event, boolean force)
57: throws WorkflowException;
58:
59: /**
60: * Checks if an event can be invoked on a document.
61: * @param workflowable The workflowable.
62: * @param event The event.
63: * @return A boolean value.
64: */
65: boolean canInvoke(Workflowable workflowable, String event);
66:
67: /**
68: * Checks if a workflowable has a workflow.
69: * @param workflowable The workflowable.
70: * @return A boolean value.
71: */
72: boolean hasWorkflow(Workflowable workflowable);
73:
74: /**
75: * Resolves the workflow schema of a workflowable.
76: * @param workflowable The workflowable.
77: * @return A workflow schema.
78: * @throws WorkflowException if the document has no workflow.
79: */
80: Workflow getWorkflowSchema(Workflowable workflowable)
81: throws WorkflowException;
82:
83: }
|