Systems - CSV file: users contracts synchronization

The principle of this synchronization is the same as for identity synchronization. However, the aim of this synchronization is not a direct identity, but his/her contractual relationship. More on what constitutes a contractual relationship you can find here.

Typically, one contractual relationship is equal to one contract in a company per identity.
More on the sync of contractual relationships here.
  • You need to install CzechIdM 7.5.0 (and higher).
  • You need to be logged in as 'admin'.
  • You need to have two users ready: 'john.doe' and 'john.roe'.

First we need create 'demo' data that we will synchronize. We will using CSV connector, for this we need create CSV source file with our demo contracts.

Here are demo data in CSV format:

ID,NAME,STATE,DISBLED,DESCRIPTION,VALID_FROM,VALID_TO,TEAM_LEADER,LEADER,MAIN,CHANGED,ORGANIZATION_NAME,ORGANIZATION_CODE,OWNER
1,"Contract one","30","false","visualize dot-com ROI","2016-05-04","2016-06-21","john.doe","john.doe","true","2016-06-25","Skinder","68016-376","john.roe"
2,"Contract two","20","true","revolutionize viral experiences","2017-04-06","","","","true","2016-06-15","Einti","60429-911","john.roe"

Create new file "contracts.csv" with contains above. This file you can save to your user space. For my case is path: "/home/svandav/csv/contracts.csv".

Create new system in CzechIdM, with name 'Contracts - CSV'.

Connector configuration

Now we can configurate CSV connector and his settings.

Remember, you have to set correct path to your contracts.csv file!

Generate schema

We have correctly configured system. Now we need generate schema by connector settings. Go to the scheme tab and click on "Generate scheme" button.

Create sync mapping

System mapping for sync contractual relationships, you can create on tab "Mapping".

Create mapped attributes

Now we have to create mapped attributes. They are definitons how mapping schema attributes to fields in contractual relationship.

Primary attribute

Create attribute keeps primary identifier for the contractual relationship.

  • Select '_ _ NAME _ _' from schema attributes.
  • Checkbox 'Identifier' must be checked.

Name attribute

Defines name of the contractual relationship.

  • Select 'NAME' from schema attributes.
  • Tick checkbox 'Entity attr.'.
  • In the 'Entity field' select the item 'Name of positions'.

Guarante attribute

Defines list of leaders, directly linked on the contractual relationship (more details see below).

  • Select 'LEADER' from schema attributes.
  • Tick checkbox 'Entity attr.'.
  • In the 'Entity field' select the item 'Guarantees'.

Owner attribute

Defines relation owner. Must be identity in IdM. This field is required for every relation.

  • Select 'LEADER' from schema attributes.
  • Tick checkbox 'Entity attr.'.
  • In the 'Entity field' select the item 'Guarantees'.

Valid from attribute

Valid from - Validity for the contractual relationship. This attribute required LocalDate type only. For this we need do transformation (as show example below).

import org.joda.time.LocalDate;
 
if(attributeValue){
    return new LocalDate(attributeValue);
}
  • Select 'VALID_FROM' from schema attributes.
  • Tick checkbox 'Entity attr.'.
  • In the 'Entity field' select the item 'Valid from'.
  • Paste transformation to "Transformation from the system"

Valid till attribute

Valid till - Validity for the contractual relationship. This attribute required LocalDate type only. For this we need do transformation (as show example below).

import org.joda.time.LocalDate;
 
if(attributeValue){
    return new LocalDate(attributeValue);
}
  • Select 'VALID_TO' from schema attributes.
  • Tick checkbox 'Entity attr.'.
  • In the 'Entity field' select the item 'Valid till'.
  • Paste transformation to "Transformation from the system"

State attribute

State of contract. In some situations can be informations needed to determine result state in more than once source attributes. For example we can have attribute 'state' with one of values (10,20,30) and second attribute 'disabled' (with value true/false). In this case states '10' and '30' marks that contractual relation is 'excluded', but when attribute 'disabled' will be 'true', then final state of relation must be 'DISABLED'.

For resolve situation discrabed above was created transformation script 'compileIdentityRelationState'.

  • Select 'STATE' from schema attributes.
  • Tick checkbox 'Entity attr.'.
  • In the 'Entity field' select the item 'State'.
  • In the 'Transformation from the system' area, click on 'Insert script' and select 'compileIdentityRelationState'.

Create sync configuration

We have created system with mapped attributes. Now we need create sync configuration.

  • Go to the tab 'Synchronization' and create new item.
  • Tick checkbox 'Allowed'.
  • Tick checkbox 'Reconciliation'.
  • Fill the name of sync 'Sync contracts'.
  • In the selectbox 'Set of mapped attributes', select 'Sync - Identity contract - Synchronization'.
  • In the selectbox 'Collation attribute' (in 'Not linked' section), select '_ _ NAME _ _'.
  • On the tab 'Specific settings' select some 'Default type of structure'. In this example is not matter what type of structure you select, because we do not want sync relation between organization structure and contract relationship now.
  • Save the sync configuration by 'Save and continue'.

Start sync

Finally we can start synchornization for contract relationships.
  • On the detail sync configuration click on the drop "down" button and select 'Save and run sync'.

Log of sync

After sync ended (a few seconds), you can check result of sync.

  • After sync ended (a few seconds) go to the tab 'Logs' (on the sync configuration detail).
  • Refresh table with logs (reload button at the top right on the table).
  • You should see this:

Check contracts on user 'john.roe'

On the end, you can check new contract relations on the user 'john.roe'.

  • Find the user 'john.roe'.
  • Go to his detail and on the tab 'Positions'.
  • You should see three contracts:
    • Default contract (created with this user automatically).
    • Contract one - have to be in the state excluded and as authorizer must have user 'john.doe'.
    • Contract two - have to be active (state is empty).

If you see same result, then congratulation to your first success sync of contract relationships.