View Javadoc

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.partition.impl.btree;
18  
19  
20  import java.math.BigInteger;
21  
22  import javax.naming.directory.Attributes;
23  import javax.naming.directory.SearchResult;
24  
25  
26  /***
27   * A special search result that includes the unique database primary key or 
28   * 'row id' of the entry in the master table for quick lookup.  This speeds 
29   * up various operations.
30   * 
31   * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
32   * @version $Rev: 264732 $
33   */
34  public class BTreeSearchResult extends SearchResult
35  {
36      private static final long serialVersionUID = 3976739172700860977L;
37  
38      /*** the primary key used for the resultant entry */
39      private final BigInteger id;
40      
41      
42      // ------------------------------------------------------------------------
43      // C O N S T R U C T O R S
44      // ------------------------------------------------------------------------
45      
46      
47      /***
48       * Creates a database search result.
49       * 
50       * @param id the database id of the entry
51       * @param name the user provided relative or distinguished name
52       * @param obj the object if any
53       * @param attrs the attributes of the entry
54       */
55      public BTreeSearchResult( BigInteger id, String name, Object obj,
56          Attributes attrs )
57      {
58          super( name, obj, attrs );
59          this.id = id;
60      }
61  
62      
63      /***
64       * Creates a database search result.
65       * 
66       * @param id the database id of the entry
67       * @param name the user provided relative or distinguished name
68       * @param obj the object if any
69       * @param attrs the attributes of the entry
70       * @param isRelative whether or not the name is relative to the base
71       */
72      public BTreeSearchResult( BigInteger id, String name, Object obj,
73          Attributes attrs, boolean isRelative )
74      {
75          super( name, obj, attrs, isRelative );
76          this.id = id;
77      }
78  
79      
80      /***
81       * Creates a database search result.
82       * 
83       * @param id the database id of the entry
84       * @param name the user provided relative or distinguished name
85       * @param className the classname of the entry if any
86       * @param obj the object if any
87       * @param attrs the attributes of the entry
88       */
89      public BTreeSearchResult( BigInteger id, String name, String className,
90          Object obj, Attributes attrs )
91      {
92          super( name, className, obj, attrs );
93          this.id = id;
94      }
95  
96      
97      /***
98       * Creates a database search result.
99       * 
100      * @param id the database id of the entry
101      * @param name the user provided relative or distinguished name
102      * @param className the classname of the entry if any
103      * @param obj the object if any
104      * @param attrs the attributes of the entry
105      * @param isRelative whether or not the name is relative to the base
106      */
107     public BTreeSearchResult( BigInteger id, String name, String className,
108         Object obj, Attributes attrs, boolean isRelative )
109     {
110         super( name, className, obj, attrs, isRelative );
111         this.id = id;
112     }
113     
114     
115     /***
116      * Gets the unique row id of the entry into the master table.
117      * 
118      * @return Returns the id.
119      */
120     public BigInteger getId()
121     {
122         return id;
123     }
124 }