本文整理汇总了Java中org.activiti.engine.task.Task.getId方法的典型用法代码示例。如果您正苦于以下问题:Java Task.getId方法的具体用法?Java Task.getId怎么用?Java Task.getId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.activiti.engine.task.Task
的用法示例。
在下文中一共展示了Task.getId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: TaskVo
import org.activiti.engine.task.Task; //导入方法依赖的package包/类
public TaskVo(Task task) {
this.id = task.getId();
this.name = task.getName();
this.title = task.getDescription();
this.priority = task.getPriority();
this.owner = task.getOwner();
this.assignee = task.getAssignee();
this.processInstanceId = task.getProcessInstanceId();
this.executionId = task.getExecutionId();
this.processDefinitionId = task.getProcessDefinitionId();
this.createTime = task.getCreateTime();
this.taskDefinitionKey = task.getTaskDefinitionKey();
this.dueDate = task.getDueDate();
this.category = task.getCategory();
this.parentTaskId = task.getParentTaskId();
this.tenantId = task.getTenantId();
this.formKey = task.getFormKey();
this.suspended = task.isSuspended();
}
示例2: execute
import org.activiti.engine.task.Task; //导入方法依赖的package包/类
@Scheduled(cron = "0/10 * * * * ?")
public void execute() throws Exception {
logger.info("start");
List<Task> tasks = processEngine.getTaskService().createTaskQuery()
.list();
for (Task task : tasks) {
if (task.getDueDate() != null) {
SendNoticeCmd sendNoticeCmd = new SendNoticeCmd(task.getId());
processEngine.getManagementService().executeCommand(
sendNoticeCmd);
}
}
logger.info("end");
}
示例3: testReleaseTask
import org.activiti.engine.task.Task; //导入方法依赖的package包/类
@Deployment
public void testReleaseTask() throws Exception {
runtimeService.startProcessInstanceByKey("releaseTaskProcess");
Task task = taskService.createTaskQuery().taskAssignee("fozzie").singleResult();
assertNotNull(task);
String taskId = task.getId();
// Set assignee to null
taskService.setAssignee(taskId, null);
task = taskService.createTaskQuery().taskAssignee("fozzie").singleResult();
assertNull(task);
task = taskService.createTaskQuery().taskId(taskId).singleResult();
assertNotNull(task);
assertNull(task.getAssignee());
}
示例4: testTaskDelegationThroughServiceCall
import org.activiti.engine.task.Task; //导入方法依赖的package包/类
public void testTaskDelegationThroughServiceCall() {
Task task = taskService.newTask();
task.setOwner("johndoe");
taskService.saveTask(task);
String taskId = task.getId();
// Fetch the task again and update
task = taskService.createTaskQuery().taskId(taskId).singleResult();
taskService.delegateTask(taskId, "joesmoe");
task = taskService.createTaskQuery().taskId(taskId).singleResult();
assertEquals("johndoe", task.getOwner());
assertEquals("joesmoe", task.getAssignee());
assertEquals(DelegationState.PENDING, task.getDelegationState());
taskService.resolveTask(taskId);
task = taskService.createTaskQuery().taskId(taskId).singleResult();
assertEquals("johndoe", task.getOwner());
assertEquals("johndoe", task.getAssignee());
assertEquals(DelegationState.RESOLVED, task.getDelegationState());
// Finally, delete task
taskService.deleteTask(taskId, true);
}
示例5: testCompleteTaskWithParametersEmptyParameters
import org.activiti.engine.task.Task; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public void testCompleteTaskWithParametersEmptyParameters() {
Task task = taskService.newTask();
taskService.saveTask(task);
String taskId = task.getId();
taskService.complete(taskId, Collections.EMPTY_MAP);
if (processEngineConfiguration.getHistoryLevel()>=ProcessEngineConfigurationImpl.HISTORYLEVEL_AUDIT) {
historyService.deleteHistoricTaskInstance(taskId);
}
// Fetch the task again
task = taskService.createTaskQuery().taskId(taskId).singleResult();
assertNull(task);
}
示例6: testGetIdentityLinksWithCandidateUser
import org.activiti.engine.task.Task; //导入方法依赖的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");
}
示例7: testGetIdentityLinksWithCandidateGroup
import org.activiti.engine.task.Task; //导入方法依赖的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");
}
示例8: testGetIdentityLinksWithAssignee
import org.activiti.engine.task.Task; //导入方法依赖的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");
}
示例9: performResetPassword
import org.activiti.engine.task.Task; //导入方法依赖的package包/类
@Override
public void performResetPassword(DelegateExecution execution)
{
// This method chooses to take a rather indirect route to access the password value.
// This is for security reasons. We do not want to store the password in the Activiti DB.
// We can get the username from the execution (process scope).
final String userName = (String) execution.getVariable(WorkflowModelResetPassword.WF_PROP_USERNAME_ACTIVITI);
// But we cannot get the password from the execution as we have intentionally not stored the password there.
// Instead we recover the password from the specific task in which it was set.
List<Task> activitiTasks = activitiTaskService.createTaskQuery().taskDefinitionKey(WorkflowModelResetPassword.TASK_RESET_PASSWORD)
.processInstanceId(execution.getProcessInstanceId()).list();
if (activitiTasks.size() != 1)
{
throw new ResetPasswordWorkflowException("Unexpected count of task instances: " + activitiTasks.size());
}
Task activitiTask = activitiTasks.get(0);
String activitiTaskId = activitiTask.getId();
final String password = (String) activitiTaskService.getVariable(activitiTaskId, WorkflowModelResetPassword.WF_PROP_PASSWORD_ACTIVITI);
if (LOGGER.isDebugEnabled())
{
LOGGER.debug("Retrieved new password from task " + activitiTaskId);
}
ParameterCheck.mandatoryString(WorkflowModelResetPassword.WF_PROP_USERNAME_ACTIVITI, userName);
ParameterCheck.mandatoryString(WorkflowModelResetPassword.WF_PROP_PASSWORD_ACTIVITI, password);
if (LOGGER.isDebugEnabled())
{
LOGGER.debug("Changing password for " + userName);
// Don't LOG the password. :)
}
this.authenticationService.setAuthentication(userName, password.toCharArray());
}
示例10: convert
import org.activiti.engine.task.Task; //导入方法依赖的package包/类
/**
* Converts the given task into a {@link WorkflowTask}, allows ignoring domain mismatch (ALF-12264)
* @param task Task
* @param ignoreDomainMismatch whether or not to ignore domain mismatch exception
* @return the converter task. Returns null when the domain mismatched and ignoreDomainMismatch was true.
*/
public WorkflowTask convert(Task task, boolean ignoreDomainMismatch)
{
if(task == null)
return null;
String id = task.getId();
String defaultTitle = task.getName();
String defaultDescription = task.getDescription();
WorkflowTaskState state = WorkflowTaskState.IN_PROGRESS;
WorkflowPath path = getWorkflowPath(task.getExecutionId(), ignoreDomainMismatch);
if(path != null)
{
// Since the task is active, it's safe to use the active node on
// the execution path
WorkflowNode node = path.getNode();
TaskFormData taskFormData =formService.getTaskFormData(task.getId());
String taskDefId = null;
if(taskFormData != null)
{
taskDefId = taskFormData.getFormKey();
}
WorkflowTaskDefinition taskDef = factory.createTaskDefinition(taskDefId, node, taskDefId, false);
// All task-properties should be fetched, not only local
Map<QName, Serializable> properties = propertyConverter.getTaskProperties(task);
return factory.createTask(id,
taskDef, taskDef.getId(), defaultTitle, defaultDescription, state, path, properties);
}
else
{
// Ignoring this task, domain mismatched and safely ignoring that
return null;
}
}
示例11: TaskExtract
import org.activiti.engine.task.Task; //导入方法依赖的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;
}
示例12: testCreateToComplete
import org.activiti.engine.task.Task; //导入方法依赖的package包/类
public void testCreateToComplete() {
// Create and save task
Task task = taskService.newTask();
task.setName("testTask");
taskService.saveTask(task);
String taskId = task.getId();
// Add user as candidate user
taskService.addCandidateUser(taskId, "kermit");
taskService.addCandidateUser(taskId, "gonzo");
// Retrieve task list for jbarrez
List<Task> tasks = taskService.createTaskQuery().taskCandidateUser("kermit").list();
assertEquals(1, tasks.size());
assertEquals("testTask", tasks.get(0).getName());
// Retrieve task list for tbaeyens
tasks = taskService.createTaskQuery().taskCandidateUser("gonzo").list();
assertEquals(1, tasks.size());
assertEquals("testTask", tasks.get(0).getName());
// Claim task
taskService.claim(taskId, "kermit");
// Tasks shouldn't appear in the candidate tasklists anymore
assertTrue(taskService.createTaskQuery().taskCandidateUser("kermit").list().isEmpty());
assertTrue(taskService.createTaskQuery().taskCandidateUser("gonzo").list().isEmpty());
// Complete task
taskService.deleteTask(taskId, true);
// Task should be removed from runtime data
// TODO: check for historic data when implemented!
assertNull(taskService.createTaskQuery().taskId(taskId).singleResult());
}
示例13: testStandaloneTaskVariables
import org.activiti.engine.task.Task; //导入方法依赖的package包/类
public void testStandaloneTaskVariables() {
Task task = taskService.newTask();
task.setName("gonzoTask");
taskService.saveTask(task);
String taskId = task.getId();
taskService.setVariable(taskId, "instrument", "trumpet");
assertEquals("trumpet", taskService.getVariable(taskId, "instrument"));
taskService.deleteTask(taskId, true);
}
示例14: testTaskComments
import org.activiti.engine.task.Task; //导入方法依赖的package包/类
public void testTaskComments() {
int historyLevel = processEngineConfiguration.getHistoryLevel();
if (historyLevel>ProcessEngineConfigurationImpl.HISTORYLEVEL_NONE) {
Task task = taskService.newTask();
task.setOwner("johndoe");
taskService.saveTask(task);
String taskId = task.getId();
identityService.setAuthenticatedUserId("johndoe");
// Fetch the task again and update
taskService.addComment(taskId, null, "look at this \n isn't this great? slkdjf sldkfjs ldkfjs ldkfjs ldkfj sldkfj sldkfj sldkjg laksfg sdfgsd;flgkj ksajdhf skjdfh ksjdhf skjdhf kalskjgh lskh dfialurhg kajsh dfuieqpgkja rzvkfnjviuqerhogiuvysbegkjz lkhf ais liasduh flaisduh ajiasudh vaisudhv nsfd");
Comment comment = taskService.getTaskComments(taskId).get(0);
assertEquals("johndoe", comment.getUserId());
assertEquals(taskId, comment.getTaskId());
assertNull(comment.getProcessInstanceId());
assertEquals("look at this isn't this great? slkdjf sldkfjs ldkfjs ldkfjs ldkfj sldkfj sldkfj sldkjg laksfg sdfgsd;flgkj ksajdhf skjdfh ksjdhf skjdhf kalskjgh lskh dfialurhg ...", ((Event)comment).getMessage());
assertEquals("look at this \n isn't this great? slkdjf sldkfjs ldkfjs ldkfjs ldkfj sldkfj sldkfj sldkjg laksfg sdfgsd;flgkj ksajdhf skjdfh ksjdhf skjdhf kalskjgh lskh dfialurhg kajsh dfuieqpgkja rzvkfnjviuqerhogiuvysbegkjz lkhf ais liasduh flaisduh ajiasudh vaisudhv nsfd", comment.getFullMessage());
assertNotNull(comment.getTime());
taskService.addComment(taskId, "pid", "one");
taskService.addComment(taskId, "pid", "two");
Set<String> expectedComments = new HashSet<String>();
expectedComments.add("one");
expectedComments.add("two");
Set<String> comments = new HashSet<String>();
for (Comment cmt: taskService.getProcessInstanceComments("pid")) {
comments.add(cmt.getFullMessage());
}
assertEquals(expectedComments, comments);
// Finally, delete task
taskService.deleteTask(taskId, true);
}
}
示例15: testTaskAttachments
import org.activiti.engine.task.Task; //导入方法依赖的package包/类
public void testTaskAttachments() {
int historyLevel = processEngineConfiguration.getHistoryLevel();
if (historyLevel>ProcessEngineConfigurationImpl.HISTORYLEVEL_NONE) {
Task task = taskService.newTask();
task.setOwner("johndoe");
taskService.saveTask(task);
String taskId = task.getId();
identityService.setAuthenticatedUserId("johndoe");
// Fetch the task again and update
taskService.createAttachment("web page", taskId, "someprocessinstanceid", "weatherforcast", "temperatures and more", "http://weather.com");
Attachment attachment = taskService.getTaskAttachments(taskId).get(0);
assertEquals("weatherforcast", attachment.getName());
assertEquals("temperatures and more", attachment.getDescription());
assertEquals("web page", attachment.getType());
assertEquals(taskId, attachment.getTaskId());
assertEquals("someprocessinstanceid", attachment.getProcessInstanceId());
assertEquals("http://weather.com", attachment.getUrl());
assertNull(taskService.getAttachmentContent(attachment.getId()));
// Finally, clean up
taskService.deleteTask(taskId);
assertEquals(0, taskService.getTaskComments(taskId).size());
assertEquals(1, historyService.createHistoricTaskInstanceQuery().taskId(taskId).list().size());
taskService.deleteTask(taskId, true);
}
}