本文整理汇总了Java中org.activiti.engine.delegate.DelegateTask.getAssignee方法的典型用法代码示例。如果您正苦于以下问题:Java DelegateTask.getAssignee方法的具体用法?Java DelegateTask.getAssignee怎么用?Java DelegateTask.getAssignee使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.activiti.engine.delegate.DelegateTask
的用法示例。
在下文中一共展示了DelegateTask.getAssignee方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: process
import org.activiti.engine.delegate.DelegateTask; //导入方法依赖的package包/类
public void process(DelegateTask delegateTask) {
if (delegateTask.getAssignee() == null) {
return;
}
String taskDefinitionKey = delegateTask.getTaskDefinitionKey();
String processDefinitionId = delegateTask.getProcessDefinitionId();
List<BpmConfNotice> bpmConfNotices = ApplicationContextHelper
.getBean(BpmConfNoticeManager.class)
.find("from BpmConfNotice where bpmConfNode.bpmConfBase.processDefinitionId=? and bpmConfNode.code=?",
processDefinitionId, taskDefinitionKey);
for (BpmConfNotice bpmConfNotice : bpmConfNotices) {
if (TYPE_ARRIVAL == bpmConfNotice.getType()) {
processArrival(delegateTask, bpmConfNotice);
}
}
}
示例2: handleDelegateTaskProperty
import org.activiti.engine.delegate.DelegateTask; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
protected Object handleDelegateTaskProperty(DelegateTask task, TypeDefinition type, QName key, Serializable value)
{
checkType(key, value, String.class);
String assignee = (String) value;
String currentAssignee = task.getAssignee();
// Only set the assignee if the value has changes to prevent
// triggering assignementhandlers when not needed
if (currentAssignee == null || !currentAssignee.equals(assignee))
{
task.setAssignee(assignee);
}
return DO_NOT_ADD;
}
示例3: checkFullyAuthenticatedUser
import org.activiti.engine.delegate.DelegateTask; //导入方法依赖的package包/类
/**
* Checks a valid Fully Authenticated User is set.
* If none is set then attempts to set the task assignee as the Fully Authenticated User.
* @param delegateTask the delegate task
* @return <code>true</code> if the Fully Authenticated User was changed, otherwise <code>false</code>.
*/
private boolean checkFullyAuthenticatedUser(final DelegateTask delegateTask)
{
if (AuthenticationUtil.getFullyAuthenticatedUser() == null)
{
String userName = delegateTask.getAssignee();
if (userName != null)
{
AuthenticationUtil.setFullyAuthenticatedUser(userName);
return true;
}
}
return false;
}
示例4: onCreate
import org.activiti.engine.delegate.DelegateTask; //导入方法依赖的package包/类
@Override
public void onCreate(DelegateTask delegateTask) throws Exception {
String assignee = delegateTask.getAssignee();
logger.debug("assignee : {}", assignee);
if (assignee == null) {
return;
}
for (Map.Entry<RuleMatcher, AssigneeRule> entry : assigneeRuleMap
.entrySet()) {
RuleMatcher ruleMatcher = entry.getKey();
if (!ruleMatcher.matches(assignee)) {
continue;
}
String value = ruleMatcher.getValue(assignee);
AssigneeRule assigneeRule = entry.getValue();
logger.debug("value : {}", value);
logger.debug("assigneeRule : {}", assigneeRule);
if (assigneeRule instanceof SuperiorAssigneeRule) {
this.processSuperior(delegateTask, assigneeRule, value);
} else if (assigneeRule instanceof PositionAssigneeRule) {
this.processPosition(delegateTask, assigneeRule, value);
}
}
}
示例5: notify
import org.activiti.engine.delegate.DelegateTask; //导入方法依赖的package包/类
@Override
public void notify(DelegateTask delegateTask) {
OperationResult result = new OperationResult(TaskCreateListener.class.getName() + ".notify");
Task wfTask = ActivitiUtil.getTask(delegateTask.getExecution(), result);
String taskId = delegateTask.getId();
// duration/deadline
ApprovalStageDefinitionType stageDef = WfContextUtil.getCurrentStageDefinition(wfTask.getWorkflowContext());
if (stageDef == null) {
throw new IllegalStateException("No approval stage information in " + delegateTask);
}
if (stageDef.getDuration() != null) {
MidpointUtil.setTaskDeadline(delegateTask, stageDef.getDuration());
}
// triggers
int escalationLevel = ActivitiUtil.getEscalationLevelNumber(delegateTask.getVariables());
MidpointUtil.createTriggersForTimedActions(taskId, escalationLevel, delegateTask.getCreateTime(),
delegateTask.getDueDate(), wfTask, stageDef.getTimedActions(), result);
// originalAssignee
String assignee = delegateTask.getAssignee();
if (assignee != null) {
TaskService taskService = delegateTask.getExecution().getEngineServices().getTaskService();
taskService.setVariableLocal(taskId, CommonProcessVariableNames.VARIABLE_ORIGINAL_ASSIGNEE, assignee);
taskService.addUserIdentityLink(taskId, assignee, CommonProcessVariableNames.MIDPOINT_ASSIGNEE);
}
getActivitiInterface().notifyMidpointAboutTaskEvent(delegateTask);
}
示例6: notify
import org.activiti.engine.delegate.DelegateTask; //导入方法依赖的package包/类
@Override
public void notify(DelegateTask delegateTask) {
String originAssginee = delegateTask.getAssignee();
String newUser = userMap.get(originAssginee);
if (StringUtils.isNotBlank(newUser)) {
delegateTask.setAssignee(newUser);
EngineServices engineServices = delegateTask.getExecution().getEngineServices();
TaskService taskService = engineServices.getTaskService();
String message = getClass().getName() + "-> 任务[" + delegateTask.getName() + "]的办理人[" + originAssginee + "]自动转办给了用户[" + newUser + "]";
taskService.addComment(delegateTask.getId(), delegateTask.getProcessInstanceId(), "delegate", message);
} else {
System.out.println("任务[" + delegateTask.getName() + "]没有预设的代办人");
}
}
示例7: notify
import org.activiti.engine.delegate.DelegateTask; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public void notify(DelegateTask delegateTask) {
// get mapping table from variable
DelegateExecution execution = delegateTask.getExecution();
Map<String, String> assigneeMappingTable = (Map<String, String>) execution.getVariable("assigneeMappingTable");
// get assignee from process
String assigneeFromProcessDefinition = delegateTask.getAssignee();
// overwrite assignee if there is an entry in the mapping table
if (assigneeMappingTable.containsKey(assigneeFromProcessDefinition)) {
String assigneeFromMappingTable = assigneeMappingTable.get(assigneeFromProcessDefinition);
delegateTask.setAssignee(assigneeFromMappingTable);
}
}
示例8: onCreate
import org.activiti.engine.delegate.DelegateTask; //导入方法依赖的package包/类
@Override
public void onCreate(DelegateTask delegateTask) throws Exception {
String initiatorId = Authentication.getAuthenticatedUserId();
if (initiatorId == null) {
return;
}
String assignee = delegateTask.getAssignee();
if (assignee == null) {
return;
}
PvmActivity targetActivity = this.findFirstActivity(delegateTask
.getProcessDefinitionId());
if (!targetActivity.getId().equals(
delegateTask.getExecution().getCurrentActivityId())) {
return;
}
if (!initiatorId.equals(assignee)) {
return;
}
logger.debug("auto complete first task : {}", delegateTask);
for (IdentityLink identityLink : delegateTask.getCandidates()) {
String userId = identityLink.getUserId();
String groupId = identityLink.getGroupId();
if (userId != null) {
delegateTask.deleteCandidateUser(userId);
}
if (groupId != null) {
delegateTask.deleteCandidateGroup(groupId);
}
}
// 对提交流程的任务进行特殊处理
HumanTaskDTO humanTaskDto = humanTaskConnector
.findHumanTaskByTaskId(delegateTask.getId());
humanTaskDto.setCatalog(HumanTaskConstants.CATALOG_START);
humanTaskConnector.saveHumanTask(humanTaskDto);
// ((TaskEntity) delegateTask).complete();
// Context.getCommandContext().getHistoryManager().recordTaskId((TaskEntity) delegateTask);
new CompleteTaskWithCommentCmd(delegateTask.getId(), null, "发起流程")
.execute(Context.getCommandContext());
}
示例9: onCreate
import org.activiti.engine.delegate.DelegateTask; //导入方法依赖的package包/类
public void onCreate(DelegateTask delegateTask) throws Exception {
String initiatorId = Authentication.getAuthenticatedUserId();
if (initiatorId == null) {
return;
}
String assignee = delegateTask.getAssignee();
if (assignee == null) {
return;
}
if (!initiatorId.equals(assignee)) {
return;
}
PvmActivity targetActivity = this.findFirstActivity(delegateTask
.getProcessDefinitionId());
logger.debug("targetActivity : {}", targetActivity);
if (!targetActivity.getId().equals(
delegateTask.getExecution().getCurrentActivityId())) {
return;
}
logger.debug("auto complete first task : {}", delegateTask);
for (IdentityLink identityLink : delegateTask.getCandidates()) {
String userId = identityLink.getUserId();
String groupId = identityLink.getGroupId();
if (userId != null) {
delegateTask.deleteCandidateUser(userId);
}
if (groupId != null) {
delegateTask.deleteCandidateGroup(groupId);
}
}
// 对提交流程的任务进行特殊处理
HumanTaskDTO humanTaskDto = humanTaskConnector
.findHumanTaskByTaskId(delegateTask.getId());
humanTaskDto.setCatalog(HumanTaskConstants.CATALOG_START);
humanTaskConnector.saveHumanTask(humanTaskDto);
// ((TaskEntity) delegateTask).complete();
// Context.getCommandContext().getHistoryManager().recordTaskId((TaskEntity) delegateTask);
// Context.getCommandContext().getHistoryManager().recordTaskId((TaskEntity) delegateTask);
// new CompleteTaskWithCommentCmd(delegateTask.getId(), null, "发起流程")
// .execute(Context.getCommandContext());
// 因为recordTaskId()会判断endTime,而complete以后会导致endTime!=null,
// 所以才会出现record()放在complete后面导致taskId没记录到historyActivity里的情况
delegateTask.getExecution().setVariableLocal(
"_ACTIVITI_SKIP_EXPRESSION_ENABLED", true);
TaskDefinition taskDefinition = ((TaskEntity) delegateTask)
.getTaskDefinition();
ExpressionManager expressionManager = Context
.getProcessEngineConfiguration().getExpressionManager();
Expression expression = expressionManager
.createExpression("${_ACTIVITI_SKIP_EXPRESSION_ENABLED}");
taskDefinition.setSkipExpression(expression);
}