Package de.danet.an.workflow.internalapi

Examples of de.danet.an.workflow.internalapi.ExtActivityLocal


    actIds = new HashMap();
    for (Iterator i = setActIdMap.entrySet().iterator ();
         i.hasNext ();) {
        Map.Entry entry = (Map.Entry)i.next ();
        String actId = (String)entry.getKey ();
        ExtActivityLocal act = (ExtActivityLocal)entry.getValue ();
        if (! localToIds.contains (actId)) {
            // is entry activity
            act.setJoinMode (joinMode);
            entryActs.add(act);
            actIds.put(act.key(), actId);
        }
        if (! localFromIds.contains (actId)) {
            // is exit activity
            act.setSplitMode (splitMode);
            exitActs.add(act);
            actIds.put(act.key(), actId);
        }
    }
      }
  }
View Full Code Here


  if (logger.isDebugEnabled ()) {
      logger.debug ("Initializing transition manager for " + process);
  }
  myProcess = process;
  for (Iterator i = process.stepsLocal().iterator (); i.hasNext(); ) {
      ExtActivityLocal a = (ExtActivityLocal)i.next();
      String key = a.key();
      transByTo.put (key, new ArrayList ());
      transByFrom.put (key, new ArrayList ());
  }
  for (Iterator i = process.transitionsLocal().iterator ();
             i.hasNext(); ) {
      ExtTransitionLocal t = (ExtTransitionLocal)i.next();
      Collection fts = (Collection)transByFrom.get(t.from().key());
      if (fts == null) {
    // this may happen in the case of block activites with
    // exception triggered transitions, because there are
    // no real activities instantiated
    fts = new ArrayList ();
    transByFrom.put (t.from().key(), fts);
      }
      fts.add (t);
      ((Collection)transByTo.get(t.to().key())).add (t);
  }
  for (Iterator i = transByFrom.keySet().iterator(); i.hasNext();) {
      String key = (String)i.next();
      Collections.sort ((List)transByFrom.get(key), transComp);
  }
  for (Iterator i = transByTo.keySet().iterator(); i.hasNext();) {
      String key = (String)i.next();
      Collections.sort ((List)transByTo.get(key), transComp);
  }
  for (Iterator i = process.stepsLocal().iterator (); i.hasNext(); ) {
      ExtActivityLocal a = (ExtActivityLocal)i.next();
      State as = a.typedState();
      String ak = a.key();
      if (as.isSameOrSubState(NotRunningState.NOT_STARTED)) {
    if (as.isSameOrSubState (NotStartedState.STARTABLE)) {
        startableActs.put (ak, a);
    } else if (as.isSameOrSubState (NotStartedState.UNKNOWN)
         && (((Collection)transByTo.get(ak)).size () == 0)) {
        a.setStartable (null, false);
        if (logger.isDebugEnabled()) {
      logger.debug (a + " set to startable");
        }
        startableActs.put (ak, a);
    }
View Full Code Here

      }
  }
  boolean deferChoiceOnSplit = act.deferChoiceOnSplit ();
  for (Iterator items = starts.iterator(); items.hasNext();) {
      Object[] item = (Object[])items.next();
      ExtActivityLocal startAct = (ExtActivityLocal)item[0];
      Collection triggers = (Collection)item[1];
      setStartable (startAct, triggers, deferChoiceOnSplit);
  }
  for (Iterator items = resets.iterator(); items.hasNext();) {
      Object[] item = (Object[])items.next();
      ExtActivityLocal toAct = (ExtActivityLocal)item[0];
      Collection resetActs = (Collection)item[1];

      if (logger.isDebugEnabled ()) {
    logger.debug ("Resetting (true): " + toAct);
      }
      toAct.reset (true, false);
            resetTokens (toAct);
      for (Iterator i = resetActs.iterator(); i.hasNext(); ) {
    ExtActivityLocal resAct = (ExtActivityLocal)i.next();
    if (logger.isDebugEnabled ()) {
        logger.debug ("Resetting (false): " + resAct);
    }
    resAct.reset (false, false);
                resetTokens (resAct);
    closedActs.remove (resAct);
      }
      setStartable (toAct, null, deferChoiceOnSplit);
  }
View Full Code Here

      StringBuffer s = new StringBuffer ();
      s.append ("Setting " + act + " startable, triggers: ");
      if (triggers != null) {
    boolean first = true;
    for (Iterator i = triggers.iterator (); i.hasNext ();) {
        ExtActivityLocal ta = (ExtActivityLocal)i.next ();
        if (! first) {
      s.append (", ");
        }
        s.append (ta.key());
        first = false;
    }
      }
      s.append (", preliminary chosen: " + deferChoiceOnSplit);
      logger.debug (s.toString());
View Full Code Here

  (ExtTransitionLocal trans, Collection resets, Collection starts) {
  if (logger.isDebugEnabled ()) {
      logger.debug ("Trying transit from "
        + trans.from() + " to " + trans.to());
  }
  ExtActivityLocal toAct = (ExtActivityLocal)trans.to();
  if (toAct.typedState().isSameOrSubState (NotStartedState.UNKNOWN)) {
      Collection triggers = isStartable (trans, toAct);
      if (triggers != null) {
    starts.add (new Object[] { toAct, triggers });
                return true;
      }
      return false;
  }
  ExtActivityLocal fromAct = (ExtActivityLocal)trans.from();
  String toActKey = toAct.key();
  if (! ((toAct.typedState().isSameOrSubState (ClosedState.COMPLETED)
         && (fromAct.threadInfo().includes (toActKey)
       || fromAct.key().equals (toActKey))))) {
      return false;
  }
  // Now we reset the activities in the loop
  if (logger.isDebugEnabled ()) {
      logger.debug ("Loop detected: " + fromAct + " triggers " + toAct);
View Full Code Here

      for (Iterator p = pres.iterator (); p.hasNext(); ) {
    String k = (String)p.next();
    if (collKeys.contains (k)) {
        continue;
    }
    ExtActivityLocal a = (ExtActivityLocal)
                    myProcess.activityByKeyLocal (k);
    collectPredecessors (collected, collKeys, a, origin);
      }
  } catch (InvalidKeyException e) {
      // cannot happen
View Full Code Here

     * @return a collection of startable activities.
     */
    public Collection startableActivities () {
  Collection res = new ArrayList ();
  for (Iterator i = startableActs.values().iterator (); i.hasNext(); ) {
      ExtActivityLocal a = (ExtActivityLocal)i.next();
      if (a.typedState().isSameOrSubState(NotRunningState.NOT_STARTED)) {
    res.add (a);
      }
  }
  return res;
    }
View Full Code Here

      throw new IllegalArgumentException
    (act + " has no predecessors, cannot be preliminarily chosen");
  }
  for (Iterator i = predecessors.iterator(); i.hasNext ();) {
      ExtTransitionLocal trans = (ExtTransitionLocal)i.next();
      ExtActivityLocal fromAct = (ExtActivityLocal)trans.from();
      if (fromAct.deferChoiceOnSplit ()
    && threadInfo.includes (fromAct.key())) {
    for (Iterator j = ((Collection)transByFrom.get(fromAct.key()))
       .iterator(); j.hasNext ();) {
        ExtTransitionLocal ft = (ExtTransitionLocal)j.next();
        res.add (ft.to());
                    ft.setPendingToken(false);
    }
      }
  }
  if (logger.isDebugEnabled ()) {
      StringBuffer s = new StringBuffer ();
      s.append ("Preliminary chosen with " + act + ": ");
      boolean first = true;
      for (Iterator i = res.iterator(); i.hasNext();) {
    ExtActivityLocal a = (ExtActivityLocal)i.next ();
    if (first) {
        first = false;
    } else {
        s.append (", ");
    }
    s.append (a.toString ());
      }
      logger.debug (s);
  }
        // terminate others
        for (Iterator i = res.iterator (); i.hasNext ();) {
            ExtActivityLocal dcAct = (ExtActivityLocal)i.next ();
            if (!dcAct.key().equals (act.key())) {
                try {
                    if (dcAct.preliminarilyChosen ()) {
                        dcAct.withdrawPreliminaryChoice (true);
                        update (dcAct);
                    }
                } catch (TransitionNotAllowedException e) {
                    logger.error ("Inconsistent state: " + e.getMessage (), e);
                }
View Full Code Here

  logger.debug ("Engine state for " + myProcess.toString()
          + "(context: " + context + "):");
  logger.debug ("  Transition manager: " + this);
  logger.debug ("  Process is at end: " + isAtEnd());
  for (Iterator i = startableActs.values().iterator(); i.hasNext();) {
      ExtActivityLocal a = (ExtActivityLocal)i.next();
      logger.debug ("  Startable: " + a);
  }
  for (Iterator i = runningActs.values().iterator (); i.hasNext ();) {
      ExtActivityLocal a = (ExtActivityLocal)i.next();
      logger.debug ("  Running: " + a);
  }
    }
View Full Code Here

   
    /* (non-Javadoc)
     * Comment copied from interface or superclass.
     */
    public ExtActivityLocal toActivityLocal() {
        ExtActivityLocal actLocal = (ExtActivityLocal)ctx.getEJBLocalObject();
        return actLocal;
    }
View Full Code Here

TOP

Related Classes of de.danet.an.workflow.internalapi.ExtActivityLocal

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.