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.cms.workflow.usecases;
19:
20: import org.apache.lenya.cms.repository.Node;
21: import org.apache.lenya.cms.usecase.UsecaseException;
22: import org.apache.lenya.cms.workflow.WorkflowUtil;
23:
24: /**
25: * Invoke a workflow event on the current document. The event is obtained from the configuration in
26: * <code>cocoon.xconf</code>:<code>
27: * <pre>
28: * <component-instance name="default/workflow.submit"
29: * logger="lenya.usecases.workflow"
30: * class="org.apache.lenya.cms.workflow.usecases.InvokeWorkflow">
31: * <event id="submit"/>
32: * </component-instance>
33: * </pre>
34: * </code>
35: *
36: * @version $Id: InvokeWorkflow.java 559063 2007-07-24 14:38:01Z rfrovarp $
37: */
38: public class InvokeWorkflow extends CheckWorkflow {
39:
40: /**
41: * @see org.apache.lenya.cms.usecase.AbstractUsecase#getNodesToLock()
42: */
43: protected Node[] getNodesToLock() throws UsecaseException {
44: Node[] objects = new Node[0];
45: if (getSourceDocument() != null) {
46: objects = new Node[] { getSourceDocument()
47: .getRepositoryNode() };
48: }
49: return objects;
50: }
51:
52: /**
53: * @see org.apache.lenya.cms.usecase.AbstractUsecase#doExecute()
54: */
55: protected void doExecute() throws Exception {
56: super.doExecute();
57: WorkflowUtil.invoke(this.manager, getSession(), getLogger(),
58: getSourceDocument(), getEvent());
59: }
60:
61: }
|