This application is slightly more complex than the Simple
ordering.mdl Rational Rose file
ordering.zip 100% generated.
See It Running
The Ordering application illustrates basic relationships and starts to use some of
the configuration options. There are several classes joined by associations.
As in Simple, the classes represent entities, and
the associations represent relationships between the entities. Role names for
the relationships are set. These are optional except in rare cases, such as a
relationship between an entity and itself, where it would be necessary to distinguish
a particular end.
Relationships between entities are normally navigable both ways. The multiplicities should be set
on each end of the relationship. This governs the way the related entity will be shown on a
maintenance screen. For example order lines are shown in a grid on the order maintenance
page as there are many order lines for one order (you only see the grid if some order lined exist).
However the link to order from order lines maintenance appears as a dropdown selector. This is
because any given order line only appears on one order.
To require at least one record at the end of a relationship, it is necessary to set the "required"
tag value to true. In Rational Rose, opening up a class will reveal several tabs, each of which
contains several properties. The properties relating to a class which represents an entity are
mostly found on the JeeWiz Entity tab, although some of the more general ones, which Rational
Rose provides as standard are found on the General tab. Similarly, on opening up an association
between two classes, the tab to set values for the relation are on JeeWiz Relation, but almost all the
tab values actually refer to one end or the other of the relation and can be found on the
JeeWiz End A and JeeWiz End B tabs. The specific way of accessing tag values varies between UML editors.
Looking at the UML diagram in detail, you will notice that some of the attributes on the
classes have their types set. So there is an int, a float and a Date, etc. These may display
differently on the screen than the standard textbox provided for a String. For example the
Date on CustomerOrder will default to a three box "day, month year" representation. It is
possible to modify these even further by using tag values such as style and format. Here price
on the Product has a style of "currency". To change this in Rational Rose, open up the "price"
attribute and find the JeeWiz Attribute tab. This just adds a sign on the label and defaults
the number of decimal places to two. It's worth noting that the J2EE transform currently treats Java
primitives and their wrapper classes similarly. If you want a "not null" field you set
the "required" tag value on the attribute to True.
When running this application, try first creating a few products. Then a customer or two. Next
create a CustomerOrder, selecting the Customer from the dropdown. Finally create a couple of OrderLines
and relate them to the CustomerOrder you created before. It will not seem very easy for an average user
to get to grips with, but this is not the way you would expect to create an order entry screen for real.
The purpose is to create administrator maintenance screens giving access to the underlying standing data.
We shall look at modelling more user friendly screens in later sample applications.