Actions

Often times an entity is more than just an object used for data access, for this purpose you can use the action element to specify custom behaviors for an entity. Additionally actions can be associated with certain events of an entity and triggered by those events. Using the “async” keyword for actions attached to entity events causes that action to be triggered asynchronously. Using the “on” keyword allows the declaration of the method to be on a different class from the entity itself as well.

For the default business object framework a custom action translates into a custom method on the specified entity. The developer must implement the method manually with the appropriate parameters. The purpose of this feature is partly to allow an architect to specify all of the behaviors of an entity during design time and then to allow a developer to know what behaviors are required of the entity. It is also partly to easily trigger the execution of certain methods based on the events of the entity.

action Log when inserted;
action Notify on Example.EmailNotifier when updated async;
action DoShipping;


Action Events Description
loading Fires before data is loaded during a retrieve.
loaded Fires after data is loaded during a retrieve.
fetching Fires before a fetch occurs.
fetched Fires after a fetch has occurred.
persisting Fires before an entity is persisted. This event will fire regardless of whether or not an insert, update or delete occurs.
persisted Fires after an entity is persisted. This event will fire regardless of whether or not an insert, update or delete occurred during persistence.
inserting Fires before an entity is inserted during persistence.
inserted Fires after an entity is inserted during persistence.
updating Fires before an entity is updated during persistence.
updated Fires after an entity is persisted during persistence.
deleting Fires before an entity is deleted during persistence.
deleted Fires after an entity is deleted during persistence.
validating Fires when an entity is being validated against the specified validation rules.
validated Fires after an entity is validated against the specified validation rules.
accessing Fires before a field is accessed.
accessed Fires after a field has been accessed.
changed Fires after the state of an entity has changed. If the values of any fields are changed or if the entity is inserted, updated or deleted during persistence.
error Fires if an error occurs during persistence or a fetch.


Next: Assigning templates

Last edited Sep 5, 2007 at 1:35 AM by justinc, version 5

Comments

No comments yet.