本文整理了Java中org.kie.api.task.model.Task.getTaskData()
方法的一些代码示例,展示了Task.getTaskData()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Task.getTaskData()
方法的具体详情如下:
包路径:org.kie.api.task.model.Task
类名称:Task
方法名:getTaskData
暂无
代码示例来源:origin: kiegroup/jbpm
protected String getActualOwner(Task ti) {
String userId = "";
if (ti.getTaskData().getActualOwner() != null) {
userId = ti.getTaskData().getActualOwner().getId();
}
return userId;
}
代码示例来源:origin: kiegroup/jbpm
protected boolean isAutoClaim(KieSession session, WorkItem workItem, Task task) {
String autoclaim = (String) session.getEnvironment().get("Autoclaim");
if(autoclaim != null && !Boolean.parseBoolean(autoclaim.trim())) {
return false;
} else {
String swimlaneUser = (String) workItem.getParameter("SwimlaneActorId");
if (swimlaneUser != null && !"".equals(swimlaneUser) && task.getTaskData().getStatus() == Status.Ready) {
return true;
}
}
return false;
}
代码示例来源:origin: kiegroup/jbpm
protected AuditTaskImpl createAuditTask(Task ti, Date date) {
AuditTaskImpl auditTaskImpl = new AuditTaskImpl(
ti.getId(),
ti.getName(),
ti.getTaskData().getStatus().name(),
ti.getTaskData().getActivationTime(),
(ti.getTaskData().getActualOwner() != null) ? ti.getTaskData().getActualOwner().getId() : "",
ti.getDescription(),
ti.getPriority(),
(ti.getTaskData().getCreatedBy() != null) ? ti.getTaskData().getCreatedBy().getId() : "",
ti.getTaskData().getCreatedOn(),
ti.getTaskData().getExpirationTime(),
ti.getTaskData().getProcessInstanceId(),
ti.getTaskData().getProcessId(),
ti.getTaskData().getProcessSessionId(),
ti.getTaskData().getDeploymentId(),
ti.getTaskData().getParentId(),
ti.getTaskData().getWorkItemId(),
date
);
return auditTaskImpl;
}
代码示例来源:origin: kiegroup/jbpm
@Test
public void testDeleteAuditTaskInfoLogByProcessId() {
int p = 0;
String processId = taskTestData[p++].getTaskData().getProcessId();
String processId2 = taskTestData[p++].getTaskData().getProcessId();
AuditTaskDeleteBuilder updateBuilder = this.auditTaskDelete().processId(processId, processId2);
int result = updateBuilder.build().execute();
assertEquals(2, result);
}
代码示例来源:origin: kiegroup/jbpm
@Override
public void afterTaskStartedEvent(TaskEvent event) {
assertNotNull(event.getTask().getTaskData().getTaskInputVariables());
assertEquals(1, event.getTask().getTaskData().getTaskInputVariables().size());
assertTrue(event.getTask().getTaskData().getTaskInputVariables().containsKey("input"));
assertNull(event.getTask().getTaskData().getTaskOutputVariables());
}
代码示例来源:origin: kiegroup/jbpm
@Test
public void testAssignmentsWhenNoRuleWasFired() throws Exception {
String str = "(with (new Task()) { priority = 51, taskData = (with( new TaskData()) { } ), ";
str += "peopleAssignments = (with ( new PeopleAssignments() ) { potentialOwners = [new User('Ben Dover') ],businessAdministrators = [ new User('Administrator') ],}),";
str += "name = 'Not Bobbas tasks' })";
Task task = TaskFactory.evalTask(new StringReader(str));
assertPotentialOwners(task, 1);
long taskId = taskService.addTask(task, Collections.emptyMap());
task = taskService.getTaskById(taskId);
assertPotentialOwners(task, 0);
User actualOwner = task.getTaskData().getActualOwner();
Assertions.assertThat(actualOwner).isNull();
}
代码示例来源:origin: kiegroup/jbpm
@Override
public void afterTaskStartedEvent(TaskEvent event) {
String userId = event.getTaskContext().getUserId();
Task ti = event.getTask();
TaskEventImpl taskEvent = new TaskEventImpl(ti.getId(), org.kie.internal.task.api.model.TaskEvent.TaskEventType.STARTED, ti.getTaskData().getProcessInstanceId(), ti.getTaskData().getWorkItemId(), userId );
AuditTaskImpl auditTaskImpl = createAuditTask(ti, event.getEventDate());
auditTaskImpl.setStatus(ti.getTaskData().getStatus().name());
auditTaskImpl.setActualOwner(getActualOwner(ti));
auditTaskImpl.setLastModificationDate(event.getEventDate());
sendMessage(new AuditTaskData(auditTaskImpl, taskEvent), 5);
}
代码示例来源:origin: kiegroup/jbpm
@Override
public void afterTaskAddedEvent(TaskEvent event) {
String userId = event.getTaskContext().getUserId();
Task ti = event.getTask();
if(ti.getTaskData().getProcessId() != null){
userId = ti.getTaskData().getProcessId();
}
AuditTaskImpl auditTask = createAuditTask(ti, event.getEventDate());
TaskEventImpl taskEvent = new TaskEventImpl(ti.getId(), org.kie.internal.task.api.model.TaskEvent.TaskEventType.ADDED, ti.getTaskData().getProcessInstanceId(), ti.getTaskData().getWorkItemId(), userId);
sendMessage(new AuditTaskData(auditTask, taskEvent), 9);
}
代码示例来源:origin: kiegroup/jbpm
protected void completeTask(Task task) {
taskService.start(task.getId(), task.getTaskData().getActualOwner().getId());
taskService.complete(task.getId(), task.getTaskData().getActualOwner().getId(), new HashMap<String,Object>());
}
代码示例来源:origin: kiegroup/jbpm
public void processTaskState(Task task) {
long workItemId = task.getTaskData().getWorkItemId();
long processInstanceId = task.getTaskData().getProcessInstanceId();
RuntimeManager manager = getManager(task);
RuntimeEngine runtime = manager.getRuntimeEngine(ProcessInstanceIdContext.get(processInstanceId));
KieSession session = runtime.getKieSession();
if (task.getTaskData().getStatus() == Status.Completed) {
String userId = task.getTaskData().getActualOwner().getId();
Map<String, Object> results = new HashMap<String, Object>();
Map<String, Object> taskOutcome = task.getTaskData().getTaskOutputVariables();
if (taskOutcome != null) {
results.putAll(taskOutcome);
// results.put("Result", taskOutcome);
}
results.put("ActorId", userId);
session.getWorkItemManager().completeWorkItem(workItemId, results);
} else {
session.getWorkItemManager().abortWorkItem(workItemId);
}
}
代码示例来源:origin: kiegroup/jbpm
private void testTaskWithExpectedDescription(final Task task, final String expectedDescription) {
assertEquals("TaskName " + task.getTaskData().getProcessInstanceId(), task.getName());
assertEquals(10, task.getPriority().intValue());
assertEquals(expectedDescription, task.getDescription());
assertEquals(Status.Reserved, task.getTaskData().getStatus());
assertEquals("Darth Vader", task.getTaskData().getActualOwner().getId());
assertEquals(10L, task.getTaskData().getProcessInstanceId());
}
代码示例来源:origin: kiegroup/jbpm
@Test
public void testDeleteAuditTaskInfoLogByProcessIdAndNotMatchingDate() {
int p = 0;
String processId = taskTestData[p++].getTaskData().getProcessId();
Date endDate = taskTestData[p++].getTaskData().getCreatedOn();
AuditTaskDeleteBuilder updateBuilder = this.auditTaskDelete().date(endDate).processId(processId);
int result = updateBuilder.build().execute();
assertEquals(0, result);
}
代码示例来源:origin: kiegroup/jbpm
@Override
public void beforeTaskStartedEvent(TaskEvent event) {
assertNotNull(event.getTask().getTaskData().getTaskInputVariables());
assertEquals(1, event.getTask().getTaskData().getTaskInputVariables().size());
assertTrue(event.getTask().getTaskData().getTaskInputVariables().containsKey("input"));
assertNull(event.getTask().getTaskData().getTaskOutputVariables());
event.getTaskContext().loadTaskVariables(event.getTask());
assertNotNull(event.getTask().getTaskData().getTaskInputVariables());
assertEquals(1, event.getTask().getTaskData().getTaskInputVariables().size());
assertTrue(event.getTask().getTaskData().getTaskInputVariables().containsKey("input"));
assertNull(event.getTask().getTaskData().getTaskOutputVariables());
}
代码示例来源:origin: kiegroup/jbpm
@Override
public void afterTaskCompletedEvent(TaskEvent event) {
String userId = event.getTaskContext().getUserId();
Task ti = event.getTask();
TaskEventImpl taskEvent = new TaskEventImpl(ti.getId(), org.kie.internal.task.api.model.TaskEvent.TaskEventType.COMPLETED, ti.getTaskData().getProcessInstanceId(), ti.getTaskData().getWorkItemId(), userId);
AuditTaskImpl auditTaskImpl = createAuditTask(ti, event.getEventDate());
auditTaskImpl.setStatus(ti.getTaskData().getStatus().name());
auditTaskImpl.setActualOwner(getActualOwner(ti));
auditTaskImpl.setLastModificationDate(event.getEventDate());
sendMessage(new AuditTaskData(auditTaskImpl, taskEvent), 2);
}
代码示例来源:origin: kiegroup/jbpm
@Override
public void beforeTaskReleasedEvent(TaskEvent event) {
String userId = event.getTaskContext().getUserId();
Task ti = event.getTask();
TaskEventImpl taskEvent = new TaskEventImpl(ti.getId(), org.kie.internal.task.api.model.TaskEvent.TaskEventType.RELEASED, ti.getTaskData().getProcessInstanceId(), ti.getTaskData().getWorkItemId(), userId);
sendMessage(new AuditTaskData(null, taskEvent), 7);
}
代码示例来源:origin: kiegroup/jbpm
protected String getActualOwner(Task ti) {
String userId = "";
if (ti.getTaskData().getActualOwner() != null) {
userId = ti.getTaskData().getActualOwner().getId();
}
return userId;
}
代码示例来源:origin: kiegroup/jbpm
private Optional<Task> getTaskToComplete(String user) {
Optional<Task> task = Optional.empty();
if (tasks.containsKey(user)) {
Collection<Task> taskCollection = tasks.get(user);
if (!taskCollection.isEmpty()) {
task = taskCollection.stream().filter(t -> !t.getTaskData().getStatus().equals(Status.Completed)).findFirst();
}
}
if (!task.isPresent()) {
logger.warn("No task to complete found for {}",user);
}
return task;
}
}
代码示例来源:origin: kiegroup/jbpm
@Test
public void testNewTaskWithNoPotentialOwners() {
// One potential owner, should go straight to state Reserved
String str = "(with (new Task()) { priority = 55, taskData = (with( new TaskData()) { } ), ";
str += "peopleAssignments = (with ( new PeopleAssignments() ) { businessAdministrators = [ new User('Administrator') ],}),";
str += "name = 'This is my task name' })";
Task task = TaskFactory.evalTask(new StringReader(str));
taskService.addTask(task, new HashMap<String, Object>());
long taskId = task.getId();
// Task should remain in Created state with no actual owner
Task task1 = taskService.getTaskById(taskId);
assertEquals(task1.getTaskData().getStatus(), Status.Created);
assertNull(task1.getTaskData().getActualOwner());
}
代码示例来源:origin: kiegroup/jbpm
@Test
public void testDeleteAuditTaskInfoLogByProcessIdAndDate() {
int p = 0;
String processId = taskTestData[p].getTaskData().getProcessId();
Date endDate = taskTestData[p].getTaskData().getCreatedOn();
AuditTaskDeleteBuilder updateBuilder = this.auditTaskDelete().date(endDate).processId(processId);
int result = updateBuilder.build().execute();
assertEquals(1, result);
}
代码示例来源:origin: kiegroup/jbpm
@Override
public void beforeTaskAddedEvent(TaskEvent event) {
assertNotNull(event.getTask().getTaskData().getTaskInputVariables());
assertEquals(1, event.getTask().getTaskData().getTaskInputVariables().size());
assertTrue(event.getTask().getTaskData().getTaskInputVariables().containsKey("input"));
assertNull(event.getTask().getTaskData().getTaskOutputVariables());
event.getTaskContext().loadTaskVariables(event.getTask());
assertNotNull(event.getTask().getTaskData().getTaskInputVariables());
assertEquals(1, event.getTask().getTaskData().getTaskInputVariables().size());
assertTrue(event.getTask().getTaskData().getTaskInputVariables().containsKey("input"));
assertNull(event.getTask().getTaskData().getTaskOutputVariables());
}
内容来源于网络,如有侵权,请联系作者删除!