本文整理汇总了Java中org.activiti.engine.impl.pvm.process.ActivityImpl类的典型用法代码示例。如果您正苦于以下问题:Java ActivityImpl类的具体用法?Java ActivityImpl怎么用?Java ActivityImpl使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ActivityImpl类属于org.activiti.engine.impl.pvm.process包,在下文中一共展示了ActivityImpl类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: take
import org.activiti.engine.impl.pvm.process.ActivityImpl; //导入依赖的package包/类
/**
* @param fireActivityCompletionEvent This method can be called from other places (like {@link #takeAll(List, List)}), where the event is already fired. In that case, false is passed an no second event is fired.
*/
@Override
public void take(PvmTransition transition, boolean fireActivityCompletionEvent) {
if (fireActivityCompletionEvent) {
fireActivityCompletedEvent();
}
if (this.transition != null) {
throw new PvmException("already taking a transition");
}
if (transition == null) {
throw new PvmException("transition is null");
}
setActivity((ActivityImpl) transition.getSource());
setTransition((TransitionImpl) transition);
performOperation(AtomicOperation.TRANSITION_NOTIFY_LISTENER_END);
}
示例2: getFormKey
import org.activiti.engine.impl.pvm.process.ActivityImpl; //导入依赖的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;
}
示例3: getFormKey
import org.activiti.engine.impl.pvm.process.ActivityImpl; //导入依赖的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;
}
示例4: executeParse
import org.activiti.engine.impl.pvm.process.ActivityImpl; //导入依赖的package包/类
protected void executeParse(BpmnParse bpmnParse, UserTask userTask)
{
ActivityImpl activity = findActivity(bpmnParse, userTask.getId());
ActivityBehavior activitybehaviour = activity.getActivityBehavior();
if (activitybehaviour instanceof UserTaskActivityBehavior)
{
addListeners((UserTaskActivityBehavior) activity.getActivityBehavior());
}
else if(activitybehaviour instanceof MultiInstanceActivityBehavior)
{
MultiInstanceActivityBehavior multiInstance = (MultiInstanceActivityBehavior) activitybehaviour;
if(multiInstance.getInnerActivityBehavior() instanceof UserTaskActivityBehavior)
{
addListeners((UserTaskActivityBehavior) multiInstance.getInnerActivityBehavior());
}
}
}
示例5: executeParse
import org.activiti.engine.impl.pvm.process.ActivityImpl; //导入依赖的package包/类
protected void executeParse(BpmnParse bpmnParse, CallActivity callActivity)
{
if (multiTenancyEnabled && tenantService.isEnabled())
{
ActivityImpl activity = findActivity(bpmnParse, callActivity.getId());
ActivityBehavior activityBehavior = activity.getActivityBehavior();
if(activityBehavior instanceof CallActivityBehavior)
{
CallActivityBehavior callActivityBehavior = (CallActivityBehavior) activityBehavior;
// Make name of process-definition to be called aware of the current tenant
callActivityBehavior.setProcessDefinitonKey(tenantService.getName(callActivityBehavior.getProcessDefinitonKey()));
}
}
}
示例6: findFirstActivity
import org.activiti.engine.impl.pvm.process.ActivityImpl; //导入依赖的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;
}
示例7: getHighlightedFlows
import org.activiti.engine.impl.pvm.process.ActivityImpl; //导入依赖的package包/类
private void getHighlightedFlows(List<ActivityImpl> activityList) {
for (ActivityImpl activity : activityList) {
if (activity.getProperty("type").equals("subProcess")) {
// get flows for the subProcess
getHighlightedFlows(activity.getActivities());
}
if (historicActivityInstanceList.contains(activity.getId())) {
List<PvmTransition> pvmTransitionList = activity
.getOutgoingTransitions();
for (PvmTransition pvmTransition : pvmTransitionList) {
String destinationFlowId = pvmTransition.getDestination()
.getId();
if (historicActivityInstanceList
.contains(destinationFlowId)) {
highLightedFlows.add(pvmTransition.getId());
}
}
}
}
}
示例8: getActivieExecutions
import org.activiti.engine.impl.pvm.process.ActivityImpl; //导入依赖的package包/类
/**
* <li>获取活动的执行 , 子流程的活动执行是其孩子执行(并行多实例情况下) <li>串行情况下获取的结果数量为1
*/
protected List<ExecutionEntity> getActivieExecutions() {
List<ExecutionEntity> activeExecutions = new ArrayList<ExecutionEntity>();
ActivityImpl activity = getActivity();
List<ExecutionEntity> executions = getChildExecutionByProcessInstanceId();
for (ExecutionEntity execution : executions) {
if (execution.isActive()
&& (execution.getActivityId().equals(activityId) || activity
.contains(execution.getActivity()))) {
activeExecutions.add(execution);
}
}
return activeExecutions;
}
示例9: execute
import org.activiti.engine.impl.pvm.process.ActivityImpl; //导入依赖的package包/类
/**
* 退回流程.
*
* @return 0-退回成功 1-流程结束 2-下一结点已经通过,不能退回
*/
public Integer execute(CommandContext commandContext) {
// 获得任务
TaskEntity taskEntity = this.findTask(commandContext);
// 找到想要回退到的节点
ActivityImpl targetActivity = this.findTargetActivity(commandContext,
taskEntity);
logger.info("rollback to {}", this.activityId);
logger.info("{}", targetActivity.getProperties());
String type = (String) targetActivity.getProperty("type");
if ("userTask".equals(type)) {
logger.info("rollback to userTask");
this.rollbackUserTask(commandContext);
} else if ("startEvent".equals(type)) {
logger.info("rollback to startEvent");
this.rollbackStartEvent(commandContext);
} else {
throw new IllegalStateException("cannot rollback " + type);
}
return 0;
}
示例10: findTargetActivity
import org.activiti.engine.impl.pvm.process.ActivityImpl; //导入依赖的package包/类
/**
* 查找回退的目的节点.
*/
public ActivityImpl findTargetActivity(CommandContext commandContext,
TaskEntity taskEntity) {
if (activityId == null) {
String historyTaskId = this.findNearestUserTask(commandContext);
HistoricTaskInstanceEntity historicTaskInstanceEntity = commandContext
.getHistoricTaskInstanceEntityManager()
.findHistoricTaskInstanceById(historyTaskId);
this.activityId = historicTaskInstanceEntity.getTaskDefinitionKey();
}
String processDefinitionId = taskEntity.getProcessDefinitionId();
ProcessDefinitionEntity processDefinitionEntity = new GetDeploymentProcessDefinitionCmd(
processDefinitionId).execute(commandContext);
return processDefinitionEntity.findActivity(activityId);
}
示例11: findTargetHistoricActivity
import org.activiti.engine.impl.pvm.process.ActivityImpl; //导入依赖的package包/类
/**
* 找到想要回退对应的节点历史.
*/
public HistoricActivityInstanceEntity findTargetHistoricActivity(
CommandContext commandContext, TaskEntity taskEntity,
ActivityImpl activityImpl) {
HistoricActivityInstanceQueryImpl historicActivityInstanceQueryImpl = new HistoricActivityInstanceQueryImpl();
historicActivityInstanceQueryImpl.activityId(activityImpl.getId());
historicActivityInstanceQueryImpl.processInstanceId(taskEntity
.getProcessInstanceId());
historicActivityInstanceQueryImpl
.orderByHistoricActivityInstanceEndTime().desc();
HistoricActivityInstanceEntity historicActivityInstanceEntity = (HistoricActivityInstanceEntity) commandContext
.getHistoricActivityInstanceEntityManager()
.findHistoricActivityInstancesByQueryCriteria(
historicActivityInstanceQueryImpl, new Page(0, 1))
.get(0);
return historicActivityInstanceEntity;
}
示例12: findTargetHistoricTask
import org.activiti.engine.impl.pvm.process.ActivityImpl; //导入依赖的package包/类
/**
* 找到想要回退对应的任务历史.
*/
public HistoricTaskInstanceEntity findTargetHistoricTask(
CommandContext commandContext, TaskEntity taskEntity,
ActivityImpl activityImpl) {
HistoricTaskInstanceQueryImpl historicTaskInstanceQueryImpl = new HistoricTaskInstanceQueryImpl();
historicTaskInstanceQueryImpl.taskDefinitionKey(activityImpl.getId());
historicTaskInstanceQueryImpl.processInstanceId(taskEntity
.getProcessInstanceId());
historicTaskInstanceQueryImpl.setFirstResult(0);
historicTaskInstanceQueryImpl.setMaxResults(1);
historicTaskInstanceQueryImpl.orderByTaskCreateTime().desc();
HistoricTaskInstanceEntity historicTaskInstanceEntity = (HistoricTaskInstanceEntity) commandContext
.getHistoricTaskInstanceEntityManager()
.findHistoricTaskInstancesByQueryCriteria(
historicTaskInstanceQueryImpl).get(0);
return historicTaskInstanceEntity;
}
示例13: execute
import org.activiti.engine.impl.pvm.process.ActivityImpl; //导入依赖的package包/类
public Object execute(CommandContext commandContext) {
// for (TaskEntity taskEntity : commandContext.getTaskEntityManager()
// .findTasksByExecutionId(executionId)) {
// taskEntity.setVariableLocal("跳转原因", jumpOrigin);
// commandContext.getTaskEntityManager().deleteTask(taskEntity,
// jumpOrigin, false);
// }
ExecutionEntity executionEntity = commandContext
.getExecutionEntityManager().findExecutionById(executionId);
executionEntity.destroyScope(jumpOrigin);
ProcessDefinitionImpl processDefinition = executionEntity
.getProcessDefinition();
ActivityImpl activity = processDefinition.findActivity(activityId);
executionEntity.executeActivity(activity);
return null;
}
示例14: execute
import org.activiti.engine.impl.pvm.process.ActivityImpl; //导入依赖的package包/类
public Object execute(CommandContext commandContext) {
for (TaskEntity taskEntity : commandContext.getTaskEntityManager()
.findTasksByExecutionId(executionId)) {
taskEntity.setVariableLocal("跳转原因", jumpOrigin);
commandContext.getTaskEntityManager().deleteTask(taskEntity,
jumpOrigin, false);
}
ExecutionEntity executionEntity = commandContext
.getExecutionEntityManager().findExecutionById(executionId);
ProcessDefinitionImpl processDefinition = executionEntity
.getProcessDefinition();
ActivityImpl activity = processDefinition.findActivity(activityId);
executionEntity.executeActivity(activity);
return null;
}
示例15: execute
import org.activiti.engine.impl.pvm.process.ActivityImpl; //导入依赖的package包/类
public Map<String, String> execute(CommandContext commandContext) {
ExecutionEntity executionEntity = Context.getCommandContext()
.getExecutionEntityManager().findExecutionById(executionId);
ProcessDefinitionImpl processDefinition = executionEntity
.getProcessDefinition();
Map<String, String> map = new HashMap<String, String>();
for (ActivityImpl activity : processDefinition.getActivities()) {
logger.info("{}", activity.getProperties());
if ("userTask".equals(activity.getProperty("type"))) {
map.put(activity.getId(), (String) activity.getProperty("name"));
}
}
return map;
}