Create a GX model

Procedure

  1. In Studio, navigate in the resource tree to the location configuration > gsrc.
  2. Within the class tree, navigate to the package in which you want to store your XML model, just like you would for creating a new Gosu class. If you need to create a top-level package, right-click on the folder icon for gsrc, and select New Package.
  3. Right-click on the desired package. From the contextual menu, choose New > GX Model to open the GX Model window.
  4. Select either the Search by Name or Project tab to list the available classes and data types to map.
  5. In the Search field, enter the name of the type to export in XML format. For example, to map and export an Address entity, type Address. The dialog box lists the types that match any partial name you type. Select the desired class from the list.

    Search dialog box
  6. Enter the desired GX model name in the Model Name field. The default name of the GX model is the name of the selected class followed by the word Model. For example, if the selected class is Address, the model name is AddressModel.

    The GX model name defines the package hierarchy for the model, so choose its name carefully. For example, if an XML model called AddressModel is created in the mycompany package, the fully qualified type for the Address entity in the GX model is mycompany.addressmodel.Address.

  7. Click OK to open the GX model editor.

    GX model editor
  8. To map a property to the GX model, select the property in the editor’s left pane.

    To navigate through a property’s lower levels, click the arrow icon in front of the property to open the hierarchy below it. Continue navigating to lower levels until the desired property is located.

    Alternatively, locate the desired property by entering its name in the Filter field. Studio searches for the property in lower levels to the depth specified in the Filter Depth field. For example, to find the myProp property in the hierarchy myClass.propertyOne.subProperty.myProp, set the Filter Depth to three to search three levels below the parent myClass.

  9. With a property selected in the left pane, click Add>> to show the show the Mapping Type popup.
  10. In the Mapping Type popup, select the property’s mapping type, either Key Property or Normal Property. The selected property is added to the editor’s right pane.
  11. Continue adding properties to the GX model until the model is complete.

Results

The XML definition of the GX model can be viewed by selecting the Text tab at the bottom of the editor.

In the editor’s lower pane, select the Schema tab to view the XSD schema that is automatically generated for the GX model. Select the pane’s Sample XML tab to view a sample XML file that conforms to the XSD schema.

What to do next

For more information about key properties and normal properties in the context of the incremental mode, see "The Incremental Option" under GXOptions.