本文整理汇总了Java中org.activiti.engine.impl.persistence.entity.TaskEntity.getId方法的典型用法代码示例。如果您正苦于以下问题:Java TaskEntity.getId方法的具体用法?Java TaskEntity.getId怎么用?Java TaskEntity.getId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.activiti.engine.impl.persistence.entity.TaskEntity
的用法示例。
在下文中一共展示了TaskEntity.getId方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例2: 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;
}
示例3: 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);
}
}