Package org.apache.commons.collections.comparators

Examples of org.apache.commons.collections.comparators.ComparatorChain


            } catch (Exception e) {
                throw new FenixActionException(e);
            }
        }

        ComparatorChain comparatorChain = new ComparatorChain();
        comparatorChain.addComparator(new BeanComparator("value"));
        Collections.sort(result, comparatorChain);
        Collections.reverse(result);

        return result;
    }
View Full Code Here


            } catch (Exception e) {
                throw new FenixActionException(e);
            }
        }

        ComparatorChain comparatorChain = new ComparatorChain();
        comparatorChain.addComparator(new BeanComparator("value"));
        Collections.sort(result, comparatorChain);
        Collections.reverse(result);

        return result;
    }
View Full Code Here

        InfoPerson infoPerson = getInfoPerson(request, dynaForm);

        List detailedInfoProfessorshipList = getDetailedProfessorships(userView, infoPerson.getExternalId(), dynaForm, request);

        ComparatorChain chain = new ComparatorChain();

        Comparator executionPeriodComparator =
                new BeanComparator("infoProfessorship.infoExecutionCourse.infoExecutionPeriod.semester");
        Comparator nameComparator = new BeanComparator("infoProfessorship.infoExecutionCourse.nome");

        chain.addComparator(executionPeriodComparator);
        chain.addComparator(nameComparator);
        Collections.sort(detailedInfoProfessorshipList, chain);

        request.setAttribute("detailedProfessorshipList", detailedInfoProfessorshipList);

        extraPreparation(userView, infoPerson, request, dynaForm);
View Full Code Here

        return infoEnrolments;
    }

    public List getInfoEnrolmentsSorted() {
        final List<InfoEnrolment> infoEnrolments = getInfoEnrolments();
        ComparatorChain comparatorChain = new ComparatorChain();
        comparatorChain.addComparator(new BeanComparator("infoExecutionPeriod.infoExecutionYear.year"));
        comparatorChain.addComparator(new BeanComparator("infoExecutionPeriod.semester"));
        comparatorChain.addComparator(new BeanComparator("infoCurricularCourse.name", Collator.getInstance()));
        Collections.sort(infoEnrolments, comparatorChain);
        return infoEnrolments;
    }
View Full Code Here

    @Atomic
    public static SortedSet<DegreeModuleScope> run(String degreeCurricularPlanID, AcademicInterval academicInterval)
            throws FenixServiceException {
        final DegreeCurricularPlan degreeCurricularPlan = FenixFramework.getDomainObject(degreeCurricularPlanID);

        final ComparatorChain comparator = new ComparatorChain();
        comparator.addComparator(new BeanComparator("curricularYear"));
        comparator.addComparator(new BeanComparator("curricularSemester"));
        comparator.addComparator(new BeanComparator("curricularCourse.externalId"));
        comparator.addComparator(new BeanComparator("branch"));

        final SortedSet<DegreeModuleScope> scopes = new TreeSet<DegreeModuleScope>(comparator);

        for (DegreeModuleScope degreeModuleScope : degreeCurricularPlan.getDegreeModuleScopes()) {
            if (degreeModuleScope.isActiveForAcademicInterval(academicInterval)) {
View Full Code Here

    public static SortedSet<DegreeModuleScope> run(String degreeCurricularPlanID, String executioYearID)
            throws FenixServiceException {
        final DegreeCurricularPlan degreeCurricularPlan = FenixFramework.getDomainObject(degreeCurricularPlanID);
        final ExecutionYear executionYear = FenixFramework.getDomainObject(executioYearID);

        final ComparatorChain comparator = new ComparatorChain();
        comparator.addComparator(new BeanComparator("curricularYear"));
        comparator.addComparator(new BeanComparator("curricularSemester"));
        comparator.addComparator(new BeanComparator("curricularCourse.externalId"));
        comparator.addComparator(new BeanComparator("branch"));

        final SortedSet<DegreeModuleScope> scopes = new TreeSet<DegreeModuleScope>(comparator);

        for (DegreeModuleScope degreeModuleScope : degreeCurricularPlan.getDegreeModuleScopes()) {
            if (degreeModuleScope.isActiveForExecutionYear(executionYear)) {
View Full Code Here

        return scopesForPrintDTO.getDegreeCurricularPlans();
    }

    private void sortScopes(List<InfoCurricularCourseScope> scopes) {
        ComparatorChain comparatorChain = new ComparatorChain();
        comparatorChain.addComparator(new BeanComparator("infoCurricularSemester.infoCurricularYear.year"));
        comparatorChain.addComparator(new BeanComparator("infoBranch.name"));
        comparatorChain.addComparator(new BeanComparator("infoCurricularSemester.semester"));
        comparatorChain.addComparator(new BeanComparator("infoCurricularCourse.name"));
        Collections.sort(scopes, comparatorChain);
    }
View Full Code Here

                }
            }
        }

        if (this.getOrderCriteria() == 0) {
            final ComparatorChain comparatorChain = new ComparatorChain();
            comparatorChain.addComparator(new ReverseComparator(new BeanComparator("capacidadeExame")));
            comparatorChain.addComparator(new BeanComparator("nome"));

            Collections.sort(availableInfoRoom, comparatorChain);
        } else if (this.getOrderCriteria() == 1) {
            final ComparatorChain comparatorChain = new ComparatorChain();
            comparatorChain.addComparator(new ReverseComparator(new BeanComparator("edificio")));
            comparatorChain.addComparator(new BeanComparator("nome"));

            Collections.sort(availableInfoRoom, comparatorChain);
        } else if (this.getOrderCriteria() == 2) {
            final ComparatorChain comparatorChain = new ComparatorChain();
            comparatorChain.addComparator(new ReverseComparator(new BeanComparator("tipo")));
            comparatorChain.addComparator(new BeanComparator("nome"));

            Collections.sort(availableInfoRoom, comparatorChain);
        }

        List<SelectItem> items = new ArrayList<SelectItem>(availableInfoRoom.size());
View Full Code Here

    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());
View Full Code Here

    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());
View Full Code Here

TOP

Related Classes of org.apache.commons.collections.comparators.ComparatorChain

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.