use of org.motechproject.tasks.domain.mds.task.TaskActivity in project motech by motech.
the class TaskActivityServiceImpl method addSuccessfulExecution.
@Override
@Transactional(propagation = Propagation.REQUIRES_NEW)
public boolean addSuccessfulExecution(Long activityId) {
TaskActivity activity = taskActivitiesDataService.findById(activityId);
if (activity == null) {
return false;
}
TaskExecutionProgress progress = activity.getTaskExecutionProgress();
progress.addSuccess();
return updateTaskProgress(progress, activity);
}
use of org.motechproject.tasks.domain.mds.task.TaskActivity in project motech by motech.
the class TaskActivityServiceImpl method addTaskFiltered.
@Override
@Transactional(propagation = Propagation.REQUIRES_NEW)
public void addTaskFiltered(Long activityId) {
TaskActivity activity = taskActivitiesDataService.findById(activityId);
activity.setActivityType(TaskActivityType.FILTERED);
activity.setMessage(TASK_FILTERED);
taskActivitiesDataService.update(activity);
}
use of org.motechproject.tasks.domain.mds.task.TaskActivity in project motech by motech.
the class TaskActivityServiceImpl method addTaskStarted.
@Override
@Transactional(propagation = Propagation.REQUIRES_NEW)
public long addTaskStarted(Task task, Map<String, Object> parameters) {
int totalActions = task.getActions().size();
TaskActivity activity = taskActivitiesDataService.create(new TaskActivity(TASK_IN_PROGRESS, Arrays.asList("0", String.valueOf(totalActions)), task.getId(), task.getTrigger().getDisplayName(), TaskActivityType.IN_PROGRESS, null, parameters, new TaskExecutionProgress(totalActions)));
return activity.getId();
}
use of org.motechproject.tasks.domain.mds.task.TaskActivity in project motech by motech.
the class TaskTriggerHandler method retryTask.
@Override
@Transactional
public void retryTask(Long activityId) {
TaskActivity activity = activityService.getTaskActivityById(activityId);
handleTask(taskService.getTask(activity.getTask()), activity.getParameters());
}
use of org.motechproject.tasks.domain.mds.task.TaskActivity in project motech by motech.
the class TasksPostExecutionHandlerTest method initTaskActivity.
private void initTaskActivity() {
taskActivity = new TaskActivity();
taskActivity.setId(TASK_ACTIVITY_ID);
taskActivity.setTask(task.getId());
}
Aggregations