Copyright © TIBCO Software Inc. All Rights Reserved
Copyright © TIBCO Software Inc. All Rights Reserved


Chapter 2 Concepts : Using the Business Object Model

Using the Business Object Model
The business object model provides a way to define in business terms the Classes, Attributes, Primitive Types, Operations, Associations, and so on that describe a business or organization. In terms of forms design, the business object model is a powerful and convenient way of defining primitive and complex types.
A business object model is defined using the Business Object Model Editor. For complete information on using this editor to create business object models, see the TIBCO Business Studio Business Object Modeler User’s Guide. Information on business object models in the present guide is limited to instructions for creating classes and other objects in the business object model to define complex data types, and using these data types in forms modeling.
The Objects in a Business Object Model
Objects are added to a business object model in the Business Object Model Editor much as panes and controls are added to forms, either by clicking the desired object in the palette and then clicking in the desired location on the canvas of the editor, or by dragging and dropping the object onto the canvas. Objects that can be placed into a business object model include the Elements (Package, Class, Primitive Type, and Enumeration), Children (Attribute and Enum Literal), and Relationships (Generalization and Composition).
Figure 61 The Palette of the Business Object Model Editor
The objects in the palette are of several kinds, each distinguished by an icon and color, which will appear (as an aid to the identifying the object) in various places throughout the Business Studio interface, including in the title bars of the objects on the canvas. The objects most important for creating complex types to be used in forms modeling are described in this section.
Elements
Class A container for a complex data object. Classes contain children, such as attributes and enum literals. A class from the BOM can later be specified as the type for a data field in the Forms Editor.
Primitive Type An object of one of the BOM Primitive Types (Integer, Boolean, Date, Time, Integer, and so on), or of the type of a previously-defined primitive type object.
In the latter case, the previously-defined primitive type might be, for instance, a zip code object that was defined as an integer with a pattern (specified in the Advanced tab of the object’s Properties view) as a regular expression) that limits its value to 5 single-digit integers. Figure 62 shows the Advanced tab of the Properties view for a primitive type called ZIP Code. The Pattern value restricts valid entries to five integers. This restriction will be enforced at runtime.
A pattern that has been specified as a restriction for a data type in the BOM does not appear in the Forms modeling environment. For instance, if a ZIP Code primitive type is defined in the BOM as requiring a value of five single-digit integers, and that primitive type is included in an Address class in the BOM which, in turn, is used as a data type for a form parameter, the default generated form will not display the restriction in the Validations tab of the zip code text control’s Properties view. Nonetheless, the restriction will be enforced at runtime, and cannot be modified or overwritten by different restrictions defined in the Forms Editor on the text control’s Properties view.
Figure 62 Properties of a ZIP Code Primitive Type in the BOM
Enumeration A data type that can contain a list of values. Selecting this type enables you to specify a set of enumerated values. For example, an enumeration called Color might have the values Red, Blue, and Green.
An enumeration from the BOM can be included as an attribute for a class in the BOM or be specified later as the type for a data field in the Forms Editor. On the default generated form, this type will be rendered by default as an optionlist. (The control type could later be changed in the form control’s Properties view to a radiogroup, or other control type.)
Children
Attribute Attributes are data members that make up a class. By default, new attributes are created with the primitive BOM type text. A different data type can be chosen in the attribute’s Properties view, either another primitive type, or an existing class or enumeration. Each attribute type ends up corresponding to a different control type in a generated form.
The attributes in a class can be re-ordered in the Attributes tab of the class’s Properties view using the up and down arrows. Their order in the BOM determines the order in which they appear in the default form.
Enum Literal  These are the values within an enumeration. For example, an enumeration called Color might have the enum literals with the names Red, Blue, and Green.
The enum literals in an enumeration can be re-ordered in the Enum Literals tab of the enumeration’s Properties view using the up and down arrows. Their order in the BOM determines the order in which they appear in the default form.
Relationships
Generalization This is a relationship of inheritance: a class that is related to an existing class by generalization will inherit the qualities of the existing class, and hence will contain members of the same type as the existing class.
Composition This relationship indicates that the child class is wholly contained within the parent class.
Multiplicity of Relationships
Relationships between BOM classes have a multiplicity, for instance, one-to-one (1..1), zero-to-many (0..*), or one-to-many (1..*). You can also have a finite lower or upper multiplicity bound like one-to-finite upper bound (1..m), finite lower bound-to-finite upper bound (n..m), or exactly finite bound (n). On a generated form, a particular pane type is rendered for a child class based on the multiplicity value.
If a Student class, for instance, has a child class called Courses, with a 0..* relationship (meaning that one student can have many courses), the Course class will be rendered as a grid pane. The attributes of the Course class (for instance, course number, course name, time, room number, and so on.) will appear as columns in the grid pane. Each course for a given student will be represented by a row in the grid pane.
Implicit Validations
The multiplicity constraints defined in the BOM are reflected in the implicit validations. The validation messages conform to the following:
 
Table 6 Validation Messages for BOM Level Multiplicity Constraints
These apply for both primitive attributes and complex children.
Master-Detail Panes
If a child class has a relationship to the parent class that allows multiple instances of the child class, and the child class itself contains a child class with multiple attributes, the two child classes will be rendered on the default form in a master-detail pane.
The first child, the master pane, will be rendered in the form as a grid pane, and the second child, the detail pane, will appear as a vertical pane which can be used for editing all attributes of both child classes.
If you want the detail pane to be generated as a record pane, go to Preferences > Form Designer > Generator, and select the check box Generate master-detail configuration with record pane for details.
In this case, the grid pane will be read-only, but a row can be selected for editing in the vertical pane (detail) by clicking that row in the grid pane (master).
As an example, a Student class might be the parent of a child class called Course. Each student could have zero-to-many courses. The course class, in turn, might have a child class called Course Details. The BOM diagram is shown in Figure 63.
Figure 63 Business Object Model Editor Showing Child Classes
The business object model shown in Figure 63 would be rendered in a form with a master-detail pane for the Course and Course Details classes, as shown in Figure 64.
Figure 64 Master-Detail Pane on a Form
Selecting a row in the grid pane (that is, the master pane) allows that row to be edited in the vertical or record pane (that is, the detail pane). An alternate way of selecting rows for editing is to enable navigation for the record pane. Navigation is turned off by default, but is enabled by selecting the Show Navigator check box in the Properties tab of the record pane’s Properties view. The navigator then appears for the record pane, as seen in Figure 65.
Figure 65 Record Pane with Navigation Enabled
 

Copyright © TIBCO Software Inc. All Rights Reserved
Copyright © TIBCO Software Inc. All Rights Reserved