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.action.impl.AbstractAction;
11 import org.weda.action.impl.ActionStateImpl;
12 import org.weda.data.DataProviderLinkBuilder;
13 import org.weda.enhance.InjectHivemindObject;
14 import org.weda.workflow.Workflow;
15 import org.weda.workflow.impl.DefaultPath;
16
17 /**
18 *
19 * @author Mikhail Titov
20 */
21 public abstract class AbstractDataViewAction extends AbstractAction {
22
23 @InjectHivemindObject()
24 protected static DataProviderLinkBuilder linkBuilder;
25
26 @InjectHivemindObject()
27 protected static Workflow workflow;
28
29 public abstract Object getDataId(ActionContainer targetObject);
30
31 public ActionState getActionState(ActionContainer targetObject)
32 throws Exception
33 {
34 return new ActionStateImpl(true, true);
35 }
36
37 public Object execute(ActionContainer targetObject) throws Exception {
38 String url = linkBuilder.getLinkToDataViewer(getDataId(targetObject));
39 DefaultPath path = new DefaultPath(url, true);
40 workflow.pushPath(path);
41 return null;
42 }
43 }