Table of Contents

Systems - DB: Users' contracts synchronization

What do you need before you start

CREATE DATABASE "jdbcTest"
  WITH OWNER = idmadmin
       ENCODING = 'UTF8'
       TABLESPACE = pg_default
       LC_COLLATE = 'cs_CZ.UTF-8'
       LC_CTYPE = 'cs_CZ.UTF-8'
       CONNECTION LIMIT = -1;
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;
INSERT INTO public.contracts(
            id, name, state, disbled, description, valid_from, valid_to,
            team_leader, leader, main, changed, organization_name, organization_code,
            owner)
    VALUES (
'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');

INSERT INTO public.contracts(
            id, name, state, disbled, description, valid_from, valid_to,
            team_leader, leader, main, changed, organization_name, organization_code,
            owner)
    VALUES (
'2','Contract two','20','true','revolutionize viral experiences','2017-04-06',null,null,null,'true','2016-06-15','Einti','60429-911','john.roe');

Create and edit DB system

Go to Configuration tab and fill in information about your database. Ours are as such:

^ Host                 ^ jdbc:postgresql://localhost:5432/jdbcTest  ^
| Port                 | 5432                                       |
| User                 | idmadmin                                   |
| User Password        | ********                                   |
| Database             | jdbcTest                                   |
| Table                | contracts                                  |
| Key Column           | id                                         |
| JDBC Driver          | org.postgresql.Driver                      |
| JDBC Connection URL  | jdbc:postgresql://localhost:5432/jdbcTest  |

^ Attribute in schema ^ Name       ^ Identifier ^ Entity attr. ^ Entity field     ^ IdM key    ^ Transform from system ^
| leader              | leader     | false      | true         | Guarantess       | guarantees | does not have         |
| name                | name       | false      | true         | Name of position | position   | does not have         |
| __NAME__            | __NAME__   | true       | false        |   |            | does not have         |
| owner               | owner      | false      | true         | Owner            | identity   | does not have         |
| state               | state      | false      | true         | State            | state      | has                   |
| valid_from          | valid_from | false      | true         | Valid from       | validFrom  | has                   |
| valid_to            | valid_to   | false      | true         | Valid till       | validTill  | has                   |

import org.joda.time.LocalDate;

if(attributeValue){
    return new LocalDate(attributeValue);
}

If you have it in a state like in the upper picture you successfully complete this tutorial.

Thank you for following this tutorial, I hope it was useful.