The TypecodeMapper class

The TypecodeMapper class enables configuration code to translate the mappings between PolicyCenter typecodes and the codes used by an external system.

The getTypecodeMapper method

The getTypecodeMapper method retrieves the static TypecodeMapper object which is used to translate the mappings of typecodes and external system codes. The method is implemented in the gw.api.util.TypecodeMapperUtil class.

gw.api.util.TypecodeMapperUtil.getTypecodeMapper() : TypecodeMapper

The method accepts no arguments. It returns a TypecodeMapper object which implements the remaining methods described in this section.

The containsMappingFor method

The containsMappingFor method determines whether a specified typelist has any mappings to external system codes.

containsMappingFor(typelist : String) : boolean

The typelist argument references a PolicyCenter typelist by specifying the value of the name attribute of the typelist element defined in the typecodemapping.xml file. The specified typelist must exist in PolicyCenter or the method throws an InvalidMappingFileException.

The method returns true if any mappings are defined for the specified typelist.

The getAliasByInternalCode and getAliasesByInternalCode methods

The getAliasByInternalCode and getAliasesByInternalCode methods are called when PolicyCenter is exporting data to an external system. The term "Alias" in the method names refers to an external system's code, and "InternalCode" refers to a PolicyCenter typelist and typecode combination. The methods enable the configuration code to translate a PolicyCenter typelist/typecode to a mapped code in the external system.

getAliasByInternalCode(typelist : String, namespace : String, code : String) : String
getAliasesByInternalCode(typelist : String, namespace : String, code : String) : String

Each argument references an attribute value assigned in the typecodemapping.xml file. The typelist argument references a PolicyCenter typelist by specifying the value of the name attribute of the typelist element. The code argument references the typelist's typecode by specifying the typecode attribute value of the mapping element. The namespace argument identifies the external system by specifying its unique name attribute value assigned in its namespace element. None of the arguments can be null.

The methods return either a single external system code or an array of codes that are mapped to the specified typelist and code. If no mapped code is found, getAliasByInternalCode returns null and getAliasesByInternalCode returns an empty array.

If getAliasByInternalCode finds more than one code mapped to the specified typelist/typecode, it throws a NonUniqueAliasException.

The getInternalCodeByAlias and getInternalCodesByAlias methods

The getInternalCodeByAlias and getInternalCodesByAlias methods are called when PolicyCenter is importing data from an external system. The methods enable PolicyCenter to translate an external system's code to a mapped typecode.

getInternalCodeByAlias(typelist : String, namespace : String, alias : String) : String
getInternalCodesByAlias(typelist : String, namespace : String, alias : String) : String[]

Each argument references an attribute value assigned in the typecodemapping.xml file. The typelist argument references a PolicyCenter typelist by specifying the value of the name attribute of the typelist element. The namespace argument identifies the external system by specifying its unique name attribute value assigned in its namespace element. The alias argument references the external system's code by specifying the alias attribute value of the mapping element. None of the arguments can be null.

The methods return either a single typecode or an array of typecodes that are mapped to the specified external system alias. If no mapped typecode is found, getInternalCodeByAlias returns null and getInternalCodesByAlias returns an empty array.

If getInternalCodeByAlias finds more than one typecode mapped to the specified external system code, it throws a NonUniqueTypecodeException.