Events

Domain Event Classes

Domain events are broadcast through the EventBusService whenever the framework interacts with the domain object members.

They allow subscribers to change either veto the interaction, or to trigger other operations as a result of the interaction.

Table 1. Domain Event Classes
API Event class defined by Published when

AbstractDomainEvent

n/a

n/a - superclass of the other domain events.

ActionDomainEvent

@Action#domainEvent()

interact with (hide, disable, validate, pre-execute, post-execute) an object’s action.

CollectionDomainEvent

@Collection#domainEvent()

hide an object’s collection.

PropertyDomainEvent

@Property#domainEvent()

interact with (hide, disable, validate, pre-edit, post-edit) an object’s property.

UI Event Classes

UI events are broadcast on the EventBusService as the result of rendering a domain object.

They allow subscribers to change various presentation aspects of the rendered object.

Note that if the domain object defines its own layout preferences (for example, a title() supporting method) then these will take precedence.

Table 2. UI Event Classes
API Event class defined by @DomainObjectLayout Published when Overridden by

TitleUiEvent

... rendering the title for a domain object.

title()
@Title

IconUiEvent

... rendering an icon for a domain object.

iconName()

CssClassUiEvent

... obtaining a CSS class hint for a domain object.

cssClass()

LayoutUiEvent

... obtain an alternative layout for a domain object.

layout()

Lifecycle Events

Lifecycle events are broadcast through the EventBusService when a domain entity is loaded, created, updated to/from the database.

They allow subscribers to trigger other operations as a result of these persistence operations. One use case is to maintain an alternate data store.

It is also possible for the domain object itself to be invoked on a callback.

Table 3. Lifecycle Event Classes
API Event class defined by @DomainObject Published when Object callback

AbstractLifecycleEvent

n/a

n/a - superclass of the other lifecycle events.

n/a

ObjectCreatedEvent

createdLifecycleEvent()

entity is first instantiated using FactoryService

Also raised for view models.

created()

ObjectLoadedEvent

loadedLifecycleEvent()

entity is retrieved from the database.

loaded()

ObjectPersistingEvent

persistingLifecycleEvent()

entity is about to be saved (inserted) into the database using the RepositoryService's #persist(…​) method.

persisting()

ObjectPersistedEvent

persistedLifecycleEvent()

entity is first saved (inserted) into the database using the RepositoryService's #persist(…​) method.

persisted()

ObjectUpdatedEvent

updatedLifecycleEvent()

entity has just been updated in the database.

updated()

ObjectUpdatingEvent

updatingLifecycleEvent()

entity is about to be updated in the database.

updating()

ObjectRemovingEvent

removingLifecycleEvent()

entity is about to be deleted from the database using the RepositoryService's #remove(…​) method.

removing()