1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package net.sf.ldaptemplate.support.filter;
18
19 /***
20 * Filter for logical OR.
21 *
22 * <pre>
23 * AndFilter filter = new AndFilter();
24 * filter.or(new EqualsFilter("objectclass", "person");
25 * filter.or(new EqualsFilter("objectclass", "organizationalUnit");
26 * System.out.println(filter.ecode());
27 * </pre>
28 *
29 * would result in:
30 * <code>(|(objectclass=person)(objectclass=organizationalUnit))</code>
31 *
32 * @author Adam Skogman
33 * @author Mattias Arthursson
34 */
35 public class OrFilter extends BinaryLogicalFilter {
36
37 private static final String PIPE_SIGN = "|";
38
39 /***
40 * Add a query to the OR expression
41 *
42 * @param query
43 * The query to or with the rest of the or:ed queries.
44 * @return This LdapOrQuery
45 */
46 public OrFilter or(Filter query) {
47 queryList.add(query);
48 return this;
49 }
50
51
52
53
54
55
56 protected String getLogicalOperator() {
57 return PIPE_SIGN;
58 }
59 }