Example usage for org.apache.commons.collections PredicateUtils truePredicate

List of usage examples for org.apache.commons.collections PredicateUtils truePredicate

Introduction

In this page you can find the example usage for org.apache.commons.collections PredicateUtils truePredicate.

Prototype

public static Predicate truePredicate() 

Source Link

Document

Gets a Predicate that always returns true.

Usage

From source file:au.edu.uq.cmm.paul.grabber.Analyser.java

public Analyser analyse(Date lwmTimestamp, Date hwmTimestamp, DateRange queueRange, boolean checkHashes) {
    this.lwm = lwmTimestamp;
    this.hwm = hwmTimestamp;
    if (queueRange == null) {
        this.qStart = null;
        this.qEnd = null;
    } else {// w  ww .j  av  a 2s.c o  m
        this.qStart = queueRange.getFromDate();
        this.qEnd = queueRange.getToDate();
    }
    this.checkHashes = checkHashes;
    LOG.info("Analysing queues and folders for " + getFacility().getFacilityName());
    SortedSet<DatasetMetadata> inFolder = buildInFolderMetadata();
    SortedSet<DatasetMetadata> inDatabase = buildInDatabaseMetadata();
    LOG.debug("Got " + inFolder.size() + " in folders and " + inDatabase.size() + " in database");
    LOG.info("Grouping datasets for " + getFacility().getFacilityName());
    grouped = groupDatasets(inFolder, inDatabase);
    LOG.debug("Got " + grouped.size() + " groups");
    LOG.info("Gathering statistics for " + getFacility().getFacilityName());
    determineFolderRange(inFolder);
    all = gatherStats(grouped, PredicateUtils.truePredicate());
    if (hwmTimestamp == null || lwmTimestamp == null) {
        beforeLWM = null;
        afterHWM = null;
        intertidal = null;
    } else {
        final long lwmTime = lwmTimestamp.getTime();
        beforeLWM = gatherStats(grouped, new Predicate() {
            public boolean evaluate(Object metadata) {
                return ((DatasetMetadata) metadata).getLastFileTimestamp().getTime() < lwmTime;
            }
        });
        final long hwmTime = hwmTimestamp.getTime();
        afterHWM = gatherStats(grouped, new Predicate() {
            public boolean evaluate(Object metadata) {
                return ((DatasetMetadata) metadata).getLastFileTimestamp().getTime() > hwmTime;
            }
        });
        intertidal = gatherStats(grouped, new Predicate() {
            public boolean evaluate(Object metadata) {
                long time = ((DatasetMetadata) metadata).getLastFileTimestamp().getTime();
                return time >= lwmTime && time <= hwmTime;
            }
        });
    }
    if (queueRange == null) {
        afterQEnd = null;
        beforeQStart = null;
        inQueue = null;
    } else {
        final long qStart = this.qStart.getTime();
        beforeQStart = gatherStats(grouped, new Predicate() {
            public boolean evaluate(Object metadata) {
                return ((DatasetMetadata) metadata).getLastFileTimestamp().getTime() < qStart;
            }
        });
        final long qEnd = this.qEnd.getTime();
        afterQEnd = gatherStats(grouped, new Predicate() {
            public boolean evaluate(Object metadata) {
                return ((DatasetMetadata) metadata).getLastFileTimestamp().getTime() > qEnd;
            }
        });
        inQueue = gatherStats(grouped, new Predicate() {
            public boolean evaluate(Object metadata) {
                long ts = ((DatasetMetadata) metadata).getLastFileTimestamp().getTime();
                return ts >= qStart && ts <= qEnd;
            }
        });
    }
    LOG.info("Performing queue entry integrity checks for " + getFacility().getFacilityName());
    problems = integrityCheck(grouped);
    return this;
}

From source file:org.apache.cayenne.modeler.dialog.autorelationship.InferRelationshipsTabController.java

/**
 * An action that updates entity check boxes in response to the Select All state
 * change./*from w  w w  .  ja  v a  2 s .  c  o  m*/
 */
public void checkAllAction() {

    Predicate predicate = view.getCheckAll().isSelected() ? PredicateUtils.truePredicate()
            : PredicateUtils.falsePredicate();

    if (getParentController().updateSelection(predicate)) {
        tableBinding.updateView();
    }
}

From source file:org.lockss.protocol.IdentityManagerImpl.java

/**
 * <p>Return a collection of all V3-style PeerIdentities.</p>
 *///from w w  w. jav  a  2  s  .  com
public Collection getTcpPeerIdentities() {
    return getTcpPeerIdentities(PredicateUtils.truePredicate());
}

From source file:org.mifos.reports.branchreport.persistence.BranchReportPersistenceIntegrationTest.java

@Test
public void testRetrievesEmptyListIfNoBranchReportBatchForDateAndBranch() throws Exception {
    List<BranchReportBO> retrievedBranchReports = branchReportPersistence.getBranchReport(BRANCH_ID, runDate);
    assertListSizeAndTrueCondition(0, retrievedBranchReports, PredicateUtils.truePredicate());
}

From source file:org.mifos.reports.branchreport.persistence.BranchReportPersistenceIntegrationTest.java

@Test
public void testRetrievesEmptyListIfNoBranchReportsForGivenDate() throws Exception {
    List<BranchReportBO> retrievedBranchReports = branchReportPersistence.getBranchReport(runDate);
    assertListSizeAndTrueCondition(0, retrievedBranchReports, PredicateUtils.truePredicate());
}

From source file:org.mifos.reports.branchreport.persistence.BranchReportPersistenceIntegrationTest.java

@Test
public void testReturnsEmptyListIfNoBranchReportClientSummaryBatchForDateAndBranch() throws Exception {
    retrieveAndAssertBranchReportClientSummaryForBranchAndDate(0, PredicateUtils.truePredicate());
}

From source file:org.mifos.reports.branchreport.persistence.BranchReportPersistenceIntegrationTest.java

@Test
public void testGetLoanArrearsReportReturnsEmptyListIfReportNotFound() throws Exception {
    retrieveAndAssertLoanArrearsReportForBranchAndDate(0, PredicateUtils.truePredicate());
}

From source file:org.mifos.reports.branchreport.persistence.BranchReportPersistenceIntegrationTest.java

@Test
public void testRetrieveStaffSummaryForDateAndBranchReturnsEmptyListIfNoDataPresent() throws Exception {
    retrieveAndAssertBranchReportStaffSummaryForBranchAndDate(0, PredicateUtils.truePredicate());
}

From source file:org.openvpms.component.business.service.archetype.helper.IMObjectBean.java

/**
 * Helper to return the default predicate for evaluating relationships.
 *
 * @param active determines if the relationship must be active
 * @return the default predicate//ww w .  j a v a  2 s.c o m
 */
protected Predicate getDefaultPredicate(boolean active) {
    return (active) ? IsActiveRelationship.isActiveNow() : PredicateUtils.truePredicate();
}