Name Last Update
..
conf Loading commit data...
data Loading commit data...
README Loading commit data...

README

/**
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2014 ForgeRock AS. All rights reserved.
*
* The contents of this file are subject to the terms
* of the Common Development and Distribution License
* (the License). You may not use this file except in
* compliance with the License.
*
* You can obtain a copy of the License at
* http://forgerock.org/license/CDDLv1.0.html
* See the License for the specific language governing
* permission and limitations under the License.
*
* When distributing Covered Code, include this CDDL
* Header Notice in each file and include the License file
* at http://forgerock.org/license/CDDLv1.0.html
* If applicable, add the following below the CDDL Header,
* with the fields enclosed by brackets [] replaced by
* your own identifying information:
* "Portions Copyrighted [year] [name of copyright owner]"
*/

Sample 4 - CSV File to XML File
-------------------

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"
"Don", "DDOE", "Doe", "doe@example.org", "123456", "Z29vZA=="
"Stephen", "SCARTER", "Carter", "scarter@example.com", "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




bjensen
bjensen@example.com
TestPassw0rd#
Barbara
Jensen
bjensen@example.com
1234567
openidm-authorized
Created By XML1


scarter
scarter@example.com
TestPassw0rd#
Steven
Carter
scarter@example.com
1234567
openidm-admin,openidm-authorized
Created By XML1

Note that the last entry in that file has the same email address (scarter@example.com)
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 -H "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




scarter
N/A
Stephen
Created By XML1
openidm-admin,openidm-authorized
scarter@example.com
scarter@example.com
Z29vZA==
Carter


N/A
Don

openidm-authorized
492f28f8-dc03-43e1-aaed-abd33f265ecb
doe@example.org
doe@example.org
Z29vZA==
Doe

Note that Carter 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.