[This is preliminary documentation and is subject to change.]
A FieldMapping defines how to map a local application field to an element or
attribute of the SIF Data Object type encapsulated by the parent ObjectMapping.
Each FieldMapping is associated with a Rule that is evaluated at
runtime to carry out the actual mapping operation on a SifDataObject instance.
The way the rule behaves is up to its implementation.
A FieldMapping may have a default value. If set, the default value is
assigned to the SIF element or attribute if the corresponding field value is
null or undefined. This is useful if you wish to ensure that a specific SIF
element/attribute always has a value regardless of whether or not there is a
corresponding value in your application's database.
The application-defined field name that is associated with a FieldMapping
must be unique; that is, there cannot be more than one FieldMapping for the
same application field. However, if you wish to map the same field to more
than one SIF element or attribute, you can create an alias. An alias
is a FieldMapping that has a unique field name but refers to another field.
For example, if your application defines the field STUDENT_NUM and you wish
to define two FieldMappings for that field, create an alias:
CopyC#
In the above example, the "STUDENT_NUM" mapping produces an <OtherId>
element with its Type attribute set to '06'. The "MYALIAS" mapping produces
a second <OtherId> element with its Type attribute set to 'ZZ'. Both
elements will have the value of the application-defined STUDENT_NUM field.
Note that if MYALIAS were an actual field name of your application, however,
the value of the <OtherId Type='ZZ'> element would be equal to that
field's value. When creating aliases be sure to choose a name that does not
conflict with the real field names used by your application.
// Create the default mapping<br /> FieldMapping fm = new FieldMapping("STUDENT_NUM","OtherId[@Type='06']");<br /><br /><br /> // Create an alias (the field name must be unique)<br /> FieldMapping zz = new FieldMapping("MYALIAS","OtherId[@Type='ZZ']");<br /> zz.setAlias( "STUDENT_NUM" );<br /><br />
| C# | Visual Basic | Visual C++ |
public class FieldMapping
Public Class FieldMapping
public ref class FieldMapping
| All Members | Constructors | Methods | Properties | ||
| Icon | Member | Description |
|---|---|---|
| FieldMappingFieldMappingNew()() | Constructor | |
| FieldMappingFieldMappingNew(String, String) | Constructs a FieldMapping with an XPath-like rule | |
| FieldMappingFieldMappingNew(String, String, XmlElement) | ||
| FieldMappingFieldMappingNew(String, OtherIdMapping) | Constructs a FieldMapping with an <OtherId> rule.
| |
| FieldMappingFieldMappingNew(String, OtherIdMapping, XmlElement) | Constructs a FieldMapping with an <OtherId> rule.
| |
| Alias | Gets or sets an alias of another field mapping. | |
| copy(ObjectMapping) | Creates a copy this ObjectMapping instance.
| |
| DefaultValue | Gets or sets the default value for this field when no corresponding element or
attribute is found in the SIF Data Object. The Mapping.map methods will
create an entry in the HashMap with this default value.
| |
| evaluate(SifDataObject) | Evaluates this rule against a SifDataObject and returns the text value
of the element or attribute that satisfied the query.
| |
| FieldName | Gets or sets the name of the local application field that maps to the SIF Data
Object element or attribute
| |
| Filter | Gets or sets optional filtering attributes. | |
| GetRule()() | Gets the field mapping rule | |
| SetRule(String) | Sets this FieldMapping rule to an XPath-like query string | |
| SetRule(OtherIdMapping) | Sets this object's rule to an "<OtherId> rule" | |
| SetRule(OtherIdMapping, XmlElement) | ||
| ValueSetID | Gets or sets the ID of the ValueSet that should be used to translate the value
of this field.
| |
| XmlElement | Gets the optional DOM XmlElement associated with this FieldMapping instance.
The DOM XmlElement is usually set by the parent ObjectMapping instance when a
FieldMapping is populated from a DOM Document.
Sets the optional DOM XmlElement associated with this FieldMapping instance.
The DOM XmlElement is usually set by the parent ObjectMapping instance when a
FieldMapping is populated from a DOM Document.
|
| Object | |
| FieldMapping | |