|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.softwareag.mdm.schema.trigger.TableTrigger
Specifies methods that are automatically executed when some operations are performed on a table. This is the equivalent of database triggers.
The trigger must be declared under the element
xs:annotation/xs:appinfo
:
where<mdm:trigger class="com.foo.MyTableTrigger" />
com.foo.MyTableTrigger
is
the fully qualified name of the class implementing this interface.
It is also possible to set additional JavaBean properties:
where<mdm:trigger class="com.foo.MyTableTrigger"> <param1>...</param1> <param2>...</param2> </mdm:trigger>
param1
and param2
are JavaBean properties of the class specified.
For more information, read JavaBeans specification.
setParam1(...)
and
setParam2(...)
);setup(TriggerSetupContext)
is called on the new instance.handle...
are called each time the associated operation is executed.
If several operations are defined for the same table, no specific ordering in their execution must be assumed.
The general execution of triggers during a transaction follows the triple : before update, update, after update. Where an update is either a creation, a modification or a deletion of an occurrence. During a given transaction, one can have a sequence of nested updates as shown in the following example:
Begin triple 1 before update 1 update 1 after update 1 Begin triple 2 before update 2 update 2 after update 2 Begin triple 3 before update 3 update 3 after update 3 End triple 3 End triple 2 End triple 1
Note that a sequence of nested updates is handled by the same ProcedureContext
.
ProcedureContext.getAdaptationHome()
), during a given sequence of nested
updates execution, will be cancelled.
Furthermore, if a ProcedureContext
raises an exception then any
preceeding updates made on the repository, during a given sequence of nested updates execution,
will be first cancelled before the corresponding update method
gets the exception. This additional feature is for ensuring
that repository and cache remain consistent, even if the corresponding
update method catches the exception.
A "before trigger" allows to update, in the current branch, only the current occurrence content
(no access to ProcedureContext
is provided).
If at this stage more advanced updates were needed, one should use a specific service instead of triggers.
Constructor Summary | |
TableTrigger()
|
Method Summary | |
void |
handleAfterCreate(AfterCreateOccurrenceContext aContext)
This method is called after the creation of an occurrence. |
void |
handleAfterDelete(AfterDeleteOccurrenceContext aContext)
This method is called after deleting an occurrence. |
void |
handleAfterModify(AfterModifyOccurrenceContext aContext)
This method is called after the modification of an occurrence. |
void |
handleBeforeCreate(BeforeCreateOccurrenceContext aContext)
This method is called before the creation of an occurrence. |
void |
handleBeforeDelete(BeforeDeleteOccurrenceContext aContext)
This method is called before deleting an occurrence. |
void |
handleBeforeModify(BeforeModifyOccurrenceContext aContext)
This method is called before the modification of an occurrence. |
void |
handleNewContext(NewTransientOccurrenceContext aContext)
This method is called when a transient occurrence context is created. |
abstract void |
setup(TriggerSetupContext aContext)
This method is called when the schema is loaded, for checking and preparing this instance. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public TableTrigger()
Method Detail |
public abstract void setup(TriggerSetupContext aContext)
public void handleNewContext(NewTransientOccurrenceContext aContext)
Default implementation does nothing.
ProcedureContext.getContextForNewOccurrence(AdaptationTable)
public void handleBeforeCreate(BeforeCreateOccurrenceContext aContext) throws OperationException
Default implementation does nothing.
OperationException
- when an exception occurred or for preventing the execution of the
subsequent creation (guard role). Warning: in case of a mass update
the whole transaction is aborted.public void handleAfterCreate(AfterCreateOccurrenceContext aContext)
Default implementation does nothing.
public void handleBeforeModify(BeforeModifyOccurrenceContext aContext) throws OperationException
Default implementation does nothing.
OperationException
- when an exception occurred or for preventing the execution of the
subsequent modification (guard role). Warning: in case of a mass update
the whole transaction is aborted.public void handleAfterModify(AfterModifyOccurrenceContext aContext)
Default implementation does nothing.
public void handleBeforeDelete(BeforeDeleteOccurrenceContext aContext) throws OperationException
Default implementation does nothing.
OperationException
- when an exception occurred or for preventing the execution of the
subsequent deletion (guard role). Warning: in case of a mass update
the whole transaction is aborted.public void handleAfterDelete(AfterDeleteOccurrenceContext aContext)
Default implementation does nothing.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
(report a bug)
webMethods MDM 4.2.8 [0558]
Copyright Software AG 2000-2007. All rights reserved.