Time slices of contractual relationships
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.
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.
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, 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.
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
sets to value '0'. That means protection interval is disabled.
How customize the method for the create/update contract by slice?
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 upper).
If you need implementing more specific behavior, you can override that method. For this you can create new service witch will be extends the default implementation of the contract slice manager DefaultContractSliceManager
.
@Primary
(ensures that new service will take 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); } }
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 here.
Processors
Core module
- ContractSliceSaveProcessor
- Basic processor for create and update entity
IdmContractSlice
in the database.
- ContractSliceSaveRecalculateProcessor
- Processor executes after
ContractSliceSaveProcessor
. Ensures order of slices (generatesvalidTill
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 connectedIdmContractSliceGuarantee
). If is slice last (for same parent contract), then is parent contract deleted too.
- 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
IdmContractSlice
. Basic structure of the slices are same as identity contract.
IdmContractSlice.isUsingAsContract()
).
IdmContractSliceFormValue
).