}
public ActionForward prepareCreateComplexSummary(ActionMapping mapping, ActionForm form, HttpServletRequest request,
HttpServletResponse response) {
Professorship loggedProfessorship = (Professorship) request.getAttribute("loggedTeacherProfessorship");
ExecutionCourse executionCourse = (ExecutionCourse) request.getAttribute("executionCourse");
DynaActionForm dynaActionForm = (DynaActionForm) form;
String[] selectedLessons = request.getParameterValues("selectedLessonAndDate");
if (selectedLessons == null || selectedLessons.length == 0) {
return goToInsertComplexSummaryAgain(request, mapping, response, form);
} else if (selectedLessons != null && selectedLessons.length != 0) {
boolean uniqueType = true;
ShiftType shiftType = null;
List<NextPossibleSummaryLessonsAndDatesBean> nextPossibleLessonsDates =
new ArrayList<NextPossibleSummaryLessonsAndDatesBean>();
for (String lessonRepresentation : selectedLessons) {
NextPossibleSummaryLessonsAndDatesBean nextLesson =
NextPossibleSummaryLessonsAndDatesBean.getNewInstance(lessonRepresentation);
if (nextLesson.getLesson().getShift().getCourseLoadsSet().size() == 1) {
nextLesson.setLessonType(nextLesson.getLesson().getShift().getCourseLoadsSet().iterator().next().getType());
}
nextPossibleLessonsDates.add(nextLesson);
ShiftType lessonType = null;
if (nextLesson.getLesson().getShift().getCourseLoadsSet().size() == 1) {
lessonType = nextLesson.getLesson().getShift().getCourseLoadsSet().iterator().next().getType();
if (shiftType == null) {
shiftType = lessonType;
} else if (!shiftType.equals(lessonType)) {
request.setAttribute("notShowLessonPlanningsAndSummaries", Boolean.TRUE);
uniqueType = false;
}
} else {
request.setAttribute("notShowLessonPlanningsAndSummaries", Boolean.TRUE);
uniqueType = false;
}
}
SummariesManagementBean bean =
new SummariesManagementBean(SummariesManagementBean.SummaryType.NORMAL_SUMMARY, executionCourse,
loggedProfessorship, nextPossibleLessonsDates);
bean.setTaught(true);
if (uniqueType) {
bean.setLessonType(shiftType);
}
request.setAttribute("summariesManagementBean", bean);
dynaActionForm.set("teacher", loggedProfessorship.getExternalId().toString());
return mapping.findForward("prepareInsertComplexSummary");
}
return prepareShowSummaries(mapping, form, request, response);
}