Package de.danet.an.workflow.api

Examples of de.danet.an.workflow.api.ProcessDefinitionDirectory


     * Import the process definitions from a XPDL file
     * unsing the ProcessDefinitionDirectory bean.
     */
    public void importProcessDefinitions() throws Exception {
  // Create process definition directory bean
  ProcessDefinitionDirectory pdd
      = workflowService.processDefinitionDirectory();

  InputStream is = getClass().getResourceAsStream("/process/types.xml");
  assertTrue (is != null);
  BufferedReader br = new BufferedReader
      (new InputStreamReader(is, "ISO-8859-1"));
  StringBuffer sb = new StringBuffer();
  String st;
  while ((st = br.readLine()) != null) {
      sb.append(st + "\n");
  }
  pdd.importProcessDefinitions(sb.toString());
  Collection processDefinitions = pdd.processDefinitions();
  assertTrue (processDefinitions.size() > 0);
 
    }
View Full Code Here


    }

    private WfProcess createProcess
  (String pkgId, String prcId, WfRequester req)
        throws Exception {
  ProcessDefinitionDirectory procDir = null;
  try {
      procDir = workflowService.processDefinitionDirectory();
      ProcessMgr pmgr = procDir.processMgr(pkgId, prcId);
      return pmgr.createProcess (req);
  } finally {
      workflowService.release (procDir);
  }
    }
View Full Code Here

 
    /**
     * Test types.
     */
    public void typeInformation() throws Exception {
  ProcessDefinitionDirectory procDir = null;
  try {
      procDir = workflowService.processDefinitionDirectory();
      ProcessMgr pmgr = procDir.processMgr("typestest", "typestest1");
      ProcessDataInfo pdi = pmgr.contextSignature();
      assertTrue (pdi.get("XMLField") instanceof SAXEventBuffer);
      assertTrue (pdi.get("XMLField2") instanceof ExternalReference);
      assertTrue (((ExternalReference)pdi.get("XMLField2"))
      .location().toString()
View Full Code Here

     * Import the process definitions from a XPDL file
     * unsing the ProcessDefinitionDirectory bean.
     */
    public void importProcessDefinitions() throws Exception {
  // Create process definition directory bean
  ProcessDefinitionDirectory pdd
            = workflowService().processDefinitionDirectory();

  InputStream is = getClass().getResourceAsStream("/process/subflow.xml");
  assertTrue (is != null);
  BufferedReader br = new BufferedReader
      (new InputStreamReader(is, "ISO-8859-1"));
  StringBuffer sb = new StringBuffer();
  String st;
  while ((st = br.readLine()) != null) {
      sb.append(st + "\n");
  }
  pdd.importProcessDefinitions(sb.toString());
  Collection processDefinitions = pdd.processDefinitions();
  assertTrue (processDefinitions.size() > 0);
 
    }
View Full Code Here

    }

    private WfProcess createProcess
  (String pkgId, String prcId, WfRequester req)
        throws Exception {
  ProcessDefinitionDirectory pdd = null;
  try {
      pdd = workflowService().processDefinitionDirectory ();
      WfProcessMgr pmgr = pdd.processMgr(pkgId, prcId);
      return pmgr.createProcess (req);
  } finally {
      workflowService().release (pdd);
  }
    }
View Full Code Here

    /**
     * Create a new process and then remove its process definition.
     */
    public void createProcess1AndRemoveProcessDef() throws Exception
  ProcessDefinitionDirectory pdd = null;
  try {
      WfRequester cont = new DefaultRequester(workflowService());
      Process process = (Process)createProcess("ut-process", "jut1", cont);
      assertTrue(process.state().startsWith("open.not_running.not_started"));
      process.start();
      assertTrue(process.state().startsWith("open.running"));
      // remove its process definition
      pdd = workflowService().processDefinitionDirectory ();
      ProcessDefinition pd
    = pdd.lookupProcessDefinition("ut-process", "jut1");
      assertTrue(pd!=null);
      pdd.removeProcessDefinition("ut-process", "jut1");
      boolean gotEx = false;
      try {
    pd = pdd.lookupProcessDefinition("ut-process", "jut1");
      } catch (Exception ex) {
    gotEx = true;
      }
      assertTrue(gotEx);
      // check the process definition of the process
      ProcessDefinition procDef = process.processDefinition();
      assertTrue(procDef.packageId().equals("ut-process"));
      assertTrue(procDef.processId().equals("jut1"));
      // import the process definition again.
      importProcessDefinitions();
      pd = pdd.lookupProcessDefinition("ut-process", "jut1");
      assertTrue(pd!=null);
  } finally {
      workflowService().release (pdd);
  }
    }
View Full Code Here

   // Create process definition directory bean
  ProcessDefinitionDirectoryHome pddh
      = (ProcessDefinitionDirectoryHome)EJBUtil.lookupEJBHome
      (ProcessDefinitionDirectoryHome.class,
       "ejb/de.danet.an.wfdemo.ProcessDefinitionDirectory");
  ProcessDefinitionDirectory pdd = pddh.create();
  InputStream is = SubFlow.class.getResourceAsStream(filename);
  assertTrue (is != null);
  BufferedReader br = new BufferedReader
      (new InputStreamReader(is, "ISO-8859-1"));
  StringBuffer sb = new StringBuffer();
  String st;
  while ((st = br.readLine()) != null) {
      sb.append(st + "\n");
  }
  pdd.importProcessDefinitions(sb.toString());
  Collection processDefinitions = pdd.processDefinitions();
  assertTrue (processDefinitions.size() > 0);
    }
View Full Code Here

    /**
     * Import the process definitions from a XPDL file
     * unsing the ProcessDefinitionDirectory bean.
     */
    public void importProcessDefinitions() throws Exception {
  ProcessDefinitionDirectory pdd
            = workflowService().processDefinitionDirectory();

  InputStream is = getClass().getResourceAsStream("/process/jstest2.xml");
  assertTrue (is != null);
  BufferedReader br = new BufferedReader
      (new InputStreamReader(is, "ISO-8859-1"));
  StringBuffer sb = new StringBuffer();
  String st;
  while ((st = br.readLine()) != null) {
      sb.append(st + "\n");
  }
  pdd.importProcessDefinitions(sb.toString());
  Collection processDefinitions = pdd.processDefinitions();
  assertTrue (processDefinitions.size() > 0);
 
    }
View Full Code Here

    }

    private WfProcess createProcess
  (String pkgId, String prcId, WfRequester req)
        throws Exception {
  ProcessDefinitionDirectory pdd = null;
  try {
      pdd = workflowService().processDefinitionDirectory ();
      WfProcessMgr pmgr = pdd.processMgr(pkgId, prcId);
      return pmgr.createProcess (req);
  } finally {
      workflowService().release (pdd);
  }
    }
View Full Code Here

 
    /**
     * Create a new process and then remove its process definition.
     */
    public void createProcessAndRemoveProcessDef() throws Exception
  ProcessDefinitionDirectory pdd = null;
  try {
      WfRequester cont = new DefaultRequester(workflowService());
      Process process = (Process)createProcess("N1", "N2", cont);
      process.start();
      Thread.sleep(5000);

      // get processdata
      ProcessData data = process.processContext();
      Object value = data.get("result");
      if (value != null) {
    SAXEventBufferImpl myBuffer
        = (SAXEventBufferImpl)value;
    TransformerFactory tf
        = TransformerFactory.newInstance();
    SAXTransformerFactory saxTransFact = null;
    if (tf.getFeature(SAXTransformerFactory.FEATURE)) {
        saxTransFact = (SAXTransformerFactory)tf;
    }
    TransformerHandler transHand = null;
      transHand = saxTransFact.newTransformerHandler();
      StreamResult streamResult = new StreamResult
          (new java.io.ByteArrayOutputStream());
      transHand.setResult(streamResult);
      myBuffer.emit(transHand);
     System.out.println(streamResult.getOutputStream().toString());

    DOMResult domResult = new DOMResult();
    transHand = saxTransFact.newTransformerHandler();
    transHand.setResult(domResult);
    myBuffer.emit(transHand);
    Element returnResult = ((Document)domResult.getNode())
        .getDocumentElement();

    XPath xpath = new DOMXPath("/BLUB/root/element1");
    Element element1
        = (Element)xpath.selectSingleNode(returnResult);
    String value1 = element1.getAttribute("attr1");
    // check testXSLT.xml for the expected result
    assertTrue(value1.equals("42"));

    xpath = new DOMXPath("/BLUB/root/element2");
    Element element2
        = (Element)xpath.selectSingleNode(returnResult);
    String value2 = element2.getAttribute("attr2");
    // check testXSLT.xml for the expected result
    assertTrue(value2.equals("66"));

      }

      // remove its process definition
      pdd = workflowService().processDefinitionDirectory ();
      ProcessDefinition pd
    = pdd.lookupProcessDefinition("N1", "N2");
      assertTrue(pd!=null);
      pdd.removeProcessDefinition("N1", "N2");
      boolean gotEx = false;
      try {
    pd = pdd.lookupProcessDefinition("N1", "N2");
      } catch (Exception ex) {
    gotEx = true;
      }
      assertTrue(gotEx);
      // check the process definition of the process
      ProcessDefinition procDef = process.processDefinition();
      assertTrue(procDef.packageId().equals("N1"));
      assertTrue(procDef.processId().equals("N2"));
      // import the process definition again.
      importProcessDefinitions();
      pd = pdd.lookupProcessDefinition("N1", "N2");
      assertTrue(pd!=null);
  } finally {
      workflowService().release (pdd);
  }
    }
View Full Code Here

TOP

Related Classes of de.danet.an.workflow.api.ProcessDefinitionDirectory

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.