com.edustructures.sifworks.tools.mapping
Class StringMapAdaptor

java.lang.Object
  extended by com.edustructures.sifworks.tools.mapping.ObjectMapAdaptor
      extended by com.edustructures.sifworks.tools.mapping.StringMapAdaptor
All Implemented Interfaces:
FieldAdaptor, org.apache.commons.jxpath.Variables

public class StringMapAdaptor
extends ObjectMapAdaptor

A FieldAdaptor implementation that contains field values to assign to the supplied SIFDataObject, where each entry in the map is keyed by the local application-defined name of a field and the value is the text value to assign to the corresponding element or attribute of the SIFDataObject, in the SIF 1.5r1 text format.

This class is most useful for agents that were written using the 1.x version of the ADK and offers compatibility with the Mappings implementation used in that release. Values mapped to and from the Map used in this class will match the textual representation of those values in the 1.x version of the ADK. For example, a SIF date field that is mapped to this class will map to and from the SIF 1.5 format for dates, which was yyyyMMdd.

The Data-to-Text formatting is controlled by the ADK.getTextFormatter() property, which defaults to SIF 1.5 formatting. If you wish to supply your own text formatter, you can call the constructor overload that accepts a SIFFormatter instance. To use this class,

  1. Create an instance and optionally populate the Map with known field values that will not be subject to the mapping process. If pre-loading the Map, the key of each entry should be the local application-defined field name and the value should be the string value of that field. Any field added to the Map before calling this method will not be subject to mapping rules, unless the ObjectMapAdaptor.setOverwriteValues(boolean) property is set to True.
  2. Use this class instance with the Mappings class,by calling the appropriate map method and passing the SIFDataObject instance to retrieve field values from for insertion into the Map. The method first looks up the ObjectMapping instance corresponding to the SIF Data Object type. If no ObjectMapping has been defined for the object type, no action is taken and the method returns successfully without exception. Otherwise, all field rules defined by the ObjectMapping are evaluated in order. If a rule evaluates successfully, the corresponding element or attribute value will be inserted into the HashMap. A rule will not be evaluated if the associated field already exists in the Map, unless the ObjectMapAdaptor.setOverwriteValues(boolean) property is set to True.

Version:
2.0
See Also:
ADK.setTextFormatter(SIFFormatter), ADK.getTextFormatter(), Mappings

Constructor Summary
StringMapAdaptor(java.util.Map dataMap)
          Creates an instance of StringMapAdaptor that uses the specified Map
StringMapAdaptor(java.util.Map dataMap, SIFFormatter formatter)
          Creates an instance of StringMapAdaptor that uses the specified map and specified SIFFormatter instance for deriving String values from SIF datatypes
 
Method Summary
 
Methods inherited from class com.edustructures.sifworks.tools.mapping.ObjectMapAdaptor
declareVariable, getMap, getOverwriteValues, getSIFValue, getValue, getVariable, hasField, isDeclaredVariable, keySet, setMap, setOverwriteValues, setSIFValue, undeclareVariable
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringMapAdaptor

public StringMapAdaptor(java.util.Map dataMap)
Creates an instance of StringMapAdaptor that uses the specified Map

Parameters:
dataMap - The Map to use for SIF Data mapping operations

StringMapAdaptor

public StringMapAdaptor(java.util.Map dataMap,
                        SIFFormatter formatter)
Creates an instance of StringMapAdaptor that uses the specified map and specified SIFFormatter instance for deriving String values from SIF datatypes

Parameters:
dataMap - The Map to use for SIF Data mapping operations
formatter - The formatter to use for converting SIF native datatypes to text and back again.


Copyright © 2001-2007 Edustructures LLC. All Rights Reserved. SIFWorks® and ADK® are registered trademarks of Edustructures LLC. SIF™ and Schools Interoperability Framework are trademarks of the Schools Interoperability Framework Association.