Type to start searching...

Event

Events are the behaviors of Classes or Aspects.

Description

Events are the behaviors of Classes or Aspects. They may take a list of arguments. When invoked, they execute a series of Actions, which are script items or Java methods in a particular order. Events always have a single 'main' action. All other Event Actions are executed relative to the main action (and each other). Event Actions can be overridden in subclasses.

All Classes (not Aspects) inherit from the base class - Object - which has no attributes and provides the following Events:


   :class() Returns the class object of this instance
   :oid() Returns the instance OID
   :state() Returns the instance state symbol: init|clean|new|dirty|deleted
   :dirty(attribute) Returns #t if the attribute has been updated but not committed since the beginning of the unit of work
   :updated(attribute) Returns #t if the attribute has been updated since the last create or update event main action (or the unit of work start if none)
   :loaded(attribute) Returns #t if the attribute value is loaded, i.e. retrieving the value would not trigger the load event, otherwise returns #f
   annotation(name, value) Sets an arbitrary named value on the instance
   annotation(name) Gets an annotation value from the instance
   old(attribute) Returns the value of the attribute as it was in the beginning of the unit of work
   pre(attribute) Returns the value of the attribute as it was immediately after the last create or update event main action (or at unit of work start if none)
   new(value...) Creates and initializes an instance of this class
   create() Invoked after the instance has been created and initialized
   update() Invoked to update the instance
   commit() Invoked by the framework on a new or an updated instance, after all the events, before a unit of work is committed, only once per unit of work
   delete() Invoked to delete the instance
   read(attributes, where, orderBy, count, offset, xlock) Reads specified instances of this class
   openCursor(attributes, where, orderBy, count, offset, xlock) Opens a cursor over the specified instances of this class
   load(attribute...) Loads attributes which have not been previously loaded (and so are currently undefined)
   lock() Locks the instance
   aggregate(attributes, where groupBy having orderBy count offset) Runs an aggregate query, returning instances of class Object
   openAggregateCursor(attributes, where groupBy having orderBy count offset) Opens a cursor over the results of an aggerate query

Properties
access : identifier

Attribute on the same class, which value must be non-false to allow invoking this event.

Valid values based on“string”.
:?[\p{L}_][\p{L}\p{N}_]*(:[\p{L}_][\p{L}\p{N}_]*)*

Value must begin with a letter or an underscore. Case and length are not restricted. Letters, numbers and underscores are allowed. Colon is used as a scope separator. Spaces and other punctuation characters are not allowed.

args : identifierList

Ordered argument names.

Valid values based on“token”.
(:?[\p{L}_][\p{L}\p{N}_]*(:[\p{L}_][\p{L}\p{N}_]*)*\s+)*(:?[\p{L}_][\p{L}\p{N}_]*(:[\p{L}_][\p{L}\p{N}_]*)*)?

Each element in the list must begin with a letter or underscore. Elements are space delimited.

audit : boolean

True to record RPC invocations of this event in the audit log.

Invocations over RPC are audited, side effects through business logic are not audited through the use of this flag.
category : string

Event category.

compatibility : compatibility

Backward compatibility: none|backward|deprecated

"backward" includes the event in the current versioned API. "deprecated" includes it but indicates that an alternative is preferred and that it may be excluded from future versions. "none" excludes the event from the current versioned API.
Valid values based on“string”.
none
backward
deprecated
description : string

Event description.

facets : string

Facets with values and overrides: <name1> (<name2> <value2> value|list|assoc) ... Override defaults to value if not specified.

name : identifier

Event name. Usually starts with lower case.

Valid values based on“string”.
:?[\p{L}_][\p{L}\p{N}_]*(:[\p{L}_][\p{L}\p{N}_]*)*

Value must begin with a letter or an underscore. Case and length are not restricted. Letters, numbers and underscores are allowed. Colon is used as a scope separator. Spaces and other punctuation characters are not allowed.

privilege : string

Privilege required to invoke this event.

static : boolean

True if the event can update only shared state, false if it updates instance state.

Statics are available on instances and on the class metadata object.
Example


Object'read is a static event so (Person'read ...) and (myInstance'read ...) are
both valid.

transaction : transaction

Event's transactional behavior in the context of a caller's transaction (if any). One of supported, required, new, none, mandatory, unsupported.

Valid values based on“string”.
supported

Join a transaction, if available, otherwise run transactionless.

If the caller is running within a transaction and invokes the event, the event executes within the caller's transaction. If the caller is not associated with a transaction, a new transaction is not started for the event i.e. run transactionless.

Because the transactional behavior of the event may vary, you should use 'supported' with caution. (similar to JTA Supports)

required

Join a transaction, if available, otherwise start a new transaction. Do not auto-commit on return.

If the caller is running within a transaction and invokes the event, the event executes within the caller's transaction. If the caller is not associated with a transaction, a new transaction will start for the event. Do not auto-commit before returning to the caller. (similar to JTA Required)
new

Always suspend the current transaction, if any, and start a new one. Auto-commit on return.

If the caller is running within a transaction and invokes the event, the caller takes the following steps:


   1. Suspend the caller's transaction
   2. Start a new transaction
   3. Call the event
   4. Commit and resume the callers transaction when the event returns

If the caller is not associated with a transaction, a new transaction is started before calling the event. Auto-commit on return.

You should use 'new' when you want to ensure that the event always runs within a new transaction. (similar to JTA RequiresNew)

none

Always suspend the current transaction, if any. Restore on return.

If the caller is running within a transaction and invokes the event, suspend the callers transaction and call the event without a transaction. After the event has completed, resume the caller's transaction.

If the caller is not associated with a transaction, run the event transactionless.

Use 'none' for events that don't need transactions. Because transactions involve overhead, this may impove performance. (similar to JTA NotSupported)

mandatory

Fail if there is no transaction.

If the caller is running within a transaction and invokes the event, the event executes within the caller's transaction. If the caller is not associated with a transaction, the event will throw an exception. Use 'mandatory' if the event must use the transaction of the caller. (similar to JTA Mandatory)
unsupported

Fail if there is a transaction.

If the caller is running within a transaction and invokes the event, the event throws an exception. If the caller is not associated with a transaction, a transaction is not started for the event. (similar to JTA Never)
vararg : boolean

True if the event accepts a variable number of arguments, which are stored as a list in the last argument.

variables : string

Variables shared among the actions: var1 (var2 init2) ... varN.

visibility : visibility

Public events can be invoked by the clients through RPC, protected ones only within the server.

Valid values based on“string”.
public
protected
Content
  • Sequence of:

    • Arguments [0..1] - Collection of optional argument details for an Event. (Class or Aspect Events)

    • Result [0..1] - Optional result specification for an Event.

    • Actions [0..1] - Collection of Actions on an Event. (Class or Aspect Events)

Parents
  • Events - Collection of Events on a Class or Aspect.