In this section, we will discuss how to build an object model using the Class Diagram Editor. For this example, you will start by laying out the components of an order management system. The details of the system are not important at this point, however this exercise will give you a good understanding for the capabilities of the Class Diagram Editor.
The first step is to determine what objects should exist in your system. Let's assume that your order management system will consist of the following:
The first step is to create some objects in the Class Diagram Editor. The following figure illustrates the start of your object model. In this example, three objects have been created:
- An Entity named Order.
- A Datatype object named OrderDetails.
- An Enumeration object named OrderStatus.
It should be noted that any changes made in the Class Diagram Editor window are immediately reflected in the underlying Tigerstripe object model, and those changes are visible in the Tigerstripe Explorer. In the following figure, three objects have been created in the Class Diagram Editor, and those object are also visible in the Tigerstripe Explorer.
There are three ways to edit the features of an Artifact in Tigerstripe Workbench
- You can edit the features of each of the Artifacts directly in the Class Diagram Editor. This is referred to as direct-editing of a feature (or as a direct-edit).
- You can edit the Artifact features in the Properties tab.
- You can also edit the Artifact features in the multi-page editor that is available for the Artifact through the Tigerstripe Explorer
When direct-editing an Artifact feature, you edit the feature directly in the Class Diagram Editor. Complete the following procedure to direct-edit an Artifact feature.
When editing a feature, there are a number of rules that should be considered:
Changes made to an Artifact through a direct-edit will immediately update the information displayed in both the Tigerstripe Explorer and the Properties tab. Similarly, changes made to an Artifact through the Properties tab will immediately update the information displayed in both the Tigerstripe Explorer and the Class Diagram Editor.
Note: This multi-page editor will open as an additional tab on top of any existing tabs that are already open in Tigerstripe Workbench. All updates to an Artifact from this multi-page editor will trigger an update to all diagrams that contain the selected artifact. However, these updates will only occur when you save your changes. If a diagram containing the edited Artifact is closed when the you save your changes, that diagram will remain synchronized with the underlying object model. Diagrams automatically update when you first open them in order to pick up any changes that might have occurred in the underlying object model while it was closed.
Once you create a few objects in your diagram, you can start filling in the details of those objects. The following figure shows an example of some of the Features that you can add to Artifacts in your model. Each Artifact in your Diagram consists of one or more Compartments. These Compartments hold a specific type of Feature. In this example, Arrow 1 indicates the location of the Attribute Compartment for a Managed Entity named Order. Arrow 2 indicates the location of the Method Compartment for that same Artifact.
You can add Features to an Artifact in two ways:
- The Features Drawer in the Tool Palette. A drawer is a collapsible window inside the Tool Palette that contains a set of related tools.
In the above figure, there are two drawers, one for the Artifact creation tools and one for the Feature creation tools. You use the tools in the Features drawer exactly like you used the tools in the Artifact drawer.
To add Features using the Features Drawer
- Click on the desired tool and drag that tool over to a compartment in an Artifact that accepts that type of Feature.
- Click in the compartment, and the new feature is added with an automatically generated name and a default type.
- For Attribute features, the name and type for the feature is displayed as name:type.
- For Method features, the name and type for the feature is displayed as name(arg0Type, arg1Type, ... ):type. If there are no arguments in the function, then the Method signature is displayed with no argument type (i.e. as name():type).
- The type displayed for both Attributes and Methods is a fully-qualified name for that type unless the type is a primitive data type or a type value of String. String objects are considered to be an additional primitive type that is supported by the system.
- The format used to display a Literal (or Constant) is name=value. The value given in the string must be either an Integer or a String depending on the type supported by the Enumeration that contains the Literal. If the Enumeration is of type int, then the value for the Literal must be an Integer value. If the Enumeration is of type String, then the value entered must be a double-quote delimited String ("value0", for example).
The Artifact toolbar is similar to the Class Diagram Editor toolbar and displays when you rest on the Class Diagram Editor.
The Artifact toolbar is illustrated in the above figure. The options available will change depending on the type of Feature supported. In this example, a Data Type Artifact is selected, therefore both the Attribute creation tool and the Method creation tool display. Clicking on either of these tools will create an Attribute or a Method in the appropriate compartment of the selected object. Once you create the Feature in the appropriate compartment, you can edit it either through direct-edit, the Properties tab, or by using the multi-page editor available through the Tigerstripe Explorer.
Note:Typically, a direct-edit or editing through the Properties tab is easier, although there are limitations to both features that may require that you use of the multi-page editor.
In the above figure, highlights a control that you use when creating relationships. For more information about Relationships, refer to (Adding Relationships). For now, a brief discussion is all that is needed for the current topic.
When creating Relationships in the Class Diagram Editor you will see a new type of control; the Connection Handle. Connection Handles display next to a selected Artifact at the same time as the Artifact toolbar. There are two Connection Handles that appear:
- One for constructing outgoing connections.
- The other for constructing incoming connections.
We will discuss the use of these Connection Handles and the difference between incoming and outgoing connections, in the next section.
Because of the complexity of the underlying artifacts and features, there are a few limitations to the direct-edit or the Properties tab method of editing. These limitations are best described as follows:
- Methods: Only the name and type of a method can be edited directly in the Class Diagram Editor or by using the Properties tab. If you want to change the number of arguments in a method or the type of one or more of the arguments in a method, you will need to open the artifact that contains the method in that artifact's multi-page editor and edit the method there. Any changes made in the multi-page editor will automatically appear in the Class Diagram Editor after you save those changes.
- Enumerations: The type of an Enumeration Artifact can only be changed using that Artifacts multi-page editor. Changing the type of an Enumeration requires changing the type used for all of the values in that Enumeration, therefore you cannot edit the Enumeration type using the direct-edit or Properties tab.
We described how to create and configure Artifacts using the tools available in the Class Diagram Editor. In the next section, (Adding Relationships), we'll go into more detail on how to build relationships between Artifacts. Defining these relationships accurately is critical to building object models, so it is important that you understand the types of relationships available and how you can define these relationships using the Class Diagram Editor.
© copyright 2005, 2006, 2007 Cisco Systems, Inc. - All rights reserved