Defining column data resolvers

Each type (class) other than String to be exported and imported must have its own ColumnDataResolver class. This class specifies how to convert a value to a string on export and convert the string back into the correct value type on import. PolicyCenter defines the following ColumnDataResolvers:

  • NullColumnDataResolver – Imports nothing. Typically used for the Action column and for any informational column that is processed during import or export operations.
  • SimpleColumnDataResolver – Exports and imports strings and numbers. It is so named because processing strings and numbers is simple compared to other types.
  • TypeKeyColumnDataResolver – Exports a resolved type key as a string and imports a string as a type key.
  • CoverageColumnDataResolver – Exports the display value of a coverage term as a string. Imports the localized coverage term value using the dotted path to resolve the coverage pattern and coverage term pattern.
  • TerritoryCodeColumnDataResolver – Exports a territory code value as a string and imports a string as a territory code value.
  • TaxLocationColumnDataResolver – Exports a tax location value as a string and imports a string as a tax location value.
  • ClassCodeColumnDataResolver – Exports a class code value as a string and imports a string as a class code value.
  • AbstractColumnDataResolver – An abstract class that uses iterative reflection to resolve the dotted bean path to the value that needs to be exported and imported. Typically you extend this class when defining new column data resolvers.
  • ColumnDataResolver – An interface that is responsible for importing and exporting cell data values. Implemented by AbstractColumnDataResolver.

If you need to export and import a type (class) that is not handled by one of the provided column data resolvers, you must implement a new one. In Studio navigate to configuration > gsrc and define a new class in my_domain_name.exportimport.resolver where my_domain_name is the package for your company’s files. Give the class a name appropriate to the column type it is designed to resolve.

Typically it is sufficient to leverage the AbstractColumnDataResolver and implement the method #calculateCellValue. This method constructs and returns a new object of a type that matches the ColumnInfo type.

For example, you can implement a new TaxLocationColumnDataResolver using CPClassCodeColumnDataResolver as a model. If the ColumnDataResolver needs more context to resolve the value, you can define dependent data for the ColumnInfo. In this case, the TaxLocationColumnDataResolver requires state information to calculate the jurisdiction and find the TaxLocation. This dependency must be completed by using the Dependent element and id attribute in the EntityInfo XML file.

See also