use of org.kie.internal.task.api.model.InternalTaskData in project jbpm by kiegroup.
the class EmailDeadlinesBaseTest method testDelayedEmailNotificationOnDeadlineTaskFailed.
@Test(timeout = 10000)
public void testDelayedEmailNotificationOnDeadlineTaskFailed() throws Exception {
CountDownTaskEventListener countDownListener = new CountDownTaskEventListener(1, false, true);
addCountDownListner(countDownListener);
Map<String, Object> vars = new HashMap<String, Object>();
vars.put("now", new Date());
Reader reader = new InputStreamReader(getClass().getResourceAsStream(MvelFilePath.DeadlineWithNotification));
InternalTask task = (InternalTask) TaskFactory.evalTask(reader, vars);
((InternalTaskData) task.getTaskData()).setSkipable(true);
InternalPeopleAssignments assignments = (InternalPeopleAssignments) TaskModelProvider.getFactory().newPeopleAssignments();
List<OrganizationalEntity> ba = new ArrayList<OrganizationalEntity>();
User user = TaskModelProvider.getFactory().newUser();
((InternalOrganizationalEntity) user).setId("Administrator");
ba.add(user);
assignments.setBusinessAdministrators(ba);
List<OrganizationalEntity> po = new ArrayList<OrganizationalEntity>();
User user2 = TaskModelProvider.getFactory().newUser();
((InternalOrganizationalEntity) user2).setId("Administrator");
po.add(user2);
assignments.setPotentialOwners(po);
task.setPeopleAssignments(assignments);
taskService.addTask(task, new HashMap<String, Object>());
long taskId = task.getId();
InternalContent content = (InternalContent) TaskModelProvider.getFactory().newContent();
Map<String, String> params = fillMarshalSubjectAndBodyParams();
ContentData marshalledObject = ContentMarshallerHelper.marshal(task, params, null);
content.setContent(marshalledObject.getContent());
taskService.addContent(taskId, content);
long contentId = content.getId();
content = (InternalContent) taskService.getContentById(contentId);
Object unmarshallObject = ContentMarshallerHelper.unmarshall(content.getContent(), null);
checkContentSubjectAndBody(unmarshallObject);
taskService.start(taskId, "Administrator");
taskService.fail(taskId, "Administrator", null);
// emails should not be set yet
assertEquals(0, getWiser().getMessages().size());
countDownListener.waitTillCompleted();
// no email should ne sent as task was completed before deadline was triggered
assertEquals(0, getWiser().getMessages().size());
task = (InternalTask) taskService.getTaskById(taskId);
assertEquals(Status.Failed, task.getTaskData().getStatus());
assertEquals(0, task.getDeadlines().getStartDeadlines().size());
assertEquals(0, task.getDeadlines().getEndDeadlines().size());
}
use of org.kie.internal.task.api.model.InternalTaskData in project jbpm by kiegroup.
the class TaskInstanceServiceImpl method setSkipable.
public void setSkipable(long taskId, boolean skipable) {
Task task = persistenceContext.findTask(taskId);
((InternalTaskData) task.getTaskData()).setSkipable(skipable);
}
use of org.kie.internal.task.api.model.InternalTaskData in project jbpm by kiegroup.
the class TaskInstanceServiceImpl method setExpirationDate.
public void setExpirationDate(long taskId, Date date) {
Task task = persistenceContext.findTask(taskId);
taskEventSupport.fireBeforeTaskUpdated(task, context);
((InternalTaskData) task.getTaskData()).setExpirationTime(date);
taskEventSupport.fireAfterTaskUpdated(task, context);
}
use of org.kie.internal.task.api.model.InternalTaskData in project jbpm by kiegroup.
the class TaskContentServiceImpl method deleteDocumentContent.
public void deleteDocumentContent(long taskId, long contentId) {
Task task = persistenceContext.findTask(taskId);
((InternalTaskData) task.getTaskData()).setDocumentContentId(-1);
Content content = persistenceContext.findContent(contentId);
persistenceContext.removeContent(content);
}
use of org.kie.internal.task.api.model.InternalTaskData in project jbpm by kiegroup.
the class TaskContentServiceImpl method setDocumentContent.
// TODO: if there's an existing document content entity, we lose all link to that through this!
public long setDocumentContent(long taskId, Content content) {
Task task = persistenceContext.findTask(taskId);
persistenceContext.persistContent(content);
((InternalTaskData) task.getTaskData()).setDocumentContentId(content.getId());
return content.getId();
}
Aggregations