Examples of WfProcess


Examples of de.danet.an.workflow.omgcore.WfProcess

     * without any branched activity.
     */
    public void processjut2() throws Exception {
  WfRequester req = new DefaultRequester(workflowService);
  // create the process
  WfProcess process = createProcess("ut-process", "jut2", req);
  assertTrue(process.state().equals("open.not_running.not_started"));
  // start the process
  process.start();
  assertTrue(process.state().startsWith("open.running"));
  Thread.sleep (1000);
  // start the activities and stop it.
  for (int i = 1; i <= 4; i++) {
      Collection c = process.steps();
      WfActivity a = null;
      for (Iterator it = c.iterator(); it.hasNext();) {
    a = (WfActivity)it.next();
    if (a.name().equals ("A2" + i)) {
        break;
    }
      }
      assertTrue(a.state() != null);
      boolean exceptionCaught = false;
      assertTrue
    (a.name() + " not open.not_running.suspended: " + a.state(),
     a.state().startsWith("open.not_running.suspended"));
      a.resume();
      Thread.sleep (1000);
      a.resume();
      Thread.sleep (1000);
      assertTrue(a.name() + " not closed.completed: " + a.state(),
           a.state().startsWith("closed.completed"));
  }
  assertTrue(process.state().startsWith("closed.completed"));
    }
View Full Code Here

Examples of de.danet.an.workflow.omgcore.WfProcess

     * </pre>
     */
    public void processjut4() throws Exception {
  WfRequester req = new DefaultRequester(workflowService);
  // create the process
  WfProcess process = createProcess("ut-process", "jut4", req);
  assertTrue(process.state().equals("open.not_running.not_started"));
  // start the process
  process.start();
  assertTrue(process.state().startsWith("open.running"));
  Thread.sleep (1000);
  // start the activities and stop it.
  Object[] actArray = process.steps().toArray();
  assertTrue(actArray.length == 4);
  Arrays.sort (actArray, new Comparator () {
    public int compare (Object o1, Object o2) {
        return ((WfActivity)o1).toString()
      .compareTo (((WfActivity)o2).toString());
    }
      });
  WfActivity a41 = (WfActivity)actArray[0];
  WfActivity a42 = (WfActivity)actArray[1];
  WfActivity a43 = (WfActivity)actArray[2];
  WfActivity a44 = (WfActivity)actArray[3];
  // start A41
  assertTrue(a41.state().startsWith("open.not_running.suspended"));
  a41.resume();
  Thread.sleep (1000);
  assertTrue(a42.state().startsWith("open.not_running.suspended"));
  assertTrue(a43.state().startsWith("open.not_running.not_started"));
  assertTrue(a44.state().startsWith("open.not_running.not_started"));
  // start A42
  a42.resume();
  Thread.sleep (1000);
  assertTrue(a43.state().startsWith("open.not_running.not_started"));
  assertTrue(a44.state().startsWith("open.not_running.suspended"));
  // start A44
  a44.resume();
  Thread.sleep (1000);
  // process terminated
  assertTrue(process.state().startsWith("closed.completed"));
    }
View Full Code Here

Examples of de.danet.an.workflow.omgcore.WfProcess

     * The activities will be finished manually.
     */
    public void processjut6() throws Exception {
  WfRequester req = new DefaultRequester(workflowService);
  // create the process
  WfProcess process = createProcess("ut-process", "jut6", req);
  assertTrue(process.state().equals("open.not_running.not_started"));
  // start the process
  process.start();
  assertTrue(process.state().startsWith("open.running"));
  Thread.sleep (1000);
  // start the activities and stop it.
  Object[] actArray = process.steps().toArray();
  assertTrue(actArray.length == 8);
  Arrays.sort (actArray, new Comparator () {
    public int compare (Object o1, Object o2) {
        return ((WfActivity)o1).toString()
      .compareTo (((WfActivity)o2).toString());
    }
      });
  WfActivity a61 = (WfActivity)actArray[0];
  WfActivity a62 = (WfActivity)actArray[1];
  WfActivity a63 = (WfActivity)actArray[2];
  WfActivity a64 = (WfActivity)actArray[3];
  WfActivity a65 = (WfActivity)actArray[4];
  WfActivity a66 = (WfActivity)actArray[5];
  WfActivity a67 = (WfActivity)actArray[6];
  WfActivity a68 = (WfActivity)actArray[7];
  // start A61
  assertTrue(a61.state().startsWith("open.not_running.suspended"));
  a61.resume();
  Thread.sleep (1000);
  assertTrue(a62.state().startsWith("open.not_running.not_started"));
  assertTrue(a63.state().startsWith("open.not_running.suspended"));
  assertTrue(a64.state().startsWith("open.not_running.not_started"));
  // start A63
  a63.resume();
  Thread.sleep (1000);
  assertTrue(a66.state().startsWith("open.not_running.suspended"));
  assertTrue(a65.state().startsWith("open.not_running.not_started"));
  // start A66 and then stop it.
  a66.resume();
  Thread.sleep (1000);
  // start A67
  a67.resume();
  Thread.sleep (1000);
  // start A68
  a68.resume();
  Thread.sleep (1000);
  // process terminated
  assertTrue(process.state().startsWith("closed.completed"));
    }
View Full Code Here

Examples of de.danet.an.workflow.omgcore.WfProcess

    }

    //Abort Process
    private void abortProcess() throws Exception {
  WfRequester req = new DefaultRequester(workflowService);
  WfProcess process = createProcess("ut-process", "jut2", req);
  assertTrue(process.state().equals("open.not_running.not_started"));
  process.start();
  assertTrue(process.state().startsWith("open.running"));
  process.suspend();
  process.abort();
  assertTrue(process.state().equals("closed.aborted"));
    }
View Full Code Here

Examples of de.danet.an.workflow.omgcore.WfProcess

        ProcessDirectory procDir = null;
        try {
            procDefDir = workflowService.processDefinitionDirectory();
            procDir = workflowService.processDirectory();
            ProcessMgr pmgr = procDefDir.processMgr ("jstests", "testReplacer");
            WfProcess process
                = pmgr.createProcess(new DefaultRequester (workflowService));
            process.start();
            assertTrue (stateReached (process, "closed.completed"));
            SAXContentBuffer xmlRes = (SAXContentBuffer)
                process.processContext().get("XMLResult");
            Node resRoot = xmlRes.toW3cDom();
            Node fc = resRoot.getFirstChild();
            assertTrue (fc.toString(), fc.getLocalName().equals("Item"));
            assertTrue (fc.getAttributes().getNamedItem("Id")
                        .getNodeValue().equals("Start"));
            assertTrue (process.processContext().get("Result").equals("Test"));
            procDir.removeProcess(process);
        } finally {
            workflowService.release (procDefDir);
            workflowService.release (procDir);
        }
View Full Code Here

Examples of de.danet.an.workflow.omgcore.WfProcess

        ProcessDirectory procDir = null;
        try {
            procDefDir = workflowService.processDefinitionDirectory();
            procDir = workflowService.processDirectory();
            ProcessMgr pmgr = procDefDir.processMgr ("jstests", "testAUK");
            WfProcess process
                = pmgr.createProcess(new DefaultRequester (workflowService));
            process.start();
            assertTrue (stateReached (process, "closed.completed"));
            String s = (String)process.processContext().get("Result");
            assertTrue (s.startsWith("jstests/testAUK "));
            procDir.removeProcess(process);
        } finally {
            workflowService.release (procDefDir);
            workflowService.release (procDir);
View Full Code Here

Examples of org.enhydra.shark.api.client.wfmodel.WfProcess

        try {

            sc = connect();

            WfProcess wfProcess = sc.getProcess(instanceId);
            processDefId = (wfProcess != null ? wfProcess.manager().name() : null);


        } catch (Exception ex) {

            LogUtil.error(getClass().getName(), ex, "");
View Full Code Here

Examples of org.ofbiz.workflow.WfProcess

    /**
     * @see org.ofbiz.workflow.WfRequester#receiveEvent(org.ofbiz.workflow.WfEventAudit)
     */
    public synchronized void receiveEvent(WfEventAudit event) throws WfException, InvalidPerformer {
        // Should the source of the audit come from the process? if so use this.
        WfProcess process = null;

        try {
            process = (WfProcess) event.source();
        } catch (SourceNotAvailable sna) {
            throw new InvalidPerformer("Could not get the performer", sna);
        } catch (ClassCastException cce) {
            throw new InvalidPerformer("Not a valid process object", cce);
        }
        if (process == null)
            throw new InvalidPerformer("No performer specified");
        if (!performers.containsKey(process))
            throw new InvalidPerformer("Performer not assigned to this requester");

        GenericRequester req = null;

        if (performers.containsKey(process))
            req = performers.get(process);
        if (req != null)
            req.receiveResult(process.result());
    }
View Full Code Here

Examples of org.ofbiz.workflow.WfProcess

     * Abort a process
     * @param workEffortId The workeffort entity key for the process to abort
     * @throws WfException
     */
    public void abortProcess(String workEffortId) throws WfException {
        WfProcess process = WfFactory.getWfProcess(delegator, workEffortId);
        process.abort();
    }
View Full Code Here

Examples of org.ofbiz.workflow.WfProcess

    /**
     * @see org.ofbiz.workflow.WfRequester#receiveEvent(org.ofbiz.workflow.WfEventAudit)
     */
    public synchronized void receiveEvent(WfEventAudit event) throws WfException, InvalidPerformer {
        // Should the source of the audit come from the process? if so use this.
        WfProcess process = null;

        try {
            process = (WfProcess) event.source();
        } catch (SourceNotAvailable sna) {
            throw new InvalidPerformer("Could not get the performer", sna);
        } catch (ClassCastException cce) {
            throw new InvalidPerformer("Not a valid process object", cce);
        }
        if (process == null)
            throw new InvalidPerformer("No performer specified");
        if (!performers.containsKey(process))
            throw new InvalidPerformer("Performer not assigned to this requester");

        GenericRequester req = null;

        if (performers.containsKey(process))
            req = (GenericRequester) performers.get(process);
        if (req != null)
            req.receiveResult(process.result());
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.