View Javadoc

1   /*
2    *  DISCLAIMER
3    */
4   
5   package org.flowfuse.base.frontend;
6   
7   import org.apache.commons.logging.Log;
8   import org.apache.commons.logging.LogFactory;
9   import org.flowfuse.base.model.WorkItem;
10  import org.springmodules.workflow.osworkflow.OsWorkflowContextHolder;
11  
12  import javax.servlet.http.HttpServletRequest;
13  
14  /***
15   * The ViewWorkitemForm displays a work item and controls the addition of
16   * a comment.
17   *
18   * @author <a href="stefan@flowfuse.org">Stefan Kleineikenscheidt</a>,
19   *         Flowfuse.org
20   * @version $Id: ViewWorkItemController.java,v 1.1 2005/11/20 15:02:07 skleinei Exp $
21   */
22  public class ViewWorkItemController extends BaseFormController {
23  
24    /* RCS ID */
25    public final static String rcsid = "$Id: ViewWorkItemController.java,v 1.1 2005/11/20 15:02:07 skleinei Exp $";
26  
27    /* Logger */
28    protected final Log logger = LogFactory.getLog(this.getClass());
29  
30    public ViewWorkItemController() {
31      setFormView("view");
32      setCommandClass(FrontendCommand.class);
33    }
34  
35    protected Object formBackingObject(HttpServletRequest request)
36            throws Exception {
37      FrontendCommand frontendCommand = (FrontendCommand) super.formBackingObject(
38              request);
39  
40      Long l = new Long(
41              OsWorkflowContextHolder.getWorkflowContext().getInstanceId());
42  
43      WorkItem workItem = super.workItemManagementService.getWorkItemByOswfId(l);
44  
45      frontendCommand.setWorkItem(workItem);
46  
47      return frontendCommand;
48    }
49  
50    /*protected ModelAndView onSubmit(Object command) throws Exception {
51  
52      // TODO allow addition of new comment
53      BaseCommand commandContainer = (BaseCommand) command;
54      WorkflowInstance workflowInstance = commandContainer.getWorkItem();
55  
56      // do workflowInstance action
57      this.workflowServiceDeprDepr.startNewWorkflow(workflowInstance);
58  
59      // TODO check whether user has right to view workflowInstance ...
60      if (true) {
61        // ... if so direct to item list ...
62        return new ModelAndView(new RedirectView("item"));
63      } else {
64        // ... otherwise return to work list
65        return new ModelAndView(new RedirectView("list"));
66      }
67    }*/
68  
69  }
70  
71  /* EOF */