Advanced annotation concepts

In some rare cases, annotations can be produced by recorders or clients.

Sending annotations from a recorder or a client

Annotations can be created by recorders and clients. To create annotations, the recorder delegate or the client delegate uses the AnnotationMessage class. The call typically is in this form:

getContext().dispatchMessage(new AnnotationMessage(annotation, interactionTime));

Modifying the available annotation actions for a specific recorder or client

If an annotation action is available by default, you can choose to hide it when a specific recorder or client is active during the recording session. If an annotation is hidden by default, you can make it available when a specific recorder or client is active during the session.

To modify the annotation actions for specific recorders or clients, use the com.ibm.rational.test.lt.recorder.ui.annotationContribution extension point and the annotationActionFilter element.

Managing a state for a annotation types

By default, annotations can be inserted at any time during recording. There might be cases where permitting users to insert an annotation is inappropriate. For example, in a test with Start Transaction and End Transaction annotations, End Transaction might be available only if a transaction has already been started.

To manage the state of annotation types, define an annotation state handler. An annotation state handler manages one or more annotation types and can individually enable or disable annotation insertions. For more information about annotation state handlers, refer to the com.ibm.rational.test.lt.recorder.core.recorderAnnotation extension point, the annotationStateHandler element, and the com.ibm.rational.test.lt.recorder.core.extensibility.AnnotationStateHandler class.

The state handler for a specific annotation type can be retrieved from an annotation action class by using this code:

stateHandler = (IMyAnnotationStateHandler) getAnnotationStateHandler(myAnnotationType);