Search in sources :

Example 1 with TaskEventInfo

use of org.wso2.carbon.humantask.core.api.event.TaskEventInfo in project carbon-business-process by wso2.

the class CommonTaskUtil method createNewTaskEvent.

/**
 * Creates a new TaskEventInfo object for the task creation event.
 *
 * @param task : The newly created task object.
 *
 * @return : The respective TaskEventInfo object for the task creation event.
 */
public static TaskEventInfo createNewTaskEvent(TaskDAO task) {
    TaskEventInfo createTaskEvent = new TaskEventInfo();
    createTaskEvent.setEventType(TaskEventType.CREATE);
    createTaskEvent.setTimestamp(task.getCreatedOn());
    // TODO - how to handle the event initiator for create task event ?
    // createTaskEvent.setEventInitiator(null);
    createTaskEvent.setTaskInfo(populateTaskInfo(task));
    return createTaskEvent;
}
Also used : TaskEventInfo(org.wso2.carbon.humantask.core.api.event.TaskEventInfo)

Example 2 with TaskEventInfo

use of org.wso2.carbon.humantask.core.api.event.TaskEventInfo in project carbon-business-process by wso2.

the class CommonTaskUtil method populateTaskEventInfo.

/**
 * Create the TaskEventInfo object from the EventDAO and the TaskDAO.
 * @param eventDAO : The event
 * @param taskDAO : The related task dao.
 *
 * @return : The new TaskEventInfo object.
 */
public static TaskEventInfo populateTaskEventInfo(EventDAO eventDAO, TaskDAO taskDAO) {
    TaskEventInfo eventInfo = new TaskEventInfo();
    eventInfo.setTimestamp(eventDAO.getTimeStamp());
    eventInfo.setEventInitiator(eventDAO.getUser());
    eventInfo.setEventType(eventDAO.getType());
    eventInfo.setNewState(eventDAO.getNewState());
    eventInfo.setOldState(eventDAO.getOldState());
    eventInfo.setTaskInfo(populateTaskInfo(taskDAO));
    return eventInfo;
}
Also used : TaskEventInfo(org.wso2.carbon.humantask.core.api.event.TaskEventInfo)

Example 3 with TaskEventInfo

use of org.wso2.carbon.humantask.core.api.event.TaskEventInfo in project carbon-business-process by wso2.

the class AbstractHumanTaskCommand method processTaskEvent.

/**
 */
protected void processTaskEvent() {
    EventDAO eventDAO = createTaskEvent();
    getTask().persistEvent(eventDAO);
    TaskEventInfo taskEventInfo = CommonTaskUtil.populateTaskEventInfo(eventDAO, task);
    getEngine().getEventProcessor().processEvent(taskEventInfo);
}
Also used : EventDAO(org.wso2.carbon.humantask.core.dao.EventDAO) TaskEventInfo(org.wso2.carbon.humantask.core.api.event.TaskEventInfo)

Aggregations

TaskEventInfo (org.wso2.carbon.humantask.core.api.event.TaskEventInfo)3 EventDAO (org.wso2.carbon.humantask.core.dao.EventDAO)1