public interface ITransformContext
The hierarchical nature of source models and the recursive nature of the transformation hierarchy require that the context in which the transforms, extractors and rules are executed must be kept in a stack-like fashion. ITransformContext is responsible for maintaining this execution contextual information, which includes the current source, target and target container objects. It also includes a local property table that enables rules to define data that can be accessed by sibling rules or by rules in nested transforms.
A new execution context object is created each time a transform is executed. All rules and extractors associated with the transform use the same context instance so if one rule defines a property, a sibling rule can access or modify that property. When a nested transform is executed, a new execution context created that is linked to its parent context. Therefore, rules within the nested transforms have access to the properties defined in the parent context(s), in addition to the properties defined in their own context. However, the properties in the parent context(s) are read-only.
An execute context has its own local property table and its associated transform may have a transformation descriptor with properties. Setting a value for a property defined in the descriptor results in an entry in the local property table, if the descriptor property is read-write. The default property values in the actual descriptor cannot be changed via the execute context. Properties may also be defined in a parent context but again, setting a new value will not change the value in the parent context. The property is simply added to the local table which temporarily overrides the value in the parent context.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CURRENT_ELEMENT
The current transform element being executed.
|
static java.lang.String |
IS_SILENT
Flag to indicate if transformation is executing in silent mode
|
static java.lang.String |
PROGRESS_MONITOR
The progress monitor to be used for this transformation execution.
|
static java.lang.String |
SOURCE
The source object property id.
|
static java.lang.String |
TARGET
The target object property id.
|
static java.lang.String |
TARGET_CONTAINER
The target container object property id.
|
Modifier and Type | Method and Description |
---|---|
ITransformContext |
getParentContext()
Get the parent execution context.
|
java.lang.String[] |
getPropertyIds()
Retrieve a list of property identifiers in this context.
|
java.lang.Object |
getPropertyValue(java.lang.String propertyId)
Get the value of a property that is defined within the context of the
transformation being executed.
|
java.lang.Object |
getSource()
Get the source object that the transformation element is to process
|
java.lang.Object |
getTarget()
Get the target object that the transformation element is to use
|
java.lang.Object |
getTargetContainer()
Get the target container object that the transformation element is to use
|
AbstractTransform |
getTransform()
Get the transform associated with this context.
|
boolean |
isSilent()
Evaluate if the transformation is executing in silent mode.
|
boolean |
setPropertyValue(java.lang.String propertyId,
java.lang.Object data)
Set a property value in the transformation execution context.
|
static final java.lang.String SOURCE
static final java.lang.String TARGET_CONTAINER
static final java.lang.String TARGET
static final java.lang.String PROGRESS_MONITOR
static final java.lang.String CURRENT_ELEMENT
static final java.lang.String IS_SILENT
ITransformContext getParentContext()
If the parent context is null, context is the root of the transformation.
java.lang.String[] getPropertyIds()
java.lang.Object getPropertyValue(java.lang.String propertyId)
This method checks the property table in the current execution context and if the property does not exist, the property table in the parent context is checked recursively. If the context for the root transform does not contain the property, the transformation descriptors associated with the transforms are then checked.
propertyId
- the ID of the propertyjava.lang.Object getSource()
java.lang.Object getTarget()
java.lang.Object getTargetContainer()
AbstractTransform getTransform()
A transformation may have several nested transforms. When each transform is executed, a new execution context is created and is linked into the existing context execution stack.
boolean setPropertyValue(java.lang.String propertyId, java.lang.Object data)
If this is the saved context for a transformation configuration, calling this method overrides the property value defined in any parent transformation configuration.
propertyId
- the ID of the property being setdata
- the data object for the property valueboolean isSilent()