Using ORM Resources of Resource-Centric Interface
VP’s Products provide the resource-centric interface which enables the easy creation of diagrams by using the valid editing resources listed around the diagram elements.
To enhance the flexibility in creating a class diagram with the persistent objects, an ORM-Persistable class can be easily created and its valid editing resources are provided.
Creating an ORM-Persistable Class
To create an ORM-Persistable class, simply perform the following steps:
Create a class diagram by using the New Class Diagram
A class diagram is created with a default package.
Double-click the <default package>
located on the top-left corner of the diagram, enter a package name for the classes to be created.
On the diagram toolbar, click the Class
shape icon and hold for a while, a pop-up menu shows.
Select ORM-Persistable Class
from the pop-up menu.
Click on the diagram, a class stereotyped with «ORM Persistable»
is created on the diagram, enter the name for the ORM-Persistable Class.
Using ORM Resources
Creating One-to-One Association
Let’s assume a Staff ORM-Persistable class has been created as shown below.
Each staff should have a staff profile. A profile class can be created by the ORM resource. To create the Profile class:
Mouse over the Staff
class, click One-to-One Association → Class
Drag the resource to anywhere of the diagram.
By dragging the resource to the diagram, you can add an ORM-Persistable class where you want.
An ORM-Persistable class is created and a one-to-one association is created between the Staff
class and the newly created class.
as the name of the newly created class.
The one-to-one association between the Staff
classes is created.
Creating One-to-Many Bi-directional Association
Let’s take the example to create a one-to-many bi-directional association Let’s assume a PurchaseOrder ORM-Persistable class has been created as shown below.
Each purchase order may contain many orderline. To create a one-to-many bi-directional association between purchase order and orderline:
Mouse over the PurchaseOrder
class, drage the One-to-Many Bi-directional Association → Class
resource to the diagram.
A one-to-many association is created with a newly created ORM-Persistable class. Enter Order
to the name of the newly created class. The one-to-many bi-directional association is created successfully.
Creating ORM Implementation Class
An ORM implementation class is used to add extra logic to the persistent object to manipulate the persistent data. Let’s take the following class diagram as example, an ORM Implementation class for the PurchaseOrder can be created to calculate the total amount of the purchase order.
To create the ORM Implementation class, perform the following steps:
Right-click on the PurchaseOrder
class, select Add > Operation
from the pop-up menu to add an operatiion to the PurchaseOrder
to the name of operation.
Mouse over the PurchaseOrder
class, click Create ORM Implementation Class
An ORM implementation class is created automatically.