I was able to solve it with this, if there is an easier way please comment.
public ListThe main part is the signedAgreement, if its true we just want to add it to the filter to check for the property to be true in LDAP, but if we want to check for False, we want to check if its False OR if its not present at all. This allows us to have both the AND and OR filter.findUsers(boolean lockedOut, boolean signedAgreement) { AndFilter andFilter = new AndFilter(); OrFilter orFilter = new OrFilter(); andFilter.and(new EqualsFilter("lockedOut", lockedOut); if(signedAgreement) { andFilter.and(new EqualsFilter("signedAgreement", signedAgreement); } else { orFilter.or(new EqualsFilter("signedAgreement", signedAgreement); orFilter.or(new NotPresentFilter("signedAgreement"); andFilter.append(orFilter); } }
No comments:
Post a Comment