Generating Object API Code

Generate object API code containing mobile business object (MBO) references, which allows you to use APIs to develop device applications for various mobile devices.

Prerequisites

Before generating device client code, develop the MBOs that will be referenced in the device applications you are developing. A mobile application project must contain at least one non-online MBO. You must have an active connection to the data sources to which the MBOs are bound.

Task
  1. Launch the Code Generation wizard.
    From Action
    The Mobile Application Diagram Right-click within the Mobile Application Diagram and select Generate Code.
    WorkSpace Navigator Right-click the Mobile Application project folder that contains the mobile objects for which you are generating API code, and select Generate Code.
  2. (Optional) Enter the information for these options:
    Note: This page of the code generation wizard is seen only if you are using the Advanced developer profile. See Switching Between Developer Profiles.
    Option Description
    Select code generation configuration Select either an existing configuration that contains code generation settings, or generate device client code without using a configuration:
    • Continue without a configuration – select this option to generate device code without using a configuration.
    • Select an existing configuration – select this option to either select an existing configuration from which you generate device client code, or create a new configuration. Selecting this option enables:
      • Select code generation configuration – lists any existing configurations, from which you can select and use for this session. You can also delete any and all existing saved configurations.
      • Create new configuration – enter the Name of the new configuration and click Create to save the configuration for future sessions.

        Select an existing configuration as a starting point for this session and click Clone to modify the configuration.

  3. Click Next.
  4. In Select Mobile Objects, select all the MBOs in the mobile application project or select MBOs under a specific synchronization group, whose references, metadata, and dependencies (referenced MBOs) are included in the generated device code.
    Dependent MBOs are automatically added (or removed) from the Dependencies section depending on your selections.
    Unwired Server automatically computes the page size after you choose the MBOs based on total attribute size. If an MBO's accumulated attribute size is larger than the page size setting, a warning displays.
    Note: Code generation fails if the server-side (run-time) enterprise information system (EIS) data sources referenced by the MBOs in the project are not running and available to connect to when you generate object API code. You can avoid this failure by installing the net_rim_api.jar file.
  5. Click Next.
  6. Enter the information for these configuration options:
    Option Description
    Language Choose the language used for developing the client applications:
    • Java
    • C#
    • Objective-C
    Platform Select the platform ( target device) from the drop-down list for which the device client code is intended. The platform is dependent on the language selected.
    • Java
      • Java ME for BlackBerry
    • C#
      • NET Framework for Windows
      • NET Compact Framework 3.5 for Windows Mobile
    • Objective C
      • iOS
    Unwired Server Specify a default Unwired Server connection profile to which the generated code connects at runtime.
    Server domain

    Choose the domain to which the generated code will connect. If you specified an Unwired Server to which you previously connected successfully, the first domain in the list is chosen by default. You can enter a different domain manually.

    Note: This field is only enabled when an Unwired Server is selected.
    Page size

    Optionally, select the page size for the generated client code. If the page size is not set, the default page size is 4KB at runtime. The default is a proposed page size based on the selected MBO's attributes.

    The page size should be larger than the sum of all attribute lengths for any MBO that is included with all the MBOs selected, and must be valid for the database. If the page size is changed, but does not meet these guidelines, object queries that use string or binary attributes with a WHERE clause may fail.

    Note: This field is only enabled when an Unwired Server is selected. The page size option is not enabled for message-based applications.
    Package, Namespace, or Name Prefix
    • Package – enter a package name for Java.
    • Namespace – enter a namespace for C#.
    • Name Prefix – enter a name prefix for Objective C.
    Destination Specify the destination of the generated device client files. Enter (or Browse) to either a Project path (Mobile Application project) location or File system path location. Select Clean up destination before code generation to clean up the destination folder before generating the device client files.
    Note: If you select Java as the language, enter a project path, specify a mobile application project folder, and select Generated Code as the destination. JAR files are automatically added to the destination for the platform that supports compiling of the generated client code.
    Replication-based Select to use replication-based synchronization.
    Note: This option is not available for mobile applications that will run on iOS devices.
    Message-based Select to use message-based synchronization.
    Note: Use message based synchronization for iOS mobile applications. This option is not available for Java or C# applications.
  7. Select Generate metadata classes to generate metadata for the attributes and operations of each generated client object.
  8. Select Generate metadata and object manager classes to generate both the metadata for the attributes and operations of each generated client object and an object manager for the generated metadata.
    The object manager allows you to retrieve the metadata of packages, MBOs, attributes, operations, and parameters during runtime using the name instead of the object instance.
  9. If you selected Java as the language, you can select Generate JavaDoc to include the Object API JavaDoc documentation in the output directory.
  10. Click Finish.