/**
* Prepare data as expected by ApplicationResultAction (could be cleaned up a lot)
*/
public ActionForward searchApplication(ActionMapping mapping, ActionForm form, HttpServletRequest req, HttpServletResponse resp) {
CriteriaSelectForm f = (CriteriaSelectForm)form;
Map<String, String[][]> criteriasInGroupsAndCategories = new HashMap<String, String[][]>();
String[] categoryNames = (String[])req.getSession().getAttribute(ATTR_CATEGORYNAMES);
if (categoryNames == null){ // probably session time out
return mapping.findForward("cancelled");
}
for (int i=0; i<categoryNames.length; i++) {
String[][] criterias = new String[MAX_NOF_GROUPS][];
criterias[0] = f.getCriterias(i, 0);
criterias[1] = f.getCriterias(i, 1);
criterias[2] = f.getCriterias(i, 2);
criteriasInGroupsAndCategories.put(categoryNames[i], criterias);
}
req.getSession().setAttribute(ATTR_CRITERIAS_IN_GROUPS_AND_CATEGORIES, criteriasInGroupsAndCategories);
Category[] categories = prepareCategories(req);
String[][][] criterianames = prepareGroupsAndCriteria(req, categories);
boolean[][][] selected = new boolean[MAX_NOF_CATEGORIES][MAX_NOF_GROUPS][];
for (int cat = 0; cat < criterianames.length; cat++) {
for (int g = 0; g < criterianames[cat].length; g++) {
boolean selectedInGroup[] = new boolean[criterianames[cat][g].length];
for (int c = 0; c < criterianames[cat][g].length; c++) {
selectedInGroup[c] = f.isSelectedCriteria(cat, g, c);
}
selected[cat][g] = selectedInGroup;
}
}
req.getSession().setAttribute("selectedcriterias", selected);