Renaming an entity

Use the update(DataObject) method to rename an entity.

To rename an entity, you must set its RDN property to a new value. In this example the RDN property of Person, uid, is changed from SalesMgr to SalesManager.

To change the uid value from SalesMgr to SalesManager, add this 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=SalesMgr,cn=users,dc=yourco,dc=com");
String newUid = "SalesManager";
String newCn = "SalesManager";
entity.set("uid", newUid);
entity.set("cn", newCn);
		
root = service.update(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=SalesMgr,cn=users,dc=yourco,dc=com"/>
      <wim:uid>SalesManager</wim:uid>
      <wim:cn>Sales Manager</wim:cn>
    </wim:entities>
  </wim:Root>
</sdo:datagraph>
The resulting output data graph for this example 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 externalId="5e846c20-a1b4-4bfc-bce2-1f841d762f9a" 
                      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:entities>
  </wim:Root>
</sdo:datagraph>
Related reference
update method
Terms of use | Feedback
(C) Copyright IBM Corporation 2005. All Rights Reserved.
IBM virtual member manager 6.1