List of usage examples for org.apache.commons.collections Predicate Predicate
Predicate
From source file:net.sourceforge.fenixedu.domain.student.Registration.java
private boolean enroledShiftsContainsShiftWithSameExecutionCourseAndShiftType(final List<Shift> enroledShifts, final ExecutionCourse executionCourse, final ShiftType shiftType) { return CollectionUtils.exists(enroledShifts, new Predicate() { @Override/*from w ww. ja v a 2 s. co m*/ final public boolean evaluate(Object object) { Shift enroledShift = (Shift) object; return enroledShift.getExecutionCourse() == executionCourse && enroledShift.containsType(shiftType); } }); }
From source file:module.siadap.domain.wrappers.UnitSiadapWrapper.java
public List<PersonSiadapWrapper> getPeopleHarmonizedWithAnyNoAssessment() { List<PersonSiadapWrapper> listPeopleToReturn = new ArrayList<PersonSiadapWrapper>(); SiadapYearConfiguration siadapYearConf = getConfiguration(); getUnitAttachedPersons(unit, listPeopleToReturn, true, new Predicate() { @Override//from w ww . j ava 2 s .co m public boolean evaluate(Object arg0) { PersonSiadapWrapper personWrapper = (PersonSiadapWrapper) arg0; if (personWrapper.getSiadap() != null) { for (SiadapEvaluationUniverse evalUniverse : personWrapper.getSiadap() .getSiadapEvaluationUniversesSet()) { if (evalUniverse.getHarmonizationAssessment() != null && evalUniverse.getHarmonizationAssessment() == false) { return true; } if (evalUniverse.getHarmonizationAssessmentForExcellencyAward() != null && evalUniverse.getHarmonizationAssessmentForExcellencyAward() == false) { return true; } } } return false; } }, Collections.singleton(siadapYearConf.getHarmonizationUnitRelations()), siadapYearConf.getSiadap2HarmonizationRelation(), siadapYearConf.getSiadap3HarmonizationRelation()); return listPeopleToReturn; }
From source file:com.kcs.service.impl.GenerateXmlServiceImpl.java
private List<Datasetirf> filterRepeatChild(final Datasetirf main, List<Datasetirf> childList) { List<Datasetirf> result = new ArrayList<Datasetirf>(); final Predicate childRepeatPredicate = new Predicate() { @Override// w ww . j a v a 2 s .c om public boolean evaluate(Object o) { if (Utility.isNotNull(o)) { Datasetirf child = (Datasetirf) o; boolean result = (main.getArrgmentTye().equals(child.getArrgmentTye()) && main.getInvPartyTye().equals(child.getInvPartyTye()) && main.getCurrCode().equals(child.getCurrCode()) && main.getDepsitTerm().equals(child.getDepsitTerm()) && main.getDepsitTermUnt().equals(child.getDepsitTermUnt()) && main.getEffectiveDate().equals(child.getEffectiveDate()) && objEquals(main.getEndDate(), child.getEndDate())); return result; } return false; } }; result = (List<Datasetirf>) CollectionUtils.select(childList, childRepeatPredicate); return result; }
From source file:net.sourceforge.fenixedu.domain.Person.java
public static Collection<Person> findInternalPersonByNameAndRole(final String name, final RoleType roleType) { final Role role = Role.getRoleByRoleType(roleType); return CollectionUtils.select(findInternalPerson(name), new Predicate() { @Override//from ww w . j a v a 2 s .c o m public boolean evaluate(final Object arg0) { return ((Person) arg0).hasPersonRoles(role); } }); }
From source file:com.kcs.service.impl.GenerateXmlServiceImpl.java
private List<DfFxm> filterRelateFiGroupInfoChild(final DfFxm main, List<DfFxm> childList) { List<DfFxm> result = new ArrayList<DfFxm>(); final Predicate childRepeatPredicate = new Predicate() { @Override// ww w . j a v a2 s . c o m public boolean evaluate(Object o) { if (Utility.isNotNull(o)) { DfFxm child = (DfFxm) o; boolean result = (objEquals(main.getCustomerCode(), child.getCustomerCode()) && objEquals(main.getSeq(), child.getSeq())); return result; } return false; } }; result = (List<DfFxm>) CollectionUtils.select(childList, childRepeatPredicate); return result; }
From source file:com.kcs.service.impl.GenerateXmlServiceImpl.java
private List<DfOlb> filterRelateFiGroupInfoOlbChild(final DfOlb main, List<DfOlb> childList) { List<DfOlb> result = new ArrayList<DfOlb>(); final Predicate childRepeatPredicate = new Predicate() { @Override//w w w. jav a 2 s.c o m public boolean evaluate(Object o) { if (Utility.isNotNull(o)) { DfOlb child = (DfOlb) o; boolean result = (objEquals(main.getCustCode(), child.getCustCode()) && objEquals(main.getSeq(), child.getSeq())); return result; } return false; } }; result = (List<DfOlb>) CollectionUtils.select(childList, childRepeatPredicate); return result; }
From source file:net.sourceforge.fenixedu.domain.Person.java
public Professorship getProfessorshipByExecutionCourse(final ExecutionCourse executionCourse) { return (Professorship) CollectionUtils.find(getProfessorshipsSet(), new Predicate() { @Override/*from w ww .j a v a2s . com*/ public boolean evaluate(final Object arg0) { final Professorship professorship = (Professorship) arg0; return professorship.getExecutionCourse() == executionCourse; } }); }
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 va 2 s.co 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:net.zcarioca.jmx.services.impl.MBeanObjectServiceImpl.java
/** * {@inheritDoc}//ww w . j a v a2 s .com */ @Override public Set<MBeanDescriptor> findMBeansByDomain(final String domain) { return toMBeanObjectSet(getPlatformMBeanServer().queryMBeans(null, null), new Predicate() { @Override public boolean evaluate(Object object) { ObjectInstance objInst = (ObjectInstance) object; return StringUtils.equalsIgnoreCase(domain, objInst.getObjectName().getDomain()); } }); }
From source file:net.zcarioca.jmx.services.impl.MBeanObjectServiceImpl.java
/** * {@inheritDoc}// ww w. j a v a 2 s .c om */ @Override public Set<MBeanDescriptor> findMBeansByType(final String domain, final String type) { return toMBeanObjectSet(getPlatformMBeanServer().queryMBeans(null, null), new Predicate() { @Override public boolean evaluate(Object object) { ObjectInstance objInst = (ObjectInstance) object; ObjectName name = objInst.getObjectName(); if (StringUtils.equalsIgnoreCase(domain, objInst.getObjectName().getDomain())) { String objectType = name.getKeyProperty("type"); return StringUtils.equalsIgnoreCase(type, objectType); } return false; } }); }