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


Java IdentityLink.getUserId方法代码示例

本文整理汇总了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;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:25,代码来源:ActivitiPropertyConverter.java

示例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());
        }
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:26,代码来源:ActivitiPooledActorsPropertyHandler.java

示例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";
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:11,代码来源:TaskCandidate.java

示例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;
}
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:16,代码来源:WorkItemProvider.java

示例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;
}
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:31,代码来源:WorkItemProvider.java

示例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);
		}
	}
}
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:38,代码来源:WorkItemManager.java

示例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;
 }
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:29,代码来源:MiscDataUtil.java

示例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);
      }
    }
  }
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:16,代码来源:TaskInvolvedPeopleComponent.java

示例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);
}
 
开发者ID:springvelocity,项目名称:xbpm5,代码行数:15,代码来源:DelegateTaskTestTaskListener.java

示例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);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:49,代码来源:ActivitiPooledActorsPropertyHandler.java

示例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());
}
 
开发者ID:zhaojunfei,项目名称:lemon,代码行数:53,代码来源:AutoCompleteFirstTaskListener.java

示例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);
}
 
开发者ID:zhaojunfei,项目名称:lemon,代码行数:67,代码来源:AutoCompleteFirstTaskEventListener.java

示例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);
     }
 }
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:44,代码来源:ActivitiInterface.java


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