1
2
3
4
5
6 package org.weda.data.impl;
7
8 import org.weda.action.ActionContainer;
9 import org.weda.action.ActionState;
10 import org.weda.enhance.InjectObject;
11 import org.weda.action.Parameter;
12 import org.weda.action.Parameter.Direction;
13 import org.weda.data.DataProviderLinkBuilder;
14 import org.weda.store.ObjectStore;
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 ViewDataAction extends AbstractAction{
25 private Object dataId;
26
27 @InjectObject()
28 public abstract DataProviderLinkBuilder getLinkBuilder();
29
30 @InjectObject()
31 public abstract Workflow getWorkflow();
32
33 @Parameter(direction=Direction.WRITE)
34 public void setDataId(Object dataId){
35 this.dataId = dataId;
36 }
37
38 public ActionState getActionState(ActionContainer targetObject)
39 throws Exception
40 {
41 return new ActionStateImpl(true, true);
42 }
43
44 public Object execute(ActionContainer targetObject) throws Exception {
45 String url = getLinkBuilder().getLinkToDataViewer(dataId);
46 DefaultPath path = new DefaultPath(url, true);
47 getWorkflow().pushPath(path);
48 return null;
49 }
50
51 }