====== HR processes ====== HR processes are mostly a special type of [[..:..:architecture:dev:events#hr_processes_processors|processors]] or [[..:..:application_configuration:dev:scheduled_tasks:task-scheduler#hrenablecontractprocess|stateful long running tasks]]. The intent here is to keep the process logic in the Activiti workflow, so it can be easily extensible without the need of digging in the code. Both HR [[..:..:architecture:dev:events#hr_processes_processors|processors]] or [[..:..:application_configuration:dev:scheduled_tasks:task-scheduler#hrenablecontractprocess|long running tasks]] executes the same Activiti workflow process, the difference is in the time of execution: - processors executes process immediately, when identity contract is changed (active operation) - long running tasks are scheduled, mainly over night. So only the contract change is saved, and the HR processes are executed separately. Choosing the way is configurable - processor can be [[..:..:application_configuration:dev:backend#entity_event_processors|disabled]], long running tasks can be [[..:..:application_configuration:dev:scheduled_tasks:task-scheduler#hrenablecontractprocess|scheduled]] or not. The ''%%AbstractWorkflowStatefulExecutor%%'' bears the responsibility of launching workflow tasks. The idea right now is fairly simple - execute the process synchronously for one user and return the operation result. The convention is that the processed item (of ''%%AbstractDto%%'' type) is passed into the workflow, which in turn writes the ''%%OperationResult%%'' as "operationResult" variable. You are advised to list through the standard set of workflow to see the real-world examples. Developer tip: avoid asynchronous workflow execution if possible. ===== Standard set of HR processes ===== ==== Enabled contract ==== The process is: * a stateful task, therefore the contract is processed only once while it is valid for a continuous period of time. The process is realized by ''%%HrEnableContractProcess%%'' executor and ''%%hrEnableContract%%'' Activiti workflow. * or processor, which checks, if the validity of a contract has changed. The same Activiti workflow is used. ==== End of contract ==== The process is: * a stateful task, therefore the contract is processed only once while it is not valid for a continuous period of time. The process is realized by ''%%HrEndContractProcess%%'' executor and ''%%hrEndContract%%'' Activiti workflow. * or processor that checks if the validity of a contract has changed. The same Activiti workflow is used. ==== Contract exclusion ==== The process is: * a stateful task, therefore the contract is processed only once while it is disabled for a continuous period of time. The process is realized by ''%%HrContractExclusionProcess%%'' executor and ''%%hrContractExclusion%%'' Activiti workflow. * or a processor that checks if the validity of a contract has changed. The same Activiti workflow is used.