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:com.sammyun.service.impl.PluginServiceImpl.java

public List<MessagePushPlugin> getMessagePushPlugins(final boolean isEnabled) {
    List<MessagePushPlugin> result = new ArrayList<MessagePushPlugin>();
    CollectionUtils.select(messagePlugins, new Predicate() {
        public boolean evaluate(Object object) {
            MessagePushPlugin messagePushPlugin = (MessagePushPlugin) object;
            return messagePushPlugin.getIsEnabled() == isEnabled;
        }//from  www .  ja  v a 2  s . c o m
    }, result);
    Collections.sort(result);
    return result;
}

From source file:edu.scripps.fl.pubchem.db.PCAssayPanel.java

@Transient
public XRef getGene() {
    List<PCAssayXRef> list = new ArrayList();
    CollectionUtils.select(assay.getAssayXRefs(), new Predicate() {
        public boolean evaluate(Object object) {
            PCAssayXRef xref = (PCAssayXRef) object;
            if (xref.getPanel() != null)
                if (xref.getPanel().getPanelNumber() == getPanelNumber() && xref.getXRef() != null
                        && "gene".equals(xref.getXRef().getDatabase()))
                    return true;
            return false;
        }/*from  w  ww .  j  av  a 2 s . co m*/
    }, list);
    return list.size() > 0 ? list.get(0).getXRef() : null;
}

From source file:net.shopxx.service.impl.PluginServiceImpl.java

public List<OAuthPlugin> getOAuthPlugins(final boolean isEnabled) {
    List<OAuthPlugin> result = new ArrayList<OAuthPlugin>();
    CollectionUtils.select(oAuthPlugins, new Predicate() {

        public boolean evaluate(Object object) {
            OAuthPlugin storagePlugin = (OAuthPlugin) object;
            return storagePlugin.getIsEnabled() == isEnabled;
        }//ww w  .  j ava  2  s. c  o m
    }, result);
    Collections.sort(result);
    return result;
}

From source file:net.sourceforge.fenixedu.domain.residence.StudentsPerformanceReport.java

public static List<StudentsPerformanceReport> readGeneratedReports(final ExecutionSemester executionSemester) {
    List<StudentsPerformanceReport> generatedReports = new ArrayList<StudentsPerformanceReport>();

    CollectionUtils.select(executionSemester.getStudentsPerformanceReportsSet(), new Predicate() {

        @Override//ww  w. j  av  a  2 s . c o m
        public boolean evaluate(Object arg0) {
            return ((StudentsPerformanceReport) arg0).getDone();
        }

    }, generatedReports);

    return generatedReports;
}

From source file:net.sourceforge.fenixedu.domain.phd.PhdProgramFocusArea.java

public List<ExternalPhdProgram> getAssociatedExternalPhdProgramsForCollaborationType(
        final PhdIndividualProgramCollaborationType type) {
    List<ExternalPhdProgram> externalPhdProgramList = new ArrayList<ExternalPhdProgram>();

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

        @Override//from  ww  w.  j a  v  a  2  s. c  o m
        public boolean evaluate(Object object) {
            return ((ExternalPhdProgram) object).isForCollaborationType(type);
        }

    }, externalPhdProgramList);

    return externalPhdProgramList;
}

From source file:net.sourceforge.fenixedu.domain.candidacyProcess.erasmus.ApprovedLearningAgreementDocumentFile.java

protected List<ApprovedLearningAgreementExecutedAction> getSentLearningAgreementActions() {
    List<ApprovedLearningAgreementExecutedAction> executedActionList = new ArrayList<ApprovedLearningAgreementExecutedAction>();

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

        @Override//from ww w  . j a v  a 2s .  c  o  m
        public boolean evaluate(Object arg0) {
            return ((ApprovedLearningAgreementExecutedAction) arg0).isSentLearningAgreementAction();
        };

    }, executedActionList);

    Collections.sort(executedActionList, Collections.reverseOrder(ExecutedAction.WHEN_OCCURED_COMPARATOR));

    return executedActionList;
}

From source file:net.sourceforge.fenixedu.domain.accounting.util.IndividualCandidacyPaymentCodeGenerator.java

private List<IndividualCandidacyPaymentCode> getAllIndividualCandidacyPaymentCodesForType(
        final PaymentCodeType paymentCodeType) {
    Set<PaymentCode> allPaymentCodes = Bennu.getInstance().getPaymentCodesSet();

    List<IndividualCandidacyPaymentCode> outputList = new ArrayList<IndividualCandidacyPaymentCode>();
    CollectionUtils.select(allPaymentCodes, new Predicate() {

        @Override/* ww w  . ja  v a2  s . com*/
        public boolean evaluate(Object arg0) {
            PaymentCode paymentCode = (PaymentCode) arg0;
            return paymentCodeType.equals(paymentCode.getType());
        }

    }, outputList);

    return outputList;
}

From source file:bard.pubchem.model.PCAssayPanel.java

public XRef getGene() {
    List<PCAssayXRef> list = new ArrayList<PCAssayXRef>();
    CollectionUtils.select(assay.getAssayXRefs(), new Predicate() {
        public boolean evaluate(Object object) {
            PCAssayXRef xref = (PCAssayXRef) object;
            if (xref.getPanel() != null)
                if (xref.getPanel().getPanelNumber() == getPanelNumber() && xref.getXRef() != null
                        && "gene".equals(xref.getXRef().getDatabase()))
                    return true;
            return false;
        }/*w w w.  j  a v a 2  s  .  c om*/
    }, list);
    return list.size() > 0 ? list.get(0).getXRef() : null;
}

From source file:net.sourceforge.fenixedu.domain.residence.StudentsPerformanceReport.java

public static List<StudentsPerformanceReport> readNotGeneratedReports(
        final ExecutionSemester executionSemester) {
    List<StudentsPerformanceReport> generatedReports = new ArrayList<StudentsPerformanceReport>();

    CollectionUtils.select(executionSemester.getStudentsPerformanceReportsSet(), new Predicate() {

        @Override/*  ww w  .jav  a 2 s.  co m*/
        public boolean evaluate(Object arg0) {
            return !((StudentsPerformanceReport) arg0).getDone();
        }

    }, generatedReports);

    return generatedReports;
}

From source file:net.sourceforge.fenixedu.presentationTier.Action.teacher.candidacy.erasmus.ErasmusCandidacyProcessDA.java

@Override
protected List<IndividualCandidacyProcess> getChildProcesses(final CandidacyProcess process,
        HttpServletRequest request) {/*  w w w .j a  v  a 2s .  c o  m*/
    Collection<IndividualCandidacyProcess> processes = super.getChildProcesses(process, request);

    List<IndividualCandidacyProcess> result = new ArrayList<IndividualCandidacyProcess>();

    CollectionUtils.select(processes, new Predicate() {

        @Override
        public boolean evaluate(Object arg0) {
            IndividualCandidacyProcess child = (IndividualCandidacyProcess) arg0;

            return ((MobilityApplicationProcess) process)
                    .getDegreesAssociatedToTeacherAsCoordinator(getTeacher()).contains(
                            ((MobilityIndividualApplicationProcess) child).getCandidacy().getSelectedDegree());
        }

    }, result);

    return result;
}