|
To define a new primary domain object in Xomega model you can do the following steps. - Add an objects grouping element to the module element that will contain your object if the former does not exist.
- Add an object element to the objects grouping element.
- Give your object a unique name by setting the name attribute.
- Add the fields element inside the object element and define your object's key.
- For each non-key field add a field element inside the fields grouping element.
- Give each field a unique name by setting the name attribute of the field element.
- Set the type attribute to one of the logical types defined in the model. Generally, you can use one of the generic types or define your own logical type that you can configure and reuse in other objects or structures in the model.
- Set the required attribute for the field as necessary.
- Specify the description of the field by adding the doc > summary inside the field element.
- If you would like to reuse a set of fields shared between multiple objects or if you need to reference an object with a composite key then you need to add a fieldset reference as follows.
- For each non-key fieldset add a fieldset element inside the fields grouping element.
- Set the ref attribute to one of the fieldsets defined in the model.
- Set the name attribute if your object may have another reference to this fieldset or have fields with the same names as the fields in the fieldset.
- Specify the description of the fieldset by adding the doc > summary inside the fieldset element.
- Specify the description of the object by adding the doc > summary inside the object element.
- Add child objects as necessary.
The snippet below shows an example of an object definition. Code:
<module xmlns="http://www.xomega.net/omodel">
<types>
<type name="invoice number" base="integer"/>
</types>
<objects>
<object name="invoice">
<fields>
<field name="number" type="invoice number" key="serial" required="true"/>
<fieldset ref="customer address"/>
<field name="total" type="money"/>
<field name="paid date" type="date"/>
</fields>
<doc>
<summary>Customer invoice object.</summary>
</doc>
<subobjects>
<object name="line item">
<fields>
<field name="product" type="product" key="reference" required="true"/>
<field name="quantaty" type="integer"/>
<field name="amount" type="money"/>
</fields>
<doc>
<summary>A customer invoice line item per product purchased.</summary>
</doc>
</object>
</subobjects>
</object>
</objects>
</module>
|
|
|
|
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.