1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 package org.apache.directory.api.ldap.trigger;
22
23
24 import org.apache.directory.api.ldap.model.message.SearchScope;
25 import org.apache.directory.api.ldap.model.name.Dn;
26
27
28
29
30
31
32
33 public class StoredProcedureSearchContextOption implements StoredProcedureOption
34 {
35
36 private final Dn baseObject;
37 private SearchScope searchScope;
38
39
40
41
42
43
44
45 public StoredProcedureSearchContextOption( Dn baseObject )
46 {
47
48 this( baseObject, SearchScope.OBJECT );
49 }
50
51
52
53
54
55
56
57
58 public StoredProcedureSearchContextOption( Dn baseObject, SearchScope searchScope )
59 {
60 this.baseObject = baseObject;
61 this.searchScope = searchScope;
62 }
63
64
65
66
67
68
69
70 public Dn getBaseObject()
71 {
72 return baseObject;
73 }
74
75
76
77
78
79
80
81 public SearchScope getSearchScope()
82 {
83 return searchScope;
84 }
85
86
87
88
89
90 @Override
91 public String toString()
92 {
93 return "searchContext { scope " + searchScope + " } \"" + baseObject + "\"";
94 }
95
96
97
98
99
100 @Override
101 public int hashCode()
102 {
103 int h = 37;
104
105 h = h * 17 + ( ( baseObject == null ) ? 0 : baseObject.hashCode() );
106 h = h * 17 + ( ( searchScope == null ) ? 0 : searchScope.hashCode() );
107
108 return h;
109 }
110
111
112
113
114
115 @Override
116 public boolean equals( Object obj )
117 {
118 if ( this == obj )
119 {
120 return true;
121 }
122 if ( obj == null )
123 {
124 return false;
125 }
126 if ( getClass() != obj.getClass() )
127 {
128 return false;
129 }
130 final StoredProcedureSearchContextOption other = ( StoredProcedureSearchContextOption ) obj;
131 if ( baseObject == null )
132 {
133 if ( other.baseObject != null )
134 {
135 return false;
136 }
137 }
138 else if ( !baseObject.equals( other.baseObject ) )
139 {
140 return false;
141 }
142 if ( searchScope == null )
143 {
144 if ( other.searchScope != null )
145 {
146 return false;
147 }
148 }
149 else if ( !searchScope.equals( other.searchScope ) )
150 {
151 return false;
152 }
153 return true;
154 }
155
156 }