Effect of locale and country on minimum search criteria
Different locales have different requirements for searches. ContactManager determines the locale for the name fields of a search and uses the country specified to determine the other fields required.
The following code snippet from ValidateABContactSearchCriteriaPluginBase.validateCanSearch shows the code that picks up the locale and the country that the user specified in the search:
var country = searchCriteria.Address.Country ?: gw.api.admin.BaseAdminUtil.getDefaultCountry()
if (searchSpec != null && searchSpec.Locale == null)
searchSpec.Locale = LocaleType.get(PLConfigParameters.DefaultApplicationLocale.Value)
}
Note: If the country or the locale or both are
not passed in, the method uses default values.
The validateCanSearch method throws an exception based on the contact subtype if the search criteria are not met:
var exception:ContactSubtypeSpecificException = null
if (searchCriteria.SpecialistServices != null and
searchCriteria.SpecialistServices.Count > 0) {
exception = new ContactSearchWithServiceCriteriaException(
searchCriteria.ContactSubtypeType, country, searchSpec.Locale)
} else {
exception = new TooLooseContactSearchCriteriaException(
searchCriteria.ContactSubtypeType, country, searchSpec.Locale)
}
em = exception.Message
The message sent uses the locale and country to send the appropriate search criteria back to the calling application.
Note: In the class ValidateABContactSearchCriteriaPluginImpl, you can
override the satisfiesNoLocaleSpecificCriteriaRequirements method to
provide locale-specific search criteria. Your override can determine if the locale
information can pass validation. For example, the base implementation requires a
combination of City and State, but some locales might not use states or might have
different requirements altogether.
See also
