HashMap<String, BreadCrumbItem> breadCrumbs = new HashMap<String, BreadCrumbItem>();
if (menus != null) {
for (int a = 0; a < menus.length; a++) {
Menu menu = menus[a];
if (menu.getId() != null) {
BreadCrumbItem bc = new BreadCrumbItem();
java.util.ResourceBundle bundle = null;
try {
if(menu.getI18nBundle() != null){
bundle = java.util.ResourceBundle.getBundle(menu.getI18nBundle(), request.getLocale());
}
} catch (java.util.MissingResourceException e) {
if (log.isDebugEnabled()) {
log.debug("Cannot find resource bundle : " + menu.getI18nBundle());
}
}
String menuText = menu.getI18nKey();
if (bundle != null) {
String tmp = null;
try {
if(menu.getI18nKey() != null){
tmp = bundle.getString(menu.getI18nKey());
}
} catch (java.util.MissingResourceException e) {
//Missing key should not be a blocking factor for UI rendering
if (log.isDebugEnabled()) {
log.debug("Cannot find resource for key :" + menu.getI18nKey());
}
}
if (tmp != null) {
menuText = tmp;
}
}
bc.setConvertedText(menuText);
bc.setI18nBundle(menu.getI18nBundle());
bc.setI18nKey(menu.getI18nKey());
bc.setId(menu.getId());
bc.setLink(menu.getLink() + "?region=" + menu.getRegion() + "&item=" +
menu.getId() + (menu.getUrlParameters() != null ?
"&" + menu.getUrlParameters() : "") + "&ordinal=0");
breadCrumbs.put(menu.getId(), bc);
}
}