Package de.danet.an.workflow.localapi

Examples of de.danet.an.workflow.localapi.ActivityLocal


     * @exception Exception if an error occurs
     */
    public void transTest1() throws Exception {
  TestProcess p = getProcess();
  assertTrue (p != null);
  ActivityLocal a1 = getActivity(p,1);
  assertTrue (a1 != null);
  ActivityLocal a2 = getActivity(p,2);
  assertTrue (a2 != null);
  Collection c = new Vector();
  c.add(a1);
  c.add(a2);
  p.setActivities(c);
View Full Code Here


                            + " (no associated activity)");
                }
                return;
            }
            resParam = (String)((Object[])applInfo.state())[1];
            ActivityLocal act = null;
            try {
                Long pk = Long.valueOf (auk.activityKey());
                act = activityLocalHome().findByPrimaryKey(pk);
            } catch (FinderException nex) {
                logger.warn (auk + " has disappeared (doing nothing)");
                return;
            }
            if (logger.isDebugEnabled ()) {
                logger.debug ("Setting result for " + auk);
            }
            try {
                if (resParam != null) {
                    ProcessData res = new DefaultProcessData ();
                    res.put (resParam, "EXPIRED");
                    act.setResult (res);
                }
                act.complete ();
                if (logger.isDebugEnabled ()) {
                    logger.debug ("Result set for " + auk + " and completed");
                }
                return;
            } catch (InvalidDataException e) {
                logger.error
                ("Cannot set result of wait tool ("
                        + auk + " will be terminated): " + e.getMessage ());
            } catch (CannotCompleteException e) {
                logger.error ("Cannot complete " + auk
                        + " (will be terminated): " + e.getMessage ());
            }
            if (act.typedState().workflowState() == State.OPEN) {
                try {
                    act.terminate ();
                } catch (CannotStopException e) {
                    logger.error
                    ("Cannot terminate " + auk + ": " + e.getMessage ());
                } catch (NotRunningException e) {
                    logger.warn (auk + " not running although state is open?");
View Full Code Here

   * are closed; <code>false</code> else.
   * @throws RemoteException if a system-level error occurs.
   */
  public boolean allActivitiesClosed() throws RemoteException {
      for (Iterator it = stepsLocal().iterator(); it.hasNext();) {
    ActivityLocal act = (ActivityLocal)it.next();
    if (! act.typedState().isSameOrSubState(State.CLOSED)) {
        return false;
    }
      }
      return true;
  }
View Full Code Here

     * @throws InvalidKeyException if no activity with the given key
     * exists.
     */
    public ActivityLocal activityByKeyLocal (String key)
        throws InvalidKeyException {
        ActivityLocal act = (ActivityLocal)activityLocalMap().get(key);
        if (act != null) {
            return act;
        }
        throw new InvalidKeyException ("Key " + key + " is invalid.");
    }   
View Full Code Here

     * @throws InvalidDataException if the message contains invalid data
     * @ejb.interface-method view-type="remote"
     */
    public boolean deliverChannelMessage (String channel, Map message)
  throws InvalidDataException {
  ActivityLocal act = null;
  try {
      act = activityLocalHome().findByWaitingOn
    ((Long)ctx.getPrimaryKey(), channel);
      if (logger.isDebugEnabled ()) {
    logger.debug
        ("Delivering message " + CollectionsUtil.toString(message)
         + " from channel " + channel
         + " to waiting activity " + act);
      }
      try {
    act.setResult (new DefaultProcessData (message));
    act.complete ();
      } catch (CannotCompleteException e) {
    logger.error
        ("Activity " + act + " listening on channel "
         + "but cannot be completed?!: " + e.getMessage (), e);
    throw new IllegalStateException
View Full Code Here

  if (!(getPaRequester() instanceof SubProcRequester)) {
      return null;
  }
  String key = ((SubProcRequester)getPaRequester()).requestingActivity();
  try {
      ActivityLocal act = lookupActivityLocal (key);
      return ((ExtProcessLocal)act.containerLocal()).toProcess();
  } catch (InvalidKeyException e) {
      logger.warn (toString() + " cannot find requesting activity "
       + key + " : " + e.getMessage ());
      return null;
  }
View Full Code Here

    public Collection activitiesOfBlockActivity (String blockActivity) {
  Collection returnList = new ArrayList();

  Iterator it = stepsLocal().iterator();
  while (it.hasNext()) {
      ActivityLocal act = (ActivityLocal)it.next();
      String ba = act.blockActivity();
      if (ba != null && ba.equals (blockActivity)) {
    returnList.add(act);
      }
  }
  return returnList;
View Full Code Here

    public void terminate () throws CannotStopException,
        NotRunningException {
  mayCloseCheck (ClosedState.TERMINATED);
  if (stepsLocal() != null) {
      for (Iterator it = stepsLocal().iterator(); it.hasNext();) {
    ActivityLocal act = (ActivityLocal)it.next();
    State s = act.typedState();
    if (s.isSameOrSubState(NotRunningState.SUSPENDED)
        || s == ClosedState.ABORTED) {
        throw new CannotStopException
      (act.toString() + " is suspended.");
    }
      }
      String unstoppable = null;
      try {
    setPaTypedState(RunningState.TERMINATING);
    for (Iterator it = stepsLocal().iterator(); it.hasNext();) {
        ActivityLocal act = (ActivityLocal)it.next();
        if (act.workflowState() == State.OPEN
      && (!act.typedState().isSameOrSubState
          (NotRunningState.NOT_STARTED))) {
      try {
          act.terminate();
      } catch (CannotStopException e) {
          unstoppable = act.toString()
        + " cannot be terminated: " + e.getMessage();
      } catch (NotRunningException e) {
          // cannot happen
          logger.error (e.getMessage(), e);
      }
View Full Code Here

  if (stepsLocal() != null) {
      String unstoppable = null;
      try {
    setPaTypedState(SuspendedState.ABORTING);
    for (Iterator it = stepsLocal().iterator(); it.hasNext();) {
        ActivityLocal act = (ActivityLocal)it.next();
        try {
      if (act.typedState().isSameOrSubState
          (NotRunningState.SUSPENDED)) {
          act.abort ();
      } else if (act.typedState().isSameOrSubState
           (OpenState.RUNNING)) {
          try {
        act.terminate();
          } catch (CannotStopException e) {
        act.suspend ();
        act.abort ();
          }
      }
        } catch (CannotStopException e) {
      unstoppable = act.toString()
          + " cannot be closed: " + e.getMessage();
        } catch (InvalidControlOperationException e) {
      // cannot happen, we check states before changing
      logger.error (e.getMessage(), e);
        }
View Full Code Here

  if ((req instanceof SubProcRequester)
      && (((SubProcRequester)req).execution()
    == SubFlowImplementation.SYNCHR)) {
      String key = ((SubProcRequester)req).requestingActivity();
      try {
    ActivityLocal act = lookupActivityLocal (key);
    if (act.typedState () != RunningState.ABANDONING
        && act.typedState() != ClosedCompletedState.ABANDONED) {
        act.terminate ();
    }
      } catch (InvalidKeyException e) {
    logger.warn (toString() + " cannot notify requesting activity "
           + key + " : " + e.getMessage ());
      } catch (InvalidControlOperationException e) {
View Full Code Here

TOP

Related Classes of de.danet.an.workflow.localapi.ActivityLocal

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.