Source Code Cross Referenced for EntityListIterator.java in  » ERP-CRM-Financial » ofbiz » org » ofbiz » entity » util » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » ERP CRM Financial » ofbiz » org.ofbiz.entity.util 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*******************************************************************************
002:         * Licensed to the Apache Software Foundation (ASF) under one
003:         * or more contributor license agreements.  See the NOTICE file
004:         * distributed with this work for additional information
005:         * regarding copyright ownership.  The ASF licenses this file
006:         * to you under the Apache License, Version 2.0 (the
007:         * "License"); you may not use this file except in compliance
008:         * with the License.  You may obtain a copy of the License at
009:         * 
010:         * http://www.apache.org/licenses/LICENSE-2.0
011:         * 
012:         * Unless required by applicable law or agreed to in writing,
013:         * software distributed under the License is distributed on an
014:         * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015:         * KIND, either express or implied.  See the License for the
016:         * specific language governing permissions and limitations
017:         * under the License.
018:         *******************************************************************************/package org.ofbiz.entity.util;
019:
020:        import java.sql.ResultSet;
021:        import java.sql.SQLException;
022:        import java.util.List;
023:        import java.util.ListIterator;
024:
025:        import javolution.util.FastList;
026:
027:        import org.ofbiz.base.util.Debug;
028:        import org.ofbiz.base.util.GeneralRuntimeException;
029:        import org.ofbiz.entity.GenericDelegator;
030:        import org.ofbiz.entity.GenericEntityException;
031:        import org.ofbiz.entity.GenericResultSetClosedException;
032:        import org.ofbiz.entity.GenericValue;
033:        import org.ofbiz.entity.jdbc.SQLProcessor;
034:        import org.ofbiz.entity.jdbc.SqlJdbcUtil;
035:        import org.ofbiz.entity.model.ModelEntity;
036:        import org.ofbiz.entity.model.ModelField;
037:        import org.ofbiz.entity.model.ModelFieldTypeReader;
038:
039:        /**
040:         * Generic Entity Cursor List Iterator for Handling Cursored DB Results
041:         */
042:        public class EntityListIterator implements  ListIterator {
043:
044:            /** Module Name Used for debugging */
045:            public static final String module = EntityListIterator.class
046:                    .getName();
047:
048:            protected SQLProcessor sqlp;
049:            protected ResultSet resultSet;
050:            protected ModelEntity modelEntity;
051:            protected List selectFields;
052:            protected ModelFieldTypeReader modelFieldTypeReader;
053:            protected boolean closed = false;
054:            protected boolean haveMadeValue = false;
055:            protected GenericDelegator delegator = null;
056:
057:            private boolean haveShowHasNextWarning = false;
058:
059:            public EntityListIterator(SQLProcessor sqlp,
060:                    ModelEntity modelEntity, List selectFields,
061:                    ModelFieldTypeReader modelFieldTypeReader) {
062:                this .sqlp = sqlp;
063:                this .resultSet = sqlp.getResultSet();
064:                this .modelEntity = modelEntity;
065:                this .selectFields = selectFields;
066:                this .modelFieldTypeReader = modelFieldTypeReader;
067:            }
068:
069:            public void setDelegator(GenericDelegator delegator) {
070:                this .delegator = delegator;
071:            }
072:
073:            /** Sets the cursor position to just after the last result so that previous() will return the last result */
074:            public void afterLast() throws GenericEntityException {
075:                try {
076:                    resultSet.afterLast();
077:                } catch (SQLException e) {
078:                    if (!closed) {
079:                        this .close();
080:                        Debug.logWarning(
081:                                "Warning: auto-closed EntityListIterator because of exception: "
082:                                        + e.toString(), module);
083:                    }
084:                    throw new GenericEntityException(
085:                            "Error setting the cursor to afterLast", e);
086:                }
087:            }
088:
089:            /** Sets the cursor position to just before the first result so that next() will return the first result */
090:            public void beforeFirst() throws GenericEntityException {
091:                try {
092:                    resultSet.beforeFirst();
093:                } catch (SQLException e) {
094:                    if (!closed) {
095:                        this .close();
096:                        Debug.logWarning(
097:                                "Warning: auto-closed EntityListIterator because of exception: "
098:                                        + e.toString(), module);
099:                    }
100:                    throw new GenericEntityException(
101:                            "Error setting the cursor to beforeFirst", e);
102:                }
103:            }
104:
105:            /** Sets the cursor position to last result; if result set is empty returns false */
106:            public boolean last() throws GenericEntityException {
107:                try {
108:                    return resultSet.last();
109:                } catch (SQLException e) {
110:                    if (!closed) {
111:                        this .close();
112:                        Debug.logWarning(
113:                                "Warning: auto-closed EntityListIterator because of exception: "
114:                                        + e.toString(), module);
115:                    }
116:                    throw new GenericEntityException(
117:                            "Error setting the cursor to last", e);
118:                }
119:            }
120:
121:            /** Sets the cursor position to last result; if result set is empty returns false */
122:            public boolean first() throws GenericEntityException {
123:                try {
124:                    return resultSet.first();
125:                } catch (SQLException e) {
126:                    if (!closed) {
127:                        this .close();
128:                        Debug.logWarning(
129:                                "Warning: auto-closed EntityListIterator because of exception: "
130:                                        + e.toString(), module);
131:                    }
132:                    throw new GenericEntityException(
133:                            "Error setting the cursor to first", e);
134:                }
135:            }
136:
137:            public void close() throws GenericEntityException {
138:                if (closed) {
139:                    //maybe not the best way: throw new GenericResultSetClosedException("This EntityListIterator has been closed, this operation cannot be performed");
140:                    Debug.logWarning("This EntityListIterator for Entity ["
141:                            + modelEntity == null ? "" : modelEntity
142:                            .getEntityName()
143:                            + "] has already been closed, not closing again.",
144:                            module);
145:                } else {
146:                    sqlp.close();
147:                    closed = true;
148:                }
149:            }
150:
151:            /** NOTE: Calling this method does return the current value, but so does calling next() or previous(), so calling one of those AND this method will cause the value to be created twice */
152:            public GenericValue currentGenericValue()
153:                    throws GenericEntityException {
154:                if (closed)
155:                    throw new GenericResultSetClosedException(
156:                            "This EntityListIterator has been closed, this operation cannot be performed");
157:
158:                GenericValue value = GenericValue.create(modelEntity);
159:
160:                for (int j = 0; j < selectFields.size(); j++) {
161:                    ModelField curField = (ModelField) selectFields.get(j);
162:
163:                    SqlJdbcUtil.getValue(resultSet, j + 1, curField, value,
164:                            modelFieldTypeReader);
165:                }
166:
167:                value.setDelegator(this .delegator);
168:                value.synchronizedWithDatasource();
169:                this .haveMadeValue = true;
170:                if (delegator != null) {
171:                    delegator.decryptFields(value);
172:                }
173:                return value;
174:            }
175:
176:            public int currentIndex() throws GenericEntityException {
177:                if (closed)
178:                    throw new GenericResultSetClosedException(
179:                            "This EntityListIterator has been closed, this operation cannot be performed");
180:
181:                try {
182:                    return resultSet.getRow();
183:                } catch (SQLException e) {
184:                    if (!closed) {
185:                        this .close();
186:                        Debug.logWarning(
187:                                "Warning: auto-closed EntityListIterator because of exception: "
188:                                        + e.toString(), module);
189:                    }
190:                    throw new GenericEntityException(
191:                            "Error getting the current index", e);
192:                }
193:            }
194:
195:            /** performs the same function as the ResultSet.absolute method;
196:             * if rowNum is positive, goes to that position relative to the beginning of the list;
197:             * if rowNum is negative, goes to that position relative to the end of the list;
198:             * a rowNum of 1 is the same as first(); a rowNum of -1 is the same as last()
199:             */
200:            public boolean absolute(int rowNum) throws GenericEntityException {
201:                if (closed)
202:                    throw new GenericResultSetClosedException(
203:                            "This EntityListIterator has been closed, this operation cannot be performed");
204:
205:                try {
206:                    return resultSet.absolute(rowNum);
207:                } catch (SQLException e) {
208:                    if (!closed) {
209:                        this .close();
210:                        Debug.logWarning(
211:                                "Warning: auto-closed EntityListIterator because of exception: "
212:                                        + e.toString(), module);
213:                    }
214:                    throw new GenericEntityException(
215:                            "Error setting the absolute index to " + rowNum, e);
216:                }
217:            }
218:
219:            /** performs the same function as the ResultSet.relative method;
220:             * if rows is positive, goes forward relative to the current position;
221:             * if rows is negative, goes backward relative to the current position;
222:             */
223:            public boolean relative(int rows) throws GenericEntityException {
224:                if (closed)
225:                    throw new GenericResultSetClosedException(
226:                            "This EntityListIterator has been closed, this operation cannot be performed");
227:
228:                try {
229:                    return resultSet.relative(rows);
230:                } catch (SQLException e) {
231:                    if (!closed) {
232:                        this .close();
233:                        Debug.logWarning(
234:                                "Warning: auto-closed EntityListIterator because of exception: "
235:                                        + e.toString(), module);
236:                    }
237:                    throw new GenericEntityException(
238:                            "Error going to the relative index " + rows, e);
239:                }
240:            }
241:
242:            /** 
243:             * PLEASE NOTE: Because of the nature of the JDBC ResultSet interface this method can be very inefficient; it is much better to just use next() until it returns null
244:             * For example, you could use the following to iterate through the results in an EntityListIterator:
245:             * 
246:             *      GenericValue nextValue = null;
247:             *      while ((nextValue = (GenericValue) this.next()) != null) { ... }
248:             * 
249:             */
250:            public boolean hasNext() {
251:                if (!haveShowHasNextWarning) {
252:                    // DEJ20050207 To further discourage use of this, and to find existing use, always log a big warning showing where it is used:
253:                    Exception whereAreWe = new Exception();
254:                    Debug
255:                            .logWarning(
256:                                    whereAreWe,
257:                                    "WARNING: For performance reasons do not use the EntityListIterator.hasNext() method, just call next() until it returns null; see JavaDoc comments in the EntityListIterator class for details and an example",
258:                                    module);
259:
260:                    haveShowHasNextWarning = true;
261:                }
262:
263:                try {
264:                    if (resultSet.isLast() || resultSet.isAfterLast()) {
265:                        return false;
266:                    } else {
267:                        // do a quick game to see if the resultSet is empty:
268:                        // if we are not in the first or beforeFirst positions and we haven't made any values yet, the result set is empty so return false
269:                        if (!haveMadeValue && !resultSet.isBeforeFirst()
270:                                && !resultSet.isFirst()) {
271:                            return false;
272:                        } else {
273:                            return true;
274:                        }
275:                    }
276:                } catch (SQLException e) {
277:                    if (!closed) {
278:                        try {
279:                            this .close();
280:                        } catch (GenericEntityException e1) {
281:                            Debug
282:                                    .logError(
283:                                            e1,
284:                                            "Error auto-closing EntityListIterator on error, so info below for more info on original error; close error: "
285:                                                    + e1.toString(), module);
286:                        }
287:                        Debug.logWarning(
288:                                "Warning: auto-closed EntityListIterator because of exception: "
289:                                        + e.toString(), module);
290:                    }
291:                    throw new GeneralRuntimeException(
292:                            "Error while checking to see if this is the last result",
293:                            e);
294:                }
295:            }
296:
297:            /** PLEASE NOTE: Because of the nature of the JDBC ResultSet interface this method can be very inefficient; it is much better to just use previous() until it returns null */
298:            public boolean hasPrevious() {
299:                try {
300:                    if (resultSet.isFirst() || resultSet.isBeforeFirst()) {
301:                        return false;
302:                    } else {
303:                        // do a quick game to see if the resultSet is empty:
304:                        // if we are not in the last or afterLast positions and we haven't made any values yet, the result set is empty so return false
305:                        if (!haveMadeValue && !resultSet.isAfterLast()
306:                                && !resultSet.isLast()) {
307:                            return false;
308:                        } else {
309:                            return true;
310:                        }
311:                    }
312:                } catch (SQLException e) {
313:                    if (!closed) {
314:                        try {
315:                            this .close();
316:                        } catch (GenericEntityException e1) {
317:                            Debug
318:                                    .logError(
319:                                            e1,
320:                                            "Error auto-closing EntityListIterator on error, so info below for more info on original error; close error: "
321:                                                    + e1.toString(), module);
322:                        }
323:                        Debug.logWarning(
324:                                "Warning: auto-closed EntityListIterator because of exception: "
325:                                        + e.toString(), module);
326:                    }
327:                    throw new GeneralRuntimeException(
328:                            "Error while checking to see if this is the first result",
329:                            e);
330:                }
331:            }
332:
333:            /** Moves the cursor to the next position and returns the GenericValue object for that position; if there is no next, returns null
334:             * For example, you could use the following to iterate through the results in an EntityListIterator:
335:             * 
336:             *      GenericValue nextValue = null;
337:             *      while ((nextValue = (GenericValue) this.next()) != null) { ... }
338:             * 
339:             */
340:            public Object next() {
341:                try {
342:                    if (resultSet.next()) {
343:                        return currentGenericValue();
344:                    } else {
345:                        return null;
346:                    }
347:                } catch (SQLException e) {
348:                    if (!closed) {
349:                        try {
350:                            this .close();
351:                        } catch (GenericEntityException e1) {
352:                            Debug
353:                                    .logError(
354:                                            e1,
355:                                            "Error auto-closing EntityListIterator on error, so info below for more info on original error; close error: "
356:                                                    + e1.toString(), module);
357:                        }
358:                        Debug.logWarning(
359:                                "Warning: auto-closed EntityListIterator because of exception: "
360:                                        + e.toString(), module);
361:                    }
362:                    throw new GeneralRuntimeException(
363:                            "Error getting the next result", e);
364:                } catch (GenericEntityException e) {
365:                    if (!closed) {
366:                        try {
367:                            this .close();
368:                        } catch (GenericEntityException e1) {
369:                            Debug
370:                                    .logError(
371:                                            e1,
372:                                            "Error auto-closing EntityListIterator on error, so info below for more info on original error; close error: "
373:                                                    + e1.toString(), module);
374:                        }
375:                        Debug.logWarning(
376:                                "Warning: auto-closed EntityListIterator because of exception: "
377:                                        + e.toString(), module);
378:                    }
379:                    throw new GeneralRuntimeException(
380:                            "Error creating GenericValue", e);
381:                }
382:            }
383:
384:            /** Returns the index of the next result, but does not guarantee that there will be a next result */
385:            public int nextIndex() {
386:                try {
387:                    return currentIndex() + 1;
388:                } catch (GenericEntityException e) {
389:                    if (!closed) {
390:                        try {
391:                            this .close();
392:                        } catch (GenericEntityException e1) {
393:                            Debug
394:                                    .logError(
395:                                            e1,
396:                                            "Error auto-closing EntityListIterator on error, so info below for more info on original error; close error: "
397:                                                    + e1.toString(), module);
398:                        }
399:                        Debug.logWarning(
400:                                "Warning: auto-closed EntityListIterator because of exception: "
401:                                        + e.toString(), module);
402:                    }
403:                    throw new GeneralRuntimeException(e.getNonNestedMessage(),
404:                            e.getNested());
405:                }
406:            }
407:
408:            /** Moves the cursor to the previous position and returns the GenericValue object for that position; if there is no previous, returns null */
409:            public Object previous() {
410:                try {
411:                    if (resultSet.previous()) {
412:                        return currentGenericValue();
413:                    } else {
414:                        return null;
415:                    }
416:                } catch (SQLException e) {
417:                    if (!closed) {
418:                        try {
419:                            this .close();
420:                        } catch (GenericEntityException e1) {
421:                            Debug
422:                                    .logError(
423:                                            e1,
424:                                            "Error auto-closing EntityListIterator on error, so info below for more info on original error; close error: "
425:                                                    + e1.toString(), module);
426:                        }
427:                        Debug.logWarning(
428:                                "Warning: auto-closed EntityListIterator because of exception: "
429:                                        + e.toString(), module);
430:                    }
431:                    throw new GeneralRuntimeException(
432:                            "Error getting the previous result", e);
433:                } catch (GenericEntityException e) {
434:                    if (!closed) {
435:                        try {
436:                            this .close();
437:                        } catch (GenericEntityException e1) {
438:                            Debug
439:                                    .logError(
440:                                            e1,
441:                                            "Error auto-closing EntityListIterator on error, so info below for more info on original error; close error: "
442:                                                    + e1.toString(), module);
443:                        }
444:                        Debug.logWarning(
445:                                "Warning: auto-closed EntityListIterator because of exception: "
446:                                        + e.toString(), module);
447:                    }
448:                    throw new GeneralRuntimeException(
449:                            "Error creating GenericValue", e);
450:                }
451:            }
452:
453:            /** Returns the index of the previous result, but does not guarantee that there will be a previous result */
454:            public int previousIndex() {
455:                try {
456:                    return currentIndex() - 1;
457:                } catch (GenericEntityException e) {
458:                    if (!closed) {
459:                        try {
460:                            this .close();
461:                        } catch (GenericEntityException e1) {
462:                            Debug
463:                                    .logError(
464:                                            e1,
465:                                            "Error auto-closing EntityListIterator on error, so info below for more info on original error; close error: "
466:                                                    + e1.toString(), module);
467:                        }
468:                        Debug.logWarning(
469:                                "Warning: auto-closed EntityListIterator because of exception: "
470:                                        + e.toString(), module);
471:                    }
472:                    throw new GeneralRuntimeException(
473:                            "Error getting the current index", e);
474:                }
475:            }
476:
477:            public void setFetchSize(int rows) throws GenericEntityException {
478:                try {
479:                    resultSet.setFetchSize(rows);
480:                } catch (SQLException e) {
481:                    if (!closed) {
482:                        this .close();
483:                        Debug.logWarning(
484:                                "Warning: auto-closed EntityListIterator because of exception: "
485:                                        + e.toString(), module);
486:                    }
487:                    throw new GenericEntityException(
488:                            "Error getting the next result", e);
489:                }
490:            }
491:
492:            public List getCompleteList() throws GenericEntityException {
493:                try {
494:                    // if the resultSet has been moved forward at all, move back to the beginning
495:                    if (haveMadeValue && !resultSet.isBeforeFirst()) {
496:                        // do a quick check to see if the ResultSet is empty
497:                        resultSet.beforeFirst();
498:                    }
499:                    List list = FastList.newInstance();
500:                    Object nextValue = null;
501:
502:                    while ((nextValue = this .next()) != null) {
503:                        list.add(nextValue);
504:                    }
505:                    return list;
506:                } catch (SQLException e) {
507:                    if (!closed) {
508:                        this .close();
509:                        Debug.logWarning(
510:                                "Warning: auto-closed EntityListIterator because of exception: "
511:                                        + e.toString(), module);
512:                    }
513:                    throw new GeneralRuntimeException("Error getting results",
514:                            e);
515:                } catch (GeneralRuntimeException e) {
516:                    if (!closed) {
517:                        this .close();
518:                        Debug.logWarning(
519:                                "Warning: auto-closed EntityListIterator because of exception: "
520:                                        + e.toString(), module);
521:                    }
522:                    throw new GenericEntityException(e.getNonNestedMessage(), e
523:                            .getNested());
524:                }
525:            }
526:
527:            /** Gets a partial list of results starting at start and containing at most number elements.
528:             * Start is a one based value, ie 1 is the first element.
529:             */
530:            public List getPartialList(int start, int number)
531:                    throws GenericEntityException {
532:                try {
533:                    if (number == 0)
534:                        return FastList.newInstance();
535:                    List list = FastList.newInstance();
536:
537:                    // just in case the caller missed the 1 based thingy
538:                    if (start == 0)
539:                        start = 1;
540:
541:                    // if starting on result 1 just call next() to avoid scrollable issues in some databases
542:                    if (start == 1) {
543:                        if (!resultSet.next()) {
544:                            return list;
545:                        }
546:                    } else {
547:                        // if can't reposition to desired index, throw exception
548:                        if (!resultSet.absolute(start)) {
549:                            // maybe better to just return an empty list here...
550:                            return list;
551:                            //throw new GenericEntityException("Could not move to the start position of " + start + ", there are probably not that many results for this find.");
552:                        }
553:                    }
554:
555:                    // get the first as the current one
556:                    list.add(this .currentGenericValue());
557:
558:                    Object nextValue = null;
559:                    // init numRetreived to one since we have already grabbed the initial one
560:                    int numRetreived = 1;
561:
562:                    //number > numRetreived comparison goes first to avoid the unwanted call to next
563:                    while (number > numRetreived
564:                            && (nextValue = this .next()) != null) {
565:                        list.add(nextValue);
566:                        numRetreived++;
567:                    }
568:                    return list;
569:                } catch (SQLException e) {
570:                    if (!closed) {
571:                        this .close();
572:                        Debug.logWarning(
573:                                "Warning: auto-closed EntityListIterator because of exception: "
574:                                        + e.toString(), module);
575:                    }
576:                    throw new GeneralRuntimeException("Error getting results",
577:                            e);
578:                } catch (GeneralRuntimeException e) {
579:                    if (!closed) {
580:                        this .close();
581:                        Debug.logWarning(
582:                                "Warning: auto-closed EntityListIterator because of exception: "
583:                                        + e.toString(), module);
584:                    }
585:                    throw new GenericEntityException(e.getNonNestedMessage(), e
586:                            .getNested());
587:                }
588:            }
589:
590:            public void add(Object obj) {
591:                throw new GeneralRuntimeException(
592:                        "CursorListIterator currently only supports read-only access");
593:            }
594:
595:            public void remove() {
596:                throw new GeneralRuntimeException(
597:                        "CursorListIterator currently only supports read-only access");
598:            }
599:
600:            public void set(Object obj) {
601:                throw new GeneralRuntimeException(
602:                        "CursorListIterator currently only supports read-only access");
603:            }
604:
605:            protected void finalize() throws Throwable {
606:                try {
607:                    if (!closed) {
608:                        this .close();
609:                        Debug
610:                                .logError(
611:                                        "\n====================================================================\n EntityListIterator Not Closed for Entity ["
612:                                                + (modelEntity == null ? ""
613:                                                        : modelEntity
614:                                                                .getEntityName())
615:                                                + "], caught in Finalize\n ====================================================================\n",
616:                                        module);
617:                    }
618:                } catch (Exception e) {
619:                    Debug
620:                            .logError(
621:                                    e,
622:                                    "Error closing the SQLProcessor in finalize EntityListIterator",
623:                                    module);
624:                }
625:                super.finalize();
626:            }
627:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.