org.apache.commons.collections.comparators.ReverseComparator Java Examples

The following examples show how to use org.apache.commons.collections.comparators.ReverseComparator. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Degree.java    From fenixedu-academic with GNU Lesser General Public License v3.0 6 votes vote down vote up
final private Collection<Coordinator> getCurrentCoordinators(final boolean responsible) {
    SortedSet<ExecutionYear> years = new TreeSet<ExecutionYear>(new ReverseComparator(ExecutionYear.COMPARATOR_BY_YEAR));
    years.addAll(getDegreeCurricularPlansExecutionYears());

    ExecutionYear current = ExecutionYear.readCurrentExecutionYear();
    for (ExecutionYear year : years) {
        if (year.isAfter(current)) {
            continue;
        }

        Collection<Coordinator> coordinators = getCoordinators(year, responsible);
        if (!coordinators.isEmpty()) {
            return coordinators;
        }
    }

    return Collections.emptyList();
}
 
Example #2
Source File: Service.java    From viritin with Apache License 2.0 6 votes vote down vote up
public static List<Person> findAll(long start, long maxResults, String sortProperty, boolean asc) {
    System.err.println("findAll " + start + " " + maxResults);
    if (pagedBase == null) {
        pagedBase = getListOfPersons((int) COUNT);
    }
    int end = (int) (start + maxResults);
    if (end > pagedBase.size()) {
        end = pagedBase.size();
    }
    
    if(sortProperty != null) {
        if(!asc) {
        	pagedBase.sort(new ReverseComparator(new BeanComparator<Person>(sortProperty)));
        } else {
            pagedBase.sort(new BeanComparator<Person>(sortProperty));
        }
    }
    
    return pagedBase.subList((int) start, end);
}
 
Example #3
Source File: DisplayEvaluationsForStudentToEnrol.java    From fenixedu-academic with GNU Lesser General Public License v3.0 6 votes vote down vote up
public List<SelectItem> getExecutionPeriodsLabels() {
    if (this.executionPeriodsLabels == null) {
        this.executionPeriodsLabels = new ArrayList();

        final List<InfoExecutionPeriod> infoExecutionPeriods = getExecutionPeriods();
        final ComparatorChain comparatorChain = new ComparatorChain();
        comparatorChain.addComparator(new ReverseComparator(new BeanComparator("infoExecutionYear.year")));
        comparatorChain.addComparator(new ReverseComparator(new BeanComparator("semester")));
        Collections.sort(infoExecutionPeriods, comparatorChain);
        for (final InfoExecutionPeriod infoExecutionPeriod : infoExecutionPeriods) {
            final SelectItem selectItem = new SelectItem();
            selectItem.setValue(infoExecutionPeriod.getExternalId());
            selectItem.setLabel(infoExecutionPeriod.getName() + " - " + infoExecutionPeriod.getInfoExecutionYear().getYear());
            this.executionPeriodsLabels.add(selectItem);
        }
    }
    return this.executionPeriodsLabels;
}
 
Example #4
Source File: CoordinatorEvaluationManagementBackingBean.java    From fenixedu-academic with GNU Lesser General Public License v3.0 6 votes vote down vote up
public List<SelectItem> getExecutionPeriodsLabels() {
    if (this.executionPeriodsLabels == null) {
        this.executionPeriodsLabels = new ArrayList();

        final List<InfoExecutionPeriod> infoExecutionPeriods = getExecutionPeriods();
        final ComparatorChain comparatorChain = new ComparatorChain();
        comparatorChain.addComparator(new ReverseComparator(new BeanComparator("infoExecutionYear.year")));
        comparatorChain.addComparator(new ReverseComparator(new BeanComparator("semester")));
        Collections.sort(infoExecutionPeriods, comparatorChain);
        for (final InfoExecutionPeriod infoExecutionPeriod : infoExecutionPeriods) {
            final SelectItem selectItem = new SelectItem();
            selectItem.setValue(infoExecutionPeriod.getExternalId());
            selectItem.setLabel(infoExecutionPeriod.getName() + " - " + infoExecutionPeriod.getInfoExecutionYear().getYear());
            this.executionPeriodsLabels.add(selectItem);
        }
    }
    return this.executionPeriodsLabels;
}
 
Example #5
Source File: ExecutionPeriodsFrom1Sem0607.java    From fenixedu-academic with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public Object provide(Object source, Object currentValue) {

    /*
     * get executionPeriods after '1 Semestre 2006/2007'
     */
    final ExecutionSemester currentExecutionPeriod = ExecutionSemester.readBySemesterAndExecutionYear(1, "2006/2007");

    final List<ExecutionSemester> result = new ArrayList<ExecutionSemester>();
    for (final ExecutionSemester executionSemester : ExecutionSemester.readNotClosedPublicExecutionPeriods()) {
        if (executionSemester.isAfterOrEquals(currentExecutionPeriod)) {
            result.add(executionSemester);
        }
    }
    Collections.sort(result, new ReverseComparator());
    return result;
}
 
Example #6
Source File: CompetenceCourseManagementBackingBean.java    From fenixedu-academic with GNU Lesser General Public License v3.0 6 votes vote down vote up
public List<SelectItem> getExecutionYears() {
    if (selectedYears == null) {

        ExecutionYear year = null;
        if (getCompetenceCourse() != null) {
            final ExecutionSemester semester = getCompetenceCourse().getStartExecutionSemester();
            year = semester != null ? semester.getExecutionYear() : null;
        }

        selectedYears = new ArrayList<SelectItem>();
        for (ExecutionYear executionYear : ExecutionYear.readNotClosedExecutionYears()) {
            if (year == null || executionYear.isAfterOrEquals(year)) {
                selectedYears.add(new SelectItem(executionYear.getExternalId(), executionYear.getYear()));
            }
        }
        Collections.sort(selectedYears, new ReverseComparator(new BeanComparator("label")));
    }

    return selectedYears;
}
 
Example #7
Source File: PhdManageEnrolmentsExecutionSemestersProvider.java    From fenixedu-academic with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public Object provide(Object source, Object obj) {
    final ManageEnrolmentsBean bean = (ManageEnrolmentsBean) source;

    final List<ExecutionSemester> result = new ArrayList<ExecutionSemester>();

    ExecutionSemester each = bean.getProcess().getExecutionYear().getFirstExecutionPeriod();
    while (each != null) {
        result.add(each);
        each = each.getNextExecutionPeriod();
    }

    Collections.sort(result, new ReverseComparator(ExecutionSemester.COMPARATOR_BY_SEMESTER_AND_YEAR));

    return result;
}
 
Example #8
Source File: ManageThesisDA.java    From fenixedu-academic with GNU Lesser General Public License v3.0 6 votes vote down vote up
private ThesisContextBean getContextBean(HttpServletRequest request) {
    ThesisContextBean bean = getRenderedObject("contextBean");
    RenderUtils.invalidateViewState("contextBean");

    if (bean != null) {
        return bean;
    } else {
        ExecutionYear executionYear = getExecutionYear(request);

        if (executionYear == null) {
            executionYear = ExecutionYear.readCurrentExecutionYear();
        }

        TreeSet<ExecutionYear> executionYears = new TreeSet<ExecutionYear>(new ReverseComparator());
        executionYears.addAll(getDegreeCurricularPlan(request).getExecutionYears());

        return new ThesisContextBean(executionYears, executionYear);
    }
}
 
Example #9
Source File: ManageThesisDA.java    From fenixedu-academic with GNU Lesser General Public License v3.0 6 votes vote down vote up
private ExecutionYear getExecutionYear(HttpServletRequest request) {
    String id = request.getParameter("executionYearId");
    if (id == null) {
        id = request.getParameter("executionYear");
    }
    if (id == null) {
        TreeSet<ExecutionYear> executionYears = new TreeSet<ExecutionYear>(new ReverseComparator());
        executionYears.addAll(getDegreeCurricularPlan(request).getExecutionYears());

        if (executionYears.isEmpty()) {
            return ExecutionYear.readCurrentExecutionYear();
        } else {
            return executionYears.first();
        }
    } else {
        return FenixFramework.getDomainObject(id);
    }
}
 
Example #10
Source File: SummariesManagementDA.java    From fenixedu-academic with GNU Lesser General Public License v3.0 5 votes vote down vote up
public ActionForward showSummariesPostBack(ActionMapping mapping, ActionForm form, HttpServletRequest request,
        HttpServletResponse response) {

    final IViewState viewState = RenderUtils.getViewState();
    ShowSummariesBean bean = (ShowSummariesBean) viewState.getMetaObject().getObject();

    ExecutionCourse executionCourse = bean.getExecutionCourse();
    ShiftType shiftType = bean.getShiftType();
    Shift shift = bean.getShift();

    SummaryTeacherBean summaryTeacher = bean.getSummaryTeacher();
    Professorship teacher = (summaryTeacher != null) ? summaryTeacher.getProfessorship() : null;
    Boolean otherTeachers = (summaryTeacher != null) ? summaryTeacher.getOthers() : null;
    SummariesOrder summariesOrder = bean.getSummariesOrder();

    Set<Summary> summariesToShow =
            summariesOrder == null || summariesOrder.equals(SummariesOrder.DECREASING) ? new TreeSet<Summary>(
                    Summary.COMPARATOR_BY_DATE_AND_HOUR) : new TreeSet<Summary>(new ReverseComparator(
                    Summary.COMPARATOR_BY_DATE_AND_HOUR));

    for (Summary summary : executionCourse.getAssociatedSummariesSet()) {
        boolean insert = true;
        if ((shift != null && (summary.getShift() == null || !summary.getShift().equals(shift)))
                || (teacher != null && (summary.getProfessorship() == null || !summary.getProfessorship().equals(teacher)))
                || (shiftType != null && (summary.getSummaryType() == null || !summary.getSummaryType().equals(shiftType)))
                || (otherTeachers != null && otherTeachers && summary.getProfessorship() != null)) {
            insert = false;
        }
        if (insert) {
            summariesToShow.add(summary);
        }
    }

    readAndSaveNextPossibleSummaryLessonsAndDates(request, executionCourse);
    request.setAttribute("showSummariesBean", bean);
    request.setAttribute("summaries", summariesToShow);
    return mapping.findForward("prepareShowSummaries");
}
 
Example #11
Source File: ExecutionPeriodsForDismissalsStudentCurricularPlanProvider.java    From fenixedu-academic with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public Object provide(Object source, Object currentValue) {
    final List<ExecutionSemester> result = new ArrayList<ExecutionSemester>();
    final StudentCurricularPlan studentCurricularPlan = ((IStudentCurricularPlanBean) source).getStudentCurricularPlan();
    ExecutionSemester scpSemester = studentCurricularPlan.getStartExecutionPeriod();
    ExecutionSemester lastExecutionSemester = ExecutionYear.readCurrentExecutionYear().getLastExecutionPeriod();
    while (scpSemester != lastExecutionSemester) {
        result.add(scpSemester);
        scpSemester = scpSemester.getNextExecutionPeriod();
    }
    result.add(lastExecutionSemester);
    Collections.sort(result, new ReverseComparator());
    return result;
}
 
Example #12
Source File: CurricularCourseDegreeExecutionSemesterProvider.java    From fenixedu-academic with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public Object provide(Object source, Object currentValue) {
    final ManageEnrolmentsBean bean = (ManageEnrolmentsBean) source;

    final Collection<ExecutionSemester> result = new TreeSet<ExecutionSemester>(new ReverseComparator());

    for (final ExecutionYear executionYear : bean.getCurricularCourse().getDegreeCurricularPlan().getExecutionYears()) {
        result.addAll(executionYear.getExecutionPeriodsSet());
    }

    return result;
}
 
Example #13
Source File: BolonhaEnrolmentsManagementDA.java    From fenixedu-academic with GNU Lesser General Public License v3.0 5 votes vote down vote up
private List<Registration> getAllRegistrations(final Student student) {
    final List<Registration> result = new ArrayList<Registration>();
    result.addAll(student.getRegistrationsSet());
    result.addAll(student.getTransitionRegistrations());
    Collections.sort(result, new ReverseComparator(Registration.COMPARATOR_BY_START_DATE));
    return result;
}
 
Example #14
Source File: ManageExecutionCoursesDA.java    From fenixedu-academic with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * @param request
 * @param infoExecutionCourses
 */
private void sortList(HttpServletRequest request, List<InfoExecutionCourse> infoExecutionCourses) {
    String sortParameter = request.getParameter("sortBy");
    if ((sortParameter != null) && (sortParameter.length() != 0)) {
        if (sortParameter.equals("occupancy")) {
            Collections.sort(infoExecutionCourses, new ReverseComparator(new BeanComparator(sortParameter)));
        } else {
            Collections.sort(infoExecutionCourses, new BeanComparator(sortParameter));
        }
    } else {
        Collections.sort(infoExecutionCourses, new ReverseComparator(new BeanComparator("occupancy")));
    }
}
 
Example #15
Source File: RoomSearchDA.java    From fenixedu-academic with GNU Lesser General Public License v3.0 5 votes vote down vote up
public ActionForward sort(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
        throws Exception {
    DynaValidatorForm roomSearchForm = (DynaValidatorForm) form;

    String[] availableRoomsId = (String[]) roomSearchForm.get("availableRoomsId");
    String sortParameter = request.getParameter("sortParameter");
    List<InfoRoom> availableRooms = new ArrayList<InfoRoom>();
    for (String element : availableRoomsId) {
        final Space room = FenixFramework.getDomainObject(element);
        availableRooms.add(InfoRoom.newInfoFromDomain(room));
    }
    if ((sortParameter != null) && (sortParameter.length() != 0)) {
        if (sortParameter.equals("name")) {
            Collections.sort(availableRooms, new BeanComparator("nome"));
        } else if (sortParameter.equals("type")) {
            Collections.sort(availableRooms, new BeanComparator("tipo"));
        } else if (sortParameter.equals("building")) {
            Collections.sort(availableRooms, new BeanComparator("edificio"));
        } else if (sortParameter.equals("floor")) {
            Collections.sort(availableRooms, new BeanComparator("piso"));
        } else if (sortParameter.equals("normal")) {
            Collections.sort(availableRooms, new ReverseComparator(new BeanComparator("capacidadeNormal")));
        } else if (sortParameter.equals("exam")) {
            Collections.sort(availableRooms, new ReverseComparator(new BeanComparator("capacidadeExame")));
        }
    } else {
        Collections.sort(availableRooms, new BeanComparator("nome"));
    }

    String sdate = roomSearchForm.get("day") + "/" + roomSearchForm.get("month") + "/" + roomSearchForm.get("year");
    String startTime = roomSearchForm.get("beginningHour") + ":" + roomSearchForm.get("beginningMinute");
    String endTime = roomSearchForm.get("endHour") + ":" + roomSearchForm.get("endMinute");
    request.setAttribute(PresentationConstants.DATE, sdate);
    request.setAttribute(PresentationConstants.START_TIME, startTime);
    request.setAttribute(PresentationConstants.END_TIME, endTime);
    request.setAttribute(PresentationConstants.AVAILABLE_ROOMS, availableRooms);
    request.setAttribute(PresentationConstants.AVAILABLE_ROOMS_ID, availableRoomsId);

    return mapping.findForward("showRooms");
}
 
Example #16
Source File: MarkSheetSearchDispatchAction.java    From fenixedu-academic with GNU Lesser General Public License v3.0 5 votes vote down vote up
private void buildPeriods(HttpServletRequest request) {
    final List<ExecutionSemester> notClosedExecutionPeriods = ExecutionSemester.readNotClosedExecutionPeriods();
    Collections.sort(notClosedExecutionPeriods, new ReverseComparator(ExecutionSemester.COMPARATOR_BY_SEMESTER_AND_YEAR));

    final List<LabelValueBean> periods = new ArrayList<LabelValueBean>();
    for (final ExecutionSemester period : notClosedExecutionPeriods) {
        periods.add(new LabelValueBean(period.getExecutionYear().getYear() + " - " + period.getName(), period.getExternalId()
                .toString()));
    }

    request.setAttribute("periods", periods);
}
 
Example #17
Source File: RegistrationDA.java    From fenixedu-academic with GNU Lesser General Public License v3.0 5 votes vote down vote up
public ActionForward showRegimes(ActionMapping mapping, ActionForm actionForm, HttpServletRequest request,
        HttpServletResponse response) {

    final Registration registration = getAndSetRegistration(request);
    final List<RegistrationRegime> regimes = new ArrayList<RegistrationRegime>(registration.getRegistrationRegimesSet());

    Collections.sort(regimes, new ReverseComparator(RegistrationRegime.COMPARATOR_BY_EXECUTION_YEAR));
    request.setAttribute("registrationRegimes", regimes);

    return mapping.findForward("showRegimes");
}
 
Example #18
Source File: AcademicServiceRequestsManagementDispatchAction.java    From fenixedu-academic with GNU Lesser General Public License v3.0 5 votes vote down vote up
private Comparator getComparator(HttpServletRequest request) {
    final String orderParameter = request.getParameter(ORDER_PARAMETER);
    final String orderGetter =
            StringUtils.isEmpty(orderParameter) ? DEFAULT_ORDER_GETTER : orderParameter.substring(0,
                    orderParameter.indexOf(ORDER_MARKER));

    final String orderDir =
            StringUtils.isEmpty(orderParameter) ? DEFAULT_ORDER_DIR : orderParameter.substring(
                    orderParameter.indexOf(ORDER_MARKER) + 1, orderParameter.length());
    final boolean orderAsc = Arrays.asList(ASC_ORDER_DIR).contains(orderDir);

    if (orderGetter.equals(REQUEST_NUMBER_YEAR)) {
        return orderAsc ? AcademicServiceRequest.COMPARATOR_BY_NUMBER : new ReverseComparator(
                AcademicServiceRequest.COMPARATOR_BY_NUMBER);
    } else if (orderGetter.equals(EXECUTION_YEAR)) {
        return orderAsc ? AcademicServiceRequest.EXECUTION_YEAR_AND_OID_COMPARATOR : new ReverseComparator(
                AcademicServiceRequest.EXECUTION_YEAR_AND_OID_COMPARATOR);
    } else if (orderGetter.equals(REGISTRATION_NUMBER) || orderGetter.equals(DESCRIPTION)
            || orderGetter.equals(URGENT_REQUEST) || orderGetter.equals(REGISTRATION_NUMBER)
            || orderGetter.equals(REQUEST_DATE) || orderGetter.equals(ACTIVE_SITUATION_DATE)) {
        final ComparatorChain chain = new ComparatorChain();
        chain.addComparator(orderAsc ? new BeanComparator(orderGetter) : new ReverseComparator(
                new BeanComparator(orderGetter)));
        chain.addComparator(DomainObjectUtil.COMPARATOR_BY_ID);
        return chain;
    }

    return null;
}
 
Example #19
Source File: Alumni.java    From fenixedu-academic with GNU Lesser General Public License v3.0 5 votes vote down vote up
public AlumniIdentityCheckRequest getLastIdentityRequest() {
    Set<AlumniIdentityCheckRequest> orderedSet =
            new TreeSet<AlumniIdentityCheckRequest>(new ReverseComparator(new BeanComparator("creationDateTime")));
    for (AlumniIdentityCheckRequest request : getIdentityRequestsSet()) {
        orderedSet.add(request);
    }
    return orderedSet.size() != 0 ? orderedSet.iterator().next() : null;
}
 
Example #20
Source File: RootCurriculumGroup.java    From fenixedu-academic with GNU Lesser General Public License v3.0 5 votes vote down vote up
public CycleCurriculumGroup getLastConcludedCycleCurriculumGroup() {
    final SortedSet<CycleCurriculumGroup> cycleCurriculumGroups =
            new TreeSet<CycleCurriculumGroup>(new ReverseComparator(CycleCurriculumGroup.COMPARATOR_BY_CYCLE_TYPE_AND_ID));
    cycleCurriculumGroups.addAll(getInternalCycleCurriculumGroups());

    for (final CycleCurriculumGroup curriculumGroup : cycleCurriculumGroups) {
        if (curriculumGroup.isConcluded()) {
            return curriculumGroup;
        }
    }

    return null;
}
 
Example #21
Source File: CourseGroup.java    From fenixedu-academic with GNU Lesser General Public License v3.0 5 votes vote down vote up
private Double countMaxEctsCredits(final Collection<DegreeModule> modulesByExecutionPeriod,
        final ExecutionSemester executionSemester, final Integer maximumLimit) {

    final List<Double> ectsCredits = new ArrayList<Double>();
    for (final DegreeModule degreeModule : modulesByExecutionPeriod) {
        ectsCredits.add(degreeModule.getMaxEctsCredits(executionSemester));
    }
    Collections.sort(ectsCredits, new ReverseComparator());
    return sumEctsCredits(ectsCredits, maximumLimit.intValue());
}
 
Example #22
Source File: ExecutionCourse.java    From fenixedu-academic with GNU Lesser General Public License v3.0 5 votes vote down vote up
public void createLessonPlanningsUsingSummariesFrom(Shift shift) {
    List<Summary> summaries = new ArrayList<>();
    summaries.addAll(shift.getAssociatedSummariesSet());
    summaries.sort(new ReverseComparator(Summary.COMPARATOR_BY_DATE_AND_HOUR));
    for (Summary summary : summaries) {
        for (ShiftType shiftType : shift.getTypes()) {
            new LessonPlanning(summary.getTitle(), summary.getSummaryText(), shiftType, this);
        }
    }
}
 
Example #23
Source File: ExecutionPeriodsForOldMarkSheets.java    From fenixedu-academic with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public Object provide(Object source, Object currentValue) {
    final List<ExecutionSemester> result = new ArrayList<ExecutionSemester>();

    for (final ExecutionSemester executionSemester : Bennu.getInstance().getExecutionPeriodsSet()) {
        if (executionSemester.isBefore(ExecutionSemester.readMarkSheetManagmentExecutionPeriod())) {
            result.add(executionSemester);
        }
    }

    Collections.sort(result, new ReverseComparator());
    return result;
}
 
Example #24
Source File: WorkflowInstancesListController.java    From telekom-workflow-engine with MIT License 5 votes vote down vote up
protected List<WorkflowInstanceSearchModel> sortSearchResult( List<WorkflowInstanceSearchModel> result, int column, String direction ){
    List<WorkflowInstanceSearchModel> unorderedSource = new ArrayList<>( result );
    String fieldName = DataTableColumnMapper.from( column ).getFieldName();
    BeanComparator<WorkflowInstanceSearchModel> beanComparator;
    if( "asc".equalsIgnoreCase( direction ) ){
        beanComparator = new BeanComparator<>( fieldName, new NullComparator() );
    }
    else{
        beanComparator = new BeanComparator<>( fieldName, new ReverseComparator( new NullComparator() ) );
    }
    Collections.sort( unorderedSource, beanComparator );
    return unorderedSource;
}
 
Example #25
Source File: ManagerCurricularCourseManagementBackingBean.java    From fenixedu-academic with GNU Lesser General Public License v3.0 5 votes vote down vote up
private List<SelectItem> readPreBolonhaExecutionPeriodItems() {
    final List<ExecutionSemester> semesters = new ArrayList<ExecutionSemester>(rootDomainObject.getExecutionPeriodsSet());
    Collections.sort(semesters, new ReverseComparator(ExecutionSemester.COMPARATOR_BY_SEMESTER_AND_YEAR));

    final List<SelectItem> result = new ArrayList<SelectItem>();
    for (final ExecutionSemester semester : semesters) {
        result.add(new SelectItem(semester.getExternalId(), semester.getQualifiedName()));
    }
    return result;
}
 
Example #26
Source File: WrittenEvaluationsByRoomBackingBean.java    From fenixedu-academic with GNU Lesser General Public License v3.0 5 votes vote down vote up
public Collection<SelectItem> getAcademicIntervals() throws FenixServiceException {
    List<AcademicInterval> intervals = AcademicInterval.readAcademicIntervals(AcademicPeriod.SEMESTER);
    Collections.sort(intervals, new ReverseComparator(AcademicInterval.COMPARATOR_BY_BEGIN_DATE));
    List<SelectItem> items = new ArrayList<>();
    for (AcademicInterval interval : intervals) {
        items.add(new SelectItem(interval.getResumedRepresentationInStringFormat(), interval.getPathName()));
    }
    return items;
}
 
Example #27
Source File: AcademicAdministrationCurricularCourseManagementBackingBean.java    From fenixedu-academic with GNU Lesser General Public License v3.0 5 votes vote down vote up
private List<SelectItem> readPreBolonhaExecutionPeriodItems() {
    final List<ExecutionSemester> semesters = new ArrayList<ExecutionSemester>(rootDomainObject.getExecutionPeriodsSet());
    Collections.sort(semesters, new ReverseComparator(ExecutionSemester.COMPARATOR_BY_SEMESTER_AND_YEAR));

    final List<SelectItem> result = new ArrayList<SelectItem>();
    for (final ExecutionSemester semester : semesters) {
        result.add(new SelectItem(semester.getExternalId(), semester.getQualifiedName()));
    }
    return result;
}
 
Example #28
Source File: ExecutionDegreesForDegreeCurricularPlan.java    From fenixedu-academic with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public Object provide(Object source, Object currentValue) {
    Set<ExecutionDegree> result =
            new TreeSet<ExecutionDegree>(new ReverseComparator(ExecutionDegree.EXECUTION_DEGREE_COMPARATORY_BY_YEAR));

    ExecutionDegreeBean executionDegreeBean = (ExecutionDegreeBean) source;
    DegreeCurricularPlan degreeCurricularPlan = executionDegreeBean.getDegreeCurricularPlan();

    if (degreeCurricularPlan != null) {
        result.addAll(degreeCurricularPlan.getExecutionDegreesSet());
    }

    return result;
}
 
Example #29
Source File: ExecutionPeriodsForCandidacyRegistrationProvider.java    From fenixedu-academic with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public Object provide(Object source, Object currentValue) {
    final StudentCurricularPlan studentCurricularPlan = ((IStudentCurricularPlanBean) source).getStudentCurricularPlan();

    final List<ExecutionSemester> executionPeriodsInTimePeriod =
            ExecutionSemester.readExecutionPeriodsInTimePeriod(
                    studentCurricularPlan.getStartDateYearMonthDay().toLocalDate(), getEndDate());

    Collections.sort(executionPeriodsInTimePeriod, new ReverseComparator(ExecutionSemester.COMPARATOR_BY_SEMESTER_AND_YEAR));
    return executionPeriodsInTimePeriod;
}
 
Example #30
Source File: ExecutionPeriodsNotClosedPublicProvider.java    From fenixedu-academic with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public Object provide(Object source, Object currentValue) {
    final List<ExecutionSemester> result = new ArrayList<ExecutionSemester>();

    for (final ExecutionSemester executionSemester : Bennu.getInstance().getExecutionPeriodsSet()) {
        if (executionSemester.isAfterOrEquals(ExecutionSemester.readMarkSheetManagmentExecutionPeriod())) {
            result.add(executionSemester);
        }
    }

    Collections.sort(result, new ReverseComparator());
    return result;
}