}
public ActionForward search(ActionMapping mapping, ActionForm actionForm, HttpServletRequest request,
HttpServletResponse response) throws Exception {
FindSpacesBean bean = getRenderedObject("beanWithLabelToSearchID");
if (bean != null) {
String labelToSearch = bean.getLabelToSearch();
Space campus = bean.getCampus();
Space building = bean.getBuilding();
if (campus != null && building == null && (labelToSearch == null || StringUtils.isEmpty(labelToSearch.trim()))) {
addActionMessage(request, "error.findSpaces.empty.building");
request.setAttribute("bean", bean);
return mapping.findForward("listFoundSpaces");
}
if (campus == null && (labelToSearch == null || StringUtils.isEmpty(labelToSearch.trim()))) {
addActionMessage(request, "error.findSpaces.empty.labelToSearch");
request.setAttribute("bean", bean);
return mapping.findForward("listFoundSpaces");
}
List<FindSpacesBean> result = new ArrayList<FindSpacesBean>();
Set<Space> resultSpaces = SpaceUtils.findSpaces(labelToSearch, campus, building, bean.getSearchType());
for (Space space : resultSpaces) {
result.add(new FindSpacesBean(space, bean.getSearchType(), AcademicInterval
.readDefaultAcademicInterval(AcademicPeriod.SEMESTER)));
}
request.setAttribute("foundSpaces", result);
}