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:org.droolsjbpm.services.impl.RuntimeDataServiceImpl.java

public Collection<ProcessDesc> getProcessesByFilter(String filter) {
    Collection<ProcessDesc> outputCollection = new HashSet<ProcessDesc>();
    CollectionUtils.select(availableProcesses, new RegExPredicate("^.*" + filter + ".*$"), outputCollection);
    return Collections.unmodifiableCollection(outputCollection);
}

From source file:org.droolsjbpm.services.impl.RuntimeDataServiceImpl.java

public ProcessDesc getProcessById(String processId) {

    Collection<ProcessDesc> outputCollection = new HashSet<ProcessDesc>();
    CollectionUtils.select(availableProcesses, new ByProcessIdPredicate(processId), outputCollection);
    if (!outputCollection.isEmpty()) {
        return outputCollection.iterator().next();
    }//from w  ww .  jav a  2s  .co  m
    return null;
}

From source file:org.extremecomponents.tree.ProcessTreeRowsCallback.java

private Collection filter(TableModel model, Collection rows) throws Exception {
    List results = new ArrayList();
    FilterPredicate filterPredicate = new FilterPredicate(model);
    CollectionUtils.select(rows, filterPredicate, results);

    // Add back the parents
    for (int i = 0; i < results.size(); i++) {
        Object bean = results.get(i);
        TreeModelUtils.findBeanParents(model, rows, results, bean);
    }/* w  ww . j  av a  2 s . com*/

    return results;
}

From source file:org.extremesite.callback.ExactMatchFilterRows.java

public Collection filterRows(TableModel model, Collection rows) throws Exception {
    boolean filtered = model.getLimit().isFiltered();
    boolean cleared = model.getLimit().isCleared();

    if (!filtered || cleared) {
        return rows;
    }//from   ww  w .  j  a v  a  2s  . c o  m

    if (filtered) {
        Collection collection = new ArrayList();
        Predicate filterPredicate = new ExactMatchFilterPredicate(model);
        CollectionUtils.select(rows, filterPredicate, collection);

        return collection;
    }

    return rows;
}

From source file:org.fenixedu.ulisboa.specifications.domain.student.access.importation.DgesStudentImportationProcess.java

public static List<DgesStudentImportationProcess> readDoneJobs(ExecutionYear executionYear) {
    List<DgesStudentImportationProcess> jobList = new ArrayList<DgesStudentImportationProcess>();
    CollectionUtils.select(executionYear.getDgesStudentImportationProcessSet(), new Predicate() {
        @Override/*w  ww  .  jav a  2  s  .  com*/
        public boolean evaluate(Object process) {
            return process instanceof DgesStudentImportationProcess && ((QueueJob) process).getDone();
        }
    }, jobList);
    return jobList;
}

From source file:org.fenixedu.ulisboa.specifications.domain.student.access.importation.DgesStudentImportationProcess.java

public static List<DgesStudentImportationProcess> readAllJobs(ExecutionYear executionYear) {
    List<DgesStudentImportationProcess> jobList = new ArrayList<DgesStudentImportationProcess>();
    CollectionUtils.select(executionYear.getDgesStudentImportationProcessSet(), new Predicate() {
        @Override/*  ww  w.  j  a  v  a2  s . c o m*/
        public boolean evaluate(Object arg0) {
            return arg0 instanceof DgesStudentImportationProcess;
        }
    }, jobList);
    return jobList;
}

From source file:org.jbpm.kie.services.impl.RuntimeDataServiceImpl.java

public void onUnDeploy(DeploymentEvent event) {
    Collection<ProcessAssetDesc> outputCollection = new HashSet<ProcessAssetDesc>();
    CollectionUtils.select(availableProcesses, new UnsecureByDeploymentIdPredicate(event.getDeploymentId()),
            outputCollection);//w ww.  ja  v  a 2 s .  c o  m

    availableProcesses.removeAll(outputCollection);
    deploymentsRoles.remove(event.getDeploymentId());
    userDeploymentIdsCache.clear();
}

From source file:org.jbpm.kie.services.impl.RuntimeDataServiceImpl.java

@Override
public void onActivate(DeploymentEvent event) {
    Collection<ProcessAssetDesc> outputCollection = new HashSet<ProcessAssetDesc>();
    CollectionUtils.select(availableProcesses, new UnsecureByDeploymentIdPredicate(event.getDeploymentId()),
            outputCollection);//from  www.j  a va  2s. co m

    for (ProcessAssetDesc process : outputCollection) {
        process.setActive(true);
    }

}

From source file:org.jbpm.kie.services.impl.RuntimeDataServiceImpl.java

@Override
public void onDeactivate(DeploymentEvent event) {
    Collection<ProcessAssetDesc> outputCollection = new HashSet<ProcessAssetDesc>();
    CollectionUtils.select(availableProcesses, new UnsecureByDeploymentIdPredicate(event.getDeploymentId()),
            outputCollection);//  w  w w  . jav a2 s  .  c o  m

    for (ProcessAssetDesc process : outputCollection) {
        process.setActive(false);
    }
}

From source file:org.jbpm.kie.services.impl.RuntimeDataServiceImpl.java

public Collection<ProcessDefinition> getProcessesByDeploymentId(String deploymentId,
        QueryContext queryContext) {/*w w w.  j  av a 2  s. c  o  m*/
    List<ProcessDefinition> outputCollection = new ArrayList<ProcessDefinition>();
    CollectionUtils.select(availableProcesses,
            new ByDeploymentIdPredicate(deploymentId, identityProvider.getRoles()), outputCollection);

    applySorting(outputCollection, queryContext);
    return applyPaginition(outputCollection, queryContext);
}