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's time slices was created.
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.
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.
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, provided that there is a next slice in the contract, which restarts the contract. Furthermore must be ensured that the gap between the termination and the beginning of the contract is less than or equal to the protection interval.
The protected interval can be set using the property idm.sec.core.contract-slice.protection-interval
, where the value is the number of days. If the number of days between the termination of the contract and its renewal in the following time slice is less than or equal to the number of days set in the protection interval, then the date of the contract validity from the following slice will be used instead of the date of termination of the contract from the currently valid slice.
idm.sec.core.contract-slice.protection-interval
is set to value '0'. That means protection interval is disabled.
idm.sec.core.contract-slice.protection-interval
, it doesn't immediately affect already existing contracts and slices. You must ensure that all affected contracts will be recalculated, so the new value of the protection interval is used. The easiest way: run the reconcilation of all contract slices.
Method updateContractBySlice
in the ContractSliceManager
ensures creating or updating a contract by slice (marked with 'Is using as a contract'). This method supports protection mode for contract validity (described above).
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
.
@Primary
(ensures that new service will have a priority).
/** * Your manager for contract slices * * @author svandav * */ @Primary @Service("yourContractSliceManager") public class YourContractSliceManager extends DefaultContractSliceManager implements ContractSliceManager { @Override @Transactional public IdmIdentityContractDto updateContractBySlice(IdmIdentityContractDto contract, IdmContractSliceDto slice, Map<String, Serializable> eventProperties) { /** * Your code ... */ return super.updateContractBySlice(contract, slice, eventProperties); } }
Synchronization of time slices is very similar as sync of contracts.
Sync of slices adds new attributes:
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. More informations about sync of time slices are here.
IdmContractSlice
in the database.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).IdmContractSlice
. Ensure referential integrity (deletes connected IdmContractSliceGuarantee
). If is slice last (for same parent contract), then is parent contract deleted too.IdmContractSliceGuarantee
in the database.IdmContractSliceGuarantee
. IdmContractSliceAccount
in the database. IdmContractSliceAccount
. Ensure referential integrity. If is relation last (for same account), then is account (AccAccount
) deleted too.IdmContractSlice
. Basic structure of the slices are same as identity contract.
IdmContractSlice.isUsingAsContract()
).
IdmContractSliceFormValue
).