Use the delete (DataObject) method and DeleteControl to remove entries.
In this example OrgContainer Sales and its descendants are being removed from the repository.
DataObject root = SDOHelper.createRootDataObject(); DataObject entity = SDOHelper.createEntityDataObject(root, null, DO_ENTITY); DataObject ctrl = SDOHelper.createControlDataObject(root, null, DO_DELETE_CONTROL); ctrl.setBoolean(PROP_DELETE_DESCENDANTS, true); ctrl.setBoolean(PROP_RETURN_DELETED, true); entity.createDataObject(DO_IDENTIFIER).set(PROP_UNIQUE_NAME, "o=Sales,cn=users,dc=yourco,dc=com"); root = service.delete(root);
<?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> <wim:identifier uniqueName="o=Sales,cn=users,dc=yourco,dc=com"/> </wim:entities> <wim:controls xsi:type="wim:DeleteControl" deleteDescendants="true" returnDeleted="true"/> </wim:Root> </sdo:datagraph>
<?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 externalName="uid=SalesPerson1,ou=CA,o=Sales,cn=users,dc=yourco,dc=com" repositoryId="LDAP1" uniqueId="e7db8c0e-d2b3-43fe-be14-1475125606f4" uniqueName="uid=SalesPerson1,ou=CA,o=Sales,cn=users,dc=yourco,dc=com"/> </wim:entities> <wim:entities xsi:type="wim:PersonAccount"> <wim:identifier externalName="uid=SalesPerson2,ou=CA,o=Sales,cn=users,dc=yourco,dc=com" repositoryId="LDAP1" uniqueId="a3f9e8a1-117a-4252-840f-6d0cb079a7fb" uniqueName="uid=SalesPerson2,ou=CA,o=Sales,cn=users,dc=yourco,dc=com"/> </wim:entities> <wim:entities xsi:type="wim:OrgContainer"> <wim:identifier externalName="ou=CA,o=Sales,cn=users,dc=yourco,dc=com" repositoryId="LDAP1" uniqueId="0dfcccf7-9fb9-4b25-a0f4-ff4b6b33068e" uniqueName="ou=CA,o=Sales,cn=users,dc=yourco,dc=com"/> </wim:entities> <wim:entities xsi:type="wim:PersonAccount"> <wim:identifier externalName="uid=SalesPerson4,ou=US,o=Sales,cn=users,dc=yourco,dc=com" repositoryId="LDAP1" uniqueId="a2d1be42-212e-44f0-8396-0bfc2d7d346d" uniqueName="uid=SalesPerson4,ou=US,o=Sales,cn=users,dc=yourco,dc=com"/> </wim:entities> <wim:entities xsi:type="wim:PersonAccount"> <wim:identifier externalName="uid=SalesPerson3,ou=US,o=Sales,cn=users,dc=yourco,dc=com" repositoryId="LDAP1" uniqueId="13ae346f-1e4c-40cd-8896-1c7f0b2b3079" uniqueName="uid=SalesPerson3,ou=US,o=Sales,cn=users,dc=yourco,dc=com"/> </wim:entities> <wim:entities xsi:type="wim:OrgContainer"> <wim:identifier externalName="ou=US,o=Sales,cn=users,dc=yourco,dc=com" repositoryId="LDAP1" uniqueId="70dd624d-6eb0-4fdf-8338-3ae4090b1c6f" uniqueName="ou=US,o=Sales,cn=users,dc=yourco,dc=com"/> </wim:entities> <wim:entities xsi:type="wim:OrgContainer"> <wim:identifier externalName="o=Sales,cn=users,dc=yourco,dc=com" repositoryId="LDAP1" uniqueId="eab85abb-9d29-40f1-b502-36c051d3ee96" uniqueName="o=Sales,cn=users,dc=yourco,dc=com"/> </wim:entities> </wim:Root> </sdo:datagraph>The OrgContainer Sales is deleted as well as its descendants OrganizationUnits CA and US and their children SalesPerson1, SalesPerson2, SalesPerson3 and SalesPerson4.
For end-to-end sample code, see the topic, Sample code for working with users, groups, group members, and group memberships.