Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
devel:documentation:synchronization:dev:contract-slice-sync [2019/08/13 13:30]
doischert [Fields for sync contractual relationship mapping]
devel:documentation:synchronization:dev:contract-slice-sync [2020/04/06 18:25] (current)
kubicar [Fields for sync contractual relationship mapping]
Line 2: Line 2:
 {{tag> sync contract slice}} {{tag> sync contract slice}}
  
-<note tip>**Time slices of identity (contractual) relationship synchronization** works according to the same rules as identity synchronization. In this page we will described only extra behavior specific for this synchronization.</note>+<note tip>**The synchronization of time slices of identity'(contractual) relationship** works according to the same rules as identity synchronization. In this page we will describe only behavior specific for this synchronization.</note>
  
-<note> **Sync of contract slice** using specific configuration from sync of contract. **Valid till date** is set only if slice is last (in sync)!</note> +<note> **Synchronization of contract slice** uses a configuration slightly different from the synchronization of contract. **Valid till date** is set only for the last slice that's synchronized!</note> 
-===== What is time slice of contractual relationship ===== + 
-<note tip>**Typically one contractual relationship is equals to one contract in company for the identity.** One slice of the contractual relationship describes how looked the contract in specific time slot. Sync of slices persists slices to the entity `IdmContractSlice` and creates relation on the account with entity `AccContractSliceAccount`. If more slices exists for same contract, then only one is using as source at one time.</note>+===== What is the time slice of contractual relationship ===== 
 + 
 +Typically one contractual relationship is equal to one contract in company for the identity. One slice of the contractual relationship describes what the contract looked like in specific time slot, i. e., it is a snapshot of the contract at a given time. Sync of slices persists slices to the entity `IdmContractSlice` and creates relation to the account with entity `AccContractSliceAccount`. If more slices exist for the same contract, then only one is being used as source at one time (the latest). See [[devel:documentation:adm:contracts|here]] to learn more about slices. 
 + 
 +From these slices (specifically the latest one), a contract is built. This contract is managed only by time slices and cannot be modified directly.
  
 ===== Actions after end of sync ===== ===== Actions after end of sync =====
  
-<note important>Actions executes after end of sync are **not executed** when user **canceled sync**!</note>+After the synchronization, HR processes must be run. In the Specific settings of synchronization, you can check **After end, start the HR processes** and not have to worry about anything. This, however, has its problems. If you sync a large amount of time slices (>10,000), you can see some issues. In those cases, it is recommended you run the HR processes manually. 
 + 
 + <note important>If you manually cancel the synchronization, the HR processes **will not start** even if you checked After end, start the HR processes. You must run them manually.</note> 
 + 
 +==== Running HR processes manually ==== 
 + 
 +As mentioned above, sometimes, you need to run HR processes manually. Each HR process is a long-running task a can be run from Settings > Task scheduler > Scheduled task. There you can run the desired LRT by simply clicking the green arrow button. 
 + 
 +You should run HR processes in this order: 
 +  - `ClearDirtyStateForContractSliceTaskExecutor` 
 +  - `SelectCurrentContractSliceTaskExecutor`  
 +  - `HrEnableContractProcess` 
 +  - `HrEndContractProcess` 
 +  - `HrContractExclusionProcess` 
 + 
 +For more details about some of them, see below. 
 + 
 +<note important>You always have to run at least the `ClearDirtyStateForContractSliceTaskExecutor` LRT, even if you cancelled the synchronization manually. If you don't, you will see duplicated contract as a result. This HR process creates and deletes contracts and deletes slices which are supposed to be deleted. 
 + 
 +So, in a situation where you ran the synchronization and either cancelled it manually before it finished and the HR processes ran or just decided to sync your contracts again (perhaps the data changed), **before you run the synchronization a second time, you must run the `ClearDirtyStateForContractSliceTaskExecutor`**. You can ignore the rest of HR processes for now but you absolutely must run `ClearDirtyStateForContractSliceTaskExecutor`.</note> 
 + 
 +==== Clear dirty state for contract slice ==== 
 + 
 +This LRT deletes those slices which have the flag "dirty" which means that they should be deleted (they are obsolete). It also creates and deletes contracts from the time slices. Beware that it takes some time to complete.
  
 ==== Select current contract slice ==== ==== Select current contract slice ====
  
-Before HR process is executed long running task select current contract slice. This options is controlled by checkbox *After end, start HR process*. LRT is started synchronously and complete log will contain information about it.+Before HR processes proper are executed, this long running task selects the current contract slicesThe LRT is started synchronously and complete log will contain information about its run.
  
-==== HR processes ==== +==== HR processes proper ====
-[[devel:dev:workflow:hr-processes| HR processes]] in the base ensure the correct state of identity depending on the state of their contractual relationships. Because we need to evaluate the status of contractual relationships as a whole (to a given identity), it is not possible to trigger HR processes during the synchronization of each contractual relationship. Therefore, no HR processes are executed during this synchronization.+
  
-HR processes can be (**should be**) correctly started after the end of the sync. This can be ensured by the property `After end, start the HR processes` on the detail of sync configuration. If is this property ticked, then HR processes '**Enabled contract**', '**End of contract**', '**Contract exclusion**' (in this order) will be automatically started after correctly end of contract relationships sync.+<note important>**In new IdM installation** must **HR processes be running at least once manually or by trigger**. Without this, sync will be not able **find HR tasks** (warning will be logged in sync log)!</note> 
 + 
 +[[devel:documentation:hr_processes|HR processes]], simply put, ensure the correct state of identity depending on the state of their contractual relationships. Because we need to evaluate the status of contractual relationships as a whole (to a given identity), it is not possible to trigger HR processes during the synchronization of each contractual relationship. Therefore, no HR processes are executed during synchronization but only after it ends. 
 + 
 +There are three HR processes: HrEnableContractProcess, HrEndContractProcess, and HrContractExclusionProcess. Their names are descriptive enough but in a nutshell HrEnableContractProcess determines that the contract should start (it's valid), HrEndContractProcess determines that the contract should end (it's no longer valid), and HrContractExclusionProcess deals with contracts exclusion's start and end. (e. g., due to parental leave) 
 + 
 +HR processes can be (**should be**) correctly started after the end of the sync. This can be ensured ticking the checkbox `After end, start the HR processes` in the Specific settings of synchronizationon in sync configuration. If is this property ticked, then all HR processes including ClearDirtyStateForContractSliceTaskExecutor and SelectCurrentContractSliceTaskExecutor will be run once the synchronization finishes.
  
 ==== Automatic roles ==== ==== Automatic roles ====
  
-Recalculation of automatic roles is skipped during sync. Recalculation of automatic roles can be (**should be**) correctly started after the end of the sync. This can be ensured by the property '**After end, start the automatic role recalculation**' on the detail of sync configuration.+Recalculation of automatic roles is skipped during sync but it can be (**should be**) started after the end of the sync. This can be ensured by the property '**After end, start the automatic role recalculation**' in  the Specific settings of synchronizationon of sync configuration.
  
 {{ :devel:documentation:synchronization:dev:sync_spec_after_end.png |}} {{ :devel:documentation:synchronization:dev:sync_spec_after_end.png |}}
  
 ===== Fields for sync contractual relationship mapping ===== ===== Fields for sync contractual relationship mapping =====
-Bellow is an example of contractual relationship mapping using slices. This is only an example; in general, slices must be mapped in the same way that contracts are but must have two extra attributes: "Valid from of slice" and some sort of "Slice ID". +  * **Contract code** - Code of the parent contract. This `String` value represents relation between all slices for the same contract. 
- +  * **Valid from of slice** - Defines time from which the slice is valid. Valid till of slice is computed automatically (by the validity of the next slice) after save. Output value from attribute transformation must be 'org.joda.time.LocalDate' (or String in the format `yyyy-MM-dd`). 
-* **Contract code** - Code of the parent contract. This `String` value represents relation between all slices for the same contract. +  * **Owner** - Relation'owner, it must be an existing identity in IdM. This field is required for every relation. Output from attribute transformation can be:
-* **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. Output value from attribute transformation must be 'org.joda.time.LocalDate' (or String in the format `yyyy-MM-dd`). +
-* **Slice ID** - ID of the time slice, it is often transformed by combining "Contract code" and "Valid from of slice", e. g., "000054-24-07-2019"+
-* **Owner** - Relation owner. Must be identity in IdM. This field is required for every relation. Output from attribute transformation can be:+
       * ID of IdM identity in String or UUID format.       * ID of IdM identity in String or UUID format.
       * Username of IdM identity in String.        * Username of IdM identity in String. 
-* **Main** - Define if is the contract main (between all contracts for the identity). Output from attribute transformation must be Boolean. +  * **Main** - Defines if the contract is the main contract (among all contracts for the identity). Output from attribute transformation must be Boolean. 
-* **State** - State of contract. Output from attribute transformation must be enumeration ContractState or String representation for this enumeration (DISABLED, EXCLUDED) (more details see below). +  * **State** - State of contract. Output from attribute transformation must be enumeration ContractState or String representation for this enumeration (DISABLED, EXCLUDED) (see below for more details). 
-* **Position** - String representation of contract. Typically name of contract. +  * **Position** - String representation of contract. Typically name of contract. 
-* **Guarantees** - List of leaders, directly linked on the contractual relationship (more details see below).  +  * **Guarantees** - List of leaders, directly linked on the contractual relationship (see below for more details).  
-* **Work position** - Define link to some tree node. Generaly define place in organization structure (more details se below).  +  * **Work position** - Defines link to some tree node. Generally defines a place in the organization structure (see below for more details).  
-* **Valid from of contract** - Validity for the contractual relationship. Output value from attribute transformation must be 'org.joda.time.LocalDate' (or String in the format `yyyy-MM-dd`). +  * **Valid from of contract** - Validity for the contractual relationship. Output value from attribute transformation must be 'org.joda.time.LocalDate' (or String in the format `yyyy-MM-dd`). 
-* **Valid till of contract** - Validity for the contractual relationship. Output value from attribute transformation must be 'org.joda.time.LocalDate' (or String in the format `yyyy-MM-dd`). +  * **Valid till of contract** - Validity for the contractual relationship. Output value from attribute transformation must be 'org.joda.time.LocalDate' (or String in the format `yyyy-MM-dd`). 
-* **Externe** -  If is the contractual relationship for externe identity, then is output value (boolean true+  * **External contractor** -  If the contractual relationship is for external identity, then the output value is boolean true. 
-* **Description** - String for description the relation. +  * **Description** - String for the description of the relation.
- +
  
 +Link to SQL details for making the Views: [[https://wiki.czechidm.com/priv/time_slices#mssql_update_of_sql_query_and_extra_information]]
 ==== Guarantees field ==== ==== Guarantees field ====
-List of leaders, directly linked on the contractual relation. Linked leader must exists in IdM.+List of leaders, directly linked to the contractual relation. Linked leader must exists in IdM.
 Output from attribute transformation can be: Output from attribute transformation can be:
   * Username of leader (String).   * Username of leader (String).
Line 57: Line 85:
   * Null value. If is value not defined and in sync configuration has set '**Default leader**', then will be this leader set to relation.    * Null value. If is value not defined and in sync configuration has set '**Default leader**', then will be this leader set to relation. 
  
-If some leader will not found. Then will be synchronization item marked as 'warning' (relation will be created/saved). Detail information will be saved in item log:+If no leader is found, the synchronization item will be marked as 'warning' (relation will be created/saved). Detailed information will be saved in item log:
  
 <code> <code>
Line 68: Line 96:
  
 ==== Work position field ==== ==== Work position field ====
-Define link to some tree node. Generaly define place in organization structure.+Defines link to some tree node. Generally defines a place in the organization structure.
 Output from attribute transformation can be: Output from attribute transformation can be:
-  * Id of tree node (UUID or String). +  * Id of tree node (UUID or String). 
-  * Code of tree node. Node by code will be searching in default tree (define in sync configuration '**Default type of structure**'). +  * Code of tree node. Node by code will be looked up in default tree (defined in sync configuration '**Default type of structure**'). 
-  * Null value. If is value not defined and in sync configuration has set '**Default position in structure**', then will be this node set to relation+  * Null value. If no value is defined and the sync configuration has set '**Default position in structure**', then this node will be set as the tree node
  
-If node will not found. Then will be synchronization item marked as 'warning' (relation will be created/saved). Detail information will be saved in item log:+If no node is found the synchronization item will be marked as 'warning' (relation will be created/saved). Detailed information will be saved in item log:
  
 <code> <code>
Line 87: Line 115:
 </code> </code>
 <note important> <note important>
-When isn'work-position attribute defined in the mapping, then **none** default position will be set.</note>+If no work-position attribute is defined in the mapping, then **no** default position will be set.</note>
  
 ==== State field ==== ==== State field ====
 State of contract. Output from attribute transformation must be enumeration ContractState or String representation for this enumeration. State of contract. Output from attribute transformation must be enumeration ContractState or String representation for this enumeration.
  
-ContractState have this values:+ContractState has these values:
   * **[[..:..:identities:dev:contractual-relationship#invalid_cr|DISABLED]]**   * **[[..:..:identities:dev:contractual-relationship#invalid_cr|DISABLED]]**
   * **[[..:..:identities:dev:contractual-relationship#invalid_cr|EXCLUDED]]**   * **[[..:..:identities:dev:contractual-relationship#invalid_cr|EXCLUDED]]**
  
  • by doischert