Package de.danet.an.workflow.api

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


     */
    public void removeClosedProcessjut1() throws Exception {
  WfRequester req = new DefaultRequester(workflowService);
  ProcessDirectory procDir = processDirectory();
  // create the process
  Process process = (Process)(createProcess("ut-process", "jut5", req));
  String processKey = process.key();
  assertTrue(process.state().equals("open.not_running.not_started"));
  // start the process
  process.start();
  assertTrue(process.state().startsWith("open.running"));
  Thread.sleep (1000);
  process.suspend();
  process.abort();
  Thread.sleep (2000);
  boolean procExists = true;
  try {
      procDir.lookupProcess("ut-process/jut5", processKey);
  } catch (Exception e) {
View Full Code Here


    public void jellyArg() throws Exception
  ProcessDirectory pd = null;
  try {
      pd = workflowService().processDirectory ();
      WfRequester cont = new DefaultRequester(workflowService());
      Process process = (Process)createProcess
    ("actParamTests", "jelly-test1", cont);
      process.start();
      assertTrue (stateReached (process, "closed.completed"));
      SAXEventBuffer res = (SAXEventBuffer)
    process.processContext().get ("result");
      SAXHandler sh = new SAXHandler ();
      res.emit (sh);
      Document resDoc = sh.getDocument();
      XPath xpath = new JDOMXPath("/result/inserted/root/element1/@attr1");
      String val = xpath.stringValueOf(resDoc);
View Full Code Here

    public void e4xArg() throws Exception {  
        ProcessDirectory pd = null;
        try {
            pd = workflowService().processDirectory ();
            WfRequester cont = new DefaultRequester(workflowService());
            Process process = (Process)createProcess
                ("actParamTests", "testE4xActParam", cont);
            process.start();
            assertTrue (stateReached (process, "closed.completed"));
            SAXContentBuffer res = (SAXContentBuffer)
                process.processContext().get ("result");
            Node resRoot = res.toW3cDom();
            Node fc = resRoot.getFirstChild();
            assertTrue (fc.toString(), fc.getLocalName().equals("Hello"));
            Node child = fc.getFirstChild();
            String data = "";
View Full Code Here

    public void test1() throws Exception
  ProcessDirectory pd = null;
  try {
      pd = workflowService().processDirectory ();
      WfRequester cont = new DefaultRequester(workflowService());
      Process process = (Process)createProcess
    ("jelly-test", "jelly-test1", cont);
      process.start();
      assertTrue (stateReached (process, "closed.completed"));
      SAXEventBuffer res = (SAXEventBuffer)
    process.processContext().get ("result");
      SAXHandler sh = new SAXHandler ();
      res.emit (sh);
      Document resDoc = sh.getDocument();
      XPath xpath = new JDOMXPath("/result/inserted/root/element1/@attr1");
      String val = xpath.stringValueOf(resDoc);
View Full Code Here

  try {
      if (processKey == null) {
    pdd = pddHome.create();
    return pdd.lookupProcessDefinition(packageId, processId);
      } else {
    Process proc = processHome.findByProcessKey(processKey);
    return proc.processDefinition();
      }
  } catch (InvalidKeyException ivke) {
      throw new IllegalStateException
    ("Key " + packageId + "/" + processId + " is invalid: "
     + ivke.getMessage());
View Full Code Here

     */
    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("/parent/firstChild");
    String value2 = xpath.stringValueOf(returnResult);
    assertTrue(value2.equals("I'm number one"));


    XPath xpath2 = new DOMXPath("/parent/thirdChild");
    Element child = (Element)xpath2.selectSingleNode(returnResult);
    System.out.println("child = " + child.getClass());
     org.jdom.Element child2 = new org.jdom.input.DOMBuilder().build(child);
     org.jdom.output.XMLOutputter output= new org.jdom.output.XMLOutputter();
     java.io.StringWriter sw = new java.io.StringWriter();
     output.output(child2, sw);
     System.out.println(sw.toString());
      }

      // 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");
View Full Code Here

            logger.debug("get instance properties...");
        }
       
        String receiverKey = getHeaderValue(reqMsg, Consts.RECEIVER_KEY);
       
        Process proc = null;
        try {
            proc = (Process) getProcess(receiverKey);
        } catch (InvalidKeyException e) {
            FaultUtils.setFault(respMsg,
                    ASAPException.ASAP_INVALID_INSTANCE_KEY, e.getMessage());
View Full Code Here

            logger.debug("set instance properties...");
        }
       
        String receiverKey = getHeaderValue(reqMsg, Consts.RECEIVER_KEY);
       
        Process proc = null;
        try {
            proc = (Process) getProcess(receiverKey);
        } catch (InvalidKeyException e) {
            FaultUtils.setFault(respMsg,
                    ASAPException.ASAP_INVALID_INSTANCE_KEY, e.getMessage());
           
            return;
        } catch (NoSuchElementException e) {
            FaultUtils.setFault(respMsg,
                    ASAPException.ASAP_INVALID_INSTANCE_KEY, e.getMessage());
           
            return;
        }

        String description = getChildsTextContent(action, "Description");
        if (description != null) {
            proc.setDescription(description);
        }
       
        SOAPElement data = findChildNode(action, "Data");
        if (data != null) {
            ProcessDefinition procdef = proc.processDefinition();
            ProcessData procData;
            try {
                procData = getProcessData(procdef, data);
                proc.setProcessContext(procData);
            } catch (ParseException e) {
                FaultUtils.setFault(respMsg,
                        ASAPException.ASAP_INVALID_INSTANCE_KEY,
                        e.getMessage());
               
View Full Code Here

    private void subscribe
        (SOAPElement action, SOAPMessage reqMsg, SOAPMessage respMsg)
        throws SOAPException, RemoteException {
        String receiverKey = getHeaderValue(reqMsg, Consts.RECEIVER_KEY);
       
        Process proc = null;
        try {
            proc = (Process) getProcess(receiverKey);
        } catch (InvalidKeyException e) {
            FaultUtils.setFault(respMsg,
                    ASAPException.ASAP_INVALID_INSTANCE_KEY,
                    e.getMessage());
           
            return;
        } catch (NoSuchElementException e) {
            FaultUtils.setFault(respMsg,
                    ASAPException.ASAP_INVALID_INSTANCE_KEY,
                    e.getMessage());
           
            return;
        }

        String observer = getChildsTextContent(action, "ObserverKey");
        if (observer == null) {
            FaultUtils.setFault(respMsg, ASAPException.ASAP_ELEMENT_MISSING,
                    "Missing observer key!");
            return;
        }

        ProcessDefinition procdef = proc.processDefinition();
        try {
            ObserverRegistry obs = getObserverRegistry();
            obs.subscribe
                (observer, procdef.packageId(),
                 procdef.processId(), proc.key(),
                 getResourceReference().getBaseUrl());
        } catch (SQLException e) {
            FaultUtils.setFault(respMsg, e);
           
            return;
View Full Code Here

    private void unsubscribe(SOAPElement action, SOAPMessage reqMsg,
            SOAPMessage respMsg)
        throws SOAPException, RemoteException {
        String receiverKey = getHeaderValue(reqMsg, Consts.RECEIVER_KEY);
       
        Process proc = null;
        try {
            proc = (Process) getProcess(receiverKey);
        } catch (InvalidKeyException e) {
            FaultUtils.setFault(respMsg,
                    ASAPException.ASAP_INVALID_INSTANCE_KEY,
                    e.getMessage());
           
            return;
        } catch (NoSuchElementException e) {
            FaultUtils.setFault(respMsg,
                    ASAPException.ASAP_INVALID_INSTANCE_KEY,
                    e.getMessage());
           
            return;
        }

        String observer = getChildsTextContent(action, "ObserverKey");
        if (observer == null) {
            FaultUtils.setFault(respMsg, ASAPException.ASAP_ELEMENT_MISSING,
                    "Missing observer key!");
           
            return;
        }

        ProcessDefinition procdef = proc.processDefinition();
        try {
            ObserverRegistry obs = getObserverRegistry();
            obs.unsubscribe(observer, procdef.packageId(), procdef.processId(),
                    proc.key());
        } catch (SQLException e) {
            FaultUtils.setFault(respMsg, e);
           
            return;
        }
View Full Code Here

TOP

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

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.