NameFormatter class

PolicyCenter displays read-only name information in various screens. It uses class gw.name.NameFormatter to manage and format these read-only strings.

The NameFormatter class is used to convert Contact names to strings for globalization. If you change, add, or delete name columns of the Contact entity or its subentities, you must also update this class.

Note: ContactManager uses NameFormatter to convert names used in ABContact and subentities of ABContact to strings for globalization.

Additionally, if you add a new region definition, you might need to update the internalFormat method of this class, which uses fields defined in the NameOwnerFieldId class.

The class contains several different versions of the format method with different signatures, for example:

  • The following version of the format method formats a name as text and includes all fields that are used for the current region. This case is the common one. This method has the following signature:
    public function format(name : ContactNameFields, delimiter : String) : String {   
      _filter = \ fieldId : NameOwnerFieldId -> { return true }
      return internalFormat(name, delimiter)
    }
  • The following version of the format method formats a name as text and includes only the specified set of fields from the current region. This method has the following signature:
    public function format(name : ContactNameFields, 
          delimiter : String, fields : Set<NameOwnerFieldId>) : String {
      _filter = \ fieldId : NameOwnerFieldId -> { return fields.contains(fieldId) }
      return internalFormat(name, delimiter)
    }

The parameters for these methods have the following meanings:

Parameter

Description

name

The Contact name to format.

delimiter

The delimiter that separates elements of the name, typically " ".

fields

The set of Contact fields to include in the name.

PolicyCenter modal PCF file

The following PolicyCenter modal PCF file uses NameFormatter:

  • GlobalPersonNameInputSet sets the following Value for the Name field:
    • new gw.api.name.NameFormatter().format(nameOwner.PersonName, " ")

The following PolicyCenter Gosu class and Gosu enhancements call NameFormatter:

gw.contact.AbstractContactResult.gs 
gw.plugin.contact.impl.ContactEnhancement.gsx 
gw.plugin.contact.impl.ContactKanjiEnhancement.gsx

The following PolicyCenter display names call NameFormatter to return Contact names:

  • displaynames/CommercialDriver.en returns:
    new NameFormatter().format(
            person, " ", 
            NameOwnerFieldId.DISPLAY_NAME_FIELDS)
  • displaynames/Company.en returns:
    • new NameFormatter().format(contact, " ")
  • displaynames/Contact.en returns one of the following, based on Contact subtype:
    new NameFormatter().format(
           person, " ", 
           NameOwnerFieldId.DISPLAY_NAME_FIELDS)
    new NameFormatter().format(contact, " ")
  • displaynames/Place.en returns:
    • new NameFormatter().format(contact, " ")
  • displaynames/PolicyContactRole.en returns one of the following, based on Contact subtype:
    new NameFormatter().format(
           person, " ", 
           NameOwnerFieldId.DISPLAY_NAME_FIELDS)
    new NameFormatter().format(contact, " ")

ContactManager modal PCF file

The following ContactManager modal PCF file uses NameFormatter:

  • GlobalPersonNameInputSet sets the following Value for the Name field:
    new gw.api.name.NameFormatter().format(
           nameOwner.PersonName, " ")

The following ContactManager display names call NameFormatter to return ABContact names:

  • displaynames/ABCompany.en returns:
    • new NameFormatter().format(contact, " ")
  • displaynames/ABContact.en returns one of the following, based on ABContact subtype:
    new NameFormatter().format(
           person, " ", 
           NameOwnerFieldId.DISPLAY_NAME_FIELDS)
    new NameFormatter().format(contact, " ")
  • displaynames/ABPlace.en returns:
    • new NameFormatter().format(contact, " ")

See also