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


Java IdentityLink类代码示例

本文整理汇总了Java中org.activiti.engine.task.IdentityLink的典型用法代码示例。如果您正苦于以下问题:Java IdentityLink类的具体用法?Java IdentityLink怎么用?Java IdentityLink使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: createHumanTask

import org.activiti.engine.task.IdentityLink; //导入依赖的package包/类
public HumanTaskDTO createHumanTask(DelegateTask delegateTask)
        throws Exception {
    HumanTaskDTO humanTaskDto = new HumanTaskBuilder()
            .setDelegateTask(delegateTask)
            .setVote(this.isVote(delegateTask)).build();

    humanTaskDto = humanTaskConnector.saveHumanTask(humanTaskDto);
    logger.debug("candidates : {}", delegateTask.getCandidates());

    for (IdentityLink identityLink : delegateTask.getCandidates()) {
        String type = identityLink.getType();
        ParticipantDTO participantDto = new ParticipantDTO();
        participantDto.setType(type);
        participantDto.setHumanTaskId(humanTaskDto.getId());

        if ("user".equals(type)) {
            participantDto.setCode(identityLink.getUserId());
        } else {
            participantDto.setCode(identityLink.getGroupId());
        }

        humanTaskConnector.saveParticipant(participantDto);
    }

    return humanTaskDto;
}
 
开发者ID:zhaojunfei,项目名称:lemon,代码行数:27,代码来源:HumanTaskEventListener.java

示例2: 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

示例3: 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

示例4: addPooledActorsAsVariable

import org.activiti.engine.task.IdentityLink; //导入依赖的package包/类
private void addPooledActorsAsVariable(DelegateTask task,
            Map<String, Object> variables) 
{
    List<IdentityLinkEntity> links = ((TaskEntity)task).getIdentityLinks();
    if (links.size() > 0)
    {
        // Add to list of IdentityLink
        List<IdentityLink> identityLinks = new ArrayList<IdentityLink>();
        identityLinks.addAll(links);
        
        List<NodeRef> pooledActorRefs = propertyConverter.getPooledActorsReference(identityLinks);
        
        // Save references as a variable
        List<String> nodeIds = new ArrayList<String>();
        for (NodeRef ref : pooledActorRefs)
        {
            nodeIds.add(ref.toString());
        }
        variables.put(ActivitiConstants.PROP_POOLED_ACTORS_HISTORY, nodeIds);
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:22,代码来源:TaskCompleteListener.java

示例5: getTaskCandidates

import org.activiti.engine.task.IdentityLink; //导入依赖的package包/类
@Override
public CollectionWithPagingInfo<TaskCandidate> getTaskCandidates(String taskId, Paging paging) 
{
    // Fetch task to check if user is authorized to perform the delete
    getValidTask(taskId);
    
    List<IdentityLink> links = activitiProcessEngine.getTaskService().getIdentityLinksForTask(taskId);
    List<TaskCandidate> page = new ArrayList<TaskCandidate>();
    if (links != null) 
    {
        for (IdentityLink identityLink : links)
        {
            if (IdentityLinkType.CANDIDATE.equals(identityLink.getType())) 
            {
                page.add(new TaskCandidate(identityLink));
            }
        }
    }
    
    return CollectionWithPagingInfo.asPaged(paging, page, false, page.size());
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:22,代码来源:TasksImpl.java

示例6: otherTest

import org.activiti.engine.task.IdentityLink; //导入依赖的package包/类
/**
 * 其他操作
 */
@Test
public void otherTest() {
    List<String> list = runtimeService.getActiveActivityIds("30001");
    logger.info("###================================================ ActiveActivityIds, {}", list);

    List<IdentityLink> identityLinkList = runtimeService.getIdentityLinksForProcessInstance("30001");
    logger.info("###================================================ identityLinkList, {}", identityLinkList);

    String variable = runtimeService.getVariable("30001","variables01", String.class);
    logger.info("###================================================ variable, {}", variable);

    Map<String, VariableInstance> map = runtimeService.getVariableInstances("30001");
    logger.info("###================================================ map, {}", map);

    String variableLocal = runtimeService.getVariableLocal("30001","variables01", String.class);
    logger.info("###================================================ variableLocal, {}", variableLocal);

    // 接收任务(ReceiveTask)
    runtimeService.signal("");
}
 
开发者ID:Lzw2016,项目名称:study,代码行数:24,代码来源:RuntimeServiceTest.java

示例7: setCandidateUserAndGroups

import org.activiti.engine.task.IdentityLink; //导入依赖的package包/类
/**
 * 读取流程定义的相关候选启动人、组,根据link信息转换并封装为User、Group对象
 * @param processDefinitionList
 * @return
 */
private Map<String, Map<String, List<? extends Object>>> setCandidateUserAndGroups(List<ProcessDefinition> processDefinitionList) {
    Map<String, Map<String, List<? extends Object>>> linksMap = new HashMap<String, Map<String, List<? extends Object>>>();
    for (ProcessDefinition processDefinition : processDefinitionList) {
        List<IdentityLink> identityLinks = repositoryService.getIdentityLinksForProcessDefinition(processDefinition.getId());

        Map<String, List<? extends Object>> single = new Hashtable<String, List<? extends Object>>();
        List<User> linkUsers = new ArrayList<User>();
        List<Group> linkGroups = new ArrayList<Group>();

        for (IdentityLink link : identityLinks) {
            if (StringUtils.isNotBlank(link.getUserId())) {
                linkUsers.add(identityService.createUserQuery().userId(link.getUserId()).singleResult());
            } else if (StringUtils.isNotBlank(link.getGroupId())) {
                linkGroups.add(identityService.createGroupQuery().groupId(link.getGroupId()).singleResult());
            }
        }

        single.put("user", linkUsers);
        single.put("group", linkGroups);

        linksMap.put(processDefinition.getId(), single);

    }
    return linksMap;
}
 
开发者ID:shawn-gogh,项目名称:myjavacode,代码行数:31,代码来源:DeploymentController.java

示例8: readStartableData

import org.activiti.engine.task.IdentityLink; //导入依赖的package包/类
/**
 * 读取已设置的候选启动人、组
 * @param processDefinitionId
 * @return
 */
@RequestMapping(value = "startable/read/{processDefinitionId}", method = RequestMethod.GET)
@ResponseBody
public Map<String, List<String>> readStartableData(@PathVariable("processDefinitionId") String processDefinitionId) {
    Map<String, List<String>> datas = new HashMap<String, List<String>>();
    ArrayList<String> users = new ArrayList<String>();
    ArrayList<String> groups = new ArrayList<String>();

    List<IdentityLink> links = repositoryService.getIdentityLinksForProcessDefinition(processDefinitionId);
    for (IdentityLink link : links) {
        if (StringUtils.isNotBlank(link.getUserId())) {
            users.add(link.getUserId());
        }
        if (StringUtils.isNotBlank(link.getGroupId())) {
            groups.add(link.getGroupId());
        }
    }
    datas.put("users", users);
    datas.put("groups", groups);
    return datas;
}
 
开发者ID:shawn-gogh,项目名称:myjavacode,代码行数:26,代码来源:ProcessManagerController.java

示例9: unclaim

import org.activiti.engine.task.IdentityLink; //导入依赖的package包/类
/**
 * 反签收任务
 */
@RequestMapping(value = "task/unclaim/{id}")
public String unclaim(@PathVariable("id") String taskId, HttpSession session, RedirectAttributes redirectAttributes) {
    // 反签收条件过滤
    List<IdentityLink> links = taskService.getIdentityLinksForTask(taskId);
    for (IdentityLink identityLink : links) {
        // 如果一个任务有相关的候选人、组就可以反签收
        if (StringUtils.equals(IdentityLinkType.CANDIDATE, identityLink.getType())) {
            taskService.claim(taskId, null);
            redirectAttributes.addFlashAttribute("message", "任务已反签收");
            return TASK_LIST;
        }
    }
    redirectAttributes.addFlashAttribute("error", "该任务不允许反签收!");
    return TASK_LIST;
}
 
开发者ID:shawn-gogh,项目名称:myjavacode,代码行数:19,代码来源:TaskController.java

示例10: execute

import org.activiti.engine.task.IdentityLink; //导入依赖的package包/类
@SuppressWarnings({"unchecked" })
public List<IdentityLink> execute(CommandContext commandContext) {
  TaskEntity task = Context
    .getCommandContext()
    .getTaskManager()
    .findTaskById(taskId);

  List<IdentityLink> identityLinks = (List) task.getIdentityLinks();
  
  // assignee is not part of identity links in the db. 
  // so if there is one, we add it here.
  // @Tom: we discussed this long on skype and you agreed ;-)
  // an assignee *is* an identityLink, and so must it be reflected in the API
  //
  // Note: we cant move this code to the TaskEntity (which would be cleaner),
  // since the task.delete cascased to all associated identityLinks 
  // and of course this leads to exception while trying to delete a non-existing identityLink
  if (task.getAssignee() != null) {
    IdentityLinkEntity identityLink = new IdentityLinkEntity();
    identityLink.setUserId(task.getAssignee());
    identityLink.setType(IdentityLinkType.ASSIGNEE);
    identityLinks.add(identityLink);
  }
  
  return (List) task.getIdentityLinks();
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:27,代码来源:GetIdentityLinksForTaskCmd.java

示例11: testGetIdentityLinksWithCandidateUser

import org.activiti.engine.task.IdentityLink; //导入依赖的package包/类
public void testGetIdentityLinksWithCandidateUser() {
  Task task = taskService.newTask();
  taskService.saveTask(task);
  String taskId = task.getId();
  
  identityService.saveUser(identityService.newUser("kermit"));
  
  taskService.addCandidateUser(taskId, "kermit");
  List<IdentityLink> identityLinks = taskService.getIdentityLinksForTask(taskId);
  assertEquals(1, identityLinks.size());
  assertEquals("kermit", identityLinks.get(0).getUserId());
  assertNull(identityLinks.get(0).getGroupId());
  assertEquals(IdentityLinkType.CANDIDATE, identityLinks.get(0).getType());
  
  //cleanup
  taskService.deleteTask(taskId, true);
  identityService.deleteUser("kermit");
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:19,代码来源:TaskServiceTest.java

示例12: testGetIdentityLinksWithCandidateGroup

import org.activiti.engine.task.IdentityLink; //导入依赖的package包/类
public void testGetIdentityLinksWithCandidateGroup() {
  Task task = taskService.newTask();
  taskService.saveTask(task);
  String taskId = task.getId();
  
  identityService.saveGroup(identityService.newGroup("muppets"));
  
  taskService.addCandidateGroup(taskId, "muppets");
  List<IdentityLink> identityLinks = taskService.getIdentityLinksForTask(taskId);
  assertEquals(1, identityLinks.size());
  assertEquals("muppets", identityLinks.get(0).getGroupId());
  assertNull(identityLinks.get(0).getUserId());
  assertEquals(IdentityLinkType.CANDIDATE, identityLinks.get(0).getType());
  
  //cleanup
  taskService.deleteTask(taskId, true);
  identityService.deleteGroup("muppets");
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:19,代码来源:TaskServiceTest.java

示例13: testGetIdentityLinksWithAssignee

import org.activiti.engine.task.IdentityLink; //导入依赖的package包/类
public void testGetIdentityLinksWithAssignee() {
  Task task = taskService.newTask();
  taskService.saveTask(task);
  String taskId = task.getId();
  
  identityService.saveUser(identityService.newUser("kermit"));
  
  taskService.claim(taskId, "kermit");
  List<IdentityLink> identityLinks = taskService.getIdentityLinksForTask(taskId);
  assertEquals(1, identityLinks.size());
  assertEquals("kermit", identityLinks.get(0).getUserId());
  assertNull(identityLinks.get(0).getGroupId());
  assertEquals(IdentityLinkType.ASSIGNEE, identityLinks.get(0).getType());
  
  //cleanup
  taskService.deleteTask(taskId, true);
  identityService.deleteUser("kermit");
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:19,代码来源:TaskServiceTest.java

示例14: testCandidateUserLink

import org.activiti.engine.task.IdentityLink; //导入依赖的package包/类
@Deployment(resources="org/activiti/engine/test/api/task/IdentityLinksProcess.bpmn20.xml")
public void testCandidateUserLink() {
  runtimeService.startProcessInstanceByKey("IdentityLinksProcess");
  
  String taskId = taskService
    .createTaskQuery()
    .singleResult()
    .getId();
  
  taskService.addCandidateUser(taskId, "kermit");
  
  List<IdentityLink> identityLinks = taskService.getIdentityLinksForTask(taskId);
  IdentityLink identityLink = identityLinks.get(0);
  
  assertNull(identityLink.getGroupId());
  assertEquals("kermit", identityLink.getUserId());
  assertEquals(IdentityLinkType.CANDIDATE, identityLink.getType());
  assertEquals(taskId, identityLink.getTaskId());
  
  assertEquals(1, identityLinks.size());

  taskService.deleteCandidateUser(taskId, "kermit");
  
  assertEquals(0, taskService.getIdentityLinksForTask(taskId).size());
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:26,代码来源:TaskIdentityLinksTest.java

示例15: testCustomTypeUserLink

import org.activiti.engine.task.IdentityLink; //导入依赖的package包/类
@Deployment(resources="org/activiti/engine/test/api/task/IdentityLinksProcess.bpmn20.xml")
public void testCustomTypeUserLink() {
  runtimeService.startProcessInstanceByKey("IdentityLinksProcess");
  
  String taskId = taskService
    .createTaskQuery()
    .singleResult()
    .getId();
  
  taskService.addUserIdentityLink(taskId, "kermit", "interestee");
  
  List<IdentityLink> identityLinks = taskService.getIdentityLinksForTask(taskId);
  IdentityLink identityLink = identityLinks.get(0);
  
  assertNull(identityLink.getGroupId());
  assertEquals("kermit", identityLink.getUserId());
  assertEquals("interestee", identityLink.getType());
  assertEquals(taskId, identityLink.getTaskId());
  
  assertEquals(1, identityLinks.size());

  taskService.deleteUserIdentityLink(taskId, "kermit", "interestee");
  
  assertEquals(0, taskService.getIdentityLinksForTask(taskId).size());
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:26,代码来源:TaskIdentityLinksTest.java


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