List of usage examples for org.apache.commons.collections CollectionUtils select
public static void select(Collection inputCollection, Predicate predicate, Collection outputCollection)
From source file:module.mailtracking.domain.Year.java
public java.util.List<CorrespondenceEntry> getAbleToViewEntries(final CorrespondenceType type, boolean onlyActive) { java.util.List<CorrespondenceEntry> entries = new java.util.ArrayList<CorrespondenceEntry>(); java.util.List<CorrespondenceEntry> baseEntries = onlyActive ? getActiveEntries(type) : getAnyStateEntries(type);/*w ww .j av a 2 s . co m*/ CollectionUtils.select(baseEntries, new Predicate() { @Override public boolean evaluate(Object arg0) { return ((CorrespondenceEntry) arg0).isUserAbleToView(Authenticate.getUser()); } }, entries); return entries; }
From source file:net.sourceforge.fenixedu.domain.student.importation.ExportExistingStudentsFromImportationProcess.java
public static List<DgesStudentImportationProcess> readPendingJobs(final ExecutionYear executionYear) { List<DgesStudentImportationProcess> jobList = new ArrayList<DgesStudentImportationProcess>(); CollectionUtils.select(executionYear.getDgesBaseProcessSet(), new Predicate() { @Override// w ww. ja va 2 s . com public boolean evaluate(Object arg0) { return (arg0 instanceof ExportExistingStudentsFromImportationProcess) && ((QueueJob) arg0).getIsNotDoneAndNotCancelled(); } }, jobList); return jobList; }
From source file:net.sourceforge.fenixedu.domain.student.importation.ExportDegreeCandidaciesByDegreeForPasswordGeneration.java
public static List<ExportDegreeCandidaciesByDegreeForPasswordGeneration> readDoneJobs( final ExecutionYear executionYear) { List<ExportDegreeCandidaciesByDegreeForPasswordGeneration> jobList = new ArrayList<ExportDegreeCandidaciesByDegreeForPasswordGeneration>(); CollectionUtils.select(executionYear.getDgesBaseProcessSet(), new Predicate() { @Override/*from w w w .j a v a2 s .com*/ public boolean evaluate(Object arg0) { return (arg0 instanceof ExportDegreeCandidaciesByDegreeForPasswordGeneration) && ((QueueJob) arg0).getDone(); } }, jobList); return jobList; }
From source file:net.sourceforge.fenixedu.domain.candidacyProcess.erasmus.ApprovedLearningAgreementDocumentFile.java
protected List<ApprovedLearningAgreementExecutedAction> getSentEmailAcceptedStudentActions() { List<ApprovedLearningAgreementExecutedAction> executedActionList = new ArrayList<ApprovedLearningAgreementExecutedAction>(); CollectionUtils.select(getExecutedActionsSet(), new Predicate() { @Override// w ww . ja v a2s . c o m public boolean evaluate(Object arg0) { return ((ApprovedLearningAgreementExecutedAction) arg0).isSentEmailAcceptedStudent(); }; }, executedActionList); Collections.sort(executedActionList, Collections.reverseOrder(ExecutedAction.WHEN_OCCURED_COMPARATOR)); return executedActionList; }
From source file:net.sourceforge.fenixedu.domain.candidacyProcess.CandidacyProcess.java
public List<IndividualCandidacyProcess> getChildsWithMissingRequiredDocuments() { List<IndividualCandidacyProcess> childs = new ArrayList<IndividualCandidacyProcess>(); CollectionUtils.select(getChildProcessesSet(), new Predicate() { @Override/*from www . j a v a 2 s .c o m*/ public boolean evaluate(Object arg0) { IndividualCandidacyProcess process = (IndividualCandidacyProcess) arg0; return !process.isCandidacyCancelled() && process.isProcessMissingRequiredDocumentFiles(); } }, childs); return childs; }
From source file:module.mailtracking.domain.MailTracking.java
public java.util.List<CorrespondenceEntry> getAbleToViewEntries(final CorrespondenceType type, boolean onlyActiveEntries) { java.util.List<CorrespondenceEntry> entries = new java.util.ArrayList<CorrespondenceEntry>(); java.util.List<CorrespondenceEntry> baseEntries = onlyActiveEntries ? getActiveEntries(type) : getAnyStateEntries(type);//from w w w . j a v a2 s.com CollectionUtils.select(baseEntries, new Predicate() { @Override public boolean evaluate(Object arg0) { return ((CorrespondenceEntry) arg0).isUserAbleToView(Authenticate.getUser()); } }, entries); return entries; }
From source file:net.sourceforge.fenixedu.domain.candidacyProcess.CandidacyProcess.java
public List<IndividualCandidacyProcess> getChildsWithMissingShifts() { List<IndividualCandidacyProcess> childs = new ArrayList<IndividualCandidacyProcess>(); CollectionUtils.select(getChildProcessesSet(), new Predicate() { @Override//from w ww . j av a2 s . c om public boolean evaluate(Object arg0) { boolean hasNotMissingShifts = true; IndividualCandidacyProcess process = (IndividualCandidacyProcess) arg0; for (Attends attends : process.getCandidacy().getPersonalDetails().getPerson() .getCurrentAttends()) { if (!attends.hasAllShiftEnrolments()) { hasNotMissingShifts = false; } } return !process.isCandidacyCancelled() && !hasNotMissingShifts; } }, childs); return childs; }
From source file:net.sourceforge.fenixedu.domain.student.importation.ExportDegreeCandidaciesByDegreeForPasswordGeneration.java
public static List<ExportDegreeCandidaciesByDegreeForPasswordGeneration> readPendingJobs( final ExecutionYear executionYear) { List<ExportDegreeCandidaciesByDegreeForPasswordGeneration> jobList = new ArrayList<ExportDegreeCandidaciesByDegreeForPasswordGeneration>(); CollectionUtils.select(executionYear.getDgesBaseProcessSet(), new Predicate() { @Override//from w w w .jav a 2s.c o m public boolean evaluate(Object arg0) { return (arg0 instanceof ExportDegreeCandidaciesByDegreeForPasswordGeneration) && ((QueueJob) arg0).getIsNotDoneAndNotCancelled(); } }, jobList); return jobList; }
From source file:module.mailtracking.domain.MailTracking.java
static java.util.List<CorrespondenceEntry> filterEntriesByTypeAndState( final java.util.Collection<CorrespondenceEntry> entries, final CorrespondenceEntryState state, final CorrespondenceType type) { java.util.List<CorrespondenceEntry> activeEntries = new java.util.ArrayList<CorrespondenceEntry>(); CollectionUtils.select(entries, new Predicate() { @Override//from w ww. j a v a 2 s . c o m public boolean evaluate(Object arg0) { CorrespondenceEntry entry = (CorrespondenceEntry) arg0; return (state == null || state.equals(entry.getState())) && (type == null || type.equals(entry.getType())); } }, activeEntries); return activeEntries; }
From source file:com.redhat.rhn.domain.monitoring.command.Command.java
/** * Return a list of threshold parameters for the metric <code>m</code>. * The parameters are sorted by ascendint {@link ThresholdType}. * @param m the metric for which to list parameters * @return a list of threshold parameters in ascending order *//* w w w . java2 s.c om*/ public List listThresholds(Metric m) { ArrayList result = new ArrayList(); CollectionUtils.select(getCommandParameters(), new ParameterForMetric(m), result); Collections.sort(result, new ThresholdParameter.ByType()); return result; }