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


Java TaskEntity.setAssignee方法代码示例

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


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

示例1: execute

import org.activiti.engine.impl.persistence.entity.TaskEntity; //导入方法依赖的package包/类
@Override
protected Void execute(CommandContext commandContext, TaskEntity task) {

    if (userId != null) {
        if (task.getAssignee() != null) {
            if (!task.getAssignee().equals(userId)) {
                // When the task is already claimed by another user, throw exception. Otherwise, ignore
                // this, post-conditions of method already met.
                throw new ActivitiTaskAlreadyClaimedException(task.getId(), task.getAssignee());
            }
        } else {
            task.setAssignee(userId, true, true);
        }
    } else {
        // Task should be assigned to no one
        task.setAssignee(null, true, true);
    }

    // Add claim time
    commandContext.getHistoryManager().recordTaskClaim(taskId);

    return null;
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:24,代码来源:ClaimTaskCmd.java

示例2: execute

import org.activiti.engine.impl.persistence.entity.TaskEntity; //导入方法依赖的package包/类
@Override
protected Void execute(CommandContext commandContext, TaskEntity task) {

    if (IdentityLinkType.ASSIGNEE.equals(type)) {
        task.setAssignee(null, true, true);
    } else if (IdentityLinkType.OWNER.equals(type)) {
        task.setOwner(null, true);
    } else {
        task.deleteIdentityLink(userId, groupId, type);
    }

    commandContext.getHistoryManager()
            .createIdentityLinkComment(taskId, userId, groupId, type, false);

    return null;
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:17,代码来源:DeleteIdentityLinkCmd.java

示例3: onEvent

import org.activiti.engine.impl.persistence.entity.TaskEntity; //导入方法依赖的package包/类
@Override
public void onEvent(ActivitiEvent event) {
    ActivitiEntityEvent entityEvent = (ActivitiEntityEvent) event;
    Object entity = entityEvent.getEntity();
    if (entity instanceof TaskEntity) {
        TaskEntity task = (TaskEntity) entity;
        String originUserId = task.getAssignee();
        String newUserId = userMap.get(originUserId);
        if (StringUtils.isNotBlank(newUserId)) {
            task.setAssignee(newUserId);
            TaskService taskService = event.getEngineServices().getTaskService();
            String message = getClass().getName() + "-> 任务[" + task.getName() + "]的办理人[" +
                    originUserId + "]自动转办给了用户[" + newUserId + "]";
            taskService.addComment(task.getId(), task.getProcessInstanceId(), "redirect", message);
        }
    }
}
 
开发者ID:shawn-gogh,项目名称:myjavacode,代码行数:18,代码来源:TaskAutoRedirectGlobalEventListener.java

示例4: execute

import org.activiti.engine.impl.persistence.entity.TaskEntity; //导入方法依赖的package包/类
protected Void execute(CommandContext commandContext, TaskEntity task) {

    boolean assignedToNoOne = false;
    if (IdentityLinkType.ASSIGNEE.equals(type)) {
      task.setAssignee(userId);
      assignedToNoOne = userId == null;
    } else if (IdentityLinkType.OWNER.equals(type)) {
      task.setOwner(userId);
    } else {
      task.addIdentityLink(userId, groupId, type);
    }

    if (assignedToNoOne) {
      // ACT-1317: Special handling when assignee is set to NULL, a CommentEntity notifying of assignee-delete should be created
      commandContext.getHistoryManager().createIdentityLinkComment(taskId, userId, groupId, type, false, true);
    } else {
      commandContext.getHistoryManager().createIdentityLinkComment(taskId, userId, groupId, type, true);
    }
    
    return null;  
  }
 
开发者ID:springvelocity,项目名称:xbpm5,代码行数:22,代码来源:AddIdentityLinkCmd.java

示例5: execute

import org.activiti.engine.impl.persistence.entity.TaskEntity; //导入方法依赖的package包/类
protected Void execute(CommandContext commandContext, TaskEntity task) {

    if(userId != null) {
      if (task.getAssignee() != null) {
        if(!task.getAssignee().equals(userId)) {
          // When the task is already claimed by another user, throw exception. Otherwise, ignore
          // this, post-conditions of method already met.
          throw new ActivitiTaskAlreadyClaimedException(task.getId(), task.getAssignee());
        }
      } else {
        task.setAssignee(userId);
      }      
    } else {
      // Task should be assigned to no one
      task.setAssignee(null);
    }
    
    // Add claim time
    commandContext.getHistoryManager().recordTaskClaim( taskId);

    return null;
  }
 
开发者ID:springvelocity,项目名称:xbpm5,代码行数:23,代码来源:ClaimTaskCmd.java

示例6: copy

import org.activiti.engine.impl.persistence.entity.TaskEntity; //导入方法依赖的package包/类
private Task copy(Task aTask) {
    TaskEntity ent = TaskEntity.create(aTask.getCreateTime());
    ent.setId(aTask.getId());
    ent.setName(aTask.getName());
    ent.setDescription(aTask.getDescription());
    ent.setOwner(aTask.getOwner());
    ent.setDueDateWithoutCascade(aTask.getDueDate());
    ent.setAssignee(aTask.getAssignee());
    ent.setPriority(aTask.getPriority());
    return ent;
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:12,代码来源:TestFlowableEntityEventTaskListener.java

示例7: execute

import org.activiti.engine.impl.persistence.entity.TaskEntity; //导入方法依赖的package包/类
@Override
protected Void execute(CommandContext commandContext, TaskEntity task) {

    boolean assignedToNoOne = false;
    if (IdentityLinkType.ASSIGNEE.equals(identityType)) {
        task.setAssignee(identityId, true, true);
        assignedToNoOne = identityId == null;
    } else if (IdentityLinkType.OWNER.equals(identityType)) {
        task.setOwner(identityId, true);
    } else if (IDENTITY_USER == identityIdType) {
        task.addUserIdentityLink(identityId, identityType);
    } else if (IDENTITY_GROUP == identityIdType) {
        task.addGroupIdentityLink(identityId, identityType);
    }

    boolean forceNullUserId = false;
    if (assignedToNoOne) {
        // ACT-1317: Special handling when assignee is set to NULL, a
        // CommentEntity notifying of assignee-delete should be created
        forceNullUserId = true;

    }

    if (IDENTITY_USER == identityIdType) {
        commandContext.getHistoryManager().createUserIdentityLinkComment(taskId, identityId, identityType, true, forceNullUserId);
    } else {
        commandContext.getHistoryManager().createGroupIdentityLinkComment(taskId, identityId, identityType, true);
    }

    return null;
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:32,代码来源:AddIdentityLinkCmd.java

示例8: createTask

import org.activiti.engine.impl.persistence.entity.TaskEntity; //导入方法依赖的package包/类
public void createTask(CommandContext commandContext, DbSqlSession dbSqlSession, MailTransformer mailTransformer) throws MessagingException {
  // distill the task description from the mail body content (without the html tags)
  String taskDescription = mailTransformer.getHtml();
  taskDescription = taskDescription.replaceAll("\\<.*?\\>", "");
  taskDescription = taskDescription.replaceAll("\\s", " ");
  taskDescription = taskDescription.trim();
  if (taskDescription.length()>120) {
    taskDescription = taskDescription.substring(0, 117)+"...";
  }

  // create and insert the task
  TaskEntity task = new TaskEntity();
  task.setAssignee(userId);
  task.setName(mailTransformer.getMessage().getSubject());
  task.setDescription(taskDescription);
  dbSqlSession.insert(task);
  String taskId = task.getId();
  
  // add identity links for all the recipients
  for (String recipientEmailAddress: mailTransformer.getRecipients()) {
    User recipient = new UserQueryImpl(commandContext)
      .userEmail(recipientEmailAddress)
      .singleResult();
    if (recipient!=null) {
      task.addUserIdentityLink(recipient.getId(), "Recipient");
    }
  }
  
  // attach the mail and other attachments to the task
  List<AttachmentEntity> attachments = mailTransformer.getAttachments();
  for (AttachmentEntity attachment: attachments) {
    // insert the bytes as content
    ByteArrayEntity content = attachment.getContent();
    dbSqlSession.insert(content);
    // insert the attachment
    attachment.setContentId(content.getId());
    attachment.setTaskId(taskId);
    dbSqlSession.insert(attachment);
  }
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:41,代码来源:MailScanCmd.java

示例9: execute

import org.activiti.engine.impl.persistence.entity.TaskEntity; //导入方法依赖的package包/类
public Void execute(CommandContext commandContext) {
  TaskEntity task = Context
    .getCommandContext()
    .getTaskManager()
    .findTaskById(taskId);
  
  if (task == null) {
    throw new ActivitiException("Cannot find task with id " + taskId);
  }
  
  if (IdentityLinkType.ASSIGNEE.equals(type)) {
    task.setAssignee(userId);
  } else if (IdentityLinkType.OWNER.equals(type)) {
    task.setOwner(userId);
  } else {
    task.addIdentityLink(userId, groupId, type);
  }

  CommentManager commentManager = commandContext.getCommentManager();
  if (commentManager.isHistoryEnabled()) {
    String authenticatedUserId = Authentication.getAuthenticatedUserId();
    CommentEntity comment = new CommentEntity();
    comment.setUserId(authenticatedUserId);
    comment.setType(CommentEntity.TYPE_EVENT);
    comment.setTime(ClockUtil.getCurrentTime());
    comment.setTaskId(taskId);
    if (userId!=null) {
      comment.setAction(Event.ACTION_ADD_USER_LINK);
      comment.setMessage(new String[]{userId, type});
    } else {
      comment.setAction(Event.ACTION_ADD_GROUP_LINK);
      comment.setMessage(new String[]{groupId, type});
    }
    commentManager.insert(comment);
  }
  
  return null;  
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:39,代码来源:AddIdentityLinkCmd.java

示例10: execute

import org.activiti.engine.impl.persistence.entity.TaskEntity; //导入方法依赖的package包/类
public Void execute(CommandContext commandContext) {
  if(taskId == null) {
    throw new ActivitiException("taskId is null");
  }
  
  TaskEntity task = Context
    .getCommandContext()
    .getTaskManager()
    .findTaskById(taskId);
  
  if (task == null) {
    throw new ActivitiException("Cannot find task with id " + taskId);
  }
  if(userId != null) {
    if (task.getAssignee() != null) {
      if(!task.getAssignee().equals(userId)) {
        // When the task is already claimed by another user, throw exception. Otherwise, ignore
        // this, post-conditions of method already met.
        throw new ActivitiException("Task " + taskId + " is already claimed by someone else");
      }
    } else {
      task.setAssignee(userId);
    }      
  } else {
    // Task should be assigned to no one
    task.setAssignee(null);
  }

  return null;
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:31,代码来源:ClaimTaskCmd.java

示例11: execute

import org.activiti.engine.impl.persistence.entity.TaskEntity; //导入方法依赖的package包/类
public Void execute(CommandContext commandContext) {
  TaskEntity task = Context
    .getCommandContext()
    .getTaskManager()
    .findTaskById(taskId);
  
  if (task == null) {
    throw new ActivitiException("Cannot find task with id " + taskId);
  }
  
  if (IdentityLinkType.ASSIGNEE.equals(type)) {
    task.setAssignee(null);
  } else {
    task.deleteIdentityLink(userId, groupId, type);
  }
  
  CommentManager commentManager = commandContext.getCommentManager();
  if (commentManager.isHistoryEnabled()) {
    String authenticatedUserId = Authentication.getAuthenticatedUserId();
    CommentEntity comment = new CommentEntity();
    comment.setUserId(authenticatedUserId);
    comment.setType(CommentEntity.TYPE_EVENT);
    comment.setTime(ClockUtil.getCurrentTime());
    comment.setTaskId(taskId);
    if (userId!=null) {
      comment.setAction(Event.ACTION_DELETE_USER_LINK);
      comment.setMessage(new String[]{userId, type});
    } else {
      comment.setAction(Event.ACTION_DELETE_GROUP_LINK);
      comment.setMessage(new String[]{groupId, type});
    }
    commentManager.insert(comment);
  }
  
  return null;  
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:37,代码来源:DeleteIdentityLinkCmd.java

示例12: execute

import org.activiti.engine.impl.persistence.entity.TaskEntity; //导入方法依赖的package包/类
protected Void execute(CommandContext commandContext, TaskEntity task) {

    if (IdentityLinkType.ASSIGNEE.equals(type)) {
      task.setAssignee(null);
    } else if (IdentityLinkType.OWNER.equals(type)) {
        task.setOwner(null);
    } else {
      task.deleteIdentityLink(userId, groupId, type);
    }
    
    commandContext.getHistoryManager()
      .createIdentityLinkComment(taskId, userId, groupId, type, false);
    
    return null;  
  }
 
开发者ID:springvelocity,项目名称:xbpm5,代码行数:16,代码来源:DeleteIdentityLinkCmd.java


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