GXOptions

The behavior of the GX model create method can be modified by specifying options as an argument of type GXOptions. The GXOptions argument is optional.

var xmlInst = YOURPACKAGE.MODELNAME.TYPENAME.create(object [, GXOptions])

The Incremental option

The Incremental option specifies whether to export to the GX model only properties that have changed on the base object. To determine whether a property has changed, PolicyCenter uses the current bundle to examine which entities were added, removed, or changed.

The Incremental option accepts a Boolean value. Its default value is false.

  • true – Export only changed properties to the GX model.
  • false – Export appropriate properties to the GX model, regardless of whether they have changed.

The following code statements demonstrate how to enable the Incremental option.

// Create a GX model with the Incremental option enabled
var myGxModel = com.mycompany.addressmodel.Address.create(myAddr,
                                                   new gw.api.gx.GXOptions() {:Incremental=true})

// Alternatively, create and use a GXOptions variable with the Incremental option enabled
uses gw.api.gx.GXOptions
public static final var IncrementalOption : GXOptions = new GXOptions() {:Incremental=true}
var myGxModel02 = com.mycompany.addressmodel.Address.create(myAddr, IncrementalOption)

When the Incremental option is enabled, special behavior exists for key properties (as opposed to normal properties) on the root entity. Key properties on the root entity that have not changed are still exported to the GX model. The reason for this behavior is because key properties rarely change value. However, this behavior applies only to the root entity. If a key property in a subobject of the root entity has not changed, the property is not exported to the GX model.

Determining whether a property has changed is not always possible. Virtual properties and enhancement properties are not defined in the data configuration file and, as a result, they are not stored in the database. This condition prevents Gosu from determining whether a virtual or enhancement property has changed. In such situations, the setting of the Incremental option is ignored for the property, and the property is exported to the GX model.

Also, Gosu cannot determine whether a property in subobjects of virtual and enhancement properties has changed. Therefore, the Incremental option is ignored for the subobjects and all appropriate properties in the subobjects are exported to the GX model. For example, the PrimaryAddress for a Claim entity is a virtual property. As a result, Gosu cannot determine whether the PrimaryAddress property and any property in the subobjects of Claim.PrimaryAddress have changed.

The SuppressExceptions option

The SuppressExceptions option specifies whether to suppress exceptions that occur when exporting properties to the GX model. An exception can occur when attempting to export a virtual or enhancement property.

The SuppressExceptions option accepts a Boolean value. Its default value is false so exceptions are not suppressed.

After the GX model instance has been created, the $HasExceptions property on the object indicates whether one or more exceptions occurred during its creation. Details of each exception can be retrieved by calling the eachException method, which expects a Gosu block. The block accepts a single argument that specifies an exception. Gosu calls the block for each exception.

The Verbose option

The Verbose option specifies whether to export a property to a GX model even if the property’s value is null.

The Verbose option accepts a Boolean value. Its default value is false so a property with a value of null is not exported to the GX model.

A property with a value of null is exported to XML with the attribute xsi:nil set to true. An example property called myNullProperty is shown below.

<myNullProperty xsi:nil="true">

Properties that exist in subobjects to the null property are naturally also null values, but they are not exported to the GX model. Only the top-level null property is exported.