GX model labels
When an instance of a GX model is created, all the model's properties are included in the new object. Alternatively, GX model labels enable the object to include only a subset of the model's properties. A label is assigned to one or more of the model's properties. When an instance of the model is created and the label is specified, only the properties assigned the label are included in the new object.
A GX model can have multiple labels assigned to its properties, and a single property can have multiple labels assigned to it. When a GX model object is created, the appropriate combination of labels are specified to include the desired properties.
By using labels, a single GX model can be defined and each instance of the model can include different properties depending on the context. Imagine the following situation.
- External
SystemAneeds to include one key property and five standard properties on an entity. - External
SystemBneeds to include two key properties and ten standard properties on the same entity.
Without labels, each system must create its own separate GX model. With labels, a
single GX model can be created where the properties that interest
SystemA are assigned a special label, such as
SysA. In the same GX model, the
SystemB properties are assigned a label like
SysB. A property can have multiple labels assigned
to it, which enables a single property to be used by both
SystemA and SystemB. When
SystemA converts the model properties to XML, only
the properties with the SysA label are converted.
Similarly, when SystemB converts the same model, only the
properties with the SysB label are converted. The result is
that a single GX model is used to handle the requirements of both
SystemA and SystemB.
A GX model label applies to a parent entity and all child entities. For example, the
AddressModel GX parent entity might include a child entity called Country. The
myGxLabel can be assigned to properties in both the parent AddressModel and
the child Country. When the GX model object is created and the myGxLabel is
specified, the resulting object includes all properties in the parent and child that were assigned the label.
