本文整理汇总了Java中org.jbpm.graph.def.Transition类的典型用法代码示例。如果您正苦于以下问题:Java Transition类的具体用法?Java Transition怎么用?Java Transition使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Transition类属于org.jbpm.graph.def包,在下文中一共展示了Transition类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: retrieveProcessDefinition
import org.jbpm.graph.def.Transition; //导入依赖的package包/类
@SuppressWarnings("rawtypes")
public ProcessDefinition retrieveProcessDefinition(ProcessDefinition pd)
{
try
{
pd.getName();
// often needed to start a process:
Iterator iter = pd.getStartState().getLeavingTransitions().iterator();
while (iter.hasNext())
{
Transition t = (Transition)iter.next();
t.getName();
}
}
catch (Exception ex)
{
log.warn("exception while retrieving process instance data for process definiton " + pd.getName(), ex);
}
return pd;
}
示例2: signal
import org.jbpm.graph.def.Transition; //导入依赖的package包/类
/**
* Provides a signal to the token.
* This leave the current state over the given transition name.
*/
public void signal(String transitionName)
{
if (node == null)
throw new JbpmException("token '" + this + "' can't be signalled cause it is currently not positioned in a node");
Transition leavingTransition = node.getLeavingTransition(transitionName);
if (leavingTransition == null)
{
// Fall back to the name of the target node
for (Transition auxTrans : node.getLeavingTransitions())
{
if (transitionName.equals(auxTrans.getTo().getName()))
{
leavingTransition = auxTrans;
break;
}
}
}
if (leavingTransition == null)
throw new JbpmException("transition '" + transitionName + "' does not exist on " + node);
signal(leavingTransition, new ExecutionContext(this));
}
示例3: NodeInfo
import org.jbpm.graph.def.Transition; //导入依赖的package包/类
public NodeInfo(
long id,
String name,
String description,
ProcessDefinition processDefinition,
List<Transition> leavingTransitions,
Set<Transition> arrivingTransitions,
Action action,
boolean isAsync,
boolean isAsyncExclusive) {
super();
this.id = id;
this.name = name;
this.description = description;
this.processDefinition = processDefinition;
this.leavingTransitions = leavingTransitions;
this.arrivingTransitions = arrivingTransitions;
this.action = action;
this.isAsync = isAsync;
this.isAsyncExclusive = isAsyncExclusive;
}
示例4: createWorkflowTransition
import org.jbpm.graph.def.Transition; //导入依赖的package包/类
/**
* Create a Workflow Transition
*
* @param transition
* JBoss JBPM Transition
* @return Workflow Transition
*/
protected WorkflowTransition createWorkflowTransition(Transition transition)
{
if(transition==null)
return null;
String id = transition.getName();
Node node = transition.getFrom();
boolean isDefault = node.getDefaultLeavingTransition().equals(transition);
String title;
String description;
if (id == null || id.length() == 0)
{
title = getLabel(DEFAULT_TRANSITION_LABEL, TITLE_LABEL, id);
description = getLabel(DEFAULT_TRANSITION_LABEL, DESC_LABEL, title);
}
else
{
String nodeName = node.getName();
String processName = node.getProcessDefinition().getName();
title = getLabel(processName + ".node." + nodeName + ".transition." + id, TITLE_LABEL, id);
description = getLabel(processName + ".node." + nodeName + ".transition." + id, DESC_LABEL, title);
}
return new WorkflowTransition(id, title, description, isDefault);
}
示例5: findReplacementTransition
import org.jbpm.graph.def.Transition; //导入依赖的package包/类
private Transition findReplacementTransition(ProcessDefinition newDef, Transition oldTransition) {
Transition newTransition = null;
Node newNodeFrom = findReplacementNode(newDef, oldTransition.getFrom());
if (newNodeFrom != null) {
Node newNodeTo = findReplacementNode(newDef, oldTransition.getTo());
if (newNodeTo != null) {
Query q = session.createQuery(
"from org.jbpm.graph.def.Transition t "
+ "where t.from = :nodeFrom "
+ " and t.to = :nodeTo");
q.setEntity("nodeFrom", newNodeFrom);
q.setEntity("nodeTo", newNodeTo);
List<Transition> transicions = (List<Transition>)q.list();
if (!transicions.isEmpty()) {
if (transicions.size() == 1)
newTransition = transicions.get(0);
else {
for (Transition t: transicions) {
if (oldTransition.getName() == null) {
if (t.getName() == null)
newTransition = t;
} else if (t.getName() != null && t.getName().equals(oldTransition.getName())) {
newTransition = t;
break;
}
}
}
}
}
}
return newTransition;
}
示例6: setLogTransition
import org.jbpm.graph.def.Transition; //导入依赖的package包/类
private void setLogTransition(TransitionLog log, Transition transition) {
Query updateQuery = getJbpmContext().getSession().createQuery(
"update org.jbpm.graph.log.TransitionLog set "
+ "transition = :transition, "
+ "sourceNode = :nodeFrom, "
+ "destinationNode = :nodeTo "
+ "where id = :logId");
updateQuery.setEntity("transition", transition);
updateQuery.setEntity("nodeFrom", transition.getFrom());
updateQuery.setEntity("nodeTo", transition.getTo());
updateQuery.setLong("logId", log.getId());
updateQuery.executeUpdate();
}
示例7: setLogSignal
import org.jbpm.graph.def.Transition; //导入依赖的package包/类
private void setLogSignal(SignalLog log, Transition transition) {
Query updateQuery = getJbpmContext().getSession().createQuery(
"update org.jbpm.graph.log.SignalLog set "
+ "transition = :transition "
+ "where id = :logId");
updateQuery.setEntity("transition", transition);
updateQuery.setLong("logId", log.getId());
updateQuery.executeUpdate();
}
示例8: findReplacementTransition
import org.jbpm.graph.def.Transition; //导入依赖的package包/类
private Transition findReplacementTransition(ProcessDefinition newDef, Transition oldTransition) {
Transition newTransition = null;
Node newNodeFrom = findReplacementNode(newDef, oldTransition.getFrom());
if (newNodeFrom != null) {
Node newNodeTo = findReplacementNode(newDef, oldTransition.getTo());
if (newNodeTo != null) {
Query q = getJbpmContext().getSession().createQuery(
"from org.jbpm.graph.def.Transition t "
+ "where t.from = :nodeFrom "
+ " and t.to = :nodeTo");
q.setEntity("nodeFrom", newNodeFrom);
q.setEntity("nodeTo", newNodeTo);
List<Transition> transicions = (List<Transition>)q.list();
if (!transicions.isEmpty()) {
if (transicions.size() == 1)
newTransition = transicions.get(0);
else {
for (Transition t: transicions) {
if (oldTransition.getName() == null) {
if (t.getName() == null)
newTransition = t;
} else if (t.getName() != null && t.getName().equals(oldTransition.getName())) {
newTransition = t;
break;
}
}
}
}
}
}
if (newTransition == null) {
throw new JbpmException("Transition for nodes from='" + oldTransition.getFrom().getName() +
"' and to='" + oldTransition.getTo().getName() + "' not found in new process definition");
}
return newTransition;
}
示例9: signal
import org.jbpm.graph.def.Transition; //导入依赖的package包/类
/**
* instructs the main path of execution to continue by taking the specified transition on the current node.
*
* @throws IllegalStateException if the token is not active.
*/
public void signal(Transition transition)
{
if (hasEnded())
{
throw new IllegalStateException("couldn't signal token : token has ended");
}
rootToken.signal(transition);
}
示例10: addAvailableTransitionsOfNode
import org.jbpm.graph.def.Transition; //导入依赖的package包/类
/**
* adds available transitions of that node to the Set and after that calls itself recursivly for the SuperSate of the
* Node if it has a super state
*/
private void addAvailableTransitionsOfNode(Node currentNode, Set availableTransitions)
{
List leavingTransitions = currentNode.getLeavingTransitions();
if (leavingTransitions != null)
{
Iterator iter = leavingTransitions.iterator();
while (iter.hasNext())
{
Transition transition = (Transition)iter.next();
String conditionExpression = transition.getCondition();
if (conditionExpression != null)
{
Object result = JbpmExpressionEvaluator.evaluate(conditionExpression, new ExecutionContext(this));
if ((result instanceof Boolean) && (((Boolean)result).booleanValue()))
{
availableTransitions.add(transition);
}
}
else
{
availableTransitions.add(transition);
}
}
}
if (currentNode.getSuperState() != null)
{
addAvailableTransitionsOfNode(currentNode.getSuperState(), availableTransitions);
}
}
示例11: findStartTaskOutcomes
import org.jbpm.graph.def.Transition; //导入依赖的package包/类
public List<String> findStartTaskOutcomes(String jbpmId, String taskName) {
//adminService.mesuraIniciar("jBPM findStartTaskOutcomes", "jbpmDao");
List<String> resultat = new ArrayList<String>();
final long pdid = Long.parseLong(jbpmId);
GetProcessDefinitionByIdCommand command = new GetProcessDefinitionByIdCommand(pdid);
ProcessDefinition processDefinition = (ProcessDefinition)commandService.execute(command);
org.jbpm.taskmgmt.def.Task task = processDefinition.getTaskMgmtDefinition().getTask(taskName);
if (task != null) {
for (Transition transition: (List<Transition>)task.getStartState().getLeavingTransitions())
resultat.add(transition.getName());
}
//adminService.mesuraCalcular("jBPM findStartTaskOutcomes", "jbpmDao");
return resultat;
}
示例12: findTaskInstanceOutcomes
import org.jbpm.graph.def.Transition; //导入依赖的package包/类
public List<String> findTaskInstanceOutcomes(String taskInstanceId) {
//adminService.mesuraIniciar("jBPM findTaskInstanceOutcomes", "jbpmDao");
List<String> resultat = new ArrayList<String>();
final long id = Long.parseLong(taskInstanceId);
GetTaskInstanceCommand command = new GetTaskInstanceCommand(id);
TaskInstance taskInstance = (TaskInstance)commandService.execute(command);
List<Transition> outcomes = (List<Transition>)taskInstance.getTask().getTaskNode().getLeavingTransitions();
if (outcomes != null) {
for (Transition transition: outcomes)
resultat.add(transition.getName());
}
//adminService.mesuraCalcular("jBPM findTaskInstanceOutcomes", "jbpmDao");
return resultat;
}
示例13: execute
import org.jbpm.graph.def.Transition; //导入依赖的package包/类
public Object execute(JbpmContext jbpmContext) throws Exception {
List<String> resposta = new ArrayList<String>();
Token token = jbpmContext.getToken(id);
if (token != null) {
Node node = token.getNode();
if (!node.getNodeType().equals(NodeType.Join)) {
for (Transition transition: token.getNode().getArrivingTransitions())
resposta.add(transition.getFrom().getName());
} else {
int joinsLeft = 1;
Node parentNode = node;
do {
Set<Transition> arrivingTransitions = parentNode.getArrivingTransitions();
if (arrivingTransitions != null && arrivingTransitions.size() > 0) {
parentNode = arrivingTransitions.iterator().next().getFrom();
if (parentNode.getNodeType().equals(NodeType.Fork))
joinsLeft--;
} else {
break;
}
} while(joinsLeft > 0);
if (joinsLeft == 0)
resposta.add(parentNode.getName());
}
}
return resposta;
}
示例14: toTransitionInfo
import org.jbpm.graph.def.Transition; //导入依赖的package包/类
public static TransitionInfo toTransitionInfo(Transition transition) {
if (transition == null)
return null;
return new TransitionInfo(
transition.getId(),
transition.getName(),
transition.getDescription(),
transition.getFrom(),
transition.getTo(),
transition.getCondition());
}
示例15: getLeavingTransitions
import org.jbpm.graph.def.Transition; //导入依赖的package包/类
public List<TransitionInfo> getLeavingTransitions() {
List<TransitionInfo> leavingTransitionsInfo = new ArrayList<TransitionInfo>();
for (Transition t: leavingTransitions) {
leavingTransitionsInfo.add(ConversioTipusInfoHelper.toTransitionInfo(t));
}
return leavingTransitionsInfo;
}