Sun GlassFish Mobility Platform 1.1 Developer's Guide for Client Applications

Retrieving Objects for Editing

To allow users to view existing objects, the code commonly displays a list of names returned by the BusinessObjectStorage.listBusinessObjectNames method. This method retrieves a list of the names of all the business objects that have the file extension specified by the SyncManager constructor method. For example, the SecureJdbcMIDlet code calls the following method before populating a form with a list of albums:

Vector v = boStorage.listBusinessObjectNames();

To display a selected album, the SecureJdbcMIDlet code instantiates an Album object, using a name argument that represents the filename stripped of its ".alb" extension. The code then calls the BusinessObjectStorage.readBusinessObject method to read the data for the selected album from the file system into the Album object.

Album a = new Album(selectedAlbum.substring(0, selectedAlbum.length()-4));
boStorage.readBusinessObject(a);

The SecureJdbcMIDlet code then calls the getter methods for Album objects to retrieve the selected album's property values and display them in a form for editing.