| |
What is Attribute Mapping
An AssemblyLine Connector is divided into two parts: a generic part that fits into an
AssemblyLine and can be set to a particular mode (Iterator, Lookup, Delete,
etc.), and a second "behind the scenes" part that understands the
technical details of the data source being connected to. When we speak of a
Connector, we are generally referring to the AssemblyLine Connector, while the data
source specific bit is called the Raw Connector.
Whenever information is read from or written to a data source, the actual
read or write (or delete) is carried out by the Raw Connector. In order to move
data between the generic part of the Connector in an AssemblyLine (where
scripted processing takes place) and the Raw Connector, attributes must be moved
between the Raw Connector's data store and the work Entry.
This is called Attribute Mapping.
Data in an AssemblyLine is stored as attributes in the work Entry,
while the information stored locally in the Raw Connector is an Entry object
called conn. This is a temporary object which only exists during
Attribute Mapping, and is therefore of limited availability in scripting. So when a Connector reads in and parses data, this information is stored in conn,
and must be transferred to the work Entry. Otherwise data read
will be gone when the Connector Attribute Mapping is done. Conversely, you
have to transfer attribute data from the work object to conn
in order for an output Connector to be able to update the data source. The conn
object is only available for scripting in Attribute Mapping code, and in
the Hooks mentioned below, which in turn are dependent on the mode of the
Connector.
Attribute Mapping from an input Connector can been perceived as a form
of standardising of the data (to a java object). You would
start out with the data source specific format of the Raw Connector and
then rename, aggregate or format them into standardised attributes of the work
Entry. The rest of the AssemblyLine will only see the standardised
attributes. For example, the Raw Connector could deliver the attributes frstnm
(first name) and lstnm (last name), while the attribute mapping would map
them over to the single standardized FullName attribute that would be
known to other Connectors within the AssemblyLine.
Sometimes, the Raw Connector will not deliver data due to missing
value. It could be that an optional telephone number is not present.
Different data sources treat missing values in different ways (NULL value, empty
string) and the Integrator provides a way of mapping missing values as well: It
is called Null Value Behavior. Null Value Behavior works both when
mapping to and from the Raw Connector.
Note that Null Value Behaviour only kicks in when no attribute is returned by
the raw Connector: If the Attribute is returned (exists) but has the value
NULL, Null Value Behaviour does not kick in. The JDBC
Connector has the jdbcExposeNullValues letting you map NULL values to
missing Attributes.
Value |
Description |
Empty String |
NULL values mapped to "" |
Value |
NULL values mapped to the given Value |
Null |
No value delivered on output, attribute created on input
with no value. |
Delete |
No value delivered on output, no attribute created on
input. This was (the only) behavior in version 4. |
Default Behavior |
On Attribute mapping level, default is AssemblyLine
Settings. For AssemblyLine Settings this is Preferences
Settings |
This depends on the mode of the Connector. Below is a list of the Hooks that
are executed around Attribute Mapping, and which therefore have access to the conn
object.
Mode |
When conn is available. |
Iterator |
After the Connector has read (and parsed) the data into the conn
object, Attribute Mapping is done. The After GetNext"Hook is called
just before
Attribute Mapping is done, and the GetNext OK Hook is called immediately
afterwards. |
Lookup |
After the Connector has located the data and put it into the conn
object, Attribute Mapping is done. The After Lookup Hook is called before
Attribute Mapping is done, and the Lookup OK Hook is called
afterwards. |
Update |
The first thing the Connector does is try to locate the Entry to be
updated in order to determine whether an Add or Modify operation is
needed:
- If no Entry is found, Attribute Mapping is done. Then empty Attributes
are removed, and so are Attributes not marked as Add in the Attribute Map.
Then the Hook Before Add is called, and the Entry is added to the
source. On completion, the Hook After Add is called.
- If more than one matching Entry is found, the Hook "Multiple
Entries Found" is called. If this Hook does not exist, the update
fails. The conn object is not available in this Hook,
but the work object is. Ater this, the update continues as if
one matching Entry were found (the first), unless you script other
behavior.
- If one matching Entry is found, Attribute Mapping is done. The current
object refers to the object found, which is to be updated, and conn
refers to the object. containing the new values. The work
object is also available. Then the Before Modify Hook is
called, and attributes not marked as "Mod" in the Attribute
Map are removed. If "Compute Changes" is set, and there are
changes, the Before Applying Changes Hook is called. Then the
data source is updated with the conn Entry, and the After
Modify Hook is called, or the Modify No Changes Hook is
called. The current object is available in all these Hooks.
|
AddOnly |
After the Attribute Mapping, empty Attributes are removed.
Then the Hook Before Add is called, and the Entry is added to the
source. Afterwards the Hook After Add is called. |
Delete |
No Attribute Mapping takes place, and therefore no conn
object is available. |
Passive |
This depends on the methods which are called in the
Connector when it is invoked from other places in the AssemblyLine or an
EventHandler. |
| |
|