|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.edustructures.sifworks.tools.mapping.ValueSet
public class ValueSet
A ValueSet is an arbitrary mapping table used to map an application's proprietary codes and constants to SIF codes and constants. For example, an agent might define a ValueSet to map grade levels, ethnicity codes, english proficiency codes, and so on.
ValueSet stores its data in a HashMap. For each entry in the map, the key is a value defined by the application and the value is a ValueSetEntry object that encapsulates the associated SIF value and other fields like a display title for user interfaces.
For example, a ValueSet that maps grade levels might be comprised of the following entries:
| Key | Value |
| PREK | PK |
| K | 0K |
| 1 | 01 |
| 2 | 02 |
| 3 | 03 |
| 4 | 04 |
| 5 | 05 |
| 6 | 06 |
| 7 | 07 |
| 8 | 08 |
| 9 | 09 |
To translate an application-defined value to its SIF equivalent, call the
translate method. To translate a SIF-defined value to its
application-defined equivalent, call the translateReverse
method.
| Constructor Summary | |
|---|---|
ValueSet(java.lang.String id)
Constructs a ValueSet with an ID |
|
ValueSet(java.lang.String id,
java.lang.String title)
Constructs a ValueSet with an ID and display title |
|
ValueSet(java.lang.String id,
java.lang.String title,
org.w3c.dom.Node node)
Constructs a ValueSet with an ID, display title, and associated DOM Node |
|
| Method Summary | |
|---|---|
void |
clear()
Clears the table |
int |
compare(java.lang.Object o1,
java.lang.Object o2)
Compares two ValueSetEntry objects for order |
ValueSet |
copy(Mappings newParent)
|
void |
define(java.lang.String appValue,
java.lang.String sifValue,
java.lang.String title)
Sets a value |
void |
define(java.lang.String appValue,
java.lang.String sifValue,
java.lang.String title,
org.w3c.dom.Node node)
Sets a value |
ValueSetEntry[] |
getEntries()
Return a sorted array of the ValueSet's entries |
java.lang.String |
getId()
|
java.util.Map |
getMap()
|
org.w3c.dom.Node |
getNode()
|
java.util.Map |
getReverseMap()
|
java.lang.String |
getTitle()
|
java.lang.String |
lookup(java.lang.String appValue)
Gets a value |
void |
remove(java.lang.String appValue)
Removes a value |
void |
setAppDefault(java.lang.String appValue,
boolean renderIfNull)
Sets the default application value that will be returned if no match is found during a valueset translation |
void |
setId(java.lang.String id)
|
void |
setNode(org.w3c.dom.Node node)
|
void |
setSifDefault(java.lang.String sifValue,
boolean renderIfNull)
Sets the default SIF value that will be returned if no match is found during a valueset translation |
void |
setTitle(java.lang.String title)
|
java.lang.String |
toString()
|
void |
toXml(org.w3c.dom.Element element)
Writes this valueset to an XML element. |
java.lang.String |
translate(java.lang.String appValue)
Translates a value. |
java.lang.String |
translate(java.lang.String appValue,
java.lang.String defaultValue)
Translates a value. |
java.lang.String |
translateReverse(java.lang.String sifValue)
Performs a reverse translation. |
java.lang.String |
translateReverse(java.lang.String sifValue,
java.lang.String defaultValue)
Performs a reverse translation. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.Comparator |
|---|
equals |
| Constructor Detail |
|---|
public ValueSet(java.lang.String id)
public ValueSet(java.lang.String id,
java.lang.String title)
public ValueSet(java.lang.String id,
java.lang.String title,
org.w3c.dom.Node node)
| Method Detail |
|---|
public ValueSet copy(Mappings newParent)
public java.lang.String getId()
public void setId(java.lang.String id)
public java.lang.String getTitle()
public void setTitle(java.lang.String title)
public org.w3c.dom.Node getNode()
public void setNode(org.w3c.dom.Node node)
public java.lang.String toString()
toString in class java.lang.Objectpublic ValueSetEntry[] getEntries()
public int compare(java.lang.Object o1,
java.lang.Object o2)
compare in interface java.util.Comparator
public void define(java.lang.String appValue,
java.lang.String sifValue,
java.lang.String title)
public void define(java.lang.String appValue,
java.lang.String sifValue,
java.lang.String title,
org.w3c.dom.Node node)
public java.lang.String lookup(java.lang.String appValue)
public java.lang.String translate(java.lang.String appValue)
This method differs from lookup in that it returns a default value
if it is available and no mapping is defined in the ValueSet. If there is no
default value, the appValue passed in is returned.
The lookup method
returns null if no mapping is defined.
appValue - An application-defined value
public java.lang.String translate(java.lang.String appValue,
java.lang.String defaultValue)
If there is no mapping defined, the default value passed in is returned.
If, however, the default value passed in is NULL, the valueset will be searched
for a default value and that value will be returned. If there is no default,
the appValue passed in is returned.
The lookup method
returns null if no mapping is defined.
appValue - An application-defined value
public java.lang.String translateReverse(java.lang.String sifValue)
If there is no match found, but there is a default value found that applies to inbound mappings, the default value will be returned. If no default value is found, the sifValue will be returned
sifValue - An SIF-defined value
public java.lang.String translateReverse(java.lang.String sifValue,
java.lang.String defaultValue)
If there is no match found, the defaultValue is returned.
If, however, the defaultValue is NULL, the Valueset's outbound default value
will be used. If the valueset does not have a default outbound value, the
sifValue will be returned
sifValue - An SIF-defined value
public void setAppDefault(java.lang.String appValue,
boolean renderIfNull)
throws ADKMappingException
appValue - The value to return if there is no matchrenderIfNull - True if the default value should be returned even if the SIF Value being
translated is NULL. If false, NULL will be returned.
ADKMappingException - Thrown if the value has not yet been defined in this valueset
by calling define
public void setSifDefault(java.lang.String sifValue,
boolean renderIfNull)
throws ADKMappingException
sifValue - The value to return if there is no matchrenderIfNull - True if the default value should be returned even if the app value
being translated is null. If false, NULL will be returned.
ADKMappingException - Thrown if the value has not yet been defined in this valueset
by calling definedefine(String, String, String),
define(String, String, String, Node)public void clear()
public void remove(java.lang.String appValue)
public java.util.Map getMap()
public java.util.Map getReverseMap()
public void toXml(org.w3c.dom.Element element)
element -
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||