Package de.danet.an.workflow.omgcore.WfExecutionObject

Examples of de.danet.an.workflow.omgcore.WfExecutionObject.State


      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);
    }
      } else if (as.isSameOrSubState (State.CLOSED)) {
    closedActs.put (ak, a);
      } else {
    runningActs.put (ak, a);
      }
  }
View Full Code Here


     * on the activity or <code>null</code> if the activity has simply
     * reached a new state
     */
    public void update (ExtActivityLocal act, String exception) {
  String key = act.key();
  State ats = act.typedState();
  if (logger.isDebugEnabled ()) {
      logState ("adjusting to " + act + " updated to " + ats);
  }
  // Update the sets of activities in a certain state, but only
  // if this is a real activity, not a block activity
  // representation
  if (!(act instanceof BlockActivity)) {
      if (ats.isSameOrSubState (NotRunningState.NOT_STARTED)) {
    startableActs.remove (key);
    runningActs.remove (key);
    closedActs.remove (key);
      } else if (ats.isSameOrSubState (State.CLOSED)) {
    startableActs.remove (key);
    runningActs.remove (key);
    closedActs.put (key, act);
    if (ats.isSameOrSubState(ClosedCompletedState.NORMAL)) {
        // this implies exception == null, no conflict
        // with code below
        updateDependend (act, null);
    }
      } else {
View Full Code Here

     *
     * @param newState new state.
     * @see #typedState
     */
    protected void updateState(State newState) {
  State oldState = getPaTypedState();
  setPaLastStateTime (new Date());
  setPaTypedState (newState);
        int auditSel = getPaAuditEventSelection();
        // base event information
  WfAuditEvent event = auditEventBase
            ((this instanceof AbstractProcess)
             ? WfAuditEvent.PROCESS_STATE_CHANGED
             : WfAuditEvent.ACTIVITY_STATE_CHANGED);
        // Now add general or specific information to the event. Note that we
        // must always fire a state audit event if a process closes (see below),
        // but we have to add result information only if the event is to be
        // published.
        if ((this instanceof AbstractProcess)
            && newState.isSameOrSubState(State.CLOSED)
            && (auditSel == ProcessDefinition.AUDIT_SELECTION_ALL_EVENTS
                || auditSel == ProcessDefinition
                                    .AUDIT_SELECTION_STATE_EVENTS_ONLY
                || auditSel == ProcessDefinition
                                .AUDIT_SELECTION_PROCESS_CLOSED_EVENTS_ONLY)) {
            try {
                event = new DefaultProcessClosedAuditEvent
                    (event, oldState.toString(), newState.toString(),
                     ((AbstractProcess)this).result());
            } catch (ResultNotAvailableException e) {
                // Cannot happen, see implementation
                logger.debug ("Unexpected exception: " + e.getMessage(), e);
            }
        } else {
            event = new DefaultStateAuditEvent
                (event, oldState.toString(), newState.toString());
        }
  // Note that process closed events
  // (case AUDIT_SELECTION_PROCESS_CLOSED_EVENTS_ONLY) are fired
  // because they are handled by the process
  if (auditSel == ProcessDefinition.AUDIT_SELECTION_ALL_EVENTS
View Full Code Here

    protected void updateImmediate(State newState) {
        doUpdateNoFeedback(newState, true);
    }

    private void doUpdateNoFeedback (State newState, boolean updateStateTime) {
        State oldState = getPaTypedState();
        setPaTypedState (newState);
        if (updateStateTime) {
            setPaLastStateTime (new Date());
        }
        int auditSel = getPaAuditEventSelection();
        if (auditSel == ProcessDefinition.AUDIT_SELECTION_ALL_EVENTS
            || auditSel==ProcessDefinition.AUDIT_SELECTION_STATE_EVENTS_ONLY) {
            fireAuditEvent
                (new DefaultStateAuditEvent
                 (auditEventBase
                  ((this instanceof AbstractProcess)
                   ? WfAuditEvent.PROCESS_STATE_CHANGED
                   : WfAuditEvent.ACTIVITY_STATE_CHANGED),
                  oldState.toString(), newState.toString(), true));
        }
    }
View Full Code Here

      if (event instanceof ImplCompleteAuditEvent) {
    handleImplCompletedEvent ((ImplCompleteAuditEvent)event);
    return;
      }
      WfStateAuditEvent evt = (WfStateAuditEvent)event;
      State oldState = State.fromString (evt.oldState());
      State newState = State.fromString (evt.newState());
      if (oldState.isSameOrSubState(NotRunningState.NOT_STARTED)) {
    if (newState == RunningState.RUNNING) {
        handleStartedEvent (evt);
        return;
    }
    if (newState == ClosedState.TERMINATED) {
        handleTerminatedEvent (evt);
        return;
    }
      } else if (oldState.isSameOrSubState(NotRunningState.SUSPENDED)) {
    if (newState == RunningState.RUNNING) {
        handleResumedEvent (evt);
        return;
    }
    if (newState == ClosedState.ABORTED) {
        handleAbortedEvent (evt);
        return;
    }
      } else if (oldState.isSameOrSubState(OpenState.RUNNING)) {
    if (newState == SuspendedState.SUSPENDED) {
        handleSuspendedEvent (evt);
        return;
    }   
    if (newState == ClosedCompletedState.NORMAL) {
        handleCompletedEvent (evt);
        return;
    }   
    if (newState == ClosedState.TERMINATED) {
        handleTerminatedEvent (evt);
        return;
    }   
      }
      logger.warn
    ("Cannot handle undefined state transition from "
     + oldState.toString() + " to " + newState.toString()
                 + " for " + this);
  } catch (InvalidStateException e) {
      // can't do much about this, shouldn't happen
      logger.error (e.getMessage(), e);
  }
View Full Code Here

            && newState.isSameOrSubState(SuspendedState.CLEARING_EXCEPTION)) {
            updateImmediate(SuspendedState.SUSPENDED);
            return;
        }
  if (getPaDebug ()) {
      State oldState = typedState ();
      if (newState == DebugState.FORWARDING_EXCEPTION
    && STATE_TO_SUB_STATE.containsKey(oldState)) {
    setPaSubStateBackup
        (((Integer)STATE_TO_SUB_STATE.get(oldState)).intValue());
    setPaTypedState (newState);
    return;
      }
      if (newState == DebugState.AWAITING_EXCEPTION) {
    if (oldState == DebugState.ABANDONING) {
        // Proceed from abandoning
        setPaTypedState (newState);
        return;
    }
    throw new TransitionNotAllowedException
        ("Change to " + DebugState.AWAITING_EXCEPTION
         + " is only allowed from " + DebugState.ABANDONING);
      }
      if (oldState.isSameOrSubState (RunningState.DEBUG)) {
    if (!newState.isSameOrSubState (OpenState.RUNNING)
        && !(oldState == DebugState.INVOKING
       && newState.isSameOrSubState
                            (NotRunningState.SUSPENDED))) {
        throw new TransitionNotAllowedException
      ("Only valid change from debug states is to "
       + OpenState.RUNNING + " or sub-state");
    }

    // Resume closing with the proper state.
    State closeState
        = (State)DEBUG_STATE_TO_CLOSE_STATE.get(oldState);
    if (closeState != null) {
        // Reset to running state in order to generate proper
        // state change event later.
        setPaTypedState (RunningState.RUNNING);
View Full Code Here

    /* Comment copied from Interface. */
    public void abandon(ExceptionResult result)
  throws TransitionNotAllowedException {
        String exception = result.exceptionName();
  // handle forwarding of exception for debugging
  State oldState = typedState ();
  if (oldState == DebugState.AWAITING_EXCEPTION
      || oldState == DebugState.FORWARDING_EXCEPTION) {
      if (oldState == DebugState.AWAITING_EXCEPTION) {
    updateInterim (ClosedCompletedState.ABANDONED);
      } else {
View Full Code Here

    return true;
  }
  if (event.eventType().equals
            (WfAuditEvent.ACTIVITY_STATE_CHANGED)) {
      try {
    State oldState = State.fromString
        (((WfStateAuditEvent)event).oldState());
    State newState = State.fromString
        (((WfStateAuditEvent)event).newState());
    if (oldState.isSameOrSubState(NotRunningState.NOT_STARTED)) {
        if (newState == ClosedState.TERMINATED) {
      return true;
        }
View Full Code Here

  // Debug only if process is still running normally, i.e. not
  // terminating or aborting.
  if (getPaDebug ()
      && ((ProcessLocal)containerLocal()).typedState()
                == RunningState.RUNNING) {
      State debState = (State)CLOSE_STATE_TO_DEBUG_STATE.get(closedState);
      if (debState != null) {
    setPaTypedState (debState);
    return;
      }
  }
View Full Code Here

     * @return the collection of all WfActivities.
     * @throws InvalidStateException if an invalid state has been specified.
     */
    public Collection activitiesInState (String state)
  throws InvalidStateException {
  State s = State.fromString (state);
  Collection returnList = new ArrayList();

  Iterator it = stepsLocal().iterator();
  while (it.hasNext()) {
      ExtActivityLocal act = (ExtActivityLocal)it.next();
View Full Code Here

TOP

Related Classes of de.danet.an.workflow.omgcore.WfExecutionObject.State

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.