List of usage examples for org.apache.commons.collections Predicate Predicate
Predicate
From source file:net.sourceforge.fenixedu.domain.teacher.TeacherService.java
public DegreeTeachingService getDegreeTeachingServiceByShiftAndProfessorship(final Shift shift, final Professorship professorship) { return (DegreeTeachingService) CollectionUtils.find(getDegreeTeachingServices(), new Predicate() { @Override/*from www.ja v a 2 s. co m*/ public boolean evaluate(Object arg0) { DegreeTeachingService degreeTeachingService = (DegreeTeachingService) arg0; return (degreeTeachingService.getShift() == shift) && (degreeTeachingService.getProfessorship() == professorship); } }); }
From source file:net.sourceforge.fenixedu.dataTransferObject.degreeAdministrativeOffice.gradeSubmission.MarkSheetManagementCreateBean.java
@Atomic public MarkSheet createMarkSheet(Person person) { final Collection<MarkSheetEnrolmentEvaluationBean> enrolmentEvaluationBeanList = CollectionUtils .select(getAllEnrolmentEvalutionBeans(), new Predicate() { @Override//from ww w . ja v a 2s . c om public boolean evaluate(Object arg0) { return ((MarkSheetEnrolmentEvaluationBean) arg0).hasAnyGradeValue(); } }); return getCurricularCourse().createNormalMarkSheet(getExecutionPeriod(), getTeacher(), getEvaluationDate(), getMarkSheetType(), Boolean.FALSE, enrolmentEvaluationBeanList, person); }
From source file:net.sourceforge.fenixedu.dataTransferObject.CurricularCourseScopesForPrintDTO.java
private CurricularSemesterForPrintDTO getSelectedSemester(final InfoCurricularCourseScope scope, BranchForPrintDTO selectedBranch) { CurricularSemesterForPrintDTO selectedSemester = (CurricularSemesterForPrintDTO) CollectionUtils .find(selectedBranch.getSemesters(), new Predicate() { @Override/*from ww w . j a v a2 s. c o m*/ public boolean evaluate(Object arg0) { CurricularSemesterForPrintDTO curricularSemesterForPrintDTO = (CurricularSemesterForPrintDTO) arg0; if (curricularSemesterForPrintDTO.getSemester() .equals(scope.getInfoCurricularSemester().getSemester())) { return true; } return false; } }); if (selectedSemester == null) { selectedSemester = new CurricularSemesterForPrintDTO(scope.getInfoCurricularSemester().getSemester()); selectedBranch.getSemesters().add(selectedSemester); } return selectedSemester; }
From source file:com.zuora.api.object.Dynamic.java
/** * Answers the name and values of the static properties of this object * @return the static properties, as string-object pairs *//* ww w . j a v a 2s .c om*/ public Collection<Entry<String, Object>> staticProperties() { return CollectionUtils.select(propertyValues(), new Predicate() { public boolean evaluate(Object object) { Entry e = (Entry) object; return e.getValue() != null && !EXCLUDED_PROPERTY_NAMES.contains(e.getKey()); } }); }
From source file:edu.common.dynamicextensions.xmi.XMIUtilities.java
/*** * Finds and returns the first model element having the given * <code>name</code> in the <code>umlPackage</code>, returns * <code>null</code> if not found. * * @param umlPackage The modelPackage to search * @param name the name to find./* ww w . ja va2 s .c o m*/ * @return the found model element. */ public static Object find(org.omg.uml.modelmanagement.UmlPackage umlPackage, final String name) { return CollectionUtils.find(umlPackage.getOwnedElement(), new Predicate() { public boolean evaluate(Object object) { return StringUtils.trimToEmpty(((ModelElement) object).getName()).equals(name); //return true; } }); }
From source file:net.sourceforge.fenixedu.domain.phd.ExternalPhdProgram.java
public static ExternalPhdProgram readExternalPhdProgramByAcronym(final String acronym) { return (ExternalPhdProgram) CollectionUtils.find(Bennu.getInstance().getExternalPhdProgramsSet(), new Predicate() { @Override//from w ww . j av a 2 s .c o m public boolean evaluate(Object object) { return acronym.equals(((ExternalPhdProgram) object).getAcronym()); } }); }
From source file:gr.omadak.leviathan.asp.objects.GenericClass.java
public Iterator getProperties() { return members == null ? IteratorUtils.EMPTY_ITERATOR : IteratorUtils.filteredIterator(members.values().iterator(), new Predicate() { public boolean evaluate(Object obj) { return obj instanceof Property; }/*from w w w . j a va2 s . c om*/ }); }
From source file:net.sourceforge.fenixedu.domain.accounting.util.IndividualCandidacyPaymentCodeGenerator.java
private List<IndividualCandidacyPaymentCode> getAllIndividualCandidacyPaymentCodesForType( final PaymentCodeType paymentCodeType) { Set<PaymentCode> allPaymentCodes = Bennu.getInstance().getPaymentCodesSet(); List<IndividualCandidacyPaymentCode> outputList = new ArrayList<IndividualCandidacyPaymentCode>(); CollectionUtils.select(allPaymentCodes, new Predicate() { @Override//from w ww. j a v a 2s. c o m public boolean evaluate(Object arg0) { PaymentCode paymentCode = (PaymentCode) arg0; return paymentCodeType.equals(paymentCode.getType()); } }, outputList); return outputList; }
From source file:net.sourceforge.fenixedu.applicationTier.Servico.administrativeOffice.gradeSubmission.EditMarkSheet.java
private static Collection<MarkSheetEnrolmentEvaluationBean> getEnrolmentEvaluationsWithValidGrades( Collection<MarkSheetEnrolmentEvaluationBean> enrolmentEvaluationBeans) { return CollectionUtils.select(enrolmentEvaluationBeans, new Predicate() { @Override/*from w ww.j a va2 s . c o m*/ public boolean evaluate(Object arg0) { MarkSheetEnrolmentEvaluationBean markSheetEnrolmentEvaluationBean = (MarkSheetEnrolmentEvaluationBean) arg0; return markSheetEnrolmentEvaluationBean.getGradeValue() != null && markSheetEnrolmentEvaluationBean.getGradeValue().length() != 0; } }); }
From source file:com.perceptive.epm.perkolcentral.bl.LicensesBL.java
@Transactional(propagation = Propagation.REQUIRED, readOnly = true, isolation = Isolation.SERIALIZABLE, rollbackFor = ExceptionWrapper.class) public HashMap<String, ArrayList<String>> getLicenseRelatedInfo() throws ExceptionWrapper { HashMap<String, ArrayList<String>> licenseInfoKeyedByLicenseName = new HashMap<String, ArrayList<String>>(); try {/*from ww w. j a v a2 s. c om*/ for (Object obj : licenseMasterDataAccessor.getAllLicenseType().values()) { final LicenseBO licenseBO = (LicenseBO) obj; //get the total license purchased for this type of item ArrayList<Licensepurchase> licensepurchaseArrayList = licensePurchaseDataAccessor .getAllLicensePurchaseInformation(); CollectionUtils.filter(licensepurchaseArrayList, new Predicate() { @Override public boolean evaluate(Object o) { Licensepurchase item = (Licensepurchase) o; return (item.getLicensemaster().getLicenseTypeId() .equals(Long.valueOf(licenseBO.getLicenseTypeId()))); } }); //Add up all the licenses purchased int totLicenses = 0; for (Object item : licensepurchaseArrayList) { totLicenses = totLicenses + ((Licensepurchase) item).getNumberOfLicenses(); } if (!licenseInfoKeyedByLicenseName.containsKey(licenseBO.getLicenseTypeName())) licenseInfoKeyedByLicenseName.put(licenseBO.getLicenseTypeName(), new ArrayList<String>()); licenseInfoKeyedByLicenseName.get(licenseBO.getLicenseTypeName()) .add(Integer.toString(totLicenses)); //Get the total number of licenses used up for this type of licenses licenseInfoKeyedByLicenseName.get(licenseBO.getLicenseTypeName()) .add(Integer.toString(employeeLicenseDataAccessor .getEmployeeIdsByLicenseId(licenseBO.getLicenseTypeId()).size())); } } catch (Exception ex) { throw new ExceptionWrapper(ex); } return licenseInfoKeyedByLicenseName; }