return mapping.findForward("history");
}
public ActionForward historyFilter(ActionMapping mapping, ActionForm actionForm, HttpServletRequest request,
HttpServletResponse response) throws Exception {
PhotographFilterBean filter = getRenderedObject("historyFilter");
Set<Photograph> photos = rootDomainObject.getPhotographsSet();
SortedMap<Person, UserHistory> history = new TreeMap<Person, UserHistory>();
for (Photograph photograph : photos) {
if (filter.accepts(photograph)) {
Person person = photograph.getPerson();
if (history.containsKey(person)) {
history.get(person).addPhotograph(photograph);
} else {
UserHistory user = new UserHistory(person);
user.addPhotograph(photograph);
history.put(person, user);
}
}
}
request.setAttribute("filter", new PhotographFilterBean());
request.setAttribute("history", history.values());
return mapping.findForward("history");
}