当前位置: 首页>>代码示例>>Java>>正文


Java PvmActivity类代码示例

本文整理汇总了Java中org.activiti.engine.impl.pvm.PvmActivity的典型用法代码示例。如果您正苦于以下问题:Java PvmActivity类的具体用法?Java PvmActivity怎么用?Java PvmActivity使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


PvmActivity类属于org.activiti.engine.impl.pvm包,在下文中一共展示了PvmActivity类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getFormKey

import org.activiti.engine.impl.pvm.PvmActivity; //导入依赖的package包/类
private String getFormKey(PvmActivity act)
{
    if(act instanceof ActivityImpl) 
    {
        ActivityImpl actImpl = (ActivityImpl) act;
        if (actImpl.getActivityBehavior() instanceof UserTaskActivityBehavior)        
        {
            UserTaskActivityBehavior uta = (UserTaskActivityBehavior) actImpl.getActivityBehavior();
            TaskFormHandler handler = uta.getTaskDefinition().getTaskFormHandler();
            if(handler != null && handler instanceof DefaultTaskFormHandler)
            {
                // We cast to DefaultTaskFormHandler since we do not configure our own
                return ((DefaultTaskFormHandler)handler).getFormKey().getExpressionText();
            }
            
        }
    }
    return null;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:20,代码来源:ActivitiWorkflowEngine.java

示例2: getTaskForTimer

import org.activiti.engine.impl.pvm.PvmActivity; //导入依赖的package包/类
private WorkflowTask getTaskForTimer(Job job, ProcessInstance processInstance, Execution jobExecution) 
{
    if (job instanceof TimerEntity) 
    {
        ReadOnlyProcessDefinition def = activitiUtil.getDeployedProcessDefinition(processInstance.getProcessDefinitionId());
        List<String> activeActivityIds = runtimeService.getActiveActivityIds(jobExecution.getId());
        
        if(activeActivityIds.size() == 1)
        {
            PvmActivity targetActivity = def.findActivity(activeActivityIds.get(0));
            if(targetActivity != null)
            {
                // Only get tasks of active activity is a user-task 
                String activityType = (String) targetActivity.getProperty(ActivitiConstants.NODE_TYPE);
                if(ActivitiConstants.USER_TASK_NODE_TYPE.equals(activityType))
                {
                    Task task = taskService.createTaskQuery().executionId(job.getExecutionId()).singleResult();
                    return typeConverter.convert(task);
                }
            }
        }
    }
    return null;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:25,代码来源:ActivitiWorkflowEngine.java

示例3: convert

import org.activiti.engine.impl.pvm.PvmActivity; //导入依赖的package包/类
/**
 * Convert a {@link ProcessDefinition} into a {@link WorkflowDefinition}.
 * @param definition ProcessDefinition
 * @return WorkflowDefinition
 */
public WorkflowDefinition convert(ProcessDefinition definition)
{
    if(definition==null)
        return null;
    
    String defId = definition.getId();
    String defName = definition.getKey();
    int version = definition.getVersion();
    String defaultTitle = definition.getName();
    
    String startTaskName = null;
    StartFormData startFormData = getStartFormData(defId, defName);
    if(startFormData != null) 
    {
        startTaskName = startFormData.getFormKey();
    }
    
    ReadOnlyProcessDefinition def = activitiUtil.getDeployedProcessDefinition(defId);
    PvmActivity startEvent = def.getInitial();
    WorkflowTaskDefinition startTask = getTaskDefinition(startEvent, startTaskName, definition.getKey(), true);
    
    return factory.createDefinition(defId,
                defName, version, defaultTitle,
                null, startTask);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:31,代码来源:ActivitiTypeConverter.java

示例4: getTaskDefinition

import org.activiti.engine.impl.pvm.PvmActivity; //导入依赖的package包/类
/**
 * Get the taskDefinition key based on the Activiti task definition id,
 * @param taskDefinitionKey String
 * @param processDefinitionId String
 * @return WorkflowTaskDefinition
 */
public WorkflowTaskDefinition getTaskDefinition(String taskDefinitionKey, String processDefinitionId)
{
	 ProcessDefinitionEntity procDef = (ProcessDefinitionEntity) activitiUtil.getDeployedProcessDefinition(processDefinitionId);
	 Collection<PvmActivity> userTasks = findUserTasks(procDef.getInitial());
	 
	 TaskDefinition taskDefinition = null;
	 for(PvmActivity activity : userTasks)
	 {
		 taskDefinition = procDef.getTaskDefinitions().get(activity.getId());
		 if(taskDefinitionKey.equals(taskDefinition.getKey()))
		 {
			 String formKey = getFormKey(taskDefinition);
			 WorkflowNode node = convert(activity);
			 return factory.createTaskDefinition(formKey, node, formKey, false);
		 }
	 }
	 
	 return null;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:26,代码来源:ActivitiTypeConverter.java

示例5: getNode

import org.activiti.engine.impl.pvm.PvmActivity; //导入依赖的package包/类
/**
 * @param activity PvmActivity
 * @param key String
 * @param forceIsTaskNode boolean
 * @return WorkflowNode
 */
private WorkflowNode getNode(PvmActivity activity, String key, boolean forceIsTaskNode)
{
    String name = activity.getId();
     String defaultTitle = (String) activity.getProperty(ActivitiConstants.NODE_NAME);
     String defaultDescription = (String) activity.getProperty(ActivitiConstants.NODE_DESCRIPTION);
     String type = (String) activity.getProperty(ActivitiConstants.NODE_TYPE);
     boolean isTaskNode = forceIsTaskNode || ActivitiConstants.USER_TASK_NODE_TYPE.equals(type);
     
     if(defaultTitle == null)
     {
     	defaultTitle = name;
     }
     if(defaultDescription == null)
     {
     	defaultDescription = name;
     }
    WorkflowTransition transition = getDefaultTransition(key, name);
    return factory.createNode(name, key, defaultTitle, defaultDescription, type, isTaskNode, transition);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:26,代码来源:ActivitiTypeConverter.java

示例6: getFormKey

import org.activiti.engine.impl.pvm.PvmActivity; //导入依赖的package包/类
public String getFormKey(PvmActivity act, ReadOnlyProcessDefinition processDefinition)
{
    if(act instanceof ActivityImpl) 
    {
        ActivityImpl actImpl = (ActivityImpl) act;
        if (actImpl.getActivityBehavior() instanceof UserTaskActivityBehavior)        
        {
        	UserTaskActivityBehavior uta = (UserTaskActivityBehavior) actImpl.getActivityBehavior();
            return getFormKey(uta.getTaskDefinition());
        }
        else if(actImpl.getActivityBehavior() instanceof MultiInstanceActivityBehavior) 
        {
        	// Get the task-definition from the process-definition
        	if(processDefinition instanceof ProcessDefinitionEntity)
        	{
        		// Task definition id is the same the the activity id
        		TaskDefinition taskDef = ((ProcessDefinitionEntity) processDefinition).getTaskDefinitions().get(act.getId());
        		if(taskDef != null)
        		{
        			return getFormKey(taskDef);
        		}
        	}
        }
    }
    return null;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:27,代码来源:ActivitiTypeConverter.java

示例7: findFirstActivity

import org.activiti.engine.impl.pvm.PvmActivity; //导入依赖的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;
}
 
开发者ID:zhaojunfei,项目名称:lemon,代码行数:29,代码来源:AutoCompleteFirstTaskListener.java

示例8: getPreviousActivities

import org.activiti.engine.impl.pvm.PvmActivity; //导入依赖的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;
}
 
开发者ID:zhaojunfei,项目名称:lemon,代码行数:17,代码来源:FindPreviousActivitiesCmd.java

示例9: execute

import org.activiti.engine.impl.pvm.PvmActivity; //导入依赖的package包/类
public void execute(DelegateExecution execution) {
    ActivityExecution activityExecution = (ActivityExecution) execution;
    PvmActivity activity = activityExecution.getActivity();

    List<PvmTransition> outgoingTransitions = activityExecution.getActivity().getOutgoingTransitions();

    execution.inactivate();

    List<ActivityExecution> joinedExecutions = activityExecution.findInactiveConcurrentExecutions(activity);

    int nbrOfExecutionsToJoin = activityExecution.getActivity().getIncomingTransitions().size();
    int nbrOfExecutionsJoined = joinedExecutions.size();

    if (nbrOfExecutionsJoined == nbrOfExecutionsToJoin) {
        LOGGER.debug("parallel gateway '{}' activates: {} of {} joined", activity.getId(), nbrOfExecutionsJoined, nbrOfExecutionsToJoin);
        activityExecution.takeAll(outgoingTransitions, joinedExecutions);

    } else if (LOGGER.isDebugEnabled()) {
        LOGGER.debug("parallel gateway '{}' does not activate: {} of {} joined", activity.getId(), nbrOfExecutionsJoined, nbrOfExecutionsToJoin);
    }
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:22,代码来源:ParallelGateway.java

示例10: findLocalErrorEventHandler

import org.activiti.engine.impl.pvm.PvmActivity; //导入依赖的package包/类
private static String findLocalErrorEventHandler(ActivityExecution execution, String errorCode) {
    PvmScope scope = execution.getActivity();
    while (scope != null) {

        @SuppressWarnings("unchecked")
        List<ErrorEventDefinition> definitions = (List<ErrorEventDefinition>) scope.getProperty(BpmnParse.PROPERTYNAME_ERROR_EVENT_DEFINITIONS);
        if (definitions != null) {
            // definitions are sorted by precedence, ie. event subprocesses first.
            for (ErrorEventDefinition errorEventDefinition : definitions) {
                if (errorEventDefinition.catches(errorCode)) {
                    return scope.findActivity(errorEventDefinition.getHandlerActivityId()).getId();
                }
            }
        }

        // search for error handlers in parent scopes
        if (scope instanceof PvmActivity) {
            scope = ((PvmActivity) scope).getParent();
        } else {
            scope = null;
        }
    }
    return null;
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:25,代码来源:ErrorPropagation.java

示例11: execute

import org.activiti.engine.impl.pvm.PvmActivity; //导入依赖的package包/类
@Override
public void execute(DelegateExecution execution) {
    ActivityExecution activityExecution = (ActivityExecution) execution;
    // Join
    PvmActivity activity = activityExecution.getActivity();
    List<PvmTransition> outgoingTransitions = activityExecution.getActivity().getOutgoingTransitions();
    execution.inactivate();
    lockConcurrentRoot(activityExecution);

    List<ActivityExecution> joinedExecutions = activityExecution.findInactiveConcurrentExecutions(activity);
    int nbrOfExecutionsToJoin = activityExecution.getActivity().getIncomingTransitions().size();
    int nbrOfExecutionsJoined = joinedExecutions.size();
    Context.getCommandContext().getHistoryManager().recordActivityEnd((ExecutionEntity) execution);
    if (nbrOfExecutionsJoined == nbrOfExecutionsToJoin) {

        // Fork
        if (LOGGER.isDebugEnabled()) {
            LOGGER.debug("parallel gateway '{}' activates: {} of {} joined", activity.getId(), nbrOfExecutionsJoined, nbrOfExecutionsToJoin);
        }
        activityExecution.takeAll(outgoingTransitions, joinedExecutions);

    } else if (LOGGER.isDebugEnabled()) {
        LOGGER.debug("parallel gateway '{}' does not activate: {} of {} joined", activity.getId(), nbrOfExecutionsJoined, nbrOfExecutionsToJoin);
    }
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:26,代码来源:ParallelGatewayActivityBehavior.java

示例12: execute

import org.activiti.engine.impl.pvm.PvmActivity; //导入依赖的package包/类
@Override
public void execute(DelegateExecution execution) {
    ActivityExecution activityExecution = (ActivityExecution) execution;
    PvmActivity activity = activityExecution.getActivity();
    ActivityImpl initialActivity = (ActivityImpl) activity.getProperty(BpmnParse.PROPERTYNAME_INITIAL);

    if (initialActivity == null) {
        throw new ActivitiException("No initial activity found for subprocess "
                + activityExecution.getActivity().getId());
    }

    // initialize the template-defined data objects as variables
    initializeDataObjects(activityExecution, activity);

    if (initialActivity.getActivityBehavior() != null
            && initialActivity.getActivityBehavior() instanceof NoneStartEventActivityBehavior) { // embedded subprocess: only none start allowed
        ((ExecutionEntity) execution).setActivity(initialActivity);
        Context.getCommandContext().getHistoryManager().recordActivityStart((ExecutionEntity) execution);
    }

    activityExecution.executeActivity(initialActivity);
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:23,代码来源:SubProcessActivityBehavior.java

示例13: findNextUserTask

import org.activiti.engine.impl.pvm.PvmActivity; //导入依赖的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;
    }
}
 
开发者ID:bill1012,项目名称:AdminEAP,代码行数:23,代码来源:RuntimePageServiceImpl.java

示例14: execute

import org.activiti.engine.impl.pvm.PvmActivity; //导入依赖的package包/类
public void execute(ActivityExecution execution) throws Exception { 
  
  // Join
  PvmActivity activity = execution.getActivity();
  List<PvmTransition> outgoingTransitions = execution.getActivity().getOutgoingTransitions();
  
  execution.inactivate();
  lockConcurrentRoot(execution);
  
  List<ActivityExecution> joinedExecutions = execution.findInactiveConcurrentExecutions(activity);
  int nbrOfExecutionsToJoin = execution.getActivity().getIncomingTransitions().size();
  int nbrOfExecutionsJoined = joinedExecutions.size();
  
  if (nbrOfExecutionsJoined==nbrOfExecutionsToJoin) {
    
    // Fork
    log.fine("parallel gateway '"+activity.getId()+"' activates: "+nbrOfExecutionsJoined+" of "+nbrOfExecutionsToJoin+" joined");
    execution.takeAll(outgoingTransitions, joinedExecutions);
    
  } else if (log.isLoggable(Level.FINE)){
    log.fine("parallel gateway '"+activity.getId()+"' does not activate: "+nbrOfExecutionsJoined+" of "+nbrOfExecutionsToJoin+" joined");
  }
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:24,代码来源:ParallelGatewayActivityBehavior.java

示例15: execute

import org.activiti.engine.impl.pvm.PvmActivity; //导入依赖的package包/类
public void execute(ActivityExecution execution) {
  PvmActivity activity = execution.getActivity();

  List<PvmTransition> outgoingTransitions = execution.getActivity().getOutgoingTransitions();
  
  execution.inactivate();
  
  List<ActivityExecution> joinedExecutions = execution.findInactiveConcurrentExecutions(activity);
  
  int nbrOfExecutionsToJoin = execution.getActivity().getIncomingTransitions().size();
  int nbrOfExecutionsJoined = joinedExecutions.size();
  
  if (nbrOfExecutionsJoined==nbrOfExecutionsToJoin) {
    log.fine("parallel gateway '"+activity.getId()+"' activates: "+nbrOfExecutionsJoined+" of "+nbrOfExecutionsToJoin+" joined");
    execution.takeAll(outgoingTransitions, joinedExecutions);
    
  } else if (log.isLoggable(Level.FINE)){
    log.fine("parallel gateway '"+activity.getId()+"' does not activate: "+nbrOfExecutionsJoined+" of "+nbrOfExecutionsToJoin+" joined");
  }
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:21,代码来源:ParallelGateway.java


注:本文中的org.activiti.engine.impl.pvm.PvmActivity类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。