Generating BlackBerry Mobile Application Project Code

After developing the mobile business objects (MBOs), generate the Java files that implement the business logic and are required for BlackBerry device application development.

  1. From Unwired WorkSpace, right-click in the Mobile Application Diagram of the project for which you are generating code and select Generate Code.
  2. Follow the Code Generation wizard instructions to generate code appropriate for the BlackBerry JDE environment, by selecting Java as the language and, in this case, Java ME for BlackBerry as the platform.

    Other selections affect generated output as well. For example, if you include an Unwired Server entry, it generates a default connection to Unwired Server.

  3. Click Next. Select the MBOs for which you are generating code and any additional options you require.

    See Generating Object API Code for details of all options.

  4. Click Finish. Ignore errors that reference the sup-rim-afaria.jar file since it has been removed and not required. The class files include all methods required to create connections, synchronize deployed MBOs with the device, query objects, and so on, as defined in your MBOs.

    By default, the MBO source code and supporting documentation are generated in the project's Generated Code folder. The generated Java files are located in the <MBO_project_name> folder under the src folder:

    The frequently used Java files in this project, described in code samples include:
    Source code file descriptions
    Java file Description
    MBO class (for example, Customer. java) Includes all the attributes, operations, object queries, and so on, defined in this MBO.
    Synchronization parameter class (for example, CustomerSynchronizationParameters.java) Includes any synchronization parameters defined in this MBO.
    Key generator classes (for example, KeyGenerator.java) Includes generation of surrogate keys used to identify and track MBO instances and data.
    Local Key generator classes(for example LocalKeyGenerator.java) Includes generation of surrogate keys used to identify and track MBO instances and data that exist only on the local device.
    Personalization parameter classes (for example, PersonalizationParameters.java) Includes any defined personalization keys.
    OfflineAuthentication.java Saves authentication information locally and includes methods used between the device application and local database for offline authentication (does not communicate with Unwired Server).
    <PkgName>DB (where PkgName is the name of the project/package, for example, MBOs_for_BB_devDB) Defines API to handle client database access, synchronization profile, authentication, and synchronization operations.
    ObjectManager (for example, MBOs_for_BB_devDB_RM) Invokes methods and retrieves the metadata of packages, MBOs, attributes, operations, and parameters during runtime using the name (reflection) instead of the object instance.
    Note: ObjectManager classes are generated only when you select the Generate metadata and object manager classes option.
    Other operation classes (for example, <MBO><OtherOperation>Operation) Encapsulates each other operation into an object