Package de.danet.an.workflow.api

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


            try {
                SimpleApplicationInfo info = applicationDirectory()
                    .instanceInfo(chosenInstanceId.longValue());
                ProcessDirectory pd
                    = wsc.getWorkflowService().processDirectory();
                Activity activity = pd.lookupActivity(info.activityUniqueKey());
                chosenInstance = new AssignmentData (null, info, activity);
            } catch (InvalidKeyException e) {
                // Must have been removed by concurrent action
                chosenInstanceId = null;
            }
View Full Code Here


                fc.getApplication().getVariableResolver()
                .resolveVariable(fc, "workflowServiceConnection");
            try {
                ProcessDirectory pd
                    = wsc.getWorkflowService().processDirectory();
                Activity act = pd.lookupActivity(activityInfo.uniqueKey());
                act.setResult(instanceData.resultData());
                act.complete();
                assignSvc.applicationDirectory().removeInstance(applInfo.id());
            } catch (EvaluationException e) {
                logger.error (e.getMessage(), e);
            } catch (RemoteException e) {
            } catch (InvalidKeyException e) {
View Full Code Here

     * exists.
     */
    public Activity activityByKey (String key)
  throws InvalidKeyException {
        try {
            Activity act = (Activity)activityMap().get(key);
            if (act != null) {
                return act;
            }
        } catch (RemoteException e) {
            throw new EJBException(e);
View Full Code Here

     * @throws CannotExecuteException
     */
    protected void invokeTool(FormalParameter[] formPars, Map map)
        throws RemoteException, CannotExecuteException {

        Activity activity = new TestActivity();
       
        tool.invoke(activity, formPars, map);
    }
View Full Code Here

            logger.debug("get activity properties...");
        }
       
        String receiverKey = getHeaderValue(reqMsg, Consts.RECEIVER_KEY);

        Activity activity = null;
        try {
            activity = getActivity(receiverKey);
        } catch (InvalidKeyException e) {
            FaultUtils.setFault(respMsg,
                    ASAPException.ASAP_INVALID_INSTANCE_KEY, e.getMessage());
View Full Code Here

            logger.debug("set activity properties...");
        }
       
        String receiverKey = getHeaderValue(reqMsg, Consts.RECEIVER_KEY);

        Activity activity = null;
        try {
            activity = getActivity(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 name = getChildsTextContent(action, "Name");
        if (name != null) {
            activity.setName(name);
        }
        String description = getChildsTextContent(action, "Description");
        if (description != null) {
            activity.setDescription(description);
        }
       
        SOAPBodyElement propsNode
            = createWfxmlResponseNode(respMsg, Consts.SET_PROPERTIES_RESPONSE);
View Full Code Here

     */
    private void completeActivity(SOAPMessage reqMsg, SOAPMessage respMsg)
        throws SOAPException, RemoteException {
        String receiverKey = getHeaderValue(reqMsg, Consts.RECEIVER_KEY);
       
        Activity activity = null;
        try {
            activity = getActivity(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;
        }
       
        try {
            activity.complete();
        } catch (CannotCompleteException e) {
            FaultUtils.setFault(respMsg,
                    ASAPException.ASAP_INVALID_STATE_TRANSITION,
                    e.getMessage());
           
            return;
        }

        createAsapResponseNode(respMsg, Consts.COMPLETE_ACTIVITY_RESPONSE);
       
        if (logger.isDebugEnabled()) {
            logger.debug("completed activity " + activity.toString());
        }
    }
View Full Code Here

        activitiesNode.addNamespaceDeclaration(Consts.ASAP_PREFIX,
                Consts.ASAP_NS);
       
        Iterator iterator = activities.iterator();
        while(iterator.hasNext()) {
            Activity activity = (Activity) iterator.next();
            SOAPElement activityNode
                = activitiesNode.addChildElement("ActivityInfo",
                        Consts.WFXML_PREFIX);
            SOAPElement activityKey
                = activityNode.addChildElement("ActivityKey",
                        Consts.WFXML_PREFIX);
            ResourceReference actResRef = new ResourceReference
                (getResourceReference().getBaseUrl(), activity);
            activityKey.addTextNode (actResRef.getResourceKey());
            SOAPElement name = activityNode.addChildElement("Name",
                    Consts.ASAP_PREFIX);
            String val = activity.name();
            maybeAddTextNode(name, val);
            SOAPElement description = activityNode
                .addChildElement("Description", Consts.ASAP_PREFIX);
            val = activity.description();
            maybeAddTextNode(description, val);
            Collection assignments = activity.assignments();
            Iterator assignmentIterator = assignments.iterator();
            while (assignmentIterator.hasNext()) {
                Assignment assignment = (Assignment) iterator.next();
                WfResource resource = assignment.assignee();
                SOAPElement assignee = activityNode.addChildElement("Assignee",
View Full Code Here

     */
    public Activity lookupActivity (ActivityUniqueKey key)
  throws InvalidKeyException {
        RequestScope scope = RequestLog.enterScope
            (this, "lookupActivity", new Object[] { key });
        Activity res = null;
  try {
      Long pk = Long.valueOf (key.activityKey());
      res = activityHome().findByPrimaryKey(pk);
  } catch (NumberFormatException nex) {
      ctx.setRollbackOnly();
View Full Code Here

  // 1. activity is suspended: (deadline is triggered after resume)
  mgr = defDir.processMgr("SystemTest", "suspendAbsolute");
  proc = mgr.createProcess(requester);
  procKey = proc.key();
  proc.start();
  Activity act = null;
  Iterator i = proc.steps().iterator();
  while (i.hasNext()) {
      act = (Activity)i.next();
      if (act.name().equals("A1")) {
    break;
      }
  }
  assertTrue(act.state(), stateReached(act, "open.running"));
  Thread.sleep(1000); // allow some time to invoke first tool
  act.suspend();
  data = proc.processContext();
  path = (String)data.get("TransitionPath");
  assertTrue(path, path.equals("PATH:start:a1"));
  assertTrue(act.state(),
       stateReached(act, "open.not_running.suspended"));
  Thread.sleep(15000);
  Date timestampRes = new Date();
  act.resume();
  assertTrue(act.state(),
       stateReached(act, "closed.completed.abandoned"));
  assertTrue(stateReached(proc, "closed.completed"));
  data = proc.processContext();
  path = (String)data.get("TransitionPath");
  Date timestampTo = (Date)data.get("timestamp_to");
  assertTrue(path,
       path.equals("PATH:start:a1:t1:end"));
  assertTrue( timestampTo + ":" + timestampRes,
        timestampTo.after(timestampRes) );
  procDir.removeProcess(proc);

  // 2. whole process is suspended: (deadline is triggered before resume
  // but cannot be started until process is resumed)
  proc = mgr.createProcess(requester);
  procKey = proc.key();
  proc.start();
  act = null;
  i = proc.steps().iterator();
  while (i.hasNext()) {
      act = (Activity)i.next();
      if (act.name().equals("A1")) {
    break;
      }
  }
  assertTrue(act.state(), stateReached(act, "open.running"));
  Thread.sleep(1000); // allow some time to invoke first tool
  proc.suspend();
  data = proc.processContext();
  path = (String)data.get("TransitionPath");
  assertTrue(path, path.equals("PATH:start:a1"));
  assertTrue(act.state(),
       stateReached(act, "closed.completed.abandoned"));
  Thread.sleep(10000);
  act = null;
  i = proc.steps().iterator();
  while (i.hasNext()) {
      act = (Activity)i.next();
      if (act.name().equals("TIMEOUT1")) {
    break;
      }
  }
  assertTrue(act.state(),
       stateReached(act, "open.not_running.not_started"));
  timestampRes = new Date();
  proc.resume();
  assertTrue(act.state(),
       stateReached(act, "closed.completed"));
  assertTrue(act.state(),
       !proc.state().equals("closed.completed.abandoned"));
  assertTrue(stateReached(proc, "closed.completed"));
  data = proc.processContext();
  path = (String)data.get("TransitionPath");
  timestampTo = (Date)data.get("timestamp_to");
View Full Code Here

TOP

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

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.