Purchase Transaction

The PurchaseTransaction example project is designed to help you explore features of Together. Some of the special features include:

This document explains how you can begin exploration of some of these features.

Creating the Purchase Transaction Project

To create the example project in Together:

  1. From the main menu, choose File > New > Project... > Together > Examples.
     
  2. Select the Purchase Transaction project.
     
  3. Click Next. On the subsequent page, click Finish.
The System Overview diagram resides at the top level of the project. From there you can drill down into the various packages and diagrams by double clicking on them in the UML Explorer.

UML Modeling

The PurchaseTransaction application uses all of the UML 1.4 diagrams. It has hyperlinks on elements and diagrams to add an extra level of relationships.

UML Explorer

To explore some of the UML modeling features:

  1. Open a deployment diagram. In the UML Explorer, expand PurchaseTransaction > src > (default package).
     
  2. Right click on POS and choose Open in New Tab. This opens a sample deployment diagram.
     
  3. In the UML Explorer, expand PurchaseTransaction > src > requirements.
     
  4. Double click on Make a Sale. This opens a sample use case diagram.
     
  5. In the Diagram view, right click on Scan Product and choose Hyperlinks > Product Scanning Details. The Product Scanning Details diagram opens.

The figure on the left shows the UML Explorer with the POS diagram highlighted.

Patterns and Templates

The source code of the project contains several patterns that you can view, customize, re-apply, and share.

Patterns  Recognizer

To find and review some of the patterns in the source code:

  1. Open the Patterns Recognition view.
     
  2. Right click PurchaseTransaction and choose Rebuild Patterns.
     
  3. Expand PurchaseTransaction to list the patterns in the code.
     
  4. Expand Exception.
     
  5. Right click problem_domain.InsufficientPaymentException and choose Select On Diagram. The problem_domain diagram opens with the Exception class selected.
     
  6. Observe the contents of the context menu in the Pattern Recognition view. If you right click the Exception class, you can try some other experiments, such as saving the class as a new pattern.

The figure on the left shows the context menu commands for a class in the Patterns Recognizer.

UML Documentation

The PurchaseTransaction project is large enough to show how you can generate custom HTML documentation, complete with a navigator applet and diagram images.

To generate documentation:

  1. From the main menu, choose File > Export.
     
  2. In the resulting dialog box, choose UML Documentation. The click Next.
     
  3. Your next page may give a warning: Javadoc command location not specified on the Javadoc preference page. In that case:
    1. Click Cancel to exit the dialog.
    2. From the main menu, choose Window > Preferences.
    3. Expand Java. Click on Javadoc.
    4. On the right side of the Preferences dialog, click Browse.
    5. Search for a javadoc command. Click Open to close the file system browser.
    6. Click Apply then OK.
    7. Restart the documentation generation process, beginning with step 1.
       
  4. On the UML Documentation page of the Export wizard, make sure that PurchaseTransaction is checked.
     
  5. In the Destination field, remove any blanks from the default file name specified, or enter a different location. Then click Next.
     
  6. Make sure all options are checked, then click Next.
     
  7. Check Document Title. Then enter Purchase Transaction in the corresponding text field. Leave the remaining option defaults. Click Finish.
     
  8. When Together finishes generating the documentation, check Open generated documentation in a browser.

Documentation navigation applet

The browser opens, displaying the documentation in three frames:

  • Top frame: displays diagram images
  • Lower left: tree view applet
  • Lower right: Text documentation

The figure on the left shows the navigation applet for the generated documentation.

The images and text in the documentation are hyperlinked according to the hyperlinks and code structure in the project. Clicking on a package or a class in an image opens the corresponding text documentation.

Quality Assurance

You can run audits and metrics on the PurchaseTransaction project. You can view the results in a table; sort them, copy them, and view the findings in graphs.

Running the Example

To run the PurchaseTransaction application:

  1. From the main menu, choose Run > Run.


  2. Choose Java Application on the Launch Configuration list. Then click New.


  3. On the Main tab, click Browse to select the PurchaseTransaction project. Then click OK. T


  4. Click the Search button. Choose PurchaseTransactionApp and click OK.


  5. Click Run.

Run Purchase Transaction appliction

The PurchaseTransaction application models the purchasing view of a simple point of sale system. To simulate a purchase transaction, click the Scan button to randomly get items from the internal sales list.

Click the Total button to total the bill. That enables the Payment button. When you enter a value for payment tendered, the application computes the change due, or it warns if the payment is too small.

Each New Sale picks a new cashier to handle the transaction. The cashier's name appears in the lower left hand corner of the application.