15
15
*/
16
16
package com .orientechnologies .orient .core .sql ;
17
17
18
+ import java .util .ArrayList ;
19
+ import java .util .Collections ;
20
+ import java .util .HashSet ;
21
+ import java .util .Iterator ;
22
+ import java .util .LinkedHashMap ;
23
+ import java .util .List ;
24
+ import java .util .Map ;
25
+ import java .util .Map .Entry ;
26
+ import java .util .Set ;
27
+
18
28
import com .orientechnologies .orient .core .command .OCommandRequest ;
19
29
import com .orientechnologies .orient .core .command .OCommandRequestText ;
20
30
import com .orientechnologies .orient .core .db .ODatabaseRecordThreadLocal ;
21
31
import com .orientechnologies .orient .core .db .record .ODatabaseRecord ;
22
- import com .orientechnologies .orient .core .db .record .ODatabaseRecordAbstract ;
23
32
import com .orientechnologies .orient .core .db .record .OIdentifiable ;
24
33
import com .orientechnologies .orient .core .exception .OCommandExecutionException ;
25
34
import com .orientechnologies .orient .core .id .ORID ;
46
55
import com .orientechnologies .orient .core .sql .query .OSQLSynchQuery ;
47
56
import com .orientechnologies .orient .core .storage .OStorage ;
48
57
49
- import java .util .ArrayList ;
50
- import java .util .Collections ;
51
- import java .util .HashSet ;
52
- import java .util .Iterator ;
53
- import java .util .LinkedHashMap ;
54
- import java .util .List ;
55
- import java .util .Map ;
56
- import java .util .Map .Entry ;
57
- import java .util .Set ;
58
-
59
58
/**
60
59
* Executes a TRAVERSE crossing records. Returns a List<OIdentifiable> containing all the traversed records that match the WHERE
61
60
* condition.
@@ -166,8 +165,8 @@ protected Object getResult() {
166
165
if (!(d instanceof OIdentifiable ))
167
166
// NON-DOCUMENT AS RESULT, COMES FROM EXPAND? CREATE A DOCUMENT AT THE FLY
168
167
d = new ODocument ().field ("value" , d );
169
- else if (!(d instanceof ORID || d instanceof ORecord ))
170
- d = ((OIdentifiable ) d ).getRecord ();
168
+ else if (!(d instanceof ORID || d instanceof ORecord ))
169
+ d = ((OIdentifiable ) d ).getRecord ();
171
170
172
171
if (!request .getResultListener ().result (d ))
173
172
break ;
@@ -186,13 +185,12 @@ protected boolean handleResult(final OIdentifiable iRecord, boolean iCloneIt) {
186
185
187
186
OIdentifiable recordCopy = iRecord instanceof ORecord <?> ? ((ORecord <?>) iRecord ).copy () : iRecord .getIdentity ().copy ();
188
187
189
- if (recordCopy != null )
190
- // CALL THE LISTENER NOW
191
- if (request .getResultListener () != null ) {
192
- final boolean result = request .getResultListener ().result (recordCopy );
193
- if (!result )
194
- return false ;
195
- }
188
+ // CALL THE LISTENER NOW
189
+ if (recordCopy != null && request .getResultListener () != null ) {
190
+ final boolean result = request .getResultListener ().result (recordCopy );
191
+ if (!result )
192
+ return false ;
193
+ }
196
194
197
195
if (limit > -1 && resultCount >= limit )
198
196
// BREAK THE EXECUTION
@@ -237,7 +235,6 @@ else if (letValueAsString.startsWith("(")) {
237
235
*
238
236
* @param w
239
237
*
240
- * @return
241
238
* @return the limit found as integer, or -1 if no limit is found. -1 means no limits.
242
239
* @throws OCommandSQLParsingException
243
240
* if no valid limit has been found
@@ -266,7 +263,6 @@ protected int parseLimit(final String w) throws OCommandSQLParsingException {
266
263
*
267
264
* @param w
268
265
*
269
- * @return
270
266
* @return the skip found as integer, or -1 if no skip is found. -1 means no skip.
271
267
* @throws OCommandSQLParsingException
272
268
* if no valid skip has been found
@@ -365,8 +361,8 @@ protected void searchInClasses() {
365
361
.getVariable ("$locking" ) : OStorage .LOCKING_STRATEGY .DEFAULT ;
366
362
367
363
final ORID [] range = getRange ();
368
- target = new ORecordIteratorClass <ORecordInternal <?>>(database , ( ODatabaseRecordAbstract ) database , cls .getName (), true ,
369
- request . isUseCache (), false , locking ).setRange (range [0 ], range [1 ]);
364
+ target = new ORecordIteratorClass <ORecordInternal <?>>(database , database , cls .getName (), true , request . isUseCache (), false ,
365
+ locking ).setRange (range [0 ], range [1 ]);
370
366
}
371
367
372
368
protected void searchInClusters () {
@@ -432,8 +428,6 @@ protected void applyLimitAndSkip() {
432
428
433
429
/**
434
430
* Optimizes the condition tree.
435
- *
436
- * @return
437
431
*/
438
432
protected void optimize () {
439
433
if (compiledFilter != null )
0 commit comments