Package com.opensymphony.workflow

Examples of com.opensymphony.workflow.Workflow


      out = pageContext.getOut();
      _jspx_out = out;

      out.write("\r\n\r\n");

    Workflow wf = new BasicWorkflow((String) session.getAttribute("username"));
    long id = wf.createEntry("example");
    //out.println(id);
  wf.initialize(id, 1, null);
      out.write("\r\n\r\nNew workflow entry ");
      out.write("<a href=\"test.jsp?id=");
      out.print(id);
      out.write("\">#");
      out.print(id);
View Full Code Here


      out = pageContext.getOut();
      _jspx_out = out;

      out.write("\r\n");

    Workflow wf = new BasicWorkflow((String) session.getAttribute("username"));

    long id = Long.parseLong(request.getParameter("id"));

    String doString = request.getParameter("do");
    if (doString != null && !doString.equals("")) {
        int action = Integer.parseInt(doString);
        wf.doAction(id, action, Collections.EMPTY_MAP);
    }


    int[] actions = wf.getAvailableActions(id);

    for (int i = 0; i < actions.length; i++) {
        String name = wf.getActionName("example", actions[i]);
              out.write("\r\n        ");
      out.write("<li> ");
      out.write("<a href=\"test.jsp?id=");
      out.print(id);
      out.write("&do=");
      out.print( actions[i] );
      out.write("\">");
      out.print( name );
      out.write("</a>\r\n        ");

    }
      out.write("\r\n\r\n");
      out.write("<hr>\r\n");
      out.write("<b>Permissions");
      out.write("</b>\r\n");
      out.write("<p>\r\n\r\n");

    List perms = wf.getSecurityPermissions(id);
    for (Iterator iterator = perms.iterator(); iterator.hasNext();) {
        String perm = (String) iterator.next();
      out.write("\r\n    ");
      out.write("<li>");
      out.print( perm );
View Full Code Here

   * Injects the type resolver (if available) inside the workflow.
   *
   * @see org.springmodules.workflow.osworkflow.OsWorkflowTemplate#createWorkflow(java.lang.String)
   */
  protected Workflow createWorkflow(String caller) throws WorkflowException {
    Workflow workflow = super.createWorkflow(caller);
    if (typeResolver != null) {
      // inject the type resolver if there is such a case
      if (workflow instanceof AbstractWorkflow) {
        ((AbstractWorkflow) workflow).setResolver(typeResolver);
      }
View Full Code Here

   * Executes the supplied <code>OsWorkflowCallback</code> against the current workflow instance as the caller bound
   * to the current <code>OsWorkflowContext</code>.
   */
  public Object execute(OsWorkflowCallback callback) {
    try {
      Workflow workflow = createWorkflow(OsWorkflowContextHolder.getWorkflowContext().getCaller());
      workflow.setConfiguration(this.configuration);
      return callback.doWithWorkflow(workflow);
    }
    catch (WorkflowException ex) {
      // TODO: proper exception translation
      throw new org.springmodules.workflow.WorkflowException("", ex);
View Full Code Here

    }
  }

  public void testExecute() throws Exception {
    MockControl ctl = createMockWorkflowControl();
    final Workflow workflow = (Workflow) ctl.getMock();
    final Object returnObject = new Object();

    OsWorkflowTemplate template = new OsWorkflowTemplate() {
      protected Workflow createWorkflow(String caller) throws WorkflowException {
        assertEquals("Incorrect caller", CALLER, caller);
View Full Code Here

    final Object value = new Object();
    final MockControl ctl = createMockWorkflowControl();

    OsWorkflowTemplate template = new OsWorkflowTemplate() {
      protected Workflow createWorkflow(String caller) throws WorkflowException {
        Workflow workflow = (Workflow) ctl.getMock();

        Map inputs = new HashMap();
        inputs.put(key, value);

        // record expected calls
        workflow.setConfiguration(OsWorkflowTemplateTests.this.configuration);
        ctl.setVoidCallable();
        workflow.doAction(MOCK_INSTANCE_ID, 1, inputs);
        ctl.setVoidCallable();
        ctl.replay();

        return workflow;
      }
View Full Code Here

    final MockControl ctl = createMockWorkflowControl();

    OsWorkflowTemplate template = new OsWorkflowTemplate() {
      protected Workflow createWorkflow(String caller) throws WorkflowException {
        Workflow workflow = (Workflow) ctl.getMock();
        workflow.setConfiguration(OsWorkflowTemplateTests.this.configuration);
        workflow.getWorkflowDescriptor(WAKE_UP);
        ctl.setReturnValue(null);
        ctl.replay();

        return workflow;
      }
View Full Code Here

    final MockControl ctl = createMockWorkflowControl();
    final List mockSteps = new ArrayList();

    OsWorkflowTemplate template = new OsWorkflowTemplate() {
      protected Workflow createWorkflow(String caller) throws WorkflowException {
        Workflow workflow = (Workflow) ctl.getMock();
        workflow.setConfiguration(OsWorkflowTemplateTests.this.configuration);
        workflow.getHistorySteps(MOCK_INSTANCE_ID);
        ctl.setReturnValue(mockSteps);
        ctl.replay();

        return workflow;
      }
View Full Code Here

    final MockControl ctl = createMockWorkflowControl();
    final List mockSteps = new ArrayList();

    OsWorkflowTemplate template = new OsWorkflowTemplate() {
      protected Workflow createWorkflow(String caller) throws WorkflowException {
        Workflow workflow = (Workflow) ctl.getMock();
        workflow.setConfiguration(OsWorkflowTemplateTests.this.configuration);
        workflow.getCurrentSteps(MOCK_INSTANCE_ID);
        ctl.setReturnValue(mockSteps);
        ctl.replay();

        return workflow;
      }
View Full Code Here

    final MockControl ctl = createMockWorkflowControl();
    final int mockEntryState = 98;

    OsWorkflowTemplate template = new OsWorkflowTemplate() {
      protected Workflow createWorkflow(String caller) throws WorkflowException {
        Workflow workflow = (Workflow) ctl.getMock();

        // expect setConfiguration
        workflow.setConfiguration(OsWorkflowTemplateTests.this.configuration);
        workflow.getEntryState(MOCK_INSTANCE_ID);
        ctl.setReturnValue(mockEntryState);

        ctl.replay();
        return workflow;
      }
View Full Code Here

TOP

Related Classes of com.opensymphony.workflow.Workflow

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.