本文整理汇总了Java中org.activiti.engine.task.IdentityLink.getUserId方法的典型用法代码示例。如果您正苦于以下问题:Java IdentityLink.getUserId方法的具体用法?Java IdentityLink.getUserId怎么用?Java IdentityLink.getUserId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.activiti.engine.task.IdentityLink
的用法示例。
在下文中一共展示了IdentityLink.getUserId方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getPooledActorsReference
import org.activiti.engine.task.IdentityLink; //导入方法依赖的package包/类
public List<NodeRef> getPooledActorsReference(Collection<IdentityLink> links)
{
List<NodeRef> pooledActorRefs = new ArrayList<NodeRef>();
if(links != null)
{
for(IdentityLink link : links)
{
if(IdentityLinkType.CANDIDATE.equals(link.getType()))
{
String id = link.getGroupId();
if(id == null)
{
id = link.getUserId();
}
NodeRef pooledNodeRef = authorityManager.mapNameToAuthority(id);
if (pooledNodeRef != null)
{
pooledActorRefs.add(pooledNodeRef);
}
}
}
}
return pooledActorRefs;
}
示例2: updateTaskCandidates
import org.activiti.engine.task.IdentityLink; //导入方法依赖的package包/类
private void updateTaskCandidates(DelegateTask task, UserAndGroupUpdates updates)
{
// Only new candidates are present in pooledUsers and pooledGroups, create Links for these
for (String user : updates.getUsers())
{
task.addCandidateUser( user);
}
for (String group : updates.getGroups())
{
task.addCandidateGroup( group);
}
// Remove all candidates which have been removed
for (IdentityLink link : updates.linksToRemove)
{
if (link.getUserId() != null)
{
task.deleteUserIdentityLink(link.getUserId(), link.getType());
}
else
{
task.deleteGroupIdentityLink(link.getGroupId(), link.getType());
}
}
}
示例3: TaskCandidate
import org.activiti.engine.task.IdentityLink; //导入方法依赖的package包/类
public TaskCandidate(IdentityLink identityLink)
{
if (StringUtils.isNotEmpty(identityLink.getUserId())) {
candidateId = identityLink.getUserId();
candidateType = "user";
} else {
candidateId = identityLink.getGroupId();
candidateType = "group";
}
}
示例4: getMidpointAssignees
import org.activiti.engine.task.IdentityLink; //导入方法依赖的package包/类
@NotNull
public List<ObjectReferenceType> getMidpointAssignees(TaskExtract taskExtract) {
List<ObjectReferenceType> rv = new ArrayList<>();
for (IdentityLink link : taskExtract.getTaskIdentityLinks()) {
if (CommonProcessVariableNames.MIDPOINT_ASSIGNEE.equals(link.getType())) {
if (link.getUserId() != null) {
rv.add(MiscDataUtil.stringToRef(link.getUserId()));
}
if (link.getGroupId() != null) { // just for completeness (currently we don't expect groups to be here)
rv.add(MiscDataUtil.stringToRef(link.getGroupId()));
}
}
}
return rv;
}
示例5: TaskExtract
import org.activiti.engine.task.IdentityLink; //导入方法依赖的package包/类
TaskExtract(Task task, Map<String, Object> processVariables, List<IdentityLink> taskIdentityLinks) {
id = task.getId();
assignee = task.getAssignee();
name = task.getName();
processInstanceId = task.getProcessInstanceId();
createTime = task.getCreateTime();
dueDate = task.getDueDate();
owner = task.getOwner();
executionId = task.getExecutionId();
variables = new HashMap<>();
if (task.getProcessVariables() != null) {
variables.putAll(task.getProcessVariables());
}
if (task.getTaskLocalVariables() != null) {
variables.putAll(task.getTaskLocalVariables());
}
candidateUsers = new ArrayList<>();
candidateGroups = new ArrayList<>();
for (IdentityLink link : taskIdentityLinks) {
if (IdentityLinkType.CANDIDATE.equals(link.getType())) {
if (link.getUserId() != null) {
candidateUsers.add(link.getUserId());
} else if (link.getGroupId() != null) {
candidateGroups.add(link.getGroupId());
}
}
}
addProcessVariables(processVariables);
this.taskIdentityLinks = taskIdentityLinks;
}
示例6: setNewAssignees
import org.activiti.engine.task.IdentityLink; //导入方法依赖的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);
}
}
}
示例7: isAmongCandidates
import org.activiti.engine.task.IdentityLink; //导入方法依赖的package包/类
private boolean isAmongCandidates(MidPointPrincipal principal, String taskId) {
String currentUserOid = principal.getOid();
List<IdentityLink> identityLinks;
try {
TaskService taskService = activitiEngine.getTaskService();
// working around activiti bug, see MID-3799.6 (the NPE when task does not exist)
org.activiti.engine.task.Task task = taskService.createTaskQuery()
.taskId(taskId)
.singleResult();
if (task == null) {
return false;
}
identityLinks = taskService.getIdentityLinksForTask(taskId);
} catch (ActivitiException e) {
throw new SystemException("Couldn't determine user authorization, because the task candidate users and groups couldn't be retrieved: " + e.getMessage(), e);
}
for (IdentityLink identityLink : identityLinks) {
if (identityLink.getUserId() != null && identityLink.getUserId().equals(currentUserOid)) {
return true;
}
if (identityLink.getGroupId() != null) {
if (isMemberOfActivitiGroup(principal.getUser(), identityLink.getGroupId())) {
return true;
}
}
}
return false;
}
示例8: initInvolvedPeople
import org.activiti.engine.task.IdentityLink; //导入方法依赖的package包/类
protected void initInvolvedPeople() {
List<IdentityLink> identityLinks = taskService.getIdentityLinksForTask(task.getId());
for (final IdentityLink identityLink : identityLinks) {
if (identityLink.getUserId() != null) { // only user identity links, ignoring the group ids
if (!IdentityLinkType.ASSIGNEE.equals(identityLink.getType())) {
UserDetailsComponent involvedDetails = new UserDetailsComponent(
identityLink.getUserId(),
identityLink.getType(),
i18nManager.getMessage(Messages.TASK_INVOLVED_REMOVE),
new RemoveInvolvedPersonListener(identityLink, task, taskDetailPanel));
peopleGrid.addComponent(involvedDetails);
}
}
}
}
示例9: notify
import org.activiti.engine.task.IdentityLink; //导入方法依赖的package包/类
public void notify(DelegateTask delegateTask) {
Set<IdentityLink> candidates = delegateTask.getCandidates();
Set<String> candidateUsers = new HashSet<String>();
Set<String> candidateGroups = new HashSet<String>();
for (IdentityLink candidate : candidates) {
if (candidate.getUserId() != null) {
candidateUsers.add(candidate.getUserId());
} else if (candidate.getGroupId() != null) {
candidateGroups.add(candidate.getGroupId());
}
}
delegateTask.setVariable(VARNAME_CANDIDATE_USERS, candidateUsers);
delegateTask.setVariable(VARNAME_CANDIDATE_GROUPS, candidateGroups);
}
示例10: getUserAndGroupUpdates
import org.activiti.engine.task.IdentityLink; //导入方法依赖的package包/类
/**
* Returns a DTO containing the users and groups to add and the links to remove.
*
* @param value Serializable
* @param links Collection<? extends IdentityLink>
* @return UserAndGroupUpdates
*/
private UserAndGroupUpdates getUserAndGroupUpdates(Serializable value, Collection<? extends IdentityLink> links)
{
Collection<NodeRef> actors = getNodes(value);
List<String> users = new ArrayList<String>();
List<String> groups = new ArrayList<String>();
for (NodeRef actor : actors)
{
String authorityName = authorityManager.getAuthorityName(actor);
List<String> pooledAuthorities = authorityManager.isUser(authorityName)? users : groups;
pooledAuthorities.add(authorityName);
}
// Removes all users and groups that are already links.
// Also records links that are not part of the new set of users and
// groups, in order to delete them.
List<IdentityLink> linksToRemove = new LinkedList<IdentityLink>();
for (IdentityLink link : links)
{
if (IdentityLinkType.CANDIDATE.equals(link.getType()))
{
String userId = link.getUserId();
if (userId != null)
{
if (users.remove(userId)==false)
{
linksToRemove.add(link);
}
}
else
{
String groupId = link.getGroupId();
if (groupId != null && groups.remove(groupId) == false)
{
linksToRemove.add(link);
}
}
}
}
return new UserAndGroupUpdates(users, groups, linksToRemove);
}
示例11: onCreate
import org.activiti.engine.task.IdentityLink; //导入方法依赖的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());
}
示例12: onCreate
import org.activiti.engine.task.IdentityLink; //导入方法依赖的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);
}
示例13: notifyMidpointAboutTaskEvent
import org.activiti.engine.task.IdentityLink; //导入方法依赖的package包/类
public void notifyMidpointAboutTaskEvent(DelegateTask delegateTask) {
OperationResult result = new OperationResult(DOT_CLASS + "notifyMidpointAboutTaskEvent");
TaskEvent taskEvent;
if (TaskListener.EVENTNAME_CREATE.equals(delegateTask.getEventName())) {
taskEvent = new TaskCreatedEvent(); // TODO distinguish created vs. assigned event
} else if (TaskListener.EVENTNAME_COMPLETE.equals(delegateTask.getEventName())) {
taskEvent = new TaskCompletedEvent();
} else if (TaskListener.EVENTNAME_DELETE.equals(delegateTask.getEventName())) {
taskEvent = new TaskDeletedEvent();
} else {
return; // ignoring other events
}
taskEvent.setVariables(delegateTask.getVariables());
taskEvent.setAssigneeOid(delegateTask.getAssignee());
taskEvent.setTaskId(delegateTask.getId());
taskEvent.setTaskName(delegateTask.getName());
taskEvent.setProcessInstanceName((String) delegateTask.getVariable(CommonProcessVariableNames.VARIABLE_PROCESS_INSTANCE_NAME));
taskEvent.setProcessInstanceId(delegateTask.getProcessInstanceId());
taskEvent.setCreateTime(delegateTask.getCreateTime());
taskEvent.setDueDate(delegateTask.getDueDate());
taskEvent.setExecutionId(delegateTask.getExecutionId());
taskEvent.setOwner(delegateTask.getOwner());
for (IdentityLink identityLink : delegateTask.getCandidates()) {
if (identityLink.getUserId() != null) {
taskEvent.getCandidateUsers().add(identityLink.getUserId());
} else if (identityLink.getGroupId() != null) {
taskEvent.getCandidateGroups().add(identityLink.getGroupId());
} else {
throw new IllegalStateException("Neither candidate user nor group id is provided in delegateTask: " + delegateTask);
}
}
try {
WorkItemType workItem = workItemProvider.taskEventToWorkItemNew(taskEvent, null, true, true, true, result);
wfTaskController.onTaskEvent(workItem, taskEvent, result);
} catch (Exception e) { // todo fix the exception processing e.g. think about situation where an event cannot be audited - should we allow to proceed?
String message = "Couldn't process an event coming from the workflow management system";
LoggingUtils.logUnexpectedException(LOGGER, message, e);
result.recordFatalError(message, e);
}
}