本文整理汇总了Java中org.activiti.engine.impl.pvm.PvmTransition.getDestination方法的典型用法代码示例。如果您正苦于以下问题:Java PvmTransition.getDestination方法的具体用法?Java PvmTransition.getDestination怎么用?Java PvmTransition.getDestination使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.activiti.engine.impl.pvm.PvmTransition
的用法示例。
在下文中一共展示了PvmTransition.getDestination方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: findFirstActivity
import org.activiti.engine.impl.pvm.PvmTransition; //导入方法依赖的package包/类
/**
* 获得第一个节点.
*/
public PvmActivity findFirstActivity(String processDefinitionId) {
ProcessDefinitionEntity processDefinitionEntity = Context
.getProcessEngineConfiguration().getProcessDefinitionCache()
.get(processDefinitionId);
ActivityImpl startActivity = processDefinitionEntity.getInitial();
if (startActivity.getOutgoingTransitions().size() != 1) {
throw new IllegalStateException(
"start activity outgoing transitions cannot more than 1, now is : "
+ startActivity.getOutgoingTransitions().size());
}
PvmTransition pvmTransition = startActivity.getOutgoingTransitions()
.get(0);
PvmActivity targetActivity = pvmTransition.getDestination();
if (!"userTask".equals(targetActivity.getProperty("type"))) {
logger.debug("first activity is not userTask, just skip");
return null;
}
return targetActivity;
}
示例2: getPreviousActivities
import org.activiti.engine.impl.pvm.PvmTransition; //导入方法依赖的package包/类
public List<PvmActivity> getPreviousActivities(PvmActivity pvmActivity) {
List<PvmActivity> pvmActivities = new ArrayList<PvmActivity>();
for (PvmTransition pvmTransition : pvmActivity.getIncomingTransitions()) {
PvmActivity targetActivity = pvmTransition.getDestination();
if ("userTask".equals(targetActivity.getProperty("type"))) {
pvmActivities.add(targetActivity);
} else {
pvmActivities
.addAll(this.getPreviousActivities(targetActivity));
}
}
return pvmActivities;
}
示例3: findNextUserTask
import org.activiti.engine.impl.pvm.PvmTransition; //导入方法依赖的package包/类
/**
* 递归查找下一个用户任务
*
* @param tranistion
* @return
*/
public List<PvmActivity> findNextUserTask(PvmTransition tranistion) {
List<PvmActivity> activities = new ArrayList<>();
PvmActivity nextActivity = tranistion.getDestination();
if (nextActivity == null)
return activities;
else if ("userTask".equals(nextActivity.getProperty("type"))) {
activities.add(nextActivity);
return activities;
} else {
List<PvmTransition> transitions = nextActivity.getOutgoingTransitions();
for (PvmTransition transition1 : transitions) {
activities.addAll(findNextUserTask(transition1));
}
return activities;
}
}
示例4: findUserTasks
import org.activiti.engine.impl.pvm.PvmTransition; //导入方法依赖的package包/类
private void findUserTasks(PvmActivity currentActivity, Map<String, PvmActivity> userTasks, Set<String> processedActivities)
{
// Only process activity if not already processed, to prevent endless loops
if(!processedActivities.contains(currentActivity.getId()))
{
processedActivities.add(currentActivity.getId());
if(isUserTask(currentActivity))
{
userTasks.put(currentActivity.getId(), currentActivity);
}
// Process outgoing transitions
if(currentActivity.getOutgoingTransitions() != null)
{
for(PvmTransition transition : currentActivity.getOutgoingTransitions())
{
if(transition.getDestination() != null)
{
findUserTasks(transition.getDestination(), userTasks, processedActivities);
}
}
}
}
}
示例5: nextActivityImpl
import org.activiti.engine.impl.pvm.PvmTransition; //导入方法依赖的package包/类
/**
* 该服务的私有方法 根据当前节点的底层定义对象,获取所有 当前节点的出线和出线终点,并返回封装后的集合 开发时间:2013-11-29
*
* @param currentTaskDef
* 当前节点的底层定义
* @return 节点的出线和出线终点的集合,出线作为key,终点定义对象作为value
*/
public Map<PvmTransition, ActivityImpl> nextActivityImpl(
ActivityImpl currentTaskDef) {
Map<PvmTransition, ActivityImpl> result = new HashMap<PvmTransition, ActivityImpl>();
List<PvmTransition> outTransitions = currentTaskDef
.getOutgoingTransitions();
for (PvmTransition tr : outTransitions) {
PvmActivity ac = tr.getDestination(); // 获取线路的终点节点
String type = ac.getProperty("type").toString();
// 过滤掉回退的线,只保留向前流转的线
Object pvmTransitionType = tr.getProperty("conditionText");
Object pvmTransitionName = tr.getProperty("name");
if (type.equals("userTask")) {
ActivityImpl nextTaskImpl = (ActivityImpl) ac;
result.put(tr, nextTaskImpl);
}
}
return result;
}
示例6: findUserTasks
import org.activiti.engine.impl.pvm.PvmTransition; //导入方法依赖的package包/类
private void findUserTasks(PvmActivity currentActivity, Map<String, PvmActivity> userTasks, Set<String> processedActivities)
{
// Only process activity if not already processed, to prevent endless loops
if(!processedActivities.contains(currentActivity.getId()))
{
processedActivities.add(currentActivity.getId());
if(isUserTask(currentActivity))
{
userTasks.put(currentActivity.getId(), currentActivity);
}
// Process outgoing transitions
if(currentActivity.getOutgoingTransitions() != null)
{
for(PvmTransition transition : currentActivity.getOutgoingTransitions())
{
if(transition.getDestination() != null)
{
findUserTasks(transition.getDestination(), userTasks, processedActivities);
}
}
}
if (isSubProcess(currentActivity))
{
Map<String, Object> properties = ((ActivityImpl)currentActivity).getProperties();
PvmActivity startEvent = (PvmActivity) properties.get(ActivitiConstants.PROP_INITIAL_ACTIVITY);
findUserTasks(startEvent, userTasks, processedActivities);
}
}
}
示例7: findFirstUserTaskActivityId
import org.activiti.engine.impl.pvm.PvmTransition; //导入方法依赖的package包/类
/**
* 获得提交节点
*/
public String findFirstUserTaskActivityId(String processDefinitionId,
String initiator) {
GetDeploymentProcessDefinitionCmd getDeploymentProcessDefinitionCmd = new GetDeploymentProcessDefinitionCmd(
processDefinitionId);
ProcessDefinitionEntity processDefinitionEntity = processEngine
.getManagementService().executeCommand(
getDeploymentProcessDefinitionCmd);
ActivityImpl startActivity = processDefinitionEntity.getInitial();
if (startActivity.getOutgoingTransitions().size() != 1) {
throw new IllegalStateException(
"start activity outgoing transitions cannot more than 1, now is : "
+ startActivity.getOutgoingTransitions().size());
}
PvmTransition pvmTransition = startActivity.getOutgoingTransitions()
.get(0);
PvmActivity targetActivity = pvmTransition.getDestination();
if (!"userTask".equals(targetActivity.getProperty("type"))) {
logger.info("first activity is not userTask, just skip");
return null;
}
return targetActivity.getId();
}
示例8: getNextActivities
import org.activiti.engine.impl.pvm.PvmTransition; //导入方法依赖的package包/类
public List<PvmActivity> getNextActivities(PvmActivity pvmActivity) {
List<PvmActivity> pvmActivities = new ArrayList<PvmActivity>();
for (PvmTransition pvmTransition : pvmActivity.getOutgoingTransitions()) {
PvmActivity targetActivity = pvmTransition.getDestination();
if ("userTask".equals(targetActivity.getProperty("type"))) {
pvmActivities.add(targetActivity);
} else {
pvmActivities.addAll(this.getNextActivities(targetActivity));
}
}
return pvmActivities;
}
示例9: visitNode
import org.activiti.engine.impl.pvm.PvmTransition; //导入方法依赖的package包/类
/**
* 遍历.
*/
public Node visitNode(PvmActivity pvmActivity) {
if (visitedNodeIds.contains(pvmActivity.getId())) {
return null;
}
visitedNodeIds.add(pvmActivity.getId());
Node currentNode = new Node();
currentNode.setId(pvmActivity.getId());
currentNode.setName(this.getString(pvmActivity.getProperty("name")));
currentNode.setType(this.getString(pvmActivity.getProperty("type")));
for (PvmTransition pvmTransition : pvmActivity.getOutgoingTransitions()) {
PvmActivity destination = pvmTransition.getDestination();
Node targetNode = this.visitNode(destination);
if (targetNode == null) {
continue;
}
Edge edge = new Edge();
edge.setId(pvmTransition.getId());
edge.setSrc(currentNode);
edge.setDest(targetNode);
currentNode.getOutgoingEdges().add(edge);
}
return currentNode;
}
示例10: getTaskDefinition
import org.activiti.engine.impl.pvm.PvmTransition; //导入方法依赖的package包/类
@Override
public List<TaskDefinition> getTaskDefinition(ActivityImpl activityImpl, String elString) {
List<TaskDefinition> taskDefinitionList = new ArrayList<>();
List<TaskDefinition> nextTaskDefinition;
if ("userTask".equals(activityImpl.getProperty("type"))) {
TaskDefinition taskDefinition = ((UserTaskActivityBehavior) activityImpl.getActivityBehavior()).getTaskDefinition();
taskDefinitionList.add(taskDefinition);
} else {
List<PvmTransition> pvmTransitions = activityImpl.getOutgoingTransitions();
List<PvmTransition> outTransitionsTemp;
for (PvmTransition tr : pvmTransitions) {
PvmActivity pvmActivity = tr.getDestination(); //获取线路的终点节点
if ("exclusiveGateway".equals(pvmActivity.getProperty("type")) || "parallelGateway".equals(pvmActivity.getProperty("type"))) {
outTransitionsTemp = pvmActivity.getOutgoingTransitions();
if (outTransitionsTemp.size() == 1) {
nextTaskDefinition = getTaskDefinition((ActivityImpl) outTransitionsTemp.get(0).getDestination(), elString);
taskDefinitionList.addAll(nextTaskDefinition);
} else if (outTransitionsTemp.size() > 1) {
for (PvmTransition tr1 : outTransitionsTemp) {
Object s = tr1.getProperty("conditionText");
if (elString.equals(s.toString().trim())) {
nextTaskDefinition = getTaskDefinition((ActivityImpl) tr1.getDestination(), elString);
taskDefinitionList.addAll(nextTaskDefinition);
}
}
}
} else if ("userTask".equals(pvmActivity.getProperty("type"))) {
taskDefinitionList.add(((UserTaskActivityBehavior) ((ActivityImpl) pvmActivity).getActivityBehavior()).getTaskDefinition());
}
}
}
return taskDefinitionList;
}
示例11: getHighLightedFlows
import org.activiti.engine.impl.pvm.PvmTransition; //导入方法依赖的package包/类
/**
* 获取需要高亮的线,如果其他方法需要调用 重构到RuntimePageService
*
* @param processDefinitionEntity
* @param historicActivityInstances
* @return
*/
private List<String> getHighLightedFlows(ProcessDefinitionEntity processDefinitionEntity,
List<HistoricActivityInstance> historicActivityInstances) {
List<String> highFlows = new ArrayList<>();// 用以保存高亮的线flowId
for (int i = 0; i < historicActivityInstances.size() - 1; i++) {// 对历史流程节点进行遍历
ActivityImpl activityImpl = processDefinitionEntity.findActivity(historicActivityInstances.get(i)
.getActivityId());// 得到节点定义的详细信息
List<ActivityImpl> sameStartTimeNodes = new ArrayList<>();// 用以保存后需开始时间相同的节点
ActivityImpl sameActivityImpl1 = processDefinitionEntity.findActivity(historicActivityInstances.get(i + 1)
.getActivityId());
// 将后面第一个节点放在时间相同节点的集合里
sameStartTimeNodes.add(sameActivityImpl1);
for (int j = i + 1; j < historicActivityInstances.size() - 1; j++) {
HistoricActivityInstance activityImpl1 = historicActivityInstances.get(j);// 后续第一个节点
HistoricActivityInstance activityImpl2 = historicActivityInstances.get(j + 1);// 后续第二个节点
//if (activityImpl1.getStartTime().equals(activityImpl2.getStartTime())) {
// 如果第一个节点和第二个节点开始时间相同保存
ActivityImpl sameActivityImpl2 = processDefinitionEntity.findActivity(activityImpl2.getActivityId
());
sameStartTimeNodes.add(sameActivityImpl2);
/*} else {
// 有不相同跳出循环
break;
}*/
}
List<PvmTransition> pvmTransitions = activityImpl.getOutgoingTransitions();// 取出节点的所有出去的线
for (PvmTransition pvmTransition : pvmTransitions) {
// 对所有的线进行遍历
ActivityImpl pvmActivityImpl = (ActivityImpl) pvmTransition.getDestination();
// 如果取出的线的目标节点存在时间相同的节点里,保存该线的id,进行高亮显示
if (sameStartTimeNodes.contains(pvmActivityImpl)) {
highFlows.add(pvmTransition.getId());
}
}
}
return highFlows;
}
示例12: isReachable
import org.activiti.engine.impl.pvm.PvmTransition; //导入方法依赖的package包/类
protected boolean isReachable(PvmActivity srcActivity, PvmActivity targetActivity, Set<PvmActivity> visitedActivities) {
if (srcActivity.equals(targetActivity)) {
return true;
}
// To avoid infinite looping, we must capture every node we visit
// and check before going further in the graph if we have already visitied the node.
visitedActivities.add(srcActivity);
List<PvmTransition> transitionList = srcActivity.getOutgoingTransitions();
if(transitionList != null && transitionList.size() > 0) {
for (PvmTransition pvmTransition : transitionList) {
PvmActivity destinationActivity = pvmTransition.getDestination();
if(destinationActivity != null && !visitedActivities.contains(destinationActivity)) {
boolean reachable = isReachable(destinationActivity, targetActivity, visitedActivities);
// If false, we should investigate other paths, and not yet return the result
if(reachable) {
return true;
}
}
}
}
return false;
}
示例13: addEGTasks
import org.activiti.engine.impl.pvm.PvmTransition; //导入方法依赖的package包/类
private void addEGTasks(List<String> sarr, List<PvmTransition> outs) {
for (PvmTransition out : outs) {
PvmActivity act = out.getDestination();
String type = (String) act.getProperty("type");
if (type.endsWith("Task")) {
sarr.add((String) act.getProperty("name"));
} else {
System.err.println("RhoAutoRunner: addEGTasks meet wrong type of exclusive gateway, ignored.");
}
}
}
示例14: execute
import org.activiti.engine.impl.pvm.PvmTransition; //导入方法依赖的package包/类
public FirstTaskForm execute(CommandContext commandContext) {
ProcessDefinitionEntity processDefinitionEntity = Context
.getProcessEngineConfiguration().getDeploymentManager()
.findDeployedProcessDefinitionById(processDefinitionId);
if (processDefinitionEntity == null) {
throw new IllegalArgumentException(
"cannot find processDefinition : " + processDefinitionId);
}
if (processDefinitionEntity.hasStartFormKey()) {
return this.findStartEventForm(processDefinitionEntity);
}
ActivityImpl startActivity = processDefinitionEntity.getInitial();
if (startActivity.getOutgoingTransitions().size() != 1) {
throw new IllegalStateException(
"start activity outgoing transitions cannot more than 1, now is : "
+ startActivity.getOutgoingTransitions().size());
}
PvmTransition pvmTransition = startActivity.getOutgoingTransitions()
.get(0);
PvmActivity targetActivity = pvmTransition.getDestination();
if (!"userTask".equals(targetActivity.getProperty("type"))) {
logger.info("first activity is not userTask, just skip");
return new FirstTaskForm();
}
FirstTaskForm firstTaskForm = new FirstTaskForm();
firstTaskForm.setProcessDefinitionId(processDefinitionId);
firstTaskForm.setExists(true);
firstTaskForm.setTaskForm(true);
String taskDefinitionKey = targetActivity.getId();
logger.debug("activityId : {}", targetActivity.getId());
firstTaskForm.setActivityId(taskDefinitionKey);
TaskDefinition taskDefinition = processDefinitionEntity
.getTaskDefinitions().get(taskDefinitionKey);
Expression expression = taskDefinition.getAssigneeExpression();
if (expression != null) {
String expressionText = expression.getExpressionText();
logger.debug("{}", expressionText);
logger.debug("{}", startActivity.getProperties());
logger.debug("{}", processDefinitionEntity.getProperties());
firstTaskForm.setAssignee(expressionText);
} else {
logger.info("cannot find expression : {}, {}", processDefinitionId,
taskDefinitionKey);
}
String initiatorVariableName = (String) processDefinitionEntity
.getProperty(BpmnParse.PROPERTYNAME_INITIATOR_VARIABLE_NAME);
firstTaskForm.setInitiatorName(initiatorVariableName);
DefaultFormHandler formHandler = (DefaultFormHandler) taskDefinition
.getTaskFormHandler();
if (formHandler.getFormKey() != null) {
String formKey = formHandler.getFormKey().getExpressionText();
firstTaskForm.setFormKey(formKey);
} else {
logger.info("cannot find formKey from xml : {}, {}",
processDefinitionId, taskDefinitionKey);
}
return firstTaskForm;
}