Prev Next

Redefine Operation and Check for Exceptions

If the parent element of a selected operation is the source element for a Generalize connector, you can configure the operation to redefine an operation in the target element. Also, you can create code in your application to check for an exception and, if one occurs, to switch to the code defined by a Classifier element. You can identify the target operation and/or the classifier element on the 'Redefines' tab of the Operation 'Properties' dialog.

It is also possible to add or change these properties in the 'Raised Exceptions' and 'Redefined Operation' fields of the Properties window for an operation.

Access

Context Menu

On an open diagram, click on an operation and then right-click |  View Properties > Redefines

In the Browser window, right-click on an operation | Properties | Properties > Redefines

Tasks

Task

Action

See also

Redefine a target element Operation

  1. Click on the Add button beneath the 'Redefined Operation' panel.
    The 'Select Operation' dialog displays, showing the operations in the target element.
  2. Click on the appropriate operation; if you want to redefine more than one operation in the target element, press Ctrl as you click on each one.
  3. Click on the OK button.
    A statement displays in the 'Redefined Operation' panel, of the format:
         <Package>::<Target Element>.<Operation>
  4. On the parent element in a diagram, the Operation compartment shows the complete statement, of the format:
         <Operation>:{redefines <Package>::<Target Element>.<Operation>

If you want to change the redefined operation(s) at any point, return to the 'Redefines' tab and again click on the Add button, and repeat the process. The original selection is replaced by the new selection.

You can also add or change a redefined operation (with a little more knowledge of your element structures) in the 'Redefined Operation' field of the Properties window for the operation.

  1. Click on the operation in a diagram or the Browser window, and press Ctrl+2.
  2. In the Properties window, click on the Browse. icon at the end of the 'Redefined Operation' field.
    The 'Redefined Operation' browser displays.
  3. Locate and double-click on the required redefined operation.
  4. In the Properties window, click off the 'Redefined Operation' field; the name of the selected operation displays in the field.
Select Dialog

Identify Exception Classifier

  1. Click on the Add button beneath the 'Raised Exception' panel.
    The 'Select Classifier' dialog displays; locate and double-click on the appropriate Classifier.
  2. The name of the parent Package and the Classifier displays in the 'Raised Exception' panel.

If you want to change the Classifier at any point, return to the 'Redefines' tab and 'Raised Exception' panel and again click on the Add button, repeating the process. The original selection is replaced by the new selection.

You can also add or change the Exception Classifier through the Properties window for the operation.

  1. Click on the operation in a diagram or the Browser window, and press Ctrl+2.
  2. In the Properties window, click on the Browse. icon at the end of the 'Raised Exceptions' field.
    The 'Raised Exceptions' browser displays.
  3. Locate and double-click on the required classifier.
  4. In the Properties window, click off the 'Raised Exceptions' field; the name of the selected classifier displays in the field.
Select Dialog

Learn more