|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object
|
+--org.openeai.OpenEaiObject
|
+--org.openeai.config.EnterpriseTranslator
This object is used to perform translations from application values to Enterprise values and vice versa. It contains a Hashtable of EnterpriseMapping objects and uses those mappings to translate the values. The information in the Mappings is specified in the EnterpriseObjects document and are associated to a specific field.
This object is built by the EnterpriseFields object when that object is initialized and it reads through the EnterpriseObjects XML Document and finds a Field that has a Translation associated with it.
For example, the 'Enterprise Values' as specified in a hypothetical EnterpriseObject document for the Gender Element in the BasicPerson object are 'Male' and 'Female'. This means that those are the only allowable values that can be set on the BasicPerson.gender instance variable. Data is set on the gender field via the BasicPerson.setGender(String) method. When this data is passed through the BasicPerson's EnterpriseFields object in that setter method, it attempts to translate the value being passed in to one of these enterprise values if possible. If the data passed in is not equal to or cannot be translated to an enterprise value, an exception is thrown.
Field,
EnterpriseMapping,
EnterpriseFormatter,
EnterpriseFields| Field Summary |
| Fields inherited from class org.openeai.OpenEaiObject |
logger |
| Constructor Summary | |
EnterpriseTranslator()
Constructor |
|
| Method Summary | |
void |
addMapping(java.lang.String objectFieldName,
java.util.List vMapsForField)
Adds a list of EnterpriseMapping objects to this translator to the Hashtable of mappings. |
java.lang.String |
convertToAppValue(java.lang.String appName,
java.lang.String objectFieldName,
java.lang.String fieldName,
java.lang.String enterpriseValue)
This method converts the enterprise value passed in to the corresponding application specific value and returns that value for the field specified. |
java.lang.String |
convertToEnterpriseValue(java.lang.String objectFieldName,
java.lang.String fieldName,
java.lang.String value,
boolean isRequired)
This method converts the value passed in to the enterprise value and returns that value for the field specified. |
java.util.Hashtable |
getMappings()
Returns a Hashtable of EnterpriseMapping objects associated to this translator. |
java.lang.String |
toString()
|
| Methods inherited from class org.openeai.OpenEaiObject |
addLog4jProperty, getAppName, getDebug, getFromAddr, getLog4jProperties, getMailHost, getMailService, getProperties, getToAddr, initializeLog4j, initializeLog4j, initializeLog4j, setAppName, setDebug, setFromAddr, setMailHost, setMailService, setProperties, setToAddr |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public EnterpriseTranslator()
| Method Detail |
public final java.util.Hashtable getMappings()
public final void addMapping(java.lang.String objectFieldName,
java.util.List vMapsForField)
throws EnterpriseTranslationException
EnterpriseTranslationException
public final java.lang.String convertToEnterpriseValue(java.lang.String objectFieldName,
java.lang.String fieldName,
java.lang.String value,
boolean isRequired)
throws EnterpriseTranslationException
This method is called by the EnterpriseFields.getEnterpriseValue method.
EnterpriseTranslationException - if the application value cannot be successfully mapped to an enterprise value.EnterpriseMapping,
EnterpriseFields.getEnterpriseValue(String, String, String)
public final java.lang.String convertToAppValue(java.lang.String appName,
java.lang.String objectFieldName,
java.lang.String fieldName,
java.lang.String enterpriseValue)
throws EnterpriseTranslationException
Note, applications may have multiple application specific values that get translated to one enterprise value but that enterprise value can only be converted back to ONE application value. Therefore, when these mappings are specified in the EnterpriseObjects documents, application specific values that will be used for "reverse translations" must be indicated as such by specifying the "preferred" attribute with a value of "true". This way, if there is more than one application value associated to a field for the same application the foundation will know which application value should be used when a reverse translation is performed.
This method is called by the EnterpriseFields.getApplicationValue method.
EnterpriseTranslationException - if an error occurs attempting to map the enterprise value to an application value.EnterpriseMapping,
EnterpriseFields.getApplicationValue(String, String, String, String)public final java.lang.String toString()
toString in class java.lang.Object
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||