Legacy code in Mifos make use of LookupEntity, LookupValueEntity, LookupValueLocaleEntity, and LookupLabelEntity. Together these objects were supposed to fill multiple purposes including supporting static lists of localizable values, user definable lists of localizable values, user customizable labels.

Initially localization was intended to occur using a database based mechanism with translations for different locales being stored in LookupValueLocaleEntity objects.  Instead localization implemented using the standard Java resource bundle mechanism with localized text stored in individual properties files.  So currently text for multiple locales is not stored in the database.

Static List Usage

An example of static usage is the OfficeStatus LookupEntity. Fixed values are inserted in base_data.sql like:

insert into lookup_entity(entity_id,entity_name,description) values
(4,'OfficeStatus','Office Status')

insert into lookup_value(lookup_id,entity_id,lookup_name) values(15, 4, 'OfficeStatus-Active');
insert into lookup_value_locale(lookup_value_id,locale_id,lookup_id,lookup_value)
values(29, 1, 15, null);
insert into lookup_value(lookup_id,entity_id,lookup_name) values(16, 4, 'OfficeStatus-Inactive');
insert into lookup_value_locale(lookup_value_id,locale_id,lookup_id,lookup_value)
values(31, 1, 16, null);

insert into office_status(status_id,lookup_id)values

There is an OfficeStatusEntity that reads from the office_status table. These entries link to the the lookup_value table which contains the properties keys used to look up the localized text from LookupValueMessages.properties. In this case the lookup_value_locale table is not used.

We would like to eliminate the use of lookup values for static lists and instead use a simple enum like OfficeStatus and implement the LocalizedTextLookup interface to get a property value from an enum value for message lookup.

Dynamic List Usage

There are some dynamic lists of values that can be defined in the UI under Admin->Lookup Options.  An example is "Saluation", where end users could define "Mr.", "Ms.", "Mrs.", etc. for this list.  These values are also stored using the lookup value mechanism.  In this case, there is a lookup_entity for salutations, again defined in base_data.sql.  By default there will be no lookup_values associated with the entity, but each time the user adds a new salutation, a new lookup_value will be added along with a lookup_value_locale which will store the actual text (like "Mr.").  The locale_id in lookup_value_locale is unused and is always set to 1.

Label Usage

Previously lookup_labels were used to support customization of particular words or phrases in Mifos.  Customizing words or phrases is not done using CustomizedText.  There is still legacy code that uses the MifosLabelTag in JSP pages that still accesses mifos_label data.  When these legacy references to mifos_label are removed, then the table and associated Java classes can be deleted.