# Human Task Management
## Pre-Reading(s)
* https://docs.camunda.io/docs/components/tasklist/userguide/using-tasklist/
* https://docs.camunda.io/docs/components/best-practices/architecture/understanding-human-tasks-management/
* https://blog.kie.org/2021/05/kogito-user-tasks-process-api.html
* https://documentation.signavio.com/suite/en-us/Content/workflow-accelerator/userguide/action-types/user-task.htm
* https://www.omg.org/spec/BPMN/2.0/PDF
* https://docs.jboss.org/jbpm/v6.0/userguide/jBPMTaskService.html
## Requirements
* All states (FSM | Zeebe) can create an item to the Human Task List.
* Tasks supports;
* Role based transition consuming
* Auto Transition
* Pool management features (Claim, Release)
* The task list is dynamically updated (SignalR)
* Supports task list count badge
* Task list transitions are part of records transtion history. (Like sub workflow).
* Completion of the task can only be through the current transactions of the state.
### Task Lifetime With Claim
```mermaid
stateDiagram-v2
unclaimed: Waiting
claimed: Claimed By User
completed: Completed
unclaimed --> claimed : Claim
claimed --> unclaimed : Release
claimed --> completed : Transaction 1
claimed --> completed : Transaction 2
```
### Task Lifetime Without Claim
```mermaid
stateDiagram-v2
unclaimed: Waiting
completed: Completed
unclaimed --> completed : Transaction 1
unclaimed --> completed : Transaction 2
```
## Transaction Security
All transitions are secured with **Roles** defined in Amorphie IAM. Role configuration of processes is stored in the workflow database.
## "Set State" with Create Task
All states can also hold the task item creation configuration.
```csharp
public class State : BaseDbEntity
{
...
public bool CreateTask { get; set; } = false;
public string[]? TaskRoles { get; set; }
public int? TaskPriority { get; set; }
public bool? MustClaimTaskBeforeAction { get; set; }
public string? AutoTranstion { get; set; }
public int? AutoTranstionInSeconds { get; set; }
}
```
## Task List View
Task List View is custom, DI based view for Amorphie.Backoffice (This view will also be validation of custom view injection to the backoffice.)
Task List View direcly consumes Task List services for interactions (Amorphie.Workflow.HumanTask ?)
Task List View Filters;
* Waiting
* Claimed By Me
* Claimed By Another
* Completed
* Released By Me, *This is history based filter*
Task list works with paging