Advanced Customization > Services and Infrastructure Customization > Enumerated Types > External Enumerated Value Lists > Solution > Procedure – Implementing an EnumerationInfoProvider
  
Procedure – Implementing an EnumerationInfoProvider
Provide an implementation of the EnumerationInfoProvider interface.
The initialize method is called once, before the first time the enumeration is retrieved by the system. The usage of the parameter field is optional. If your implementation does not require any inputs, then the parameter can be ignored. The syntax of the parameter field is entirely up to you, with the only restriction being that it should not contain white space or the ‘~’ character. The parameter is not used by the system for any purpose. The EnumerationInfoProvider.initialize() method is also invoked after EnumerationInfomanager.resetEnumeration(<provider>) call is made.
The getEnumerationInfo method is called after the initialization, and the results of that call is cached by the system automatically. The getEnumerationInfo method is called again only on the next request for the enumeration after an EnumerationInfomanager.resetEnumeration(<provider>) call is made. Otherwise, the cached information is returned. You can use any logic appropriate to your use case to determine when to make the resetEnumeration call. If you never call it, then the enumeration is effectively static (unless the system caches flush for another reason.) You could call it periodically, or in response to a trigger. For best performance, only call this method after changes to the external information have been made which need to be reflected in the enumeration.
The getEnumerationInfo() method is where you return an instance of the EnumerationInfo data structure. The EnumerationInfo supports two non-localizable properties that you can use to customize the behavior of your enumeration.
Sample
public EnumerationInfo getEnumerationInfo() {
EnumerationInfo enumerationInfo = new EnumerationInfo();

enumerationInfo.setNonLocalizableProperty(EnumerationInfo.AUTO_SORT,
Boolean.TRUE);
enumerationInfo.setNonLocalizableProperty(EnumerationInfo.DEFAULT_LOCALE,
Locale.EN_US);

Set<EnumerationEntryInfo> enumEntryInfos = getEntries();
enumerationInfo.addEnumerationEntryInfos(enumEntryInfos);

return enumerationInfo;
}
An EnumerationInfo contains a collection of EnumerationEntryInfo data structures. The EnumerationEntryInfo data structure supports two non-localizable and one localizable property that you can use to customize the behavior of your enumeration. Localizable properties can have distinct values set of any number of different locales.
Sample
Set<EnumerationEntryInfo> enumEntryInfos =
new LinkedHashSet<EnumerationEntryInfo>(12);
loop (…) {
String name = …;
EnumerationEntryInfo enumEntryInfo = new EnumerationEntryInfo(name);

int sortOrder = …;
Boolean selectable = …;

enumEntryInfo.setNonLocalizableProperty(EnumerationEntryInfo.SORT_ORDER,
sortOrder);
enumEntryInfo.setNonLocalizableProperty(EnumerationEntryInfo.SELECTABLE,
selectable);

Locale locale = …;
String displayName = …;
enumEntryInfo.setLocalizableProperty(EnumerationEntryInfo.DISPLAY_NAME,
locale, displayName); }