KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > ldap > server > db > DbSearchResult


1 /*
2  * Copyright 2004 The Apache Software Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */

17 package org.apache.ldap.server.db;
18
19
20 import javax.naming.directory.Attributes JavaDoc;
21 import javax.naming.directory.SearchResult JavaDoc;
22 import java.math.BigInteger JavaDoc;
23
24
25 /**
26  * A special search result that includes the unique database primary key or
27  * 'row id' of the entry in the master table for quick lookup. This speeds
28  * up various operations.
29  *
30  * @author <a HREF="mailto:dev@directory.apache.org">Apache Directory Project</a>
31  * @version $Rev: 169198 $
32  */

33 public class DbSearchResult extends SearchResult JavaDoc
34 {
35     private static final long serialVersionUID = 3976739172700860977L;
36
37     /** the primary key used for the resultant entry */
38     private final BigInteger JavaDoc id;
39     
40     
41     // ------------------------------------------------------------------------
42
// C O N S T R U C T O R S
43
// ------------------------------------------------------------------------
44

45     
46     /**
47      * Creates a database search result.
48      *
49      * @param id the database id of the entry
50      * @param name the user provided relative or distinguished name
51      * @param obj the object if any
52      * @param attrs the attributes of the entry
53      */

54     public DbSearchResult( BigInteger JavaDoc id, String JavaDoc name, Object JavaDoc obj,
55         Attributes JavaDoc attrs )
56     {
57         super( name, obj, attrs );
58         this.id = id;
59     }
60
61     
62     /**
63      * Creates a database search result.
64      *
65      * @param id the database id of the entry
66      * @param name the user provided relative or distinguished name
67      * @param obj the object if any
68      * @param attrs the attributes of the entry
69      * @param isRelative whether or not the name is relative to the base
70      */

71     public DbSearchResult( BigInteger JavaDoc id, String JavaDoc name, Object JavaDoc obj,
72         Attributes JavaDoc attrs, boolean isRelative )
73     {
74         super( name, obj, attrs, isRelative );
75         this.id = id;
76     }
77
78     
79     /**
80      * Creates a database search result.
81      *
82      * @param id the database id of the entry
83      * @param name the user provided relative or distinguished name
84      * @param className the classname of the entry if any
85      * @param obj the object if any
86      * @param attrs the attributes of the entry
87      */

88     public DbSearchResult( BigInteger JavaDoc id, String JavaDoc name, String JavaDoc className,
89         Object JavaDoc obj, Attributes JavaDoc attrs )
90     {
91         super( name, className, obj, attrs );
92         this.id = id;
93     }
94
95     
96     /**
97      * Creates a database search result.
98      *
99      * @param id the database id of the entry
100      * @param name the user provided relative or distinguished name
101      * @param className the classname of the entry if any
102      * @param obj the object if any
103      * @param attrs the attributes of the entry
104      * @param isRelative whether or not the name is relative to the base
105      */

106     public DbSearchResult( BigInteger JavaDoc id, String JavaDoc name, String JavaDoc className,
107         Object JavaDoc obj, Attributes JavaDoc attrs, boolean isRelative )
108     {
109         super( name, className, obj, attrs, isRelative );
110         this.id = id;
111     }
112     
113     
114     /**
115      * Gets the unique row id of the entry into the master table.
116      *
117      * @return Returns the id.
118      */

119     public BigInteger JavaDoc getId()
120     {
121         return id;
122     }
123 }
124
Popular Tags