1
2
3
4
5
6
7 package org.weda.model.actions;
8
9 import org.weda.action.ActionContainer;
10 import org.weda.action.ActionState;
11 import org.weda.action.Parameter;
12 import org.weda.action.Parameter.Direction;
13 import org.weda.enhance.InjectObject;
14 import org.weda.model.PageValueSelector;
15 import org.weda.action.impl.AbstractAction;
16 import org.weda.action.impl.ActionStateImpl;
17 import org.weda.workflow.Workflow;
18 import org.weda.workflow.impl.DefaultPath;
19
20 /**
21 *
22 * @author Mikhail Titov
23 */
24 public abstract class PageValueSelectorAction extends AbstractAction {
25
26 @InjectObject()
27 public abstract Workflow getWorkflow();
28
29 public ActionState getActionState(ActionContainer targetObject)
30 throws Exception
31 {
32 return new ActionStateImpl(true, true);
33 }
34
35 public Object execute(ActionContainer targetObject) throws Exception {
36 PageValueSelector selector = (PageValueSelector)targetObject;
37 Workflow workflow = getWorkflow();
38 DefaultPath currentPage =
39 new DefaultPath(workflow.getCurrentPage(), false);
40 workflow.pushPath(currentPage);
41 DefaultPath selectPage = new DefaultPath(selector.getPageName(), false);
42 workflow.pushPath(selectPage);
43 selector.prepareSelectValueOperation();
44 return null;
45 }
46
47 public Object afterLinkedActionExecute(
48 Object targetObject, Object linkedTargetObject
49 , boolean cancelAction)
50 throws Exception
51 {
52 PageValueSelector selector = (PageValueSelector)targetObject;
53 if (!cancelAction)
54 selector.selectValue();
55 selector.finishSelectValueOperation();
56 return null;
57 }
58
59 }