com.edustructures.sifworks.tools.mapping
Class MappingsContext

java.lang.Object
  extended by com.edustructures.sifworks.tools.mapping.MappingsContext

public class MappingsContext
extends java.lang.Object

Encapsulates context operation about a set of mappings that is being done to handle a specific operation, such as processing a SIF Message.

Using MappingsContext is more efficient than repeatedly calling Mappings.mapInbound or Mappings.mapOutbound. To get an instance of MappingsContext, call Mappings.selectInbound(ElementDef, SIFVersion, String, String) or Mappings.selectOutbound(ElementDef, SIFVersion, String, String)


Method Summary
static MappingsContext create(Mappings m, MappingsDirection direction, SIFVersion version, ElementDef elementDef)
          Creates a MappingsContext instance to handle a set of mappings operations using the same parameters
 MappingsDirection getDirection()
          Gets the MappingsDirection being used for this Mappings Context
 java.util.Collection<FieldMapping> getFieldMappings()
          Returns an unmodifiable collection of the FieldMappings defined in this mapping context
 Mappings getMappings()
          Returns the Mappings object that this context is using to perform Mapping operations.
 ElementDef getObjectDef()
          Returns the ElementDef that this MappingsContext is initialized to map values for
 ObjectMapping getObjectMappings()
          Gets the ObjectMapping instance that this MappingsContext was initialized with
 void map(SIFElement mappedElement, FieldAdaptor adaptor)
          Perform a mapping operation on the specified SIFElement.
 void setValueBuilder(ValueBuilder functions)
          Sets the ValueBuilder instance to use for mapping operations.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

create

public static MappingsContext create(Mappings m,
                                     MappingsDirection direction,
                                     SIFVersion version,
                                     ElementDef elementDef)
Creates a MappingsContext instance to handle a set of mappings operations using the same parameters

Parameters:
m - The mappings instance to use
direction - The mappings direction
version - The version of SIF to use for evaluating rule filters on field mappings
elementDef - The ElementDef representing the object type being mapped
Returns:
A new MappingsContext, initialized to map using the specified parameters

map

public void map(SIFElement mappedElement,
                FieldAdaptor adaptor)
         throws ADKMappingException
Perform a mapping operation on the specified SIFElement. The mapping operation will be either inbound or outbound, depending on whether this class was returned from Mappings.selectInbound(ElementDef, SIFVersion, String, String) or Mappings.selectOutbound(ElementDef, SIFVersion, String, String)

Parameters:
mappedElement - The SIFElement to perform the mappings operation on
adaptor - The FieldAdaptor to use for getting or setting data
Throws:
ADKMappingException

getDirection

public MappingsDirection getDirection()
Gets the MappingsDirection being used for this Mappings Context

Returns:
A MappingsDirection value (INBOUND or OUTBOUND)

setValueBuilder

public void setValueBuilder(ValueBuilder functions)
Sets the ValueBuilder instance to use for mapping operations.

Parameters:
functions - A class implementing the ValueBuilder interface

getObjectMappings

public ObjectMapping getObjectMappings()
Gets the ObjectMapping instance that this MappingsContext was initialized with

Returns:
The ObjectMapping being used for this MappingsContext

getFieldMappings

public java.util.Collection<FieldMapping> getFieldMappings()
Returns an unmodifiable collection of the FieldMappings defined in this mapping context

Returns:
an unmodifiable collection of FieldMappings

getObjectDef

public ElementDef getObjectDef()
Returns the ElementDef that this MappingsContext is initialized to map values for

Returns:
The ElementDef that this MappingsContext is mapping data for

getMappings

public Mappings getMappings()
Returns the Mappings object that this context is using to perform Mapping operations.

Returns:
a Mappings instance


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.