本文整理汇总了Java中org.activiti.engine.impl.bpmn.behavior.UserTaskActivityBehavior类的典型用法代码示例。如果您正苦于以下问题:Java UserTaskActivityBehavior类的具体用法?Java UserTaskActivityBehavior怎么用?Java UserTaskActivityBehavior使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
UserTaskActivityBehavior类属于org.activiti.engine.impl.bpmn.behavior包,在下文中一共展示了UserTaskActivityBehavior类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getFormKey
import org.activiti.engine.impl.bpmn.behavior.UserTaskActivityBehavior; //导入依赖的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;
}
示例2: executeParse
import org.activiti.engine.impl.bpmn.behavior.UserTaskActivityBehavior; //导入依赖的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());
}
}
}
示例3: getFormKey
import org.activiti.engine.impl.bpmn.behavior.UserTaskActivityBehavior; //导入依赖的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: packageSingleActivitiInfo
import org.activiti.engine.impl.bpmn.behavior.UserTaskActivityBehavior; //导入依赖的package包/类
/**
* 封装输出信息,包括:当前节点的X、Y坐标、变量信息、任务类型、任务描述
* @param activity
* @param processInstance
* @param currentActiviti
* @return
*/
private Map<String, Object> packageSingleActivitiInfo(ActivityImpl activity, ProcessInstance processInstance,
boolean currentActiviti) throws Exception {
Map<String, Object> vars = new HashMap<String, Object>();
Map<String, Object> activityInfo = new HashMap<String, Object>();
activityInfo.put("currentActiviti", currentActiviti);
setPosition(activity, activityInfo);
setWidthAndHeight(activity, activityInfo);
Map<String, Object> properties = activity.getProperties();
vars.put("节点名称", properties.get("name"));
vars.put("任务类型", ActUtils.parseToZhType(properties.get("type").toString()));
ActivityBehavior activityBehavior = activity.getActivityBehavior();
logger.debug("activityBehavior={}", activityBehavior);
if (activityBehavior instanceof UserTaskActivityBehavior) {
Task currentTask = null;
// 当前节点的task
if (currentActiviti) {
currentTask = getCurrentTaskInfo(processInstance);
}
// 当前任务的分配角色
UserTaskActivityBehavior userTaskActivityBehavior = (UserTaskActivityBehavior) activityBehavior;
TaskDefinition taskDefinition = userTaskActivityBehavior.getTaskDefinition();
Set<Expression> candidateGroupIdExpressions = taskDefinition.getCandidateGroupIdExpressions();
if (!candidateGroupIdExpressions.isEmpty()) {
// 任务的处理角色
setTaskGroup(vars, candidateGroupIdExpressions);
// 当前处理人
if (currentTask != null) {
setCurrentTaskAssignee(vars, currentTask);
}
}
}
vars.put("节点说明", properties.get("documentation"));
String description = activity.getProcessDefinition().getDescription();
vars.put("描述", description);
logger.debug("trace variables: {}", vars);
activityInfo.put("vars", vars);
return activityInfo;
}
示例5: deleteTasksByProcessInstanceId
import org.activiti.engine.impl.bpmn.behavior.UserTaskActivityBehavior; //导入依赖的package包/类
@SuppressWarnings({"unchecked", "rawtypes"})
public void deleteTasksByProcessInstanceId(String processInstanceId, String deleteReason, boolean cascade) {
List<TaskEntity> tasks = (List) getDbSqlSession()
.createTaskQuery()
.processInstanceId(processInstanceId)
.list();
String reason = (deleteReason == null || deleteReason.length() == 0) ? TaskEntity.DELETE_REASON_DELETED : deleteReason;
CommandContext commandContext = Context.getCommandContext();
for (TaskEntity task : tasks) {
if (commandContext.getProcessEngineConfiguration().getEventDispatcher().isEnabled()) {
commandContext.getProcessEngineConfiguration().getEventDispatcher().dispatchEvent(
ActivitiEventBuilder.createActivityCancelledEvent(
task.getExecution().getActivityId(),
task.getName(),
task.getExecutionId(),
task.getProcessInstanceId(),
task.getProcessDefinitionId(),
"userTask", UserTaskActivityBehavior.class.getName(), deleteReason));
}
deleteTask(task, reason, cascade);
}
}
示例6: parseUserTask
import org.activiti.engine.impl.bpmn.behavior.UserTaskActivityBehavior; //导入依赖的package包/类
/**
* Parses a userTask declaration.
*/
public ActivityImpl parseUserTask(Element userTaskElement, ScopeImpl scope) {
ActivityImpl activity = createActivityOnScope(userTaskElement, scope);
String async = userTaskElement.attributeNS(BpmnParser.ACTIVITI_BPMN_EXTENSIONS_NS, "async");
activity.setAsync("true".equals(async));
TaskDefinition taskDefinition = parseTaskDefinition(userTaskElement, activity.getId(), (ProcessDefinitionEntity) scope.getProcessDefinition());
UserTaskActivityBehavior userTaskActivity = new UserTaskActivityBehavior(expressionManager, taskDefinition);
activity.setActivityBehavior(userTaskActivity);
parseProperties(userTaskElement, activity);
parseExecutionListenersOnScope(userTaskElement, activity);
for (BpmnParseListener parseListener : parseListeners) {
parseListener.parseUserTask(userTaskElement, scope, activity);
}
return activity;
}
示例7: parseUserTask
import org.activiti.engine.impl.bpmn.behavior.UserTaskActivityBehavior; //导入依赖的package包/类
/**
* Parses a userTask declaration.
*/
public ActivityImpl parseUserTask(Element userTaskElement, ScopeImpl scope) {
ActivityImpl activity = createActivityOnScope(userTaskElement, scope);
activity.setAsync(isAsync(userTaskElement));
activity.setExclusive(isExclusive(userTaskElement));
TaskDefinition taskDefinition = parseTaskDefinition(userTaskElement, activity.getId(), (ProcessDefinitionEntity) scope.getProcessDefinition());
UserTaskActivityBehavior userTaskActivity = new UserTaskActivityBehavior(expressionManager, taskDefinition);
activity.setActivityBehavior(userTaskActivity);
parseProperties(userTaskElement, activity);
parseExecutionListenersOnScope(userTaskElement, activity);
for (BpmnParseListener parseListener : parseListeners) {
parseListener.parseUserTask(userTaskElement, scope, activity);
}
return activity;
}
示例8: addListeners
import org.activiti.engine.impl.bpmn.behavior.UserTaskActivityBehavior; //导入依赖的package包/类
protected void addListeners(UserTaskActivityBehavior activityBehavior)
{
if (createTaskListener != null)
{
addTaskListenerAsFirst(createTaskListener, TaskListener.EVENTNAME_CREATE, activityBehavior);
}
if (completeTaskListener != null)
{
addTaskListenerAsFirst(completeTaskListener, TaskListener.EVENTNAME_COMPLETE, activityBehavior);
}
if(notificationTaskListener != null)
{
addTaskListenerAsLast(notificationTaskListener, TaskListener.EVENTNAME_CREATE, activityBehavior);
}
}
示例9: getOrCreateListenerList
import org.activiti.engine.impl.bpmn.behavior.UserTaskActivityBehavior; //导入依赖的package包/类
protected List<TaskListener> getOrCreateListenerList(String eventName, UserTaskActivityBehavior userTask)
{
List<TaskListener> taskEventListeners = userTask.getTaskDefinition().getTaskListeners().get(eventName);
if (taskEventListeners == null) {
taskEventListeners = new ArrayList<TaskListener>();
userTask.getTaskDefinition().getTaskListeners().put(eventName, taskEventListeners);
}
return taskEventListeners;
}
示例10: packageSingleActivitiInfo
import org.activiti.engine.impl.bpmn.behavior.UserTaskActivityBehavior; //导入依赖的package包/类
/**
* 封装输出信息,包括:当前节点的X、Y坐标、变量信息、任务类型、任务描述
*
* @param activity
* @param processInstance
* @param currentActiviti
* @return
*/
private Map<String, Object> packageSingleActivitiInfo(ActivityImpl activity, ProcessInstance processInstance,
boolean currentActiviti) throws Exception {
Map<String, Object> vars = new HashMap<String, Object>();
Map<String, Object> activityInfo = new HashMap<String, Object>();
activityInfo.put("currentActiviti", currentActiviti);
setPosition(activity, activityInfo);
setWidthAndHeight(activity, activityInfo);
Map<String, Object> properties = activity.getProperties();
vars.put("任务类型", WorkflowUtils.parseToZhType(properties.get("type").toString()));
ActivityBehavior activityBehavior = activity.getActivityBehavior();
logger.debug("activityBehavior={}", activityBehavior);
if (activityBehavior instanceof UserTaskActivityBehavior) {
Task currentTask = null;
/*
* 当前节点的task
*/
if (currentActiviti) {
currentTask = getCurrentTaskInfo(processInstance);
}
/*
* 当前任务的分配角色
*/
UserTaskActivityBehavior userTaskActivityBehavior = (UserTaskActivityBehavior) activityBehavior;
TaskDefinition taskDefinition = userTaskActivityBehavior.getTaskDefinition();
Set<Expression> candidateGroupIdExpressions = taskDefinition.getCandidateGroupIdExpressions();
if (!candidateGroupIdExpressions.isEmpty()) {
// 任务的处理角色
setTaskGroup(vars, candidateGroupIdExpressions);
// 当前处理人
if (currentTask != null) {
setCurrentTaskAssignee(vars, currentTask);
}
}
}
vars.put("节点说明", properties.get("documentation"));
String description = activity.getProcessDefinition().getDescription();
vars.put("描述", description);
logger.debug("trace variables: {}", vars);
activityInfo.put("vars", vars);
return activityInfo;
}
示例11: getTaskDefinition
import org.activiti.engine.impl.bpmn.behavior.UserTaskActivityBehavior; //导入依赖的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;
}
示例12: parseUserTask
import org.activiti.engine.impl.bpmn.behavior.UserTaskActivityBehavior; //导入依赖的package包/类
public void parseUserTask(Element userTaskElement, ScopeImpl scope, ActivityImpl activity) {
addActivityHandlers(activity);
if (activityHistoryEnabled(scope, historyLevel)) {
TaskDefinition taskDefinition = ((UserTaskActivityBehavior) activity.getActivityBehavior()).getTaskDefinition();
taskDefinition.addTaskListener(TaskListener.EVENTNAME_ASSIGNMENT, USER_TASK_ASSIGNMENT_HANDLER);
}
}
示例13: addTaskListenerAsFirst
import org.activiti.engine.impl.bpmn.behavior.UserTaskActivityBehavior; //导入依赖的package包/类
protected void addTaskListenerAsFirst(TaskListener taskListener, String eventName, UserTaskActivityBehavior userTask)
{
getOrCreateListenerList(eventName, userTask).add(0, taskListener);
}
示例14: addTaskListenerAsLast
import org.activiti.engine.impl.bpmn.behavior.UserTaskActivityBehavior; //导入依赖的package包/类
protected void addTaskListenerAsLast(TaskListener taskListener, String eventName, UserTaskActivityBehavior userTask)
{
getOrCreateListenerList(eventName, userTask).add(taskListener);
}
示例15: createUserTaskActivityBehavior
import org.activiti.engine.impl.bpmn.behavior.UserTaskActivityBehavior; //导入依赖的package包/类
public UserTaskActivityBehavior createUserTaskActivityBehavior(
UserTask userTask, TaskDefinition taskDefinition) {
log.info("change usertask Behavior : {} ", userTask);
return new CustomUserTaskActivityBehavior(taskDefinition);
}