Exercise 3.8: Applying a profile to the design model

In this exercise, you apply a profile to the design model and you apply stereotypes to UML classes.

You can apply a profile to a UML model to define the output of a transformation. You can use the EJB transformation profile to specify the elements that are transformed into enterprise beans from the PiggyBank design model. The EJB profile defines stereotypes that the EJB transformation interprets to generate enterprise beans. For example, when you apply the «Entity» stereotype to a class in your model, the transformation generates an entity bean from the class.

To generate enterprise beans, you apply the EJB profile to the itso.ad.business subpackage of the PiggyBank design model. You then apply the stereotypes in the profile to the model elements.

Applying a profile to the design model

To create EJB classes when your model is transformed, you must apply the EJB profile to your design model.

To apply the EJB profile to the ejb subpackage:
  1. In the Model Explorer view, expand Enterprise IT Design Model, expand PiggyBank Implementation Designs and, in the itso.ad.business subpackage, click ejb.
  2. In the Properties view, on the Profiles page, click Add Profile.
  3. In the Select Profile window, beside Analysis Profile, click the down arrow and click EJB Transformation.

To apply stereotypes to the Customer and Account EJB classes:
  1. In the Model Explorer view, expand ejb and, in the model subpackage, click Account.
  2. In the Properties view, on the Stereotypes page, click Add Stereotypes.
  3. In the Apply Stereotypes window, click Entity.
  4. In the Model Explorer view, click Customer.
  5. In the Properties view, on the Stereotypes page, click Add Stereotypes.
  6. In the Apply Stereotypes window, click Entity.
You have applied the Entity stereotype to the Customer and Account classes. When the design model is transformed, these classes create EJB entity beans.

To apply the Id stereotype to the accountNumber and customerId properties:
  1. In the Model Explorer view, expand ejb, expand model and, in the Account subpackage, click accountNumber.
  2. In the Properties view, on the Stereotypes page, click Add Stereotypes.
  3. In the Apply Stereotypes window, click Id.
  4. In the Model Explorer view, in the Customer subpackage, click customerId.
  5. In the Properties view, on the Stereotypes page, click Add Stereotypes.
  6. In the Apply Stereotypes window, click Id.
You have applied the Id stereotype to the accountNumber and customerId properties. When the design model is transformed, these properties are used to store the ID of the bean.

To apply stereotypes to the PiggyBankController EJB class:
  1. In the Model Explorer view, expand ejb and, in the facade subpackage, click PiggyBankController.
  2. In the Properties view, on the Stereotypes page, click Add Stereotypes.
  3. In the Apply Stereotypes window, click Service.
You have applied the Service stereotype to the PiggyBankController class. When the design model is transformed, the PiggyBankController classes create an EJB service bean.

You have completed the business and integration layers of the PiggyBank design model. The design model completes the PiggyBank UML model. Note that the tutorial did not model the common design layer because the common layer contains only utility classes that perform secondary tasks in the application. You can download the complete PiggyBank design model from the PiggyBank online banking system summary page.

To continue, proceed to the tutorial Summary.

Terms of use | Feedback
(C) Copyright IBM Corporation 2004, 2005. All Rights Reserved.