TaskActivityService

public interface TaskActivityService

Service for managing task activities. Task activities are used for storing information about current and past task executions.

Methods

addFailedExecution

void addFailedExecution(Long activityId, Throwable e)

Adds failed execution to the activity of the provided id, which in consequence marks it as “FAILED”.

Parameters:
  • activityId – the id of the activity
  • e – the throwable that has caused the task execution failure

addFilteredExecution

void addFilteredExecution(Long activityId)

Adds filtered execution to the activity of the provided id.

Parameters:
  • activityId – the id of the activity

addSuccessfulExecution

boolean addSuccessfulExecution(Long activityId)

Adds successful execution to the activity of the provided id. If all the task actions are executed, it marks the activity as “SUCCESS”.

Parameters:
  • activityId – the id of the activity
Returns:

whether the task is finished

addTaskDisabledWarning

void addTaskDisabledWarning(Task task)

Logs a warning for the given task.

Parameters:
  • task – the task, not null

addTaskFiltered

void addTaskFiltered(Long activityId)

Marks the activity as “FILTERED”, if task was filtered and not executed.

Parameters:
  • activityId – the id of the activity

addTaskStarted

long addTaskStarted(Task task, Map<String, Object> parameters)

Adds a new task activity log and marks it as “In Progress”.

Parameters:
  • task – The task to add the log for
  • parameters – The event trigger parameters the task was initiated with
Returns:

id of the created activity log

addWarning

void addWarning(Task task, String key, String value)

Logs a warning for the given task.

Parameters:
  • task – the task, not null
  • key – the key of the message
  • value – the name of the field that caused the warning

addWarningWithException

void addWarningWithException(Task task, String key, String field, Exception e)

Logs a warning for the given task.

Parameters:
  • task – the task, not null
  • key – the key of the message
  • field – the name of the failed that caused the warning, not null
  • e – the exception that caused the warning, not null

deleteActivitiesForTask

void deleteActivitiesForTask(Long taskId)

Deletes all activities for the task with the given ID.

Parameters:
  • taskId – the task ID, not null

getAllActivities

List<TaskActivity> getAllActivities(Set<TaskActivityType> activityTypeSet, QueryParams queryParams)

Returns all the activities as a list.

Parameters:
  • activityTypeSet – the type of activities
  • queryParams – query parameters to use while retrieving
Returns:

the list of all activities

getAllActivities

List<TaskActivity> getAllActivities(Set<TaskActivityType> activityTypes, Range<DateTime> dateRange, QueryParams queryParams)

Returns all the activities as a list.

Parameters:
  • activityTypes – the type of activities
  • dateRange – the date range
  • queryParams – query parameters to use while retrieving
Returns:

the list of all activities

getAllTaskActivitiesCount

long getAllTaskActivitiesCount(Set<TaskActivityType> activityTypes)

Returns the count of all activities.

Parameters:
  • activityTypes – the type of activities to include in count
Returns:

the count of matching activities

getAllTaskActivitiesCount

long getAllTaskActivitiesCount(Set<TaskActivityType> activityTypes, Range<DateTime> dateRange)

Returns the count of all activities.

Parameters:
  • activityTypes – the type of activities to include in count
  • dateRange – the date range
Returns:

the count of matching activities

getLatestActivities

List<TaskActivity> getLatestActivities()

Returns 10 most recent activities as a list, ordered by date.

Returns:the list of all activities

getTaskActivities

List<TaskActivity> getTaskActivities(Long taskId, Set<TaskActivityType> activityTypeSet, QueryParams queryParams)

Returns list of all activities for task with the given ID.

Parameters:
  • taskId – the task ID, null returns null
  • activityTypeSet – the type of activities
  • queryParams – query parameters to use while retrieving
Returns:

the list of all activities for task with given ID

getTaskActivities

List<TaskActivity> getTaskActivities(Long taskId, Set<TaskActivityType> activityTypeSet, Range<DateTime> dateRange, QueryParams queryParams)

Returns list of all activities for task with the given ID, of specific activity type and the given date range.

Parameters:
  • taskId – the task ID, null returns null
  • activityTypeSet – the type of activities
  • dateRange – the range of datetime
  • queryParams – query parameters to use while retrieving
Returns:

the list of all activities for task with given ID

getTaskActivitiesCount

long getTaskActivitiesCount(Long taskId, Set<TaskActivityType> activityTypes)

Returns the count of all activities for the given task, of the specified type.

Parameters:
  • taskId – the task ID
  • activityTypes – the type of activities to include in count
Returns:

the count of matching activities

getTaskActivitiesCount

long getTaskActivitiesCount(Long taskId, TaskActivityType type)

Returns the count of all activities for the given task, of the specified type.

Parameters:
  • taskId – the task ID
  • type – the type of activity to include in count
Returns:

the count of matching activities

getTaskActivitiesCount

long getTaskActivitiesCount(Long taskId, Set<TaskActivityType> activityTypes, Range<DateTime> dateRange)

Returns the count of all activities for the given task, of the specified type and the given date range.

Parameters:
  • taskId – the task ID
  • activityTypes – the type of activities to include in count
  • dateRange – the range of datetime
Returns:

the count of matching activities

getTaskActivityById

TaskActivity getTaskActivityById(Long activityId)

Returns single TaskActivity with given activity ID.

Parameters:
  • activityId – the ID of activity instance to be retrieved
Returns:

TaskActivity with the given ID