List of usage examples for org.apache.commons.collections CollectionUtils select
public static void select(Collection inputCollection, Predicate predicate, Collection outputCollection)
From source file:net.sourceforge.fenixedu.domain.student.importation.DgesStudentImportationProcess.java
public static List<DgesStudentImportationProcess> readDoneJobs(final ExecutionYear executionYear) { List<DgesStudentImportationProcess> jobList = new ArrayList<DgesStudentImportationProcess>(); CollectionUtils.select(executionYear.getDgesBaseProcessSet(), new Predicate() { @Override/*from w w w.j av a2 s .c o m*/ public boolean evaluate(Object arg0) { return (arg0 instanceof DgesStudentImportationProcess) && ((QueueJob) arg0).getDone(); } }, jobList); return jobList; }
From source file:net.sourceforge.fenixedu.domain.candidacyProcess.mobility.MobilityApplicationProcess.java
public List<ErasmusCandidacyProcessReport> getPendingReports() { List<ErasmusCandidacyProcessReport> jobList = new ArrayList<ErasmusCandidacyProcessReport>(); CollectionUtils.select(getErasmusCandidacyProcessReportsSet(), new Predicate() { @Override/* w w w .j ava 2 s .co m*/ public boolean evaluate(Object arg0) { return ((QueueJob) arg0).getIsNotDoneAndNotCancelled(); } }, jobList); return jobList; }
From source file:net.sourceforge.fenixedu.domain.student.importation.DgesStudentImportationProcess.java
public static List<DgesStudentImportationProcess> readPendingJobs(final ExecutionYear executionYear) { List<DgesStudentImportationProcess> jobList = new ArrayList<DgesStudentImportationProcess>(); CollectionUtils.select(executionYear.getDgesBaseProcessSet(), new Predicate() { @Override/* w w w.j a v a 2s . com*/ public boolean evaluate(Object arg0) { return (arg0 instanceof DgesStudentImportationProcess) && ((QueueJob) arg0).getIsNotDoneAndNotCancelled(); } }, jobList); return jobList; }
From source file:net.sourceforge.fenixedu.domain.accounting.report.events.EventReportQueueJob.java
public static List<EventReportQueueJob> retrieveAllGeneratedReports() { List<EventReportQueueJob> reports = new ArrayList<EventReportQueueJob>(); CollectionUtils.select(Bennu.getInstance().getQueueJobSet(), new Predicate() { @Override//from w w w . ja v a2 s . c o m public boolean evaluate(Object arg0) { return arg0 instanceof EventReportQueueJob; } }, reports); return reports; }
From source file:net.sourceforge.fenixedu.domain.accounting.report.events.EventReportQueueJob.java
public static List<EventReportQueueJob> retrieveDoneGeneratedReports() { List<EventReportQueueJob> reports = new ArrayList<EventReportQueueJob>(); CollectionUtils.select(Bennu.getInstance().getQueueJobSet(), new Predicate() { @Override/*from w w w. j a va 2s. c om*/ public boolean evaluate(Object arg0) { if (!(arg0 instanceof EventReportQueueJob)) { return false; } EventReportQueueJob eventReportQueueJob = (EventReportQueueJob) arg0; return eventReportQueueJob.getDone(); } }, reports); return reports; }
From source file:net.sourceforge.fenixedu.domain.student.Registration.java
public RegistrationState getLastActiveState() { List<RegistrationState> activeStateList = new ArrayList<RegistrationState>(); CollectionUtils.select(getRegistrationStatesSet(), new Predicate() { @Override/*from w w w. j a v a2 s. c o m*/ public boolean evaluate(Object arg0) { return ((RegistrationState) arg0).getStateType().isActive(); } }, activeStateList); return !activeStateList.isEmpty() ? Collections.max(activeStateList, RegistrationState.DATE_COMPARATOR) : null; }
From source file:org.broadleafcommerce.common.util.BLCCollectionUtils.java
/** * Delegates to {@link CollectionUtils#select(Collection, org.apache.commons.collections.Predicate)}, but will * force the return type to be a List<T>. * //from w ww . jav a2s . c om * @param inputCollection * @param predicate * @return */ public static <T> List<T> selectList(Collection<T> inputCollection, TypedPredicate<T> predicate) { ArrayList<T> answer = new ArrayList<T>(inputCollection.size()); CollectionUtils.select(inputCollection, predicate, answer); return answer; }
From source file:org.cesecore.util.query.QueryGenerator.java
/** * Generates the SQL query according to the criteria passed in generator. * //from w w w . jav a 2s .c om * @return generated Query. */ public String generate() { if (query.isEmpty()) { final List<Elem> elements = criteria.getElements(); final List<Elem> terms = new ArrayList<Elem>(); final List<Elem> clauses = new ArrayList<Elem>(); CollectionUtils.selectRejected(elements, PredicateUtils.instanceofPredicate(Order.class), terms); CollectionUtils.select(elements, PredicateUtils.instanceofPredicate(Order.class), clauses); if (terms.size() > 0) { query.where(); } termTraversal(terms); clauseTraversal(clauses); } return query.toString(); }
From source file:org.droolsjbpm.services.impl.RuntimeDataServiceImpl.java
public void removeOnUnDeploy(@Observes @Undeploy DeploymentEvent event) { Collection<ProcessDesc> outputCollection = new HashSet<ProcessDesc>(); CollectionUtils.select(availableProcesses, new ByDeploymentIdPredicate(event.getDeploymentId()), outputCollection);/*from ww w .j a va2 s. c o m*/ availableProcesses.removeAll(outputCollection); }
From source file:org.droolsjbpm.services.impl.RuntimeDataServiceImpl.java
public Collection<ProcessDesc> getProcessesByDeploymentId(String deploymentId) { Collection<ProcessDesc> outputCollection = new HashSet<ProcessDesc>(); CollectionUtils.select(availableProcesses, new ByDeploymentIdPredicate(deploymentId), outputCollection); return Collections.unmodifiableCollection(outputCollection); }