README
Sample 4 - CSV File to XML File
-------------------
Copyright (c) 2012-2014 ForgeRock AS
This work is licensed under a Creative Commons Attribution-
NonCommercial-NoDerivs 3.0 Unported License. See
http://creativecommons.org/licenses/by-nc-nd/3.0/
This sample demonstrates using both a comma-separated value file and an XML
file as external resources. The synchronization mapping is directly from the
CSV file to the XML file, without using the OpenIDM internal repository.
Changes flow only from the CSV to XML. Data exists in both files, and
correlation is used to find matching records.
For documentation pertaining to this example see:
http://openidm.forgerock.org/doc/install-guide/index.html#more-sample4
To try the sample, follow these steps.
1. CSV data for this sample is in the file samples/sample4/data/hr.csv.
$ cd /path/to/openidm
$ cat samples/sample4/data/hr.csv
firstName, uid, "lastName","email", "employeeNumber", password
"Darth", "DDOE", "Doe", "doe@forgerock.org", "123456", "Z29vZA=="
"Darth", "VDART", "Vader", "vader@forgerock.org", "654321", "Z29vZA=="
XML data for this sample is in the file samples/sample4/data/xmlConnectorData.xml
$ cd /path/to/openidm
$ cat samples/sample4/data/xmlConnectorData.xml
1
bjensen@example.com
TestPassw0rd#
Barbara
Jensen
bjensen@example.com
1234567
openidm-authorized
Created By XML1
3
vader@forgerock.org
TestPassw0rd#
Anakin
Skywalker
vader@forgerock.org
1234567
openidm-admin,openidm-authorized
Created By XML1
Note that the last entry in that file has the same email address (vader@forgerock.org)
as an entry in the CSV. This will be used by correlation to find and update the record.
2. Start OpenIDM with the configuration for sample 4.
$ ./startup.sh -p samples/sample4
3. Run reconciliation.
$ curl -k --header "Content-type: application/json" -u "openidm-admin:openidm-admin" -X POST "https://localhost:8443/openidm/recon?_action=recon&mapping=csv_xmlfile"
{"reconId":"84b55592-a2d5-438a-ba71-c5e9a7a93938"}
4. See the data updated in the XML file:
$ cd /path/to/openidm
$ cat samples/sample4/data/xmlConnectorData.xml
3
N/A
Darth
Created By XML1
openidm-admin,openidm-authorized
vader@forgerock.org
vader@forgerock.org
Z29vZA==
Vader
N/A
Darth
openidm-authorized
01e85792-0515-426e-b2d6-7e0c4b354265
doe@forgerock.org
doe@forgerock.org
Z29vZA==
Doe
Note that Vader got updated, Doe got created, and Jensen got deleted. This
is all based on the policies declared in sync.json.
You can also try changing data in either the CSV or the XML and running recon
again. You should see the changes you make in the CSV used as authoritative,
overriding any changes you make in the XML and the two remaining in sync.
These users will not be visible from the OpenIDM UI, since they are mapped
directly rather than via the internal OpenIDM repository.