Updating the properties of an entity

Use the update(DataObject) method and the PropertyControl to change the properties of an entity.

About this task

The update method is used to modify the properties of an entity. In this example the cn property of a person is changed from SalesMgr to SalesManager.

To modify the cn property of a person 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=SalesManager,cn=users,dc=yourco,dc=com");
String newCn = "Sales Manager";
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=SalesManager,cn=users,dc=yourco,dc=com"/>
      <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>


Terms of use | Feedback

http://publib.boulder.ibm.com/infocenter/wasinfo/v8r0/index.jsp?topic=/com.ibm.websphere.wim.doc/updatingthepropertiesofanentity.html