Creating an entity

Use the create(DataObject) method to create an entity.

Use the create method to create any of the entity data object types that are supported by virtual member manager. This particular example shows how to create a PersonAccount entity, Person Admin under the container cn=users,dc=yourco,dc=com. The uniqueName of the parent is defined in the virtual member manager configuration file as the default parent for entity type, PersonAccount. In this case, you do not have to specify the parent property in the input data object.
To create a PersonAccount entity, add the following sample code to your application code and replace the variables with the actual values that you want to use for this entity.:
DataObject root = SDOHelper.createRootDataObject();
	DataObject entity = SDOHelper.createEntityDataObject(root, null, DO_PERSON_ACCOUNT);
	entity.set("uid", "Admin");
	entity.set("cn", "Administrator");
	entity.set("sn", "AdminSn");
	root = service.create(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:uid>Admin</wim:uid>
      <wim:cn>Administrator</wim:cn>
      <wim:sn>AdminSn</wim:sn>
    </wim:entities>
  </wim:Root>
</sdo:datagraph>
The resulting output 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 externalName="uid=Admin,cn=users,dc=yourco,dc=com" 
                      repositoryId="LDAP1"
                      uniqueId="38dc5508-bf68-44d8-bcb1-da23f6cd009a" 
                      uniqueName="uid=Admin,cn=users,dc=yourco,dc=com"/>
    </wim:entities>
  </wim:Root>
</sdo:datagraph>
Notice that the PersonAccount entity for Person Admin has a virtual member manager identifier consisting of an external name, a repository ID, a unique ID, and a unique name.
To verify that your entry was created, you can use the search or get methods to retrieve information about Person Admin.
Related concepts
Entity DataObject
Related reference
create method
Terms of use | Feedback
(C) Copyright IBM Corporation 2005. All Rights Reserved.
IBM virtual member manager 6.1