if (lessonBeingEdited != null) { infoLesson.setIdInternal(lessonBeingEdited.getIdInternal()); }
	public ActionForward chooseRoom(		ActionMapping mapping,		ActionForm form,		HttpServletRequest request,		HttpServletResponse response)		throws Exception {		DynaActionForm manageLessonForm = (DynaActionForm) form;		DiaSemana weekDay =			new DiaSemana(				new Integer(					formDay2EnumerateDay(						(String) manageLessonForm.get("diaSemana"))));		Calendar inicio = Calendar.getInstance();		inicio.set(			Calendar.HOUR_OF_DAY,			Integer.parseInt((String) manageLessonForm.get("horaInicio")));		inicio.set(			Calendar.MINUTE,			Integer.parseInt((String) manageLessonForm.get("minutosInicio")));		inicio.set(Calendar.SECOND, 0);		Calendar fim = Calendar.getInstance();		fim.set(			Calendar.HOUR_OF_DAY,			Integer.parseInt((String) manageLessonForm.get("horaFim")));		fim.set(			Calendar.MINUTE,			Integer.parseInt((String) manageLessonForm.get("minutosFim")));		fim.set(Calendar.SECOND, 0);		InfoRoom infoSala = new InfoRoom();		infoSala.setNome((String) manageLessonForm.get("nomeSala"));		ActionErrors actionErrors =			checkTimeIntervalAndWeekDay(inicio, fim, weekDay);		if (actionErrors.isEmpty()) {			InfoRoom infoRoom = new InfoRoom();			infoRoom.setCapacidadeNormal(new Integer(0));			infoRoom.setCapacidadeExame(new Integer(0));			InfoLesson infoLesson = new InfoLesson();			infoLesson.setDiaSemana(weekDay);			infoLesson.setInicio(inicio);			infoLesson.setFim(fim);			InfoExecutionPeriod infoExecutionPeriod =				(InfoExecutionPeriod) (request					.getAttribute(SessionConstants.EXECUTION_PERIOD));			Object args[] = { infoRoom, infoLesson, infoExecutionPeriod };			List emptyRoomsList =				(List) ServiceUtils.executeService(					SessionUtils.getUserView(request),					"ReadEmptyRoomsService",					args);			if (emptyRoomsList == null || emptyRoomsList.isEmpty()) {				actionErrors.add(					"search.empty.rooms.no.rooms",					new ActionError("search.empty.rooms.no.rooms"));				saveErrors(request, actionErrors);				return mapping.getInputForward();			}			String action = request.getParameter("action");			if (action != null && action.equals("edit")) {				// Permit selection of current room only if the day didn't				// change and the hour is contained within the original hour				InfoLesson infoLessonOld =					(InfoLesson) request.getAttribute(SessionConstants.LESSON);				if (contained(infoLessonOld, infoLesson)) {					emptyRoomsList.add(						0,						((InfoLesson) request							.getAttribute(SessionConstants.LESSON))							.getInfoSala());				}				manageLessonForm.set(					"nomeSala",					""						+ ((InfoLesson) request							.getAttribute(SessionConstants.LESSON))							.getInfoSala()							.getNome());			}			Collections.sort(emptyRoomsList, new RoomAlphabeticComparator());			List listaSalas = new ArrayList();			for (int i = 0; i < emptyRoomsList.size(); i++) {				InfoRoom elem = (InfoRoom) emptyRoomsList.get(i);				listaSalas.add(					new LabelValueBean(elem.getNome(), elem.getNome()));			}			request.setAttribute("action", action);			//emptyRoomsList.add(0, infoSala);			//sessao.removeAttribute("listaSalas");			//sessao.removeAttribute("listaInfoSalas");			request.setAttribute("listaSalas", listaSalas);			//request.setAttribute("listaInfoSalas", emptyRoomsList);			//			request.setAttribute(SessionConstants.LESSON, infoLesson);			request.setAttribute("manageLessonForm", manageLessonForm);			return mapping.findForward("ShowChooseRoomForm");		} else {			saveErrors(request, actionErrors);			return mapping.getInputForward();		}	}