Iteration #1
Training Objectives:
In this lesson (iteration), the trainee will learn how to:
- Create a new project
- Create a new package
- Create objects (classes or metaobjects to be more specific)
- Create relationships
- Create a root object
- Add rules to objects and their members including: domain rule, and defining a joining attribute
- Create a portal with navigations
- Execute a metaobject or a portal.
Scope:
The scope of this iteration is to cover the following use cases:
- Manage law firm specialties
Provide CRUD functionality to manage the law firm various specialties. A specialty reflects a specific type (or category) of law this law firm offers (e.g. Immigration, Family Law, etc.). Each specialty must have a name and description.
- Manage law firm offices
Provide CRUD functionality to manage the law firm various locations. Each location (office) must have a name, description, phone number, fax number, and a full address.
- Manage law firm attorneys
Provide CRUD functionality to manage the various attorneys practicing in this law firm. Each attorney must have a name, a bio, the office he/she practices out of, and his/her specialties. The office must be one of the firm's offices, and the specialties must also be one or more of the firm's specialties.
Steps:
It is highly recommended that you consult with the VE/Designer online help at each of the steps below. To do so, make sure that the keyboard focus is in the area you need help on, then press F1. You can also use the help Find tab to search for a specific term or concept.
 |
 |
| Create ACCS Project |
Once the VE/Designer is started, create a new project for ACCS:
- Select File->New Project…
- Press the Next button on the New Project Wizard
- If you haven't already started VE/Server, you will be prompted to auto-start it, press Yes.
- If this is the very first project you create, you will be prompted to create new home folder, press Yes.
The second step in the New Project Wizard asks for the project name and where to create it. We're going to name the project accs. Accordingly, type in accs for Project Name.
- We're also going to create a new folder (optional) named tutorials. Click on the Create new (sub)folder, then type tutorials for Folder Name in the New Folder Wizard, then press Finish.
- Select the newly created tutorials folder, then press the Finish button.
- A new project node will be added in the Project Explorer (the panel on the left-hand side) named tutorials/accs. Expand the project node.
|
| Create a New Package Named "lawfirm" |
- Right-click on the project node, then select New->Package...
- On the New Package Wizard, type in lawfirm as the Package Name
- A new package node will be added under "tutorials/accs" project.
- The Package Editor will automatically be opened
|
 |
| Implement "Manage law firm specialties" Use Case |
This use case calls for a Specialty object with two attributes: name and description. To create this object,
- Click on the Create Object (
) icon on the object modeler's toolbar
- Place the mouse somewhere in the center of the canvas, then click the mouse button, and a rectangular figure will be placed where the mouse is, and it's title will be highlighted with a yellow marker
- Type in Specialty, then press Enter, which will set the object name to Specialty then changes the focus to the lower section of the rectangle, the attribute section.
- Type in the first attribute name, name then press Enter
- Type in the second attribute name, description then click the mouse button anywhere on the canvas outside of the rectangle, and this will end the attribute in-place edit mode.
|
 |
Now that we created the Specialty object, we would like to change the description attribute type to Text. To do so, right-click on the description attribute, then select Type->Text.
The remainder of this use case will be finished in the Create Admin Portal below.
|
 |
| Implement "Manage law firm offices" Use Case |
This use case calls for a LawOffice object, which has a Composite relationship to Address object. To create these objects, repeat the instructions in the previous step for each of the objects:
- Create
LawOffice (following the same instructions in the previous step) with attributes: name, description, phone, and fax.
- Change the
description attribute type to Text.
- Create
Address with attributes: street, city, state, and zip.
|
 |
To create the Composite relationship,
- Click the Create Association Relationship (
) icon on the object modeler's toolbar
- Move the mouse on top of the
LawOffice object.
- Press and hold the mouse button while moving the mouse on top of the
Address object, then release the mouse button. This will add an Association relationship named address to LawOffice.
- To change the relationship type to Composition, right-click on the
address label, then select Relationship Type->Composition.
|
 |
To take a quick look at what we've built so far and see it in action, select the LawOffice object (by clicking on it), then press the Play ( ) icon on the VE/Designer toolbar. This should open a browser with a web page that represents the law office object including its address.
Pressing Play after selecting an object in the object modeler, launches a process that creates a new instance of the selected object (actually the class or metaobject), then serves it back to the client, which is a web browser in this case. This is a live instance that applies all of the rules and constraints associated with the served object, which is not much in this case.
The remainder of this use case will be finished in the Create Admin Portal below.
|
 |
| Implement "Manage law firm attorneys" Use Case |
In this use case, we need to create the Attorney object with attributes: name, bio, and officeName where he/she works out of. Once you create this object, add two relationships to it as follows:
- Add an Association type relationship to
LawOffice named office. When you select the Create Association Relationship ( ) icon from the toolbar and connect Attorney to LawOffice as described in the previous step, the newly created relationship will be named lawOffice. To change the relationship name to office select the relationship label (lawOffice), then click on it again. This will put the label into in-place edit mode where you can change its name. Highlight the label text, type office, then press Enter. This will rename the relationship accordingly.
- Add an Association type relationship to
Specialty named specialties with cardinality of zero-or-more. The cardinality can be set to zero-or-more in two ways:
- Create the relationship as above, then right-click on the relationship label (specialty) then select Cardinality->0..*
- As a short-cut, follow the described steps for creating a regular relationship with one exception: before you release the mouse button on top of the target object (
Specialty in this case), make sure you hold the Shift key on the keyboard.
The remainder of this use case will be finished in the Create Admin Portal below.
|
 |
| Create Singleton Object |
So far we created four domain objects: Specialty, LawOffice, Address and Attorney, however, none of them is a root object. Identifying root objects is important as it specifies the entry points into the object model (for more information on root objects press F1, select the , then type root under Find).
We can define each of the main classes (Specialty, LawOffice and Attorney) as roots with cardinality of zero-or-more. However, it is better to introduce a new object LawFirm that represents the law firm itself and declare it as a root object. To do that,
- Create
LawFirm with attribute name.
- Add an Aggregate relationship, with cardinality of zero-or-more, from
LawFirm to each of the classes: Specialty, LawOffice and Attorney.
- Create a root object with the target
LawFirm as follows:
- Select the Create Root Object (
) icon from the object modeler's toolbar
- Click on the target object (
LawFirm in this case) close to the side that you would like to add the root object figure to. This will create a root object with the default name TheLawFirm. You can rename it using in-place editing (just like with the relationship label above).
|
 |
 |
| Add Some Rules |
| The domain object modeling is almost done. We have few more rules to add to make the model semantically complete, and compliant with the use cases.
First, we have the relationship office on Attorney as of type Association. We would like to limit the office that the attorney can work from to one of the firm's offices. To do this,
- Double-click on the
office relationship label. This should open the Object Editor for Attorney and auto select the office relationship. For more information on the Object Editor, press the F1 key.
- Select the Rules tab
- Click on the Domain field to set the keyboard focus to it. Sometimes the cursor doesn't show immediately, but as soon as you start typing, it will appear.
- To set the domain (which is the set of all acceptable values for this relationship), type TheLawFirm.lawOffices. You can type a capital T and pause for a second, and the code-completion feature will kick in. You can continue typing to narrow the list of acceptable values, or use the mouse or arrow-keys to highlight the desired value (
TheLawFirm in this case), then press Enter. The same thing will happen once you type the period after TheLawFirm.
|
 |
Second, we will do the same thing to the specialties relationship of Attorney. Since we're already in the Object Editor for Attorney, we can just select the specialties relationship then type in TheLawFirm.specialties in the Domain field. This will limit the acceptable specialties for the attorney to ones defined at the law firm. |
 |
The last rule is changing the type of officeName attribute of also the Attorney object. In this case, we would like to make officeName a joining attribute for the relationship office. To do this,
- Select the Attributes tab in the Object Editor for
Attorney
- Select the
officeName in the table of attributes
- Select the Advanced tab
- Check the Joining box
- Type in office.>name
What this means is that when a value is assigned to officeName, it will find a LawOffice object with a name equals to the assigned value, and sets the office relationship for the attorney to this LawOffice object. The Domain formula on the office relationship is for identifying all eligible law offices. |
 |
| Create Admin Portal |
Now that we completed the domain object model, it's time to finish the targeted use cases by creating a portal that represents the actor of these use cases (Administrator in this case). To create a new portal
- Right-click on the project node (tutorials/accs) in the Project Explorer, then select New->Portal...
- Type in the name of the portal in the Portal Name field of the New Portal Wizard. In this case, type admin to name the portal admin.
- Press the Finish button, a new portal node will be added under the project node, and the Portal Editor is automatically opened. To learn more about this editor, press the F1 button while the keyboard focus is in the editor.
|
 |
| Now that the portal is created, we need to add navigations to reflect the use cases. A navigation is used to expose a domain functionality (e.g. process) to the Actor, and it usually maps one-to-one to a use case. Accordingly, we have three CRUD use cases in this iteration, which will translate to three navigations with Action set to Manage.
To create a navigation,
- Select the Navigations tab
- Right-click on the root Navigations node, then select Add Navigation. This will create a new empty node underneath it
- Select the newly added empty navigation node, then fill in the fields as follow to represent the Manage law firm specialties use case:
- Title: Specialties (a user-recognizable label for this navigation)
- Name:
manageSpecialties (an arbitrary name that must be unique within the parent navigation and makes for a good token in a URL path)
- Action: Manage
- Resource:
#lawfirm/TheLawFirm.specialties (a formula that returns the objects which to manage. The leading # sign is optional but recommended as it indicates that the following token is the full name of the root object--in this case the package lawfirm and root object TheLawFirm)
|
 |
Repeat the above for the remaining two use cases as follows:
- Manage law firm offices
- Title: Offices
- Name:
manageOffices
- Action: Manage
- Resource:
#lawfirm/TheLawFirm.lawOffices
- Manage law firm attorneys
- Title: Attorneys
- Name:
manageAttorneys
- Action: Manage
- Resource:
#lawfirm/TheLawFirm.attorneys
|
 |
 |
| Run Admin Portal |
You're now ready to execute the admin portal. While the Portal Editor is the active window, press the Play ( ) icon on the VE/Designer toolbar. This will launch a admin portal into a web browser. The Specialties navigation will be the default navigation to launch since it is the first navigation in the portal.
In the manage Specialties, you can enter a specialty name and description, then press the Submit button (on the top left corner). This will add a new specialty to the firm's specialties, and return a new specialty to fill. You can repeat this step for each specialty you would like to add.
Also, you can press the List button on top and get a list of the added specialties, select one of them by clicking on the radio button for that specialty then pressing the Submit button. This will return the select specialty for update. Make the necessary changes, then press Submit to commit your changes to the server.
The same steps can be followed for Offices and Attorneys. Once you have few offices populated, go to the Attorneys tab and observe the special treatment to the officeName attribute since it is a joining attribute.
Finally, one point to understand. All of the dummy information you're typing (i.e. specialties, offices, and attorneys) are maintained in memory for the specific web session you're on. If you open a new browser and enter the URL to launch the admin portal, you will not be to see the same data. In a later iteration, we'll deploy to a real database, where this type of information will be persisted and made available to all sessions.
|
 Specialties List |
|
New Office
Offices List
|
|
New Attorney
Attorneys List
|
Outstanding Functionality:
In the Manage law firm attorneys use case, we still have the requirement to specify the attorney specialties out of the list of available firm specialties. This is deferred to a later iteration as it requires personalization, which is not a topic that is covered in this lesson.
Recap:
In this lesson (iteration), the trainee learned:
- Creating
tutorials/accs project
- Creating
lawfirm package
- Creating objects:
Specialty, LawOffice, Address, Attorney, and LawFirm.
- Creating root object
TheLawFirm
- Creating relationships:
Attorney.office, Attorney.specialties, LawOffice.address, LawFirm.offices, LawFirm.specialties and LawFirm.attorneys
- Adding domain formulas to
Attorney.office and Attorney.specialties, and defining Attorney.officeName as a joining attribute
- Creating
admin portal for the Administrator actor with three navigations: Specialties, Offices, and Attorneys that correspond to each use case in this iteration scope.
- Executing the
LawOffice metaobject and admin portal along with each of it navigations.
|