Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

How to define a new domain object
xomega
#1 Posted : Monday, August 6, 2012 6:31:36 PM(UTC)
xomega



To define a new primary domain object in Xomega model you can do the following steps.
  1. Add an objects grouping element to the module element that will contain your object if the former does not exist.
  2. Add an object element to the objects grouping element.
  3. Give your object a unique name by setting the name attribute.
  4. Add the fields element inside the object element and define your object's key.
  5. For each non-key field add a field element inside the fields grouping element.
  6. Give each field a unique name by setting the name attribute of the field element.
  7. 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.
  8. Set the required attribute for the field as necessary.
  9. Specify the description of the field by adding the doc > summary inside the field element.
  10. 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.
  11. For each non-key fieldset add a fieldset element inside the fields grouping element.
  12. Set the ref attribute to one of the fieldsets defined in the model.
  13. 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.
  14. Specify the description of the fieldset by adding the doc > summary inside the fieldset element.
  15. Specify the description of the object by adding the doc > summary inside the object element.
  16. 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.

Copyright © 2009-2022 Xomega.Net. All rights reserved.