final List<ExecutionPeriod> executionPeriods = (List<ExecutionPeriod>) ServiceUtils
final Collection<ExecutionPeriod> executionPeriods = (Collection<ExecutionPeriod>) ServiceUtils
    public ActionForward roomViewer(ActionMapping mapping, ActionForm form, HttpServletRequest request,            HttpServletResponse response) throws Exception {        HttpSession session = request.getSession();        IUserView userView = (IUserView) session.getAttribute(SessionConstants.U_VIEW);        String roomName = request.getParameter("roomName");        if (roomName == null) {            roomName = (String) request.getAttribute("roomName");        }        request.setAttribute("roomName", roomName);        RoomKey roomKey = null;        if (roomName != null) {            roomKey = new RoomKey(roomName);            ISiteComponent bodyComponent = new InfoSiteRoomTimeTable();            DynaActionForm indexForm = (DynaActionForm) form;            Integer indexWeek = (Integer) indexForm.get("indexWeek");            // Integer executionPeriodID = (Integer)            // indexForm.get("selectedExecutionPeriodID");            String executionPeriodIDString = request.getParameter("selectedExecutionPeriodID");            if (executionPeriodIDString == null) {                executionPeriodIDString = (String) request.getAttribute("selectedExecutionPeriodID");            }            Integer executionPeriodID = (executionPeriodIDString != null) ? Integer                    .valueOf(executionPeriodIDString) : null;            if (executionPeriodID == null) {                try {                    // executionPeriodID = (Integer)                    // indexForm.get("selectedExecutionPeriodID");                    executionPeriodID = Integer.valueOf((String) indexForm                            .get("selectedExecutionPeriodID"));                } catch (IllegalArgumentException ex) {                }            }            Calendar today = Calendar.getInstance();            ArrayList weeks = new ArrayList();            InfoExecutionPeriod executionPeriod;            if (executionPeriodID == null) {                executionPeriod = (InfoExecutionPeriod) ServiceUtils.executeService(userView,                        "ReadCurrentExecutionPeriod", new Object[] {});                try {                    indexForm.set("selectedExecutionPeriodID", executionPeriod.getIdInternal()                            .toString());                } catch (IllegalArgumentException ex) {                }            } else {                executionPeriod = (InfoExecutionPeriod) ServiceUtils.executeService(userView,                        "ReadExecutionPeriodByOID", new Object[] { executionPeriodID });            }            try {                // weeks                Calendar begin = Calendar.getInstance();                begin.setTime(executionPeriod.getBeginDate());                Calendar end = Calendar.getInstance();                end.setTime(executionPeriod.getEndDate());                ArrayList weeksLabelValueList = new ArrayList();                begin.add(Calendar.DATE, Calendar.MONDAY - begin.get(Calendar.DAY_OF_WEEK));                int i = 0;                boolean selectedWeek = false;                while (begin.before(end) || begin.before(Calendar.getInstance())) {                    Calendar day = Calendar.getInstance();                    day.setTimeInMillis(begin.getTimeInMillis());                    weeks.add(day);                    String beginWeekString = DateFormatUtils.format(begin.getTime(), "dd/MM/yyyy");                    begin.add(Calendar.DATE, 5);                    String endWeekString = DateFormatUtils.format(begin.getTime(), "dd/MM/yyyy");                    weeksLabelValueList.add(new LabelValueBean(beginWeekString + " - " + endWeekString,                            new Integer(i).toString()));                    begin.add(Calendar.DATE, 2);                    if (!selectedWeek && indexWeek == null && Calendar.getInstance().before(begin)) {                        indexForm.set("indexWeek", new Integer(i));                        selectedWeek = true;                    }                    i++;                }                final List<ExecutionPeriod> executionPeriods = (List<ExecutionPeriod>) ServiceUtils                        .executeService(userView, "ReadAllDomainObjects",                                new Object[] { ExecutionPeriod.class });                final List<LabelValueBean> executionPeriodLabelValueBeans = new ArrayList<LabelValueBean>();                for (final ExecutionPeriod ep : executionPeriods) {                    if (ep.getState() == PeriodState.OPEN || ep.getState() == PeriodState.CURRENT) {                        executionPeriodLabelValueBeans.add(new LabelValueBean(ep.getName() + " "                                + ep.getExecutionYear().getYear(), ep.getIdInternal().toString()));                    }                }                request.setAttribute(SessionConstants.LABELLIST_EXECUTIONPERIOD,                        executionPeriodLabelValueBeans);                request.setAttribute(SessionConstants.LABELLIST_WEEKS, weeksLabelValueList);            } catch (FenixServiceException e) {                throw new FenixActionException();            }            if (indexWeek != null) {                today = (Calendar) weeks.get(indexWeek.intValue());            }            Object[] args = { bodyComponent, roomKey, today, executionPeriodID };            try {                SiteView siteView = (SiteView) ServiceUtils.executeService(null,                        "RoomSiteComponentServiceByExecutionPeriodID", args);                request.setAttribute("siteView", siteView);            } catch (NonExistingServiceException e) {                throw new NonExistingActionException(e);            } catch (FenixServiceException e) {                throw new FenixActionException(e);            }            return mapping.findForward("roomViewer");        }        throw new FenixActionException();    }