public static List<ExecutionDegree> filterByAcademicInterval(AcademicInterval academicInterval) { AcademicCalendarEntry academicCalendarEntry = academicInterval.getAcademicCalendarEntry(); while (!(academicCalendarEntry instanceof AcademicCalendarRootEntry)) { if (academicCalendarEntry instanceof AcademicYearCE) { ExecutionYear year = ExecutionYear.getExecutionYear((AcademicYearCE) academicCalendarEntry); List<ExecutionDegree> result = new ArrayList<ExecutionDegree>(); result.addAll(year.getExecutionDegreesSet()); return result; } else { academicCalendarEntry = academicCalendarEntry.getParentEntry(); } } return Collections.emptyList(); }
@EntryPoint public ActionForward prepare( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { ContextSelectionBean contextSelectionBean = (ContextSelectionBean) request.getAttribute(PresentationConstants.CONTEXT_SELECTION_BEAN); final StudentContextSelectionBean studentContextSelectionBean = new StudentContextSelectionBean(contextSelectionBean.getAcademicInterval()); request.setAttribute("studentContextSelectionBean", studentContextSelectionBean); final List<ExecutionDegree> executionDegrees = new ArrayList<ExecutionDegree>( ExecutionDegree.filterByAcademicInterval(contextSelectionBean.getAcademicInterval())); Collections.sort(executionDegrees, executionDegreeComparator); request.setAttribute("executionDegrees", executionDegrees); ExecutionSemester executionSemester = (ExecutionSemester) ExecutionInterval.getExecutionInterval(contextSelectionBean.getAcademicInterval()); request.setAttribute("executionSemester", executionSemester); AcademicCalendarEntry academicCalendarEntry = contextSelectionBean.getAcademicInterval().getAcademicCalendarEntry(); while (!(academicCalendarEntry instanceof AcademicCalendarRootEntry)) { if (academicCalendarEntry instanceof AcademicYearCE) { ExecutionYear year = ExecutionYear.getExecutionYear((AcademicYearCE) academicCalendarEntry); request.setAttribute("executionYear", year); break; } else { academicCalendarEntry = academicCalendarEntry.getParentEntry(); } } if (!executionSemester.isCurrent()) { request.setAttribute("noEditionAllowed", true); } return mapping.findForward("showForm"); }
private boolean isActiveForCalendarEntry(AcademicCalendarEntry entry) { if (entry instanceof AcademicCalendarRootEntry) { return false; } if (entry instanceof AcademicYearCE) { return intersects(entry.getBegin().toDate(), entry.getEnd().toDate()); } if (intersects(entry.getBegin().toDate(), entry.getEnd().toDate()) && new Integer(entry.getAcademicSemesterOfAcademicYear(entry.getAcademicChronology())) .equals(getCurricularSemester().getSemester())) { return true; } return isActiveForCalendarEntry(entry.getParentEntry()); }
public static CalendarEntryBean createCalendarEntryBeanToEditEntry( AcademicCalendarRootEntry rootEntry, AcademicCalendarEntry entry, Partial begin, Partial end) { CalendarEntryBean bean = new CalendarEntryBean(); bean.setRootEntry(rootEntry); bean.setEntry(entry); bean.setBeginDateToDisplay(begin); bean.setEndDateToDisplay(end); bean.setTemplateEntry(entry.getTemplateEntry()); bean.setType(entry.getClass()); bean.setTitle(entry.getTitle()); bean.setDescription(entry.getDescription()); bean.setBegin(entry.getBegin()); bean.setEnd(entry.getEnd()); return bean; }