Interaction (interface)

Represents an action invocation or property modification, resulting in some state change of the system. It captures not only the target object and arguments passed, but also builds up the call-graph, and captures metrics, eg for profiling.

The Interaction can be used to obtain the Command object representing the top-level invocation action/property edit.

The distinction between Command and this object is perhaps subtle: the former represents the intention to invoke an action/edit a property, whereas this represents the actual invocation/edit itself.

To confuse matters slightly, historically the Command interface defines members (specifically: Command#getStartedAt() , Command#getCompletedAt() , Command#getResult() , Command#getException() ) which logically belong to this class instead; they remain in Command for backward compatibility only (and have been deprecated).

API

Interaction.java
interface Interaction {
  UUID getInteractionId()     (1)
  Command getCommand()     (2)
  Execution<?, ?> getCurrentExecution()     (3)
  Execution<?, ?> getPriorExecution()     (4)
}
1 getInteractionId()

The unique identifier of this interaction (inherited from HasInteractionId )

2 getCommand()

Represents the intention to perform this interaction.

3 getCurrentExecution()

The current (most recently pushed) Execution .

4 getPriorExecution()

The execution that preceded the current one.

Members

getInteractionId()

The unique identifier of this interaction (inherited from HasInteractionId )

This can be used to correlate audit records and transactions happening as a consequence or within the interaction.

getCommand()

Represents the intention to perform this interaction.

getCurrentExecution()

The current (most recently pushed) Execution .

getPriorExecution()

The execution that preceded the current one.

Implementation

This is a concrete class.

Usage Notes

You could also think of this interface as somewhat analogous to a (database) transaction. However, the framework’s TransactionService allows programmatic control of underlying database transactions, including the ability to commit one transaction and start a new one (using nextTransaction). The is therefore not an exact mapping between an Interaction and a (database) transaction, because the former could span multiple of the latter.