Add transition to action state.

@param state           the action state
@param criteriaOutcome the criteria outcome
@param targetState     the target state
@param removeExisting  the remove existing
@return the transition
966624
public Transition createTransitionForState(final TransitionableState state, final String criteriaOutcome, final String targetState, final boolean removeExisting) {
        try {
            if (removeExisting) {
                val success = (Transition) state.getTransition(criteriaOutcome);
                if (success != null) {
                    state.getTransitionSet().remove(success);
                }
            }
            val transition = createTransition(criteriaOutcome, targetState);
            state.getTransitionSet().add(transition);
            LOGGER.trace("Added transition [{}] to the state [{}]", transition.getId(), state.getId());
            return transition;
        } catch (final Exception e) {
            LOGGER.error(e.getMessage(), e);
        }
        return null;
    }
971946
public void transition (Class<?> clazz, String name, Transition trans)
        throws PersistenceException
    {
        if (!isTransitionApplied(clazz, name) && noteTransition(clazz, name)) {
            try {
                trans.run();

            } catch (PersistenceException e) {
                try {
                    clearTransition(clazz, name);
                } catch (PersistenceException pe) {
                    log.warning("Failed to clear failed transition", "class", clazz, "name", name,
                                pe);
                }
                throw e;

            } catch (RuntimeException rte) {
                try {
                    clearTransition(clazz, name);
                } catch (PersistenceException pe) {
                    log.warning("Failed to clear failed transition", "class", clazz, "name", name,
                                pe);
                }
                throw rte;
            }
        }
    }
1163032
function (newState, newMetaState, options) {
      var args = Util.resolveArgs(
        arguments,
        'newState', function (x) { return Imm.Map.isMap(x) ? 'newMetaState' : null; }, '?options'
      );

      var effectiveOptions = args.options || {};

      var tx = this.getBinding().atomically();
      tx.set(newState);

      if (args.newMetaState) tx.set(this.getMetaBinding(), args.newMetaState);

      tx.commit({ notify: effectiveOptions.notify });
    }
1056946
public Transition<S> getTransition(S fromState, T transition){
		Transition<S> transitionDef = transitions.get(new DoubleValueBean<S, T>(fromState, transition));
		if (transitionDef == null){
			throw new IllegalArgumentException("Transition '" + transition + "' from state '" + fromState + "' has not been defined.");
		}
		return transitionDef;
	}
765883
def transition_to_add(self):
        """"""
        assert self.state in [AQStateMachineStates.init, AQStateMachineStates.add]
        self.state = AQStateMachineStates.add
1099646
public function createTransition(StateInterface $sourceState, StateInterface $targetState, $eventName = null, ConditionInterface $condition = null)
    {
        return new Transition($targetState, $eventName, $condition);
    }
1066170
public void setTransitions(int state,
                               int inputIdx,
                               Collection<? extends Integer> successors) { // TODO: replace by primitive specialization
        int transIdx = toMemoryIndex(state, inputIdx);
        //TIntSet succs = transitions[transIdx];
        Set<Integer> succs = transitions[transIdx]; // TODO: replace by primitive specialization
        if (succs == null) {
            //succs = new TIntHashSet(successors);
            succs = Sets.newHashSetWithExpectedSize(successors.size()); // TODO: replace by primitive specialization
            transitions[transIdx] = succs;
        } else {
            succs.clear();
        }
        succs.addAll(successors);
    }
1068820
protected void createRenewCheckActionState(final Flow flow) {
        val action = createActionState(flow, CasWebflowConstants.STATE_ID_RENEW_REQUEST_CHECK, CasWebflowConstants.ACTION_ID_RENEW_AUTHN_REQUEST);
        createTransitionForState(action, CasWebflowConstants.TRANSITION_ID_PROCEED, CasWebflowConstants.STATE_ID_GENERATE_SERVICE_TICKET);
        createTransitionForState(action, CasWebflowConstants.TRANSITION_ID_RENEW, CasWebflowConstants.STATE_ID_SERVICE_AUTHZ_CHECK);
        createStateDefaultTransition(action, CasWebflowConstants.STATE_ID_SERVICE_AUTHZ_CHECK);
    }
885506
protected void createLogoutViewState(final Flow flow) {
        val logoutView = createEndState(flow, CasWebflowConstants.STATE_ID_LOGOUT_VIEW, "casLogoutView");
        logoutView.getEntryActionList().add(createEvaluateAction(CasWebflowConstants.ACTION_ID_LOGOUT_VIEW_SETUP));
    }
554439
private void setState(final EvaluatorState toState) {
    while (true) {

      final EvaluatorState fromState = this.state.get();
      if (fromState == toState) {
        break;
      }

      if (!fromState.isLegalTransition(toState)) {
        LOG.log(Level.WARNING, "Illegal state transition: {0} -> {1}", new Object[] {fromState, toState});
        throw new IllegalStateException("Illegal state transition: " + fromState + " -> " + toState);
      }

      if (this.state.compareAndSet(fromState, toState)) {
        break;
      }
    }
  }
894630
protected void createTerminateSessionAction(final Flow flow) {
        val terminateSession = createActionState(flow,
            CasWebflowConstants.STATE_ID_TERMINATE_SESSION, createEvaluateAction(CasWebflowConstants.ACTION_ID_TERMINATE_SESSION));
        createStateDefaultTransition(terminateSession, CasWebflowConstants.STATE_ID_GATEWAY_REQUEST_CHECK);
    }
749039
private function transition(TransitionalStateInterface $fromState, EventInterface $event)
    {
        if ($fromState instanceof StateActionInterface) {
            $exitEvent = $fromState->getExitEvent();
            if ($exitEvent !== null) {
                if ($this->eventDispatcher !== null) {
                    $this->eventDispatcher->dispatch(StateMachineEvents::EVENT_EXIT, new StateMachineEvent($this, $fromState, $exitEvent));
                }

                $this->runAction($exitEvent);
            }
        }

        $transition = $this->getTransition($fromState, $event);
        $transition->setToken($fromState->getToken());
        $this->previousState = $fromState;
        $this->currentState = null;
        if ($this->eventDispatcher !== null) {
            $this->eventDispatcher->dispatch(StateMachineEvents::EVENT_TRANSITION, new StateMachineEvent($this, null, $event, $transition));
        }
        $this->runAction($event, $transition);
        $transition->getToState()->setToken($transition->getToken());
        $toState = $this->stateCollection->getCurrentState();
        $this->currentState = $toState;
        $this->transitionLog[] = $this->createTransitionLogEntry($transition);

        if ($toState instanceof StateActionInterface) {
            $entryEvent = $toState->getEntryEvent();
            if ($entryEvent !== null) {
                if ($this->eventDispatcher !== null) {
                    $this->eventDispatcher->dispatch(StateMachineEvents::EVENT_ENTRY, new StateMachineEvent($this, $toState, $entryEvent));
                }

                $this->runAction($entryEvent);
            }
        }
    }
706039
protected void createLogoutConfirmationView(final Flow flow) {
        val view = createViewState(flow, CasWebflowConstants.STATE_ID_CONFIRM_LOGOUT_VIEW, "casConfirmLogoutView");
        createTransitionForState(view, CasWebflowConstants.TRANSITION_ID_SUCCESS, CasWebflowConstants.STATE_ID_TERMINATE_SESSION);
    }
991244
def transition_to_execute(self):
        """"""
        assert self.state in [AQStateMachineStates.add]
        self.state = AQStateMachineStates.execute
1121046
public void createStateDefaultTransition(final TransitionableState state, final String targetState) {
        if (state == null) {
            LOGGER.trace("Cannot add default transition of [{}] to the given state is null and cannot be found in the flow.", targetState);
            return;
        }
        val transition = createTransition(targetState);
        state.getTransitionSet().add(transition);
    }
739044
private void moveCriteriaIntoOnClause( PlanNode criteriaNode,
                                           PlanNode joinNode ) {
        List<Constraint> constraints = joinNode.getPropertyAsList(Property.JOIN_CONSTRAINTS, Constraint.class);
        Constraint criteria = criteriaNode.getProperty(Property.SELECT_CRITERIA, Constraint.class);

        // since the parser uses EMPTY_LIST, check for size 0 also
        if (constraints == null || constraints.isEmpty()) {
            constraints = new LinkedList<Constraint>();
            joinNode.setProperty(Property.JOIN_CONSTRAINTS, constraints);
        }

        if (!constraints.contains(criteria)) {
            constraints.add(criteria);
            if (criteriaNode.hasBooleanProperty(Property.IS_DEPENDENT)) {
                joinNode.setProperty(Property.IS_DEPENDENT, Boolean.TRUE);
            }
        }
        criteriaNode.extractFromParent();
    }
1372637
public IBaseOperationOutcome toOperationOutcome() {
		IBaseOperationOutcome oo = (IBaseOperationOutcome) myCtx.getResourceDefinition("OperationOutcome").newInstance();
		populateOperationOutcome(oo);
		return oo;
	}