// inject labelarchive param if mgblpresetlabel is there
String labelArchiveParam = req.getParameter("labelarchive");
if (labelArchiveParam == null) { // try mgblPresetLabel
String presetLabelString = (String)req.getSession().getAttribute("mgblPresetLabel");
if (presetLabelString != null) {
Label presetLabel = blogMgr.getLabel(blog, presetLabelString);
if (presetLabel != null) {
labelArchiveParam = Long.toString(presetLabel.getId());
req.setAttribute("labelarchive", labelArchiveParam);
}
}
}
ActionForward fwd = super.view(mapping, form, req, resp);
if (labelArchiveParam != null && labelArchiveParam.length() > 0) {
Label label = blogMgr.getLabel(blog, Long.parseLong(labelArchiveParam));
req.getSession().setAttribute("mgblPresetLabel", label.getLabel());
Blog gameStyleBlog = blogMgr.getBlog("mgblgamestyles", blog.getGroup());
req.getSession().removeAttribute("mgblCurrentGameStyle");
req.getSession().removeAttribute("mgblCurrentGameStyleBelongsToSearchResult");
for (Article style : gameStyleBlog.getArticles()) {
if (label.getLabel().equals(style.getTitle())) {
req.getSession().setAttribute("mgblCurrentGameStyle", new DisplayableArticle(style));
List<Long> searchResults = (List<Long>)req.getSession().getAttribute("mgblSearchResults");
if (searchResults != null && searchResults.contains(style.getId())) {
req.getSession().setAttribute("mgblCurrentGameStyleBelongsToSearchResult", Boolean.TRUE);
}