1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.apache.directory.server.xdbm.search;
21
22
23 import java.util.Set;
24
25 import org.apache.directory.api.ldap.model.cursor.SetCursor;
26 import org.apache.directory.api.ldap.model.filter.ExprNode;
27 import org.apache.directory.api.ldap.model.message.AliasDerefMode;
28 import org.apache.directory.api.ldap.model.schema.SchemaManager;
29 import org.apache.directory.server.xdbm.IndexEntry;
30
31
32
33
34
35
36
37
38
39
40
41
42 public class PartitionSearchResult
43 {
44
45 private SetCursor<IndexEntry<String, String>> resultSet;
46
47
48 private Set<String> candidateSet;
49
50
51 private AliasDerefMode aliasDerefMode = AliasDerefMode.NEVER_DEREF_ALIASES;
52
53
54 private Evaluator<? extends ExprNode> evaluator;
55
56
57 private SchemaManager schemaManager;
58
59
60
61
62
63
64
65 public PartitionSearchResult( SchemaManager schemaManager )
66 {
67 this.schemaManager = schemaManager;
68 }
69
70
71
72
73
74 public SetCursor<IndexEntry<String, String>> getResultSet()
75 {
76 return resultSet;
77 }
78
79
80
81
82
83 public void setResultSet( Set<IndexEntry<String, String>> set )
84 {
85 resultSet = new SetCursor<>( set );
86 }
87
88
89
90
91
92 public Set<String> getCandidateSet()
93 {
94 return candidateSet;
95 }
96
97
98
99
100
101 public void setCandidateSet( Set<String> set )
102 {
103 candidateSet = set;
104 }
105
106
107
108
109
110 public Evaluator<? extends ExprNode> getEvaluator()
111 {
112 return evaluator;
113 }
114
115
116
117
118
119 public void setEvaluator( Evaluator<? extends ExprNode> evaluator )
120 {
121 this.evaluator = evaluator;
122 }
123
124
125
126
127
128 public void setAliasDerefMode( AliasDerefMode aliasDerefMode )
129 {
130 this.aliasDerefMode = aliasDerefMode;
131 }
132
133
134
135
136
137 public boolean isNeverDeref()
138 {
139 return aliasDerefMode == AliasDerefMode.NEVER_DEREF_ALIASES;
140 }
141
142
143
144
145
146 public boolean isDerefAlways()
147 {
148 return aliasDerefMode == AliasDerefMode.DEREF_ALWAYS;
149 }
150
151
152
153
154
155 public boolean isDerefInSearching()
156 {
157 return aliasDerefMode == AliasDerefMode.DEREF_IN_SEARCHING;
158 }
159
160
161
162
163
164 public boolean isDerefFinding()
165 {
166 return aliasDerefMode == AliasDerefMode.DEREF_FINDING_BASE_OBJ;
167 }
168
169
170
171
172
173 public SchemaManager getSchemaManager()
174 {
175 return schemaManager;
176 }
177
178
179
180
181
182 public void setSchemaManager( SchemaManager schemaManager )
183 {
184 this.schemaManager = schemaManager;
185 }
186
187
188
189
190
191 public String toString()
192 {
193 StringBuilder sb = new StringBuilder();
194
195 sb.append( "Search result : \n" );
196 sb.append( "Alias : " ).append( aliasDerefMode ).append( "\n" );
197 sb.append( "Evaluator : " ).append( evaluator ).append( "\n" );
198
199 if ( resultSet == null )
200 {
201 sb.append( "No UUID found" );
202 }
203 else
204 {
205 sb.append( '{' );
206 boolean isFirst = true;
207
208 try
209 {
210 while ( resultSet.next() )
211 {
212 if ( isFirst )
213 {
214 isFirst = false;
215 }
216 else
217 {
218 sb.append( ", " );
219 }
220
221 sb.append( resultSet.get().getId() );
222 }
223
224 resultSet.beforeFirst();
225 }
226 catch ( Exception e )
227 {
228
229 }
230
231 sb.append( '}' );
232 }
233
234 return sb.toString();
235 }
236 }