public ActionForward createShift(ActionMapping mapping, ActionForm form, HttpServletRequest request,
HttpServletResponse response) throws Exception {
DynaActionForm createShiftForm = (DynaActionForm) form;
InfoShiftEditor infoShift = new InfoShiftEditor();
infoShift.setAvailabilityFinal(new Integer(0));
InfoExecutionCourse infoExecutionCourse =
RequestUtils.getExecutionCourseBySigla(request, (String) createShiftForm.get("courseInitials"));
infoShift.setInfoDisciplinaExecucao(infoExecutionCourse);
infoShift.setInfoLessons(null);
infoShift.setLotacao((Integer) createShiftForm.get("lotacao"));
infoShift.setNome((String) createShiftForm.get("nome"));
String[] selectedShiftTypes = (String[]) createShiftForm.get("shiftTiposAula");
if (selectedShiftTypes.length == 0) {
ActionErrors actionErrors = new ActionErrors();
actionErrors.add("errors.shift.types.notSelected", new ActionError("errors.shift.types.notSelected"));
saveErrors(request, actionErrors);
return mapping.getInputForward();
}
final List<ShiftType> shiftTypes = new ArrayList<ShiftType>();
for (String selectedShiftType : selectedShiftTypes) {
shiftTypes.add(ShiftType.valueOf(selectedShiftType.toString()));
}
infoShift.setTipos(shiftTypes);
// try {
final InfoShift newInfoShift = CriarTurno.run(infoShift);
request.setAttribute(PresentationConstants.SHIFT, newInfoShift);