Example usage for org.apache.commons.collections CollectionUtils select

List of usage examples for org.apache.commons.collections CollectionUtils select

Introduction

In this page you can find the example usage for org.apache.commons.collections CollectionUtils select.

Prototype

public static void select(Collection inputCollection, Predicate predicate, Collection outputCollection) 

Source Link

Document

Selects all elements from input collection which match the given predicate and adds them to outputCollection.

Usage

From source file:net.sourceforge.fenixedu.domain.accounting.report.GratuityReportQueueJob.java

public static List<GratuityReportQueueJob> retrieveAllGeneratedReports(final ExecutionYear executionYear) {
    List<GratuityReportQueueJob> reports = new ArrayList<GratuityReportQueueJob>();

    CollectionUtils.select(executionYear.getGratuityReportQueueJobsSet(), new Predicate() {

        @Override/*w w w.  ja v  a2 s. c om*/
        public boolean evaluate(Object arg0) {
            GratuityReportQueueJob gratuityQueueJob = (GratuityReportQueueJob) arg0;

            return gratuityQueueJob.getDone();
        }

    }, reports);

    return reports;
}

From source file:net.sourceforge.fenixedu.domain.accounting.report.GratuityReportQueueJob.java

public static List<GratuityReportQueueJob> retrieveNotGeneratedReports(final ExecutionYear executionYear) {
    List<GratuityReportQueueJob> reports = new ArrayList<GratuityReportQueueJob>();

    CollectionUtils.select(executionYear.getGratuityReportQueueJobsSet(), new Predicate() {

        @Override/*  ww  w .  ja  v  a2 s. c  o  m*/
        public boolean evaluate(Object arg0) {
            GratuityReportQueueJob gratuityQueueJob = (GratuityReportQueueJob) arg0;

            return !gratuityQueueJob.getDone();
        }

    }, reports);

    return reports;
}

From source file:net.sourceforge.fenixedu.presentationTier.Action.candidate.degree.DegreeCandidacyManagementDispatchAction.java

private Object installmmentPaymentCodes(Collection<PaymentCode> availablePaymentCodes) {
    List<PaymentCode> installmentPaymentCodes = new ArrayList<PaymentCode>();

    CollectionUtils.select(availablePaymentCodes, new Predicate() {

        @Override//from w ww .  ja va2  s.  c o  m
        public boolean evaluate(Object arg0) {
            PaymentCode paymentCode = (PaymentCode) arg0;

            if (paymentCode instanceof InstallmentPaymentCode) {
                return true;
            }

            return false;
        }
    }, installmentPaymentCodes);

    Collections.sort(installmentPaymentCodes, new BeanComparator("code"));

    return installmentPaymentCodes;
}

From source file:net.sourceforge.fenixedu.domain.alumni.AlumniReportFile.java

public static List<AlumniReportFile> readDoneJobs() {
    List<AlumniReportFile> reportFileList = new ArrayList<AlumniReportFile>();

    CollectionUtils.select(ExecutionYear.readCurrentExecutionYear().getAlumniReportFilesSet(), new Predicate() {

        @Override/*from   w  w w  .  j a  va 2  s.  c  o  m*/
        public boolean evaluate(Object arg0) {
            return ((AlumniReportFile) arg0).getDone();
        }
    }, reportFileList);

    return reportFileList;
}

From source file:net.sourceforge.fenixedu.domain.alumni.AlumniReportFile.java

public static List<AlumniReportFile> readPendingJobs() {
    List<AlumniReportFile> reportFileList = new ArrayList<AlumniReportFile>();

    CollectionUtils.select(ExecutionYear.readCurrentExecutionYear().getAlumniReportFilesSet(), new Predicate() {

        @Override/*from  w  ww .j a va  2  s. c om*/
        public boolean evaluate(Object arg0) {
            return ((AlumniReportFile) arg0).getIsNotDoneAndNotCancelled();
        }
    }, reportFileList);

    return reportFileList;
}

From source file:net.sourceforge.fenixedu.domain.candidacyProcess.mobility.MobilityApplicationProcess.java

public List<MobilityIndividualApplicationProcess> getProcessesWithNotViewedApprovedLearningAgreements() {
    List<MobilityIndividualApplicationProcess> processList = new ArrayList<MobilityIndividualApplicationProcess>();
    CollectionUtils.select(getChildProcessesSet(), new Predicate() {

        @Override/*  w ww  .  ja  va 2  s.  c  o  m*/
        public boolean evaluate(Object arg0) {
            MobilityIndividualApplicationProcess individualProcess = (MobilityIndividualApplicationProcess) arg0;

            return !individualProcess.isCandidacyCancelled()
                    && individualProcess.getCandidacy().isMostRecentApprovedLearningAgreementNotViewed();
        }
    }, processList);

    return processList;
}

From source file:module.mailtracking.domain.CorrespondenceEntry.java

public java.util.List<Document> getActiveDocuments() {
    java.util.List<Document> associatedDocuments = new java.util.ArrayList<Document>();

    CollectionUtils.select(this.getDocumentsSet(), new Predicate() {

        @Override/* www . j  av  a 2s . c o  m*/
        public boolean evaluate(Object arg0) {
            return DocumentState.ACTIVE.equals(((Document) arg0).getState());
        }

    }, associatedDocuments);

    return associatedDocuments;
}

From source file:net.sourceforge.fenixedu.domain.candidacyProcess.mobility.MobilityApplicationProcess.java

public List<MobilityIndividualApplicationProcess> getProcessesWithNotViewedAlerts() {
    List<MobilityIndividualApplicationProcess> processList = new ArrayList<MobilityIndividualApplicationProcess>();
    CollectionUtils.select(getChildProcessesSet(), new Predicate() {

        @Override/* ww w  . j a va  2  s .c om*/
        public boolean evaluate(Object arg0) {
            MobilityIndividualApplicationProcess process = (MobilityIndividualApplicationProcess) arg0;
            return process.isProcessWithMostRecentAlertMessageNotViewed();
        }

    }, processList);

    return processList;
}

From source file:net.sourceforge.fenixedu.domain.candidacyProcess.mobility.MobilityApplicationProcess.java

public List<ErasmusCandidacyProcessReport> getDoneReports() {
    List<ErasmusCandidacyProcessReport> jobList = new ArrayList<ErasmusCandidacyProcessReport>();

    CollectionUtils.select(getErasmusCandidacyProcessReportsSet(), new Predicate() {

        @Override/* w  w w .  j a va 2  s.  c om*/
        public boolean evaluate(Object arg0) {
            return ((QueueJob) arg0).getDone();
        }
    }, jobList);

    return jobList;
}

From source file:net.sourceforge.fenixedu.domain.student.importation.DgesStudentImportationProcess.java

public static List<DgesStudentImportationProcess> readAllJobs(final ExecutionYear executionYear) {
    List<DgesStudentImportationProcess> jobList = new ArrayList<DgesStudentImportationProcess>();

    CollectionUtils.select(executionYear.getDgesBaseProcessSet(), new Predicate() {

        @Override//from  w ww .j a  v  a  2s.co  m
        public boolean evaluate(Object arg0) {
            return (arg0 instanceof DgesStudentImportationProcess);
        }
    }, jobList);

    return jobList;
}