Package org.fenixedu.academic.dto

Examples of org.fenixedu.academic.dto.InfoSiteRoomTimeTable


        RoomKey roomKey = null;

        if (roomName != null) {
            roomKey = new RoomKey(roomName);

            InfoSiteRoomTimeTable 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");
            }
            String executionPeriodID = (executionPeriodIDString != null) ? executionPeriodIDString : null;
            if (executionPeriodID == null) {
                try {
                    // executionPeriodID = (Integer)
                    // indexForm.get("selectedExecutionPeriodID");
                    executionPeriodID =
                            indexForm.get("selectedExecutionPeriodID").equals("") ? null : (String) indexForm
                                    .get("selectedExecutionPeriodID");
                } catch (IllegalArgumentException ex) {
                }
            }
            Calendar today = new DateMidnight().toCalendar(null);
            ArrayList weeks = new ArrayList();

            InfoExecutionPeriod executionPeriod;
            if (executionPeriodID == null) {
                executionPeriod = ReadCurrentExecutionPeriod.run();
                executionPeriodID = executionPeriod.getExternalId();
                try {
                    indexForm.set("selectedExecutionPeriodID", executionPeriod.getExternalId().toString());
                } catch (IllegalArgumentException ex) {
                }
            } else {
                executionPeriod = ReadExecutionPeriodByOID.run(executionPeriodID);
            }

            // 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 Collection<ExecutionSemester> executionSemesters = rootDomainObject.getExecutionPeriodsSet();
            final List<LabelValueBean> executionPeriodLabelValueBeans = new ArrayList<LabelValueBean>();
            for (final ExecutionSemester ep : executionSemesters) {
                if (ep.getState().equals(PeriodState.OPEN) || ep.getState().equals(PeriodState.CURRENT)) {
                    executionPeriodLabelValueBeans.add(new LabelValueBean(ep.getName() + " " + ep.getExecutionYear().getYear(),
                            ep.getExternalId().toString()));
                }
            }
            request.setAttribute(PresentationConstants.LABELLIST_EXECUTIONPERIOD, executionPeriodLabelValueBeans);

            request.setAttribute(PresentationConstants.LABELLIST_WEEKS, weeksLabelValueList);
            if (indexWeek != null) {
                final int xpto = indexWeek.intValue();
                if (xpto < weeks.size()) {
                    today = (Calendar) weeks.get(xpto);
                } else {
                    today = (Calendar) weeks.iterator().next();
                    indexForm.set("indexWeek", new Integer(0));
                }
            }

            try {
                InfoSiteRoomTimeTable component = run(roomKey, today, executionPeriodID);
                request.setAttribute("component", component);
            } catch (NonExistingServiceException e) {
                throw new NonExistingActionException(e);
            } catch (FenixServiceException e) {
                throw new FenixActionException(e);
View Full Code Here


                        infoShowOccupations.add(new InfoOccupation(roomOccupation, interval));
                    }
                }
            }
        }
        InfoSiteRoomTimeTable component = new InfoSiteRoomTimeTable();

        component.setInfoShowOccupation(infoShowOccupations);
        component.setInfoRoom(InfoRoom.newInfoFromDomain(room));

        return component;
    }
View Full Code Here

        return Response.ok(stream, contentType).header("Content-Disposition", "attachment; filename=" + filename).build();
    }

    private FenixSpace.Room getFenixRoom(Space room, java.util.Calendar rightNow) {

        InfoSiteRoomTimeTable bodyComponent = RoomSiteComponentBuilder.getInfoSiteRoomTimeTable(rightNow, room, null);
        List<FenixRoomEvent> roomEvents = new ArrayList<FenixRoomEvent>();

        try {
            for (Object occupation : bodyComponent.getInfoShowOccupation()) {
                InfoShowOccupation showOccupation = (InfoShowOccupation) occupation;
                DateTime date = new DateTime(rightNow);
                DateTime newDate = date.withDayOfWeek(showOccupation.getDiaSemana().getDiaSemanaInDayOfWeekJodaFormat());
                String day = newDate.toString("dd/MM/yyyy");
View Full Code Here

TOP

Related Classes of org.fenixedu.academic.dto.InfoSiteRoomTimeTable

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.