List of usage examples for org.apache.commons.collections Predicate Predicate
Predicate
From source file:net.shopxx.controller.admin.SpecificationController.java
@RequestMapping(value = "/update", method = RequestMethod.POST) public String update(Specification specification, RedirectAttributes redirectAttributes) { CollectionUtils.filter(specification.getOptions(), new AndPredicate(new UniquePredicate(), new Predicate() { public boolean evaluate(Object object) { String option = (String) object; return StringUtils.isNotEmpty(option); }//from ww w. j a va2 s. c o m })); if (!isValid(specification)) { return ERROR_VIEW; } specificationService.update(specification, "productCategory"); addFlashMessage(redirectAttributes, SUCCESS_MESSAGE); return "redirect:list.jhtml"; }
From source file:net.sourceforge.fenixedu.domain.phd.ExternalPhdProgram.java
public static ExternalPhdProgram readExternalPhdProgramByName(final String name) { return (ExternalPhdProgram) CollectionUtils.find(Bennu.getInstance().getExternalPhdProgramsSet(), new Predicate() { @Override// ww w . ja v a 2 s .c o m public boolean evaluate(Object object) { return name.equals(((ExternalPhdProgram) object).getName().getContent()); } }); }
From source file:net.shopxx.service.impl.PluginServiceImpl.java
public List<OAuthPlugin> getOAuthPlugins(final boolean isEnabled) { List<OAuthPlugin> result = new ArrayList<OAuthPlugin>(); CollectionUtils.select(oAuthPlugins, new Predicate() { public boolean evaluate(Object object) { OAuthPlugin storagePlugin = (OAuthPlugin) object; return storagePlugin.getIsEnabled() == isEnabled; }// w ww. j a v a2s.co m }, result); Collections.sort(result); return result; }
From source file:de.hybris.platform.b2bacceleratorservices.company.impl.DefaultB2BCommerceUnitService.java
@Override public Collection<? extends B2BUnitModel> getAllowedParentUnits(final B2BUnitModel unit) { final B2BUnitModel sessionUnitParent = getParentUnit(); final Set<B2BUnitModel> branch = getSessionService().executeInLocalView(new SessionExecutionBody() { @Override// w w w.jav a 2s .co m public Object execute() { getSearchRestrictionService().disableSearchRestrictions(); return getB2BUnitService().getBranch(sessionUnitParent); } }); final Set<B2BUnitModel> allowedUnits = new HashSet<B2BUnitModel>( CollectionUtils.select(branch, new Predicate() { @Override public boolean evaluate(final Object object) { final PrincipalGroupModel principalGroup = (PrincipalGroupModel) object; return getB2BGroupCycleValidator().validateGroups(unit, principalGroup); } })); final B2BUnitModel parentUnit = getParentUnit(unit); if (parentUnit != null) { allowedUnits.add(parentUnit); } return allowedUnits; }
From source file:de.softwareforge.pgpsigner.key.PublicKeyRing.java
public PublicKeyRing getVisibleKeys() { return processMap(new Predicate() { public boolean evaluate(Object o) { return ((PublicKey) o).isVisible(); }// w ww .jav a 2s . co m }); }
From source file:edu.kit.sharing.test.SharingTestService.java
@Override public IEntityWrapper<? extends IDefaultReferenceId> createReference(String pDomain, String pDomainUniqueId, String pReferenceGroupId, String pRole, String pGroupId, HttpContext hc) { SecurableResourceId resId = new SecurableResourceId(pDomain, pDomainUniqueId); CollectionUtils.find(references, new Predicate() { @Override/*from w ww.j a va 2 s .co m*/ public boolean evaluate(Object o) { return false; } }); ReferenceId rid = new ReferenceId(resId, new GroupId(pReferenceGroupId)); references.add(rid); return new ReferenceIdWrapper(rid); }
From source file:gov.nih.nci.caarray.domain.permissions.SecurityLevel.java
/** * @return the list of SecurityLevels that are available to the public access profile *//*from ww w. j av a 2 s. c o m*/ public static List<SecurityLevel> publicLevels() { return valuesSubset(new Predicate() { public boolean evaluate(Object o) { return ((SecurityLevel) o).isAvailableToPublic(); } }); }
From source file:com.perceptive.epm.perkolcentral.bl.EmployeeBL.java
@Cacheable(cacheName = "EmployeeKeyedByGroupCache", keyGenerator = @KeyGenerator(name = "HashCodeCacheKeyGenerator", properties = @Property(name = "includeMethod", value = "false"))) @Transactional(propagation = Propagation.REQUIRED, readOnly = true, isolation = Isolation.SERIALIZABLE, rollbackFor = ExceptionWrapper.class) public LinkedHashMap<Integer, ArrayList<EmployeeBO>> getAllEmployeesKeyedByGroupId() throws ExceptionWrapper { LinkedHashMap<Integer, ArrayList<EmployeeBO>> employeeBOLinkedHashMap = new LinkedHashMap<Integer, ArrayList<EmployeeBO>>(); Collection<EmployeeBO> employeeBOCollection = this.getAllEmployees().values(); try {// w ww . java2 s . c o m for (Object item : groupsBL.getAllGroups().values()) { final GroupBO groupBO = (GroupBO) item; ArrayList<EmployeeBO> employeeBOArrayList = new ArrayList<EmployeeBO>(employeeBOCollection); CollectionUtils.filter(employeeBOArrayList, new Predicate() { @Override public boolean evaluate(Object o) { return CollectionUtils.exists(((EmployeeBO) o).getGroups(), new Predicate() { @Override public boolean evaluate(Object o) { return ((GroupBO) o).getGroupId().equalsIgnoreCase(groupBO.getGroupId()); } }); } }); employeeBOLinkedHashMap.put(Integer.valueOf(groupBO.getGroupId()), employeeBOArrayList); } } catch (Exception ex) { throw new ExceptionWrapper(ex); } return employeeBOLinkedHashMap; }
From source file:com.ebay.cloud.cms.dal.search.impl.criteria.EqualityCriteriaHandler.java
private boolean evalEq(final List<?> fieldValues, final Object criteriaValue) { Predicate eqPre = new Predicate() { @Override/*w ww . jav a2s. co m*/ public boolean evaluate(Object object) { if (criteriaValue instanceof Long && object instanceof Integer) { Long value = Long.valueOf((Integer) object); return criteriaValue.equals(value); } else { return criteriaValue.equals(object); } } }; return CollectionUtils.exists(fieldValues, eqPre); }
From source file:net.sourceforge.fenixedu.domain.residence.StudentsPerformanceReport.java
public static List<StudentsPerformanceReport> readGeneratedReports(final ExecutionSemester executionSemester) { List<StudentsPerformanceReport> generatedReports = new ArrayList<StudentsPerformanceReport>(); CollectionUtils.select(executionSemester.getStudentsPerformanceReportsSet(), new Predicate() { @Override/* www . ja va 2s . c om*/ public boolean evaluate(Object arg0) { return ((StudentsPerformanceReport) arg0).getDone(); } }, generatedReports); return generatedReports; }