com.edustructures.sifworks.tools.mapping
Class ObjectMapping

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

public class ObjectMapping
extends java.lang.Object

An ObjectMapping defines a set of field mapping rules for a specific SIF Data Object type such as StudentPersonal, StaffPersonal, or BusInfo. ObjectMapping is comprised of zero or more FieldMapping children.

Version:
ADK 1.0

Constructor Summary
ObjectMapping(java.lang.String objType)
          Constructor
ObjectMapping(java.lang.String objType, org.w3c.dom.Node node)
          Constructor
 
Method Summary
 void addRule(FieldMapping mapping)
          Appends a FieldMapping definition
 void clearRules()
          Clear all FieldMapping definitions.
 ObjectMapping copy(Mappings newParent)
          Creates a copy this ObjectMapping instance.
 org.w3c.dom.Node getNode()
          Gets the optional DOM Node associated with this ObjectMapping instance.
 java.lang.String getObjectType()
          Gets the SIF Data Object type of this ObjectMapping
 FieldMapping getRule(int index)
          Gets the FieldMapping at the specified index
 int getRuleCount()
          Count the number of FieldMapping definitions.
 FieldMapping[] getRules(boolean inherit)
          Return an array of all FieldMapping definitions
 java.util.List<FieldMapping> getRulesList(boolean inherit)
          Return a list of all FieldMapping definitions
 void insertRule(FieldMapping mapping, int index)
          Insert a FieldMapping definition at the specified index.
 void removeRule(FieldMapping mapping)
          Remove a FieldMapping definition
 void removeRule(int index)
          Removes the FieldMapping at the specified index
 void setNode(org.w3c.dom.Node node)
          Sets the optional DOM Node associated with this ObjectMapping instance.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ObjectMapping

public ObjectMapping(java.lang.String objType)
              throws ADKMappingException
Constructor

Parameters:
objType - The name of a SIF Data Object (e.g. "StudentPersonal")
Throws:
ADKMappingException

ObjectMapping

public ObjectMapping(java.lang.String objType,
                     org.w3c.dom.Node node)
              throws ADKMappingException
Constructor

Parameters:
objType - The name of a SIF Data Object (e.g. "StudentPersonal")
node - The optional DOM Node from which this ObjectType was produced
Throws:
ADKMappingException
Method Detail

getNode

public org.w3c.dom.Node getNode()
Gets the optional DOM Node associated with this ObjectMapping instance. The DOM Node is usually set by the parent Mappings object when an ObjectMapping is populated from a DOM Document.


setNode

public void setNode(org.w3c.dom.Node node)
Sets the optional DOM Node associated with this ObjectMapping instance. The DOM Node is usually set by the parent Mappings object when an ObjectMapping is populated from a DOM Document.


copy

public ObjectMapping copy(Mappings newParent)
                   throws ADKMappingException
Creates a copy this ObjectMapping instance.

This method performs a "deep copy", such that a clone is made of each child FieldMapping. The parent of the new ObjectMapping will be the Mappings object passed to this function. Any DOM Nodes assigned to this object or its children are cloned and appended to the parent Mappings's DOM Node if one exists.

Returns:
A "deep copy" of this object
Throws:
ADKMappingException

getObjectType

public java.lang.String getObjectType()
Gets the SIF Data Object type of this ObjectMapping

Returns:
An object type name such as "StudentPersonal" or "BusInfo"

addRule

public void addRule(FieldMapping mapping)
             throws ADKMappingException
Appends a FieldMapping definition

Parameters:
mapping - A FieldMapping that defines the rules for mapping a field of the application to an element or attribute of a SIF Data Object. There can only be one FieldMapping per unique field name (i.e. if you have defined a FieldMapping rule with a field name of 'STUDENTNUM', there cannot be another FieldMapping rule with that same field name.) To map a single application field to more than one SIF element or attribute, create a FieldMapping with a unique field name (e.g. 'STUDENTNUM_2') and call the setAlias method to define it as an alias of an existing field.
Throws:
ADKMappingException - thrown if there is already a FieldMapping with the specified field name

insertRule

public void insertRule(FieldMapping mapping,
                       int index)
                throws ADKMappingException
Insert a FieldMapping definition at the specified index.

Parameters:
mapping - A FieldMapping that defines the rules for mapping a field of the application to an element or attribute of a SIF Data Object. There can only be one FieldMapping per unique field name (i.e. if you have defined a FieldMapping rule with a field name of 'STUDENTNUM', there cannot be another FieldMapping rule with that same field name.) To map a single application field to more than one SIF element or attribute, create a FieldMapping with a unique field name (e.g. 'STUDENTNUM_2') and call the setAlias method to define it as an alias of an existing field.
Throws:
ADKMappingException - thrown if there is already a FieldMapping with the specified field name

removeRule

public void removeRule(FieldMapping mapping)
Remove a FieldMapping definition


removeRule

public void removeRule(int index)
Removes the FieldMapping at the specified index

Parameters:
index - The zero-based index of the FieldMapping

getRules

public FieldMapping[] getRules(boolean inherit)
Return an array of all FieldMapping definitions

Parameters:
inherit - True to inherit FieldMapping definitions from the parent Mappings ancestry
Returns:
A list of all FieldMapping definitions

getRulesList

public java.util.List<FieldMapping> getRulesList(boolean inherit)
Return a list of all FieldMapping definitions

Parameters:
inherit - True to inherit FieldMapping definitions from the parent Mappings ancestry
Returns:
A list of all FieldMapping definitions

getRuleCount

public int getRuleCount()
Count the number of FieldMapping definitions.


getRule

public FieldMapping getRule(int index)
Gets the FieldMapping at the specified index

Parameters:
index - The zero-based index of the FieldMapping

clearRules

public void clearRules()
Clear all FieldMapping definitions.



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.