Getting the properties of an entity
Use the get(DataObject) method to obtain the properties of entities, group membership, group members, ancestors, and descendents by specifying the corresponding control.
About this task
To obtain the properties
of uid, cn, sn, telephoneNumber, and createTimeStamp of Person Admin,
add the following sample code to your application code and replace
the variables with the actual values that you want to use for
this request:
DataObject root = SDOHelper.createRootDataObject();
DataObject entity = SDOHelper.createEntityDataObject(root, null, DO_PERSON_ACCOUNT);
entity.createDataObject(DO_IDENTIFIER).set(PROP_UNIQUE_NAME,
"uid=SalesManager,cn=users,dc=yourco,dc=com");
DataObject propCtrl = SDOHelper.createControlDataObject(root, null, DO_PROPERTY_CONTROL);
propCtrl.getList(PROP_PROPERTIES).add("sn");
propCtrl.getList(PROP_PROPERTIES).add("uid");
propCtrl.getList(PROP_PROPERTIES).add("cn");
propCtrl.getList(PROP_PROPERTIES).add("telephoneNumber");
propCtrl.getList(PROP_PROPERTIES).add("createTimestamp");
root = service.get(root);
Sample input and output data graphs
For
this particular example the input data graph is:
<?xml version="1.0" encoding="UTF-8"?>
<sdo:datagraph xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:sdo="commonj.sdo"
xmlns:wim="http://www.ibm.com/websphere/wim">
<wim:Root>
<wim:entities xsi:type="wim:PersonAccount">
<wim:identifier uniqueName="uid=SalesManager,cn=users,dc=yourco,dc=com"/>
</wim:entities>
<wim:controls xsi:type="wim:PropertyControl">
<wim:properties>sn</wim:properties>
<wim:properties>uid</wim:properties>
<wim:properties>cn</wim:properties>
<wim:properties>telephoneNumber</wim:properties>
<wim:properties>createTimestamp</wim:properties>
</wim:controls>
</wim:Root>
</sdo:datagraph>
The resulting output data graph is:
<sdo:datagraph xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:sdo="commonj.sdo"
xmlns:wim="http://www.ibm.com/websphere/wim">
<wim:Root>
<wim:entities xsi:type="wim:PersonAccount">
<wim:identifier externalName="uid=SalesManager,cn=users,dc=yourco,dc=com"
repositoryId="LDAP1"
uniqueId="5e846c20-a1b4-4bfc-bce2-1f841d762f9a"
uniqueName="uid=SalesManager,cn=users,dc=yourco,dc=com"/>
<wim:createTimestamp>2005-10-17T14:13:26.0Z</wim:createTimestamp>
<wim:uid>SalesManager</wim:uid>
<wim:cn>Sales Manager</wim:cn>
<wim:sn>SalesMgrSn</wim:sn>
<wim:telephoneNumber>11111111</wim:telephoneNumber>
<wim:telephoneNumber>22222222</wim:telephoneNumber>
</wim:entities>
</wim:Root>
</sdo:datagraph>
For end-to-end sample code, see the topic, Sample code for working with users, groups, group members, and group memberships.