use of org.mifos.framework.exceptions.TableTagException in project head by mifos.
the class Text method getImage.
// to get Image
static String getImage(Object obj, String name, Locale locale) throws TableTagException {
StringBuilder stringbuilder = new StringBuilder();
Method method = null;
Object customerType = null;
String textValue = null;
String imagePath = null;
try {
method = obj.getClass().getDeclaredMethod("getCustomerType", (Class[]) null);
customerType = method.invoke(obj, (Object[]) null);
} catch (NoSuchMethodException nsme) {
throw new TableTagException(nsme.getMessage());
} catch (IllegalArgumentException iae) {
throw new TableTagException(iae);
} catch (IllegalAccessException iae) {
throw new TableTagException(iae);
} catch (InvocationTargetException ite) {
throw new TableTagException(ite);
}
Properties filePaths = getNonLocalizedFileLookupDatabase();
if (customerType != null && (customerType.toString().equals("4") || customerType.toString().equals("5"))) {
textValue = MessageLookup.getLocalizedMessage("loanaccount_stateid_" + name);
imagePath = filePaths.getProperty("loanaccount_imageid_" + name);
} else if (customerType != null && (customerType.toString().equals("6") || customerType.toString().equals("7") || customerType.toString().equals("8"))) {
textValue = MessageLookup.getLocalizedMessage("savings_stateid_" + name);
imagePath = filePaths.getProperty("savings_imageid_" + name);
} else {
textValue = MessageLookup.getLocalizedMessage("value_" + name);
imagePath = filePaths.getProperty("image_" + name);
}
stringbuilder.append("<span class=\"fontnormal\">").append(" ").append("<img src=").append(imagePath).append(" width=\"8\" height=\"9\">").append("</span>").append("<span class=\"fontnormal\">").append(" ").append(textValue).append("</span>");
return stringbuilder.toString();
}
use of org.mifos.framework.exceptions.TableTagException in project head by mifos.
the class TableTagIntegrationTest method testTableTagException.
@Test
public void testTableTagException() throws Exception {
try {
Locale locale = Localization.getInstance().getConfiguredLocale();
Text.getImage(this, "name", locale);
Assert.fail();
} catch (TableTagException tte) {
Assert.assertEquals("exception.framework.TableTagException", tte.getKey());
}
}
Aggregations