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


Java TaskService.addUserIdentityLink方法代码示例

本文整理汇总了Java中org.activiti.engine.TaskService.addUserIdentityLink方法的典型用法代码示例。如果您正苦于以下问题:Java TaskService.addUserIdentityLink方法的具体用法?Java TaskService.addUserIdentityLink怎么用?Java TaskService.addUserIdentityLink使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.activiti.engine.TaskService的用法示例。


在下文中一共展示了TaskService.addUserIdentityLink方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setNewAssignees

import org.activiti.engine.TaskService; //导入方法依赖的package包/类
private void setNewAssignees(Task task, List<ObjectReferenceType> assigneeRefList, TaskService taskService) {
   	List<String> assignees = MiscDataUtil.refsToStrings(assigneeRefList);

   	// check and optionally set task assignee
	if (task.getAssignee() != null && !assignees.contains(task.getAssignee())
			|| task.getAssignee() == null && !assignees.isEmpty()) {
		// we will nominate the first delegate (if present) as a new assignee
		taskService.setAssignee(task.getId(), !assignees.isEmpty() ? assignees.get(0) :  null);
	}

	// set task identity links
	List<IdentityLink> currentLinks = taskService.getIdentityLinksForTask(task.getId());
	for (IdentityLink currentLink : currentLinks) {
		if (!CommonProcessVariableNames.MIDPOINT_ASSIGNEE.equals(currentLink.getType())) {
			continue;
		}
		String assigneeFromLink = currentLink.getUserId() != null ? currentLink.getUserId() : currentLink.getGroupId();
		if (assignees.contains(assigneeFromLink)) {
			assignees.remove(assigneeFromLink);
		} else {
			if (currentLink.getUserId() != null) {
				taskService.deleteUserIdentityLink(task.getId(), currentLink.getUserId(), CommonProcessVariableNames.MIDPOINT_ASSIGNEE);
			} else {
				taskService.deleteGroupIdentityLink(task.getId(), currentLink.getGroupId(), CommonProcessVariableNames.MIDPOINT_ASSIGNEE);
			}
		}
	}
	// process remaining assignees
	for (String assignee : assignees) {
		ObjectReferenceType assigneeRef = MiscDataUtil.stringToRef(assignee);
		if (assigneeRef.getType() == null || QNameUtil.match(UserType.COMPLEX_TYPE, assigneeRef.getType())) {
			taskService.addUserIdentityLink(task.getId(), assignee, CommonProcessVariableNames.MIDPOINT_ASSIGNEE);
		} else {
			taskService.addGroupIdentityLink(task.getId(), assignee, CommonProcessVariableNames.MIDPOINT_ASSIGNEE);
		}
	}
}
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:38,代码来源:WorkItemManager.java

示例2: notify

import org.activiti.engine.TaskService; //导入方法依赖的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);
}
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:31,代码来源:TaskCreateListener.java

示例3: test210TestQueryByIdentityLink

import org.activiti.engine.TaskService; //导入方法依赖的package包/类
@Test
public void test210TestQueryByIdentityLink() throws Exception {
	final String TEST_NAME = "test210TestQueryByIdentityLink";
	TestUtil.displayTestTile(this, TEST_NAME);
	login(userAdministrator);

	TaskService taskService = activitiEngine.getTaskService();
	TaskQuery tq = taskService.createTaskQuery();
	org.activiti.engine.task.Task task = tq.singleResult();
	System.out.println("Task = " + task);
	assertNotNull("No task", task);

	final String TASK_NAME = "Approve assigning Role1a to jack";
	List<IdentityLink> linksBefore = taskService.getIdentityLinksForTask(task.getId());
	System.out.println("Identity links (before)" + linksBefore);
	taskService.addUserIdentityLink(task.getId(), "123", CommonProcessVariableNames.MIDPOINT_ASSIGNEE);
	taskService.addUserIdentityLink(task.getId(), "456", CommonProcessVariableNames.MIDPOINT_ASSIGNEE);
	List<IdentityLink> linksAfter = taskService.getIdentityLinksForTask(task.getId());
	System.out.println("Identity links (after)" + linksAfter);

	TaskQuery tq1 = taskService.createTaskQuery()
			.taskInvolvedUser("UserType:"+userLead1Oid)
			.taskName(TASK_NAME);
	assertFound(tq1, "involved user (assignee)");

	assertFound(taskService.createTaskQuery()
			.taskInvolvedUser("123")
			.taskName(TASK_NAME),
			"involved user (midpoint-assignee 123)");

	assertFound(taskService.createTaskQuery()
			.taskInvolvedUser("456")
			.taskName(TASK_NAME),
			"involved user (midpoint-assignee 456)");

	assertNotFound(taskService.createTaskQuery()
			.taskInvolvedUser("123xxx")
			.taskName(TASK_NAME),
			"involved user (wrong user)");

	assertFound(taskService.createTaskQuery()
			.taskInvolvedUser("123;124")
			.taskName(TASK_NAME),
			"involved user (123 or 124)");

	assertFound(taskService.createTaskQuery()
			.taskInvolvedUser("124;123")
			.taskName(TASK_NAME),
			"involved user (124 or 123)");

	assertNotFound(taskService.createTaskQuery()
			.taskInvolvedUser("124x;123x")
			.taskName(TASK_NAME),
			"involved user (124x or 123x)");

	assertFound(taskService.createTaskQuery()
			.or()
				.taskInvolvedUser("123")
				.taskCandidateGroup("xxxxxxx")
			.endOr()
			.taskName(TASK_NAME),
			"involved user (123 or candidate group xxxxxxx)");

	assertFound(taskService.createTaskQuery()
			.or()
				.taskInvolvedUser("123;124")
				.taskCandidateGroup("xxxxxxx")
			.endOr()
			.taskName(TASK_NAME),
			"involved user (123 or 124 or candidate group xxxxxxx)");

	assertNotFound(taskService.createTaskQuery()
			.or()
				.taskInvolvedUser("123x;124x")
				.taskCandidateGroup("xxxxxxx")
			.endOr()
			.taskName(TASK_NAME),
			"involved user (123x or 124x or candidate group xxxxxxx)");
}
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:80,代码来源:TestActivitiQuery.java

示例4: test210TestQueryByIdentityLink

import org.activiti.engine.TaskService; //导入方法依赖的package包/类
@Test
public void test210TestQueryByIdentityLink() throws Exception {
	final String TEST_NAME = "test210TestQueryByIdentityLink";
	TestUtil.displayTestTitle(this, TEST_NAME);
	login(userAdministrator);

	TaskService taskService = activitiEngine.getTaskService();
	TaskQuery tq = taskService.createTaskQuery();
	org.activiti.engine.task.Task task = tq.singleResult();
	System.out.println("Task = " + task);
	assertNotNull("No task", task);

	final String TASK_NAME = "Assigning role \"Role1a\" to user \"jack\"";
	List<IdentityLink> linksBefore = taskService.getIdentityLinksForTask(task.getId());
	System.out.println("Identity links (before)" + linksBefore);
	taskService.addUserIdentityLink(task.getId(), "123", CommonProcessVariableNames.MIDPOINT_ASSIGNEE);
	taskService.addUserIdentityLink(task.getId(), "456", CommonProcessVariableNames.MIDPOINT_ASSIGNEE);
	List<IdentityLink> linksAfter = taskService.getIdentityLinksForTask(task.getId());
	System.out.println("Identity links (after)" + linksAfter);

	TaskQuery tq1 = taskService.createTaskQuery()
			.taskInvolvedUser("UserType:"+userLead1Oid)
			.taskName(TASK_NAME);
	assertFound(tq1, "involved user (assignee)");

	assertFound(taskService.createTaskQuery()
			.taskInvolvedUser("123")
			.taskName(TASK_NAME),
			"involved user (midpoint-assignee 123)");

	assertFound(taskService.createTaskQuery()
			.taskInvolvedUser("456")
			.taskName(TASK_NAME),
			"involved user (midpoint-assignee 456)");

	assertNotFound(taskService.createTaskQuery()
			.taskInvolvedUser("123xxx")
			.taskName(TASK_NAME),
			"involved user (wrong user)");

	assertFound(taskService.createTaskQuery()
			.taskInvolvedUser("123;124")
			.taskName(TASK_NAME),
			"involved user (123 or 124)");

	assertFound(taskService.createTaskQuery()
			.taskInvolvedUser("124;123")
			.taskName(TASK_NAME),
			"involved user (124 or 123)");

	assertNotFound(taskService.createTaskQuery()
			.taskInvolvedUser("124x;123x")
			.taskName(TASK_NAME),
			"involved user (124x or 123x)");

	assertFound(taskService.createTaskQuery()
			.or()
				.taskInvolvedUser("123")
				.taskCandidateGroup("xxxxxxx")
			.endOr()
			.taskName(TASK_NAME),
			"involved user (123 or candidate group xxxxxxx)");

	assertFound(taskService.createTaskQuery()
			.or()
				.taskInvolvedUser("123;124")
				.taskCandidateGroup("xxxxxxx")
			.endOr()
			.taskName(TASK_NAME),
			"involved user (123 or 124 or candidate group xxxxxxx)");

	assertNotFound(taskService.createTaskQuery()
			.or()
				.taskInvolvedUser("123x;124x")
				.taskCandidateGroup("xxxxxxx")
			.endOr()
			.taskName(TASK_NAME),
			"involved user (123x or 124x or candidate group xxxxxxx)");
}
 
开发者ID:Evolveum,项目名称:midpoint,代码行数:80,代码来源:TestActivitiQuery.java


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