List of usage examples for org.apache.commons.collections4 Predicate Predicate
Predicate
From source file:org.apache.syncope.common.lib.SyncopeClientCompositeException.java
public boolean addException(final SyncopeClientException exception) { if (exception.getType() == null) { throw new IllegalArgumentException( exception + " does not have the right " + ClientExceptionType.class.getName() + " set"); }//from w ww.j a v a 2s.c om SyncopeClientException alreadyAdded = IterableUtils.find(exceptions, new Predicate<SyncopeClientException>() { @Override public boolean evaluate(final SyncopeClientException ex) { return ex.getType() == exception.getType(); } }); return alreadyAdded == null ? exceptions.add(exception) : alreadyAdded.getElements().addAll(exception.getElements()); }
From source file:org.apache.syncope.common.lib.to.MappingTO.java
public MappingItemTO getConnObjectKeyItem() { return IterableUtils.find(getItems(), new Predicate<MappingItemTO>() { @Override// w w w.j a va2 s . c o m public boolean evaluate(final MappingItemTO item) { return item.isConnObjectKey(); } }); }
From source file:org.apache.syncope.common.lib.to.ResourceTO.java
@JsonIgnore public ProvisionTO getProvision(final String anyType) { return IterableUtils.find(provisions, new Predicate<ProvisionTO>() { @Override//from ww w. j av a2 s . c o m public boolean evaluate(final ProvisionTO provisionTO) { return anyType != null && anyType.equals(provisionTO.getAnyType()); } }); }
From source file:org.apache.syncope.common.lib.types.SyncPolicySpec.java
public SyncPolicySpecItem getItem(final String anyTypeKey) { return CollectionUtils.find(items, new Predicate<SyncPolicySpecItem>() { @Override//w ww. j ava 2s .co m public boolean evaluate(final SyncPolicySpecItem item) { return anyTypeKey != null && anyTypeKey.equals(item.getAnyTypeKey()); } }); }
From source file:org.apache.syncope.core.logic.init.JobManagerImpl.java
private boolean isRunningHere(final JobKey jobKey) throws SchedulerException { return IterableUtils.matchesAny(scheduler.getScheduler().getCurrentlyExecutingJobs(), new Predicate<JobExecutionContext>() { @Override// w ww.jav a 2 s . c o m public boolean evaluate(final JobExecutionContext jec) { return jobKey.equals(jec.getJobDetail().getKey()); } }); }
From source file:org.apache.syncope.core.misc.MappingUtils.java
public static <T extends MappingItem> Collection<T> getMatchingMappingItems(final Collection<T> items, final IntMappingType type) { return CollectionUtils.select(items, new Predicate<T>() { @Override/*from w w w. ja va2 s . c om*/ public boolean evaluate(final T item) { return item.getIntMappingType() == type; } }); }
From source file:org.apache.syncope.core.misc.MappingUtils.java
public static <T extends MappingItem> Collection<T> getMatchingMappingItems(final Collection<T> items, final String intAttrName, final IntMappingType type) { return CollectionUtils.select(items, new Predicate<T>() { @Override//from w w w . j a v a 2 s.c om public boolean evaluate(final T item) { return item.getIntMappingType() == type && intAttrName.equals(item.getIntAttrName()); } }); }
From source file:org.apache.syncope.core.misc.MappingUtils.java
public static <T extends MappingItem> Collection<T> getMatchingMappingItems(final Collection<T> items, final String intAttrName) { return CollectionUtils.select(items, new Predicate<T>() { @Override//from w w w . ja va 2s .c o m public boolean evaluate(final T item) { return intAttrName.equals(item.getIntAttrName()); } }); }
From source file:org.apache.syncope.core.misc.security.MustChangePasswordFilter.java
@Override public void doFilter(final ServletRequest request, final ServletResponse response, final FilterChain chain) throws IOException, ServletException { if (request instanceof SecurityContextHolderAwareRequestWrapper) { boolean isMustChangePassword = IterableUtils.matchesAny( SecurityContextHolder.getContext().getAuthentication().getAuthorities(), new Predicate<GrantedAuthority>() { @Override/*from w w w .j a va 2s .com*/ public boolean evaluate(final GrantedAuthority authority) { return StandardEntitlement.MUST_CHANGE_PASSWORD.equals(authority.getAuthority()); } }); SecurityContextHolderAwareRequestWrapper wrapper = SecurityContextHolderAwareRequestWrapper.class .cast(request); if (isMustChangePassword && "GET".equalsIgnoreCase(wrapper.getMethod()) && !ArrayUtils.contains(ALLOWED, wrapper.getPathInfo())) { throw new AccessDeniedException("Please change your password first"); } } chain.doFilter(request, response); }
From source file:org.apache.syncope.core.persistence.api.attrvalue.validation.InvalidEntityException.java
public final boolean hasViolation(final EntityViolationType type) { return IterableUtils.matchesAny(violations.keySet(), new Predicate<Class<?>>() { @Override// w w w. j av a 2 s. c o m public boolean evaluate(final Class<?> entity) { return violations.get(entity).contains(type); } }); }