use of org.mifos.config.util.helpers.LabelKey in project head by mifos.
the class MessageLookup method updateLookupValueInCache.
public void updateLookupValueInCache(String lookupKey, String newValue) {
synchronized (labelCache) {
LabelKey key = new LabelKey(lookupKey, getLocaleId());
if (labelCache.containsKey(key)) {
labelCache.remove(key);
labelCache.put(key, newValue);
} else {
labelCache.put(key, newValue);
}
}
}
use of org.mifos.config.util.helpers.LabelKey in project head by mifos.
the class MessageLookup method updateLabelKey.
public void updateLabelKey(String keyString, String newLabelValue, Short localeId) {
synchronized (labelCache) {
LabelKey key = new LabelKey(keyString, localeId);
if (labelCache.containsKey(key)) {
labelCache.remove(key);
labelCache.put(key, newLabelValue);
} else {
labelCache.put(key, newLabelValue);
}
}
}
use of org.mifos.config.util.helpers.LabelKey in project head by mifos.
the class MessageLookup method updateLabelCache.
public void updateLabelCache() {
List<LookUpValueEntity> lookupValueEntities = applicationConfigurationDao.findLookupValues();
for (LookUpValueEntity lookupValueEntity : lookupValueEntities) {
String keyString = lookupValueEntity.getPropertiesKey();
if (keyString == null) {
throw new IllegalStateException("Key is empty");
}
String messageText = lookupValueEntity.getMessageText();
if (StringUtils.isBlank(messageText)) {
messageText = lookup(keyString);
}
labelCache.put(new LabelKey(keyString, getLocaleId()), messageText);
}
}
use of org.mifos.config.util.helpers.LabelKey in project head by mifos.
the class ConfigurationIntegrationTest method testLabelKey.
/*
* Will be uncommented when spanish values will be entered in master data.
* @Test
public void testGetLabelValueSpanish(){Assert.assertEquals("Entrada agranel
* ",MifosConfiguration.getInstance().getLabelValue(ConfigurationConstants.BULKENTRY,(short)2))
* ; }
*/
@Test
public void testLabelKey() {
LabelKey labelKey = new LabelKey("key", (short) 1);
Assert.assertEquals("[localeId=1][key=key]", labelKey.toString());
Assert.assertEquals(false, labelKey.equals(null));
LabelKey labelKeyToCompare = new LabelKey("key", (short) 2);
Assert.assertEquals(false, labelKey.equals(labelKeyToCompare));
}
Aggregations