O/R Mapping
Mac OS X
Tips and Tricks
UML Diagrams
VP Suite
Change Log

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:

  1. Create a class diagram by using the New Class Diagram toolbar icon.
    using_orm_resources-1.jpg

    A class diagram is created with a default package.
    using_orm_resources-2.jpg

  2. Double-click the <default package> located on the top-left corner of the diagram, enter a package name for the classes to be created.
    using_orm_resources-3.jpg

  3. On the diagram toolbar, click the Class shape icon and hold for a while, a pop-up menu shows.
    using_orm_resources-4.jpg

  4. Select ORM-Persistable Class from the pop-up menu.
    using_orm_resources-5.jpg

  5. 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-6.jpg

Using ORM Resources

Using the ORM-related resources listed around the ORM-Persistable class, you can create a class diagram with persistent objects easily.

The following table shows the available ORM Resources of the ORM-Persistable class:

ORM Resource Description
using_orm_resources-7.jpgCreating an ORM Implementation Class.
using_orm_resources-8.jpgCreating an ORM-Persistable class with a one-to-one directional association.
using_orm_resources-9.jpgCreating an ORM-Persistable class with a one-to-one bi-directional association.
using_orm_resources-10.jpgCreating an ORM-Persistable class with a one-to-many directional association.
using_orm_resources-11.jpgCreating an ORM-Persistable class with a ont-to-many bi-directional association.
using_orm_resources-12.jpgCreating an ORM-Persistable class with a many-to-many directional association.
using_orm_resources-13.jpgCreating an ORM-Persistable class with a many-to-many bi-directional association.

Creating One-to-One Association

Let’s assume a Staff ORM-Persistable class has been created as shown below.
using_orm_resources-14.jpg

Each staff should have a staff profile. A profile class can be created by the ORM resource. To create the Profile class:

  1. Mouse over the Staff class, click One-to-One Association → Class resource.
    using_orm_resources-15.jpg

  2. Drag the resource to anywhere of the diagram.
    using_orm_resources-16.jpg

    Note: 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.
    using_orm_resources-17.jpg

  3. Enter Profile as the name of the newly created class.
    using_orm_resources-18.jpg

    The one-to-one association between the Staff and Profile 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.
using_orm_resources-19.jpg

Each purchase order may contain many orderline. To create a one-to-many bi-directional association between purchase order and orderline:

  1. Mouse over the PurchaseOrder class, drage the One-to-Many Bi-directional Association → Class resource to the diagram.
    using_orm_resources-20.jpg

  2. 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.
    using_orm_resources-21.jpg

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.
using_orm_resources-22.jpg

To create the ORM Implementation class, perform the following steps:

  1. Right-click on the PurchaseOrder class, select Add > Operation from the pop-up menu to add an operatiion to the PurchaseOrder class.
    using_orm_resources-23.jpg

  2. Enter calculateTotalAmt():double to the name of operation.
    using_orm_resources-24.jpg

  3. Mouse over the PurchaseOrder class, click Create ORM Implementation Class resource.
    using_orm_resources-25.jpg

    An ORM implementation class is created automatically.
    using_orm_resources-26.jpg

Related Articles

Resources

 
 
Last modified: 2006/03/21 13:37
 
 
Home | Recent Topics | Highlights | UML Diagrams | Tips and Tricks | Object-Relational Mapping
visual-paradigm.com Home | Training Center | UML Center | VP Gallery | Discussion Forum | UML Open Directory