Creates a new instance of the WorkTransationInstance entity

@param transition
@param pProcessInstId
@return WorkTransitionInstance object
554375
public TransitionInstance createTransitionInstance(Transition transition, Long pProcessInstId)
    throws DataAccessException {
        TransactionWrapper transaction=null;
        try {
            transaction = startTransaction();
            return engineImpl.createTransitionInstance(transition, pProcessInstId);
        } catch (DataAccessException e) {
            if (canRetryTransaction(e)) {
                transaction = (TransactionWrapper)initTransactionRetry(transaction);
                return ((ProcessExecutor)getTransactionRetrier()).createTransitionInstance(transition, pProcessInstId);
            }
            else
                throw e;
        } finally {
            stopTransaction(transaction);
        }
    }
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);
    }
970193
public static Event validateEventIdForMatchingTransitionInContext(final String eventId,
                                                                      final Optional<RequestContext> context,
                                                                      final Map<String, Object> attributes) {
        val attributesMap = new LocalAttributeMap<Object>(attributes);
        val event = new Event(eventId, eventId, attributesMap);

        return context.map(ctx -> {
            val def = ctx.getMatchingTransition(event.getId());
            if (def == null) {
                throw new AuthenticationException("Transition definition cannot be found for event " + event.getId());
            }
            return event;
        }).orElse(event);
    }
16071
public void addTransitionLogProbability(S fromPosition, S toPosition,
                                            double transitionLogProbability) {
        final Transition<S> transition = new Transition<>(fromPosition, toPosition);
        if (transitionLogProbabilities.containsKey(transition)) {
            throw new IllegalArgumentException("Transition has already been added.");
        }
        transitionLogProbabilities.put(transition, transitionLogProbability);
    }
949771
public function add(TransitionInterface $transition): self
    {
        $transitions = $this->internal_set->toArray();
        $transitions[] = $transition;

        return new static($transitions);
    }
1122636
def workflow_transition(self, issue, status_name):
        
        transitions = self.transitions(issue)
        for transition in transitions:
            if transition['to']['name'] == status_name:
                transition_id = transition['id']
                self.transition_issue(issue, transition_id)
                print "Changed status of issue %s to %s" % (issue.key, status_name)
                return True

        print "Unable to change status of issue %s to %s" % (issue.key, status_name)
1073370
public StateMachine<T> withTransition(T from, T to, T... moreTo) {
        transitions.put(from, EnumSet.of(to, moreTo));
        return this;
    }
418523
function(intent, isIntermediate) {
        try {
          return getTransitionByIntent.apply(this, arguments);
        } catch(e) {
          return new Transition(this, intent, null, e);
        }
      }
842363
public Transition getNextTransition(ExecutionElement currentElem, List<ExecutionElement> peerExecutionElements, ExecutionStatus currentStatus)
			throws IllegalTransitionException {
		final String method = "getNextTransition";

		if (logger.isLoggable(Level.FINE)) {
			logger.fine(method + " ,currentStatus=" + currentStatus);
		}

		Transition returnTransition = new TransitionImpl();

		ExecutionElement nextExecutionElement = null;

		List<TransitionElement> transitionElements = currentElem.getTransitionElements();

		// Check the transition elements first.
		if (!transitionElements.isEmpty()) {
			for (TransitionElement t : transitionElements) {
				logger.fine(method + " Trying to match next transition element: " + t);

				boolean isMatched = matchExitStatusAgainstOnAttribute(currentStatus.getExitStatus(), t);
				if (isMatched) {
					if (t instanceof Next) {
						Next next = (Next)t;
						nextExecutionElement = getExecutionElementFromId(peerExecutionElements, next.getTo());
						returnTransition.setNextExecutionElement(nextExecutionElement);
						break;
					} else {
						returnTransition.setTransitionElement(t);
					}
					return returnTransition;
				}
			}
		}

		// We've returned already if we matched a Stop, End or Fail
		if (nextExecutionElement == null) {
			if (currentStatus.getExtendedBatchStatus().equals(ExtendedBatchStatus.EXCEPTION_THROWN)) {
				logger.fine("Didn't match transition element, after exception thrown.  Need to fail job");
				returnTransition.setNoTransitionElementMatchAfterException();
				return returnTransition;
			} else {
				logger.fine("Didn't match transition element, check @next attribute now.");
				nextExecutionElement = getNextExecutionElemFromAttribute(peerExecutionElements, currentElem);
				returnTransition.setNextExecutionElement(nextExecutionElement);
			}
		}

		if (nextExecutionElement != null) {
			if (alreadyExecutedElements.containsKey(nextExecutionElement.getId())) {
				String errorMsg = "Execution loop detected !!!  Trying to re-execute execution element: " + nextExecutionElement.getId();
				logger.severe(errorMsg);
				throw new IllegalTransitionException(errorMsg);
			}

			if (!disallowDecisionLoopback) {
				// We allow repeating a decision
				if (!(nextExecutionElement instanceof Decision)) {
					alreadyExecutedElements.put(nextExecutionElement.getId(), nextExecutionElement);
				}
			} else {
				alreadyExecutedElements.put(nextExecutionElement.getId(), nextExecutionElement);
			}
			logger.fine(method + " Transitioning to next element id = " + nextExecutionElement.getId());
		} else {
			logger.fine(method + " There is no next execution element. Mark transition to show we're finished.");
			returnTransition.setFinishedTransitioning();
		}
		return returnTransition;
	}
1232905
@Transactional
	public ProcessInstance refreshProcessInstance(
			ProcessInstance processInstance) {
		log.debug("refreshProcessInstance");
		ProcessInstance ret =  m_entityManager.find(ProcessInstance.class, processInstance.getId());
		m_entityManager.refresh(ret);
		log.debug("\n{}",displayProcess(ret, 0));
		return ret;
	}
369376
public static function create(
        $object,
        StateLineStack $stateLineStack,
        Transition $transition
    ) {
        return new self(
            $object,
            $stateLineStack,
            $transition
        );
    }
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;
	}
874571
@Override
  public ExecutionEntity createSubProcessInstance(PvmProcessDefinition processDefinition, String businessKey, String caseInstanceId) {
    shouldQueryForSubprocessInstance = true;

    ExecutionEntity subProcessInstance = (ExecutionEntity) super.createSubProcessInstance(processDefinition, businessKey, caseInstanceId);

    // inherit the tenant-id from the process definition
    String tenantId = ((ProcessDefinitionEntity) processDefinition).getTenantId();
    if (tenantId != null) {
      subProcessInstance.setTenantId(tenantId);
    }
    else {
      // if process definition has no tenant id, inherit this process instance's tenant id
      subProcessInstance.setTenantId(this.tenantId);
    }

    fireHistoricActivityInstanceUpdate();

    return subProcessInstance;
  }
167410
public static PrincipalNameTransformer newPrincipalNameTransformer(final PrincipalTransformationProperties p) {
        val chain = new ChainingPrincipalNameTransformer();

        if (p.getGroovy().getLocation() != null) {
            val t = new GroovyPrincipalNameTransformer(p.getGroovy().getLocation());
            chain.addTransformer(t);
        }

        if (StringUtils.isNotBlank(p.getPattern())) {
            val t = new RegexPrincipalNameTransformer(p.getPattern());
            chain.addTransformer(t);
        }

        if (StringUtils.isNotBlank(p.getPrefix()) || StringUtils.isNotBlank(p.getSuffix())) {
            val t = new PrefixSuffixPrincipalNameTransformer();
            t.setPrefix(p.getPrefix());
            t.setSuffix(p.getSuffix());
            chain.addTransformer(t);
        } else {
            chain.addTransformer(new NoOpPrincipalNameTransformer());
        }

        if (p.getCaseConversion() == PrincipalTransformationProperties.CaseConversion.UPPERCASE) {
            val t = new ConvertCasePrincipalNameTransformer();
            t.setToUpperCase(true);
            chain.addTransformer(t);
        }

        if (p.getCaseConversion() == PrincipalTransformationProperties.CaseConversion.LOWERCASE) {
            val t = new ConvertCasePrincipalNameTransformer();
            t.setToUpperCase(false);
            chain.addTransformer(t);
        }

        return chain;
    }
816616
public function performTransition(WorkflowTransition $transition)
    {
        // first make sure that the transition is valid to execute!
        $action          = $this->CurrentAction();
        $allTransitions  = $action->BaseAction()->Transitions();

        $valid = $allTransitions->find('ID', $transition->ID);
        if (!$valid) {
            throw new Exception(
                sprintf(_t(
                    'WorkflowInstance.WORKFLOW_TRANSITION_EXCEPTION',
                    'Invalid transition state for action #%s'
                ), $action->ID)
            );
        }

        $action->actionComplete($transition);

        $definition = DataObject::get_by_id(WorkflowAction::class, $transition->NextActionID);
        $action = $definition->getInstanceForWorkflow();
        $action->WorkflowID   = $this->ID;
        $action->write();

        $this->CurrentActionID = $action->ID;
        $this->write();
        $this->components = array(); // manually clear the has_one cache

        $action->actionStart($transition);

        $transition->extend('onTransition');
        $this->execute();
    }
1170883
protected AbstractCreateMavenProjectsOperation createOperation() {
		return new AbstractCreateMavenProjectsOperation() {
			@SuppressWarnings("synthetic-access")
			@Override
			protected List<IProject> doCreateMavenProjects(IProgressMonitor progressMonitor) throws CoreException {
				final SubMonitor monitor = SubMonitor.convert(progressMonitor, 101);
				try {
					final List<IMavenProjectImportResult> results = MavenImportUtils.runFixedImportJob(
							true,
							getProjects(),
							getImportConfiguration(),
							new MavenProjectWorkspaceAssigner(getWorkingSets()),
							monitor.newChild(100));
					return toProjects(results);
				} finally {
					restorePom();
					monitor.done();
				}
			}
		};
	}
901137
protected function createTransition($state_name, array $transition_definition)
    {
        $target = $transition_definition['outgoing_state_name'];
        $guard_definition = $transition_definition['guard'];

        $guard = null;
        if ($guard_definition) {
            $guard = $this->service_locator->make(
                $guard_definition['class'],
                [
                    ':options' => $guard_definition['options'],
                ]
            );

            if (!$guard instanceof GuardInterface) {
                throw new RuntimeError(
                    sprintf(
                        "Given transition guard '%s' must implement: %s",
                        $guard_definition['class'],
                        GuardInterface::CLASS
                    )
                );
            }
        }

        return new Transition($state_name, $target, $guard);
    }