Package de.danet.an.workflow.internalapi

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


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


  Collection resets = new ArrayList ();
  Collection starts = new ArrayList ();
  EvaluationContext ctx = new EvaluationContext (act, exception);
  if (act.splitMode().isAND() || exception != null) {
      // consider all transitions from this activity
      ExtTransitionLocal defaultTrans = null;
      boolean gotATrans = false;
      for (Iterator i = ((Collection)transByFrom.get(act.key()))
         .iterator (); i.hasNext();) {
    ExtTransitionLocal trans = (ExtTransitionLocal)i.next();
    if ((exception == null && trans.conditionType()
         == de.danet.an.workflow.api.Transition.COND_TYPE_OTHERWISE)
        || (exception != null && trans.conditionType()
      == de.danet.an.workflow.api
                            .Transition.COND_TYPE_DEFAULTEXCEPTION)) {
        defaultTrans = trans;
        continue;
    }   
    if (ctx.transitOK (trans)) {
        gotATrans = true;
        if (!tryTransit (trans, resets, starts)) {
            trans.setPendingToken(true);
                    }
    }
      }
      if (!gotATrans && defaultTrans != null) {
    if (logger.isDebugEnabled ()) {
        logger.debug ("Trying default: " + defaultTrans);
    }
    if (!tryTransit(defaultTrans, resets, starts)) {
        defaultTrans.setPendingToken(true);
                }
      }
  } else /* act.splitMode().isXOR() */ {
      // consider only first match of all transitions from this activity
      String group = null;
      for (Iterator i = ((Collection)transByFrom.get(act.key()))
         .iterator (); i.hasNext();) {
    ExtTransitionLocal trans = (ExtTransitionLocal)i.next();
    boolean contTransit = false;
    if (group != null) {
        if (!trans.group().equals (group)) {
      break; // end of group, quit.
        }
        contTransit = true;
    }
    if (logger.isDebugEnabled()) {
        logger.debug ("Trying transition " + trans);
    }
    // note that reevalution of transit conditions is not
    // necessary within a group, it's the same condition.
    if (contTransit || ctx.transitOK (trans)) {
        if (logger.isDebugEnabled ()) {
      logger.debug ("... transit OK (continued: "
              + contTransit + ")");
        }
        if (!tryTransit (trans, resets, starts)) {
            trans.setPendingToken(true);
                    }
        group = trans.group(); // continue for group
    }
      }
  }
  boolean deferChoiceOnSplit = act.deferChoiceOnSplit ();
  for (Iterator items = starts.iterator(); items.hasNext();) {
View Full Code Here

    }

    private void resetTokens (ExtActivityLocal act) {
        for (Iterator i = ((Collection)transByFrom.get(act.key()))
                 .iterator(); i.hasNext ();) {
            ExtTransitionLocal trans = (ExtTransitionLocal)i.next();
            trans.setPendingToken(false);
        }
    }
View Full Code Here

  if (logger.isDebugEnabled()) {
      logger.debug ("Testing join for " + act
        + ", mode " + act.joinMode());
  }
  if (act.joinMode().isAND()) {
      ExtTransitionLocal trans = null;
      String curGroup = null;
      boolean groupOK = false;
      for (Iterator i = ((Collection)transByTo.get(act.key()))
         .iterator (); i.hasNext ();) {
    trans = (ExtTransitionLocal)i.next();
    if (curGroup == null) {
        curGroup = trans.group();
    } else if (!curGroup.equals (trans.group ())) {
        if (!groupOK) {
      break;
        }
        curGroup = trans.group ();
        groupOK = false;
    }
    if (logger.isDebugEnabled()) {
        if (toTrans != null && trans.equals (toTrans)) {
      logger.debug ("Transition " + trans
              + " is triggering (implicitly true)");
        }
    }
    if (!(toTrans != null && trans.equals (toTrans))
        && !trans.hasPendingToken()) {
        continue;
    }
    groupOK = true;
    addToTriggers (triggers, trans.from());
      }
      if (!groupOK) {
    if (logger.isDebugEnabled()) {
        logger.debug (act + " not startable");
    }
View Full Code Here

  if (predecessors.size() == 0) {
      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 ();
View Full Code Here

            Iterator it = updatedTransitions.iterator();
            prepStmt = new UniversalPrepStmt
                (ds, con, "UPDATE transition SET Flags = ?"
                     + " WHERE ProcessDBId = ? AND TransitionId = ?");
            while (it.hasNext()) {
                ExtTransitionLocal t = (ExtTransitionLocal)it.next();
                if (logger.isDebugEnabled ()) {
                    logger.debug ("Storing " + t);
                }
                int offset = 1;
                prepStmt.setInt(offset++,
                        ((t.hasPendingToken() ? FLAGS_HAS_PENDING_TOKEN : 0)));
                prepStmt.setLong(offset++,
                        ((Long)ctx.getPrimaryKey()).longValue());
                prepStmt.setString(offset++, t.id());
                prepStmt.executeUpdate();
            }
            updatedTransitions.clear();
        } finally {
            try {
View Full Code Here

TOP

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

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.