Class InstanceTrigger
java.lang.Object
com.orchestranetworks.schema.trigger.InstanceTrigger
Specifies methods that are automatically executed when certain
operations are performed on a dataset.
Definition in the data model
The trigger must be declared under the element
xs:annotation/xs:appinfo:
where<osd:trigger class="com.foo.MyDataSetTrigger" />
com.foo.MyDataSetTrigger is
the fully qualified name of the class implementing this interface.
It is also possible to set additional JavaBean properties:
<osd:trigger class="com.foo.MyDataSetTrigger">
<param1>...</param1>
<param2>...</param2>
</osd:trigger>
where param1 and param2 are JavaBean properties of the specified class.
For more information, see the JavaBean specification.
Life cycle
- When the data model is loaded:
- the specified class is instantiated through its default constructor and the JavaBean property
setters are called (in the example above,
setParam1(...)andsetParam2(...)); - the method
setup(TriggerSetupContext)is called on the new instance.
- the specified class is instantiated through its default constructor and the JavaBean property
setters are called (in the example above,
- During the operational phase: the methods
handle...are called each time the associated operation is executed.
If several operations are defined for the same dataset, they are not executed in any particular order.
Restrictions
Dataset triggers are not invoked in the following contexts:
-
If triggers have been explicitly deactivated using the method
ProcedureContext.setTriggerActivation(false). -
In the context of a merge operation (see
ProcedureContext.doMergeToParent(com.onwbp.adaptation.AdaptationHome)). -
In the context of an archive import (see
ProcedureContext.doImportArchive(ArchiveImportSpec)). -
In the context of a dataset copy (see
ProcedureContext.doCopy(com.onwbp.adaptation.Adaptation)).
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidhandleAfterCreate(AfterCreateInstanceContext aContext) This method is called after the creation of a dataset.voidhandleAfterDelete(AfterDeleteInstanceContext aContext) This method is called after the deletion of a dataset.voidThis method is called before the creation of a dataset.voidThis method is called before the deletion of a dataset.abstract voidsetup(TriggerSetupContext aContext) Checks and prepares this instance when the data model is loaded.
-
Constructor Details
-
InstanceTrigger
public InstanceTrigger()
-
-
Method Details
-
setup
Checks and prepares this instance when the data model is loaded. -
handleBeforeCreate
This method is called before the creation of a dataset.Default implementation does nothing.
- Throws:
OperationException- when an exception occurs or to prevent the execution of the subsequent creation (guard role). Warning: in the case of a mass update, the whole transaction is aborted.
-
handleAfterCreate
This method is called after the creation of a dataset.Default implementation does nothing.
- Throws:
OperationException- when an exception occurs. Warning: in the case of a mass update the whole transaction is aborted.
-
handleBeforeDelete
This method is called before the deletion of a dataset.Default implementation does nothing.
- Throws:
OperationException- when an exception occurs or to prevent the execution of the subsequent deletion (guard role). Warning: in the case of a mass update the whole transaction is aborted.
-
handleAfterDelete
This method is called after the deletion of a dataset.Default implementation does nothing.
- Throws:
OperationException- when an exception occurs. Warning: in the case of a mass update the whole transaction is aborted.
-