Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
tutorial:adm:systems_db_contracts [2018/03/05 09:06] stloukalp |
tutorial:adm:systems_db_contracts [2018/03/05 09:13] stloukalp |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Systems - DB: Users' contracts synchronization ====== | ||
+ | ===== What do you need before you start ===== | ||
+ | * You need install **CzechIdM 7.7.0** (and higher). | ||
+ | * You need be logged in as **admin**. | ||
+ | * You need enable **ACC** module. | ||
+ | * You must have database **jdbcTest** with table **contracts**: | ||
+ | < | ||
+ | CREATE DATABASE " | ||
+ | WITH OWNER = idmadmin | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | </ | ||
+ | < | ||
+ | CREATE TABLE public.contracts | ||
+ | ( | ||
+ | id character varying(255), | ||
+ | name character varying(255), | ||
+ | state character varying(255), | ||
+ | disbled character varying(255), | ||
+ | description character varying(255), | ||
+ | valid_from date, | ||
+ | valid_to date, | ||
+ | team_leader character varying(255), | ||
+ | leader character varying(255), | ||
+ | main character varying(255), | ||
+ | changed character varying(255), | ||
+ | organization_name character varying(255), | ||
+ | organization_code character varying(255), | ||
+ | owner character varying(255) | ||
+ | ) | ||
+ | WITH ( | ||
+ | OIDS=FALSE | ||
+ | ); | ||
+ | ALTER TABLE public.contracts | ||
+ | OWNER TO idmadmin; | ||
+ | </ | ||
+ | * And add two records: | ||
+ | < | ||
+ | INSERT INTO public.contracts( | ||
+ | id, name, state, disbled, description, | ||
+ | team_leader, | ||
+ | owner) | ||
+ | VALUES ( | ||
+ | ' | ||
+ | |||
+ | INSERT INTO public.contracts( | ||
+ | id, name, state, disbled, description, | ||
+ | team_leader, | ||
+ | owner) | ||
+ | VALUES ( | ||
+ | ' | ||
+ | </ | ||
+ | |||
+ | ===== Create and edit DB system ===== | ||
+ | * We go into **Systems** agenda and add a new system. Click on green button **Add**. | ||
+ | {{ : | ||
+ | * Fill **System name** and at bottom of page there is green button **Save and continue**, so click on it. | ||
+ | {{ : | ||
+ | Go to **Configuration** tab and fill in information about your database. Ours are as such: | ||
+ | < | ||
+ | ^ Host ^ jdbc: | ||
+ | | Port | 5432 | | ||
+ | | User | idmadmin | ||
+ | | User Password | ||
+ | | Database | ||
+ | | Table | contracts | ||
+ | | Key Column | ||
+ | | JDBC Driver | ||
+ | | JDBC Connection URL | jdbc: | ||
+ | </ | ||
+ | {{ : | ||
+ | * Then go to tab **Scheme** and generate scheme. | ||
+ | {{ : | ||
+ | * Then go to **Mapping** and click on **Add** button. | ||
+ | {{ : | ||
+ | * Now fill in information from the picture below and click on **Save and continue**. | ||
+ | {{ : | ||
+ | * At the bottom of page, there are mapped attributes. We are going to add 7 attributes: | ||
+ | < | ||
+ | ^ Attribute in schema ^ Name ^ Identifier ^ Entity attr. ^ Entity field ^ IdM key ^ Transform from system ^ | ||
+ | | leader | ||
+ | | name | name | false | true | Name of position | position | ||
+ | | __NAME__ | ||
+ | | owner | owner | false | true | Owner | identity | ||
+ | | state | state | false | true | State | state | has | | ||
+ | | valid_from | ||
+ | | valid_to | ||
+ | </ | ||
+ | * In **Transformation from system** field of **state** attribute there is green button **Insert script** select **Compiles identity-relation state** and click **Select** | ||
+ | {{ : | ||
+ | * Paste to **Transformation from system** field of **valid\_from** and **valid\_to** attributes: | ||
+ | |||
+ | < | ||
+ | import org.joda.time.LocalDate; | ||
+ | |||
+ | if(attributeValue){ | ||
+ | return new LocalDate(attributeValue); | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | * Two examples how to fill attributes: | ||
+ | {{ : | ||
+ | {{ : | ||
+ | * Now we have 7 mapped attributes: | ||
+ | {{ : | ||
+ | * Go to tab **Synchronization** and **Add** new synchronization. | ||
+ | {{ : | ||
+ | * Fill the form as in the picture below and click on **Save and continue**, then click on green **arrow** and option **Save and run sync** will show up, so click on it: | ||
+ | {{ : | ||
+ | * Confirm start synchronization: | ||
+ | {{ : | ||
+ | * Wait a few seconds, so synchronization can finish its job. And then go to **Users** section (in the left menu). And find user **john.roe**. | ||
+ | * In tab positions there is now 3 contracts. The **Default** contract has been here since creating this user (for testing purposes) and the other two are synchronized from the database. | ||
+ | {{ : | ||
+ | If you have it in a state like in the upper picture you successfully complete this tutorial. | ||
+ | |||
+ | <note tip> |