Java Code Examples for org.apache.commons.collections.CollectionUtils.filter()

The following are Jave code examples for showing how to use filter() of the org.apache.commons.collections.CollectionUtils class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: lams   File:   View Source Code Vote up 7 votes
public List<MigrationTask> getRollbackCandidates(List<MigrationTask> allMigrationTasks, int[] rollbackLevels, PatchInfoStore currentPatchInfoStore) throws MigrationException

    int rollbackLevel = rollbackLevels[0];
    int currentPatchLevel = currentPatchInfoStore.getPatchLevel();

    if (currentPatchLevel < rollbackLevel)
        throw new MigrationException(
                "The rollback patch level cannot be greater than the current patch level");

    PatchRollbackPredicate rollbackPredicate = new PatchRollbackPredicate(currentPatchLevel,
    List<MigrationTask> migrationCandidates = new ArrayList<MigrationTask>();
    CollectionUtils.filter(migrationCandidates, rollbackPredicate);
    // need to reverse the list do we apply the rollbacks in descending
    // order
    return migrationCandidates;