Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
devel:documentation:identities:dev:contractual-relationship-slice [2019/01/10 13:39] kopro Slices recalculation |
devel:documentation:identities:dev:contractual-relationship-slice [2020/05/07 15:59] apeterova [Protection of the contract validity] |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Time slices of contractual relationships | ||
+ | {{tag> | ||
+ | On many projects, we encounter a source of data about users, employees or org. structures that work with so-called time slices. For better works with this time slots, agenda of contract' | ||
+ | |||
+ | < | ||
+ | |||
+ | <note important> | ||
+ | |||
+ | ===== Task for update contract by current slice ===== | ||
+ | For recalculate current using slices as contract task `SelectCurrentContractSliceTaskExecutor` was created. This task ensures: Find all slices which should be for actual date using as contract and copy their values to parent contracts. | ||
+ | |||
+ | <note important> | ||
+ | |||
+ | |||
+ | <note tip>By default is that task triggered every day at **0:30 AM**.</ | ||
+ | |||
+ | ===== Slices recalculation ===== | ||
+ | |||
+ | During synchronization is for each processed item set dirty state. Newly created event by synchronization contains flag **SET\_DIRTY\_STATE\_CONTRACT\_SLICE** = true. This flag is catches by processor **ContractSliceSaveRecalculateProcessor**. In processor is for these slices set entity state with dirty flag. | ||
+ | |||
+ | After synchronization correctly ended is started HR processes if is these option enabled. Together with HR processes is also started task **ClearDirtyStateForContractSliceTaskExecutor**. These task process all slices that has dirty state and recalculated their status. | ||
+ | |||
+ | <note important> | ||
+ | |||
+ | |||
+ | |||
+ | ===== Protection of the contract validity ===== | ||
+ | |||
+ | Sometimes there may be a situation where one of the time slices **ends** the contract, and at the same time there is a next time slice that **restarts** this contract. If there is no gap between termination and restart, then the contract will not terminate (no accounts will be deleted). If the dates do not follow, then (by default) will be **contract terminated** and all connected **accounts will be removed** from the target systems. | ||
+ | |||
+ | However, in some situations (projects), it is required to use the **protection period** for which the contract will **not be terminated**, | ||
+ | |||
+ | **The protected interval** can be set using the property `idm.sec.core.contract-slice.protection-interval`, | ||
+ | |||
+ | <note tip> | ||
+ | **By default**, the property `idm.sec.core.contract-slice.protection-interval` is set to value ' | ||
+ | <note important> | ||
+ | If you **change** the property `idm.sec.core.contract-slice.protection-interval`, | ||
+ | ===== How to customize the method for creating/ | ||
+ | |||
+ | Method `updateContractBySlice` in the `ContractSliceManager` ensures creating or updating a contract by slice (marked with '**Is using as a contract**' | ||
+ | |||
+ | If you need to implement **more specific behavior**, you can **override** that method. For this you can create new service whitch will extend the default implementation of the contract slice manager `DefaultContractSliceManager`. | ||
+ | |||
+ | <note tip>This new service must have an annotation `@Primary` (ensures that new service will have a priority).</ | ||
+ | <code java> | ||
+ | /** | ||
+ | * Your manager for contract slices | ||
+ | | ||
+ | * @author svandav | ||
+ | * | ||
+ | */ | ||
+ | @Primary | ||
+ | @Service(" | ||
+ | public class YourContractSliceManager extends DefaultContractSliceManager implements ContractSliceManager { | ||
+ | |||
+ | @Override | ||
+ | @Transactional | ||
+ | public IdmIdentityContractDto updateContractBySlice(IdmIdentityContractDto contract, IdmContractSliceDto slice, | ||
+ | Map< | ||
+ | |||
+ | /** | ||
+ | * Your code ... | ||
+ | */ | ||
+ | return super.updateContractBySlice(contract, | ||
+ | } | ||
+ | } | ||
+ | </ | ||
+ | ===== Sync ===== | ||
+ | Synchronization of time slices is very similar as sync of contracts. | ||
+ | |||
+ | Sync of slices adds new attributes: | ||
+ | * **Contract code** - Code of the parent contract. This `String` value represents relation between all slices for the same contract. It means all slices for one contract must have this value same. During slice recalculation is created final relation on the contract (`parentContract`) in dependency on this contract code. | ||
+ | * **Valid from of slice** - Defines time from that is slice valid. Valid till of slice is computes automatically (by validity of next slice) after save. | ||
+ | |||
+ | < | ||
+ | |||
+ | |||
+ | **More informations about sync** of time slices are [[devel: | ||
+ | ===== Processors ===== | ||
+ | ==== Core module ==== | ||
+ | |||
+ | * **ContractSliceSaveProcessor** | ||
+ | * Basic processor for create and update entity `IdmContractSlice` in the database. | ||
+ | * **ContractSliceSaveRecalculateProcessor** | ||
+ | * Processor executes after `ContractSliceSaveProcessor`. Ensures order of slices (generates `validTill` on the slice) and creates or updates the parent contract (copy values from current slice to the contract). | ||
+ | * **ContractSliceDeleteProcessor** | ||
+ | * Basic processor for delete of the entity `IdmContractSlice`. Ensure referential integrity (deletes connected | ||
+ | * **ContractSliceGuaranteeSaveProcessor** | ||
+ | * Basic processor for create and update entity `IdmContractSliceGuarantee` in the database. | ||
+ | * **ContractSliceGuaranteeDeleteProcessor** | ||
+ | * Basic processor for delete of the entity `IdmContractSliceGuarantee`. | ||
+ | |||
+ | ==== Acc module ==== | ||
+ | * **ContractSliceDeleteProcessor** | ||
+ | * Ensures referential integrity - Before delete of the slice, deletes all contract-slice-account relations. | ||
+ | * **ContractSliceAccountSaveProcessor** | ||
+ | * Basic processor for create and update entity `IdmContractSliceAccount` in the database. | ||
+ | * **ContractSliceAccountDeleteProcessor** | ||
+ | * Basic processor for delete of the entity `IdmContractSliceAccount`. Ensure referential integrity. If is relation last (for same account), then is account (`AccAccount`) deleted too. | ||
+ | |||
+ | |||
+ | ===== Important properties ===== | ||
+ | |||
+ | < | ||
+ | <note important> | ||
+ | < | ||
+ | < | ||
+ | <note important> | ||
+ | <note important> | ||