KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > dods > cache > QueryResult


1 /*
2  * Enhydra Java Application Server Project
3  *
4  * The contents of this file are subject to the Enhydra Public License
5  * Version 1.1 (the "License"); you may not use this file except in
6  * compliance with the License. You may obtain a copy of the License on
7  * the Enhydra web site ( http://www.enhydra.org/ ).
8  *
9  * Software distributed under the License is distributed on an "AS IS"
10  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
11  * the License for the specific terms governing rights and limitations
12  * under the License.
13  *
14  * The Initial Developer of the Enhydra Application Server is Lutris
15  * Technologies, Inc. The Enhydra Application Server and portions created
16  * by Lutris Technologies, Inc. are Copyright Lutris Technologies, Inc.
17  * All Rights Reserved.
18  *
19  */

20 package org.enhydra.dods.cache;
21
22 import java.util.Vector JavaDoc;
23 import com.lutris.dods.builder.generator.dataobject.GenericDO;
24
25 /**
26  * This class stores results of one query.
27  *
28  * @author Tanja Jovanovic
29  * @version 2.0 15.06.2003.
30  */

31 public class QueryResult {
32
33     /**
34      * Vector with results.
35      */

36     public Vector JavaDoc DOs;
37     
38     /**
39      * Vector with objects (from result) which have data set to null.
40      */

41     public Vector JavaDoc lazy;
42     
43     /**
44      * Database of the query result.
45      */

46     public String JavaDoc database;
47    
48     /**
49      * Number of results skipped because are not unique.
50      */

51     public int skippedUnique = 0;
52    
53     /**
54      * Constructor().
55      */

56     public QueryResult() {
57         DOs = new Vector JavaDoc();
58         lazy = new Vector JavaDoc();
59         skippedUnique = 0;
60     }
61
62     /**
63      * Shows content of this class.
64      * Can be used for debugging.
65      */

66     public String JavaDoc toString() {
67         return toString(false);
68     }
69
70     /**
71      * Shows content of this class.
72      * Can be used for debugging.
73      */

74     public String JavaDoc toString(boolean onlyID) {
75         GenericDO DO = null;
76         StringBuffer JavaDoc ret = new StringBuffer JavaDoc();
77
78         ret.append("\n ----------------- QueryResult: -----------------");
79         ret.append("\n DOs : \n");
80         if (DOs != null) {
81             for (int i = 0; i < DOs.size(); i++) {
82                 if (onlyID) {
83                     if ((DO = (GenericDO) DOs.elementAt(i)).get_Data() != null) {
84                         ret.append(" " + DO.get_OId());
85                     }
86                 } else {
87                     ret.append("\n" + DOs.elementAt(i));
88                 }
89             }
90         }
91         ret.append("\n lazy : \n");
92         if (lazy != null) {
93             for (int i = 0; i < lazy.size(); i++) {
94                 if (onlyID) {
95                     if ((DO = (GenericDO) lazy.elementAt(i)).get_Data() == null) {
96                         ret.append(" " + DO.get_OId());
97                     }
98                 } else {
99                     ret.append("\n" + lazy.elementAt(i));
100                 }
101             }
102         }
103         return ret.toString();
104     }
105 }
106
Popular Tags