KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > directory > ldapstudio > dsmlv2 > reponse > SearchResponse


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

20
21 package org.apache.directory.ldapstudio.dsmlv2.reponse;
22
23
24 import java.util.ArrayList JavaDoc;
25 import java.util.List JavaDoc;
26
27 import org.apache.directory.shared.ldap.codec.LdapResponse;
28 import org.apache.directory.shared.ldap.codec.search.SearchResultDone;
29 import org.apache.directory.shared.ldap.codec.search.SearchResultEntry;
30 import org.apache.directory.shared.ldap.codec.search.SearchResultReference;
31
32
33 /**
34  * This class represents the DSML Search Response
35  *
36  * @author <a HREF="mailto:dev@directory.apache.org">Apache Directory Project</a>
37  * @version $Rev$, $Date$
38  */

39 public class SearchResponse extends LdapResponse
40 {
41     /** The List of contained Search Result Entries */
42     private List JavaDoc<SearchResultEntry> searchResultEntryList;
43
44     /** The List of contained Search Result References */
45     private List JavaDoc<SearchResultReference> searchResultReferenceList;
46
47     /** The Search Result Done object */
48     private SearchResultDone searchResultDone;
49
50
51     /**
52      * Creates a new instance of SearchResponse.
53      */

54     public SearchResponse()
55     {
56         searchResultEntryList = new ArrayList JavaDoc<SearchResultEntry>();
57         searchResultReferenceList = new ArrayList JavaDoc<SearchResultReference>();
58     }
59
60
61     /**
62      * Adds a Search Result Entry
63      *
64      * @param searchResultEntry
65      * the Search Result Entry to add
66      * @return
67      * true (as per the general contract of the Collection.add method)
68      */

69     public boolean addSearchResultEntry( SearchResultEntry searchResultEntry )
70     {
71         return searchResultEntryList.add( searchResultEntry );
72     }
73
74
75     /**
76      * Gets the Current Search Result Entry
77      *
78      * @return
79      * the current Searche Result Entry
80      */

81     public SearchResultEntry getCurrentSearchResultEntry()
82     {
83         if ( searchResultEntryList.size() > 0 )
84         {
85             return searchResultEntryList.get( searchResultEntryList.size() - 1 );
86         }
87         else
88         {
89             return null;
90         }
91     }
92
93
94     /**
95      * Gets the Search Result Entry List
96      *
97      * @return
98      * the Search Result Entry List
99      */

100     public List JavaDoc<SearchResultEntry> getSearchResultEntryList()
101     {
102         return searchResultEntryList;
103     }
104
105
106     /**
107      * Adds a Search Result Reference
108      *
109      * @param searchResultReference
110      * the Search Result Reference to add
111      * @return
112      * true (as per the general contract of the Collection.add method)
113      */

114     public boolean addSearchResultReference( SearchResultReference searchResultReference )
115     {
116         return searchResultReferenceList.add( searchResultReference );
117     }
118
119
120     /**
121      * Gets the current Search Result Reference
122      *
123      * @return
124      * the current Search Result Reference
125      */

126     public SearchResultReference getCurrentSearchResultReference()
127     {
128         if ( searchResultReferenceList.size() > 0 )
129         {
130             return searchResultReferenceList.get( searchResultReferenceList.size() - 1 );
131         }
132         else
133         {
134             return null;
135         }
136     }
137
138
139     /**
140      * Gets the Search Result Reference List
141      *
142      * @return
143      * the Search Result Reference List
144      */

145     public List JavaDoc<SearchResultReference> getSearchResultReferenceList()
146     {
147         return searchResultReferenceList;
148     }
149
150
151     /**
152      * Gets the Search Result Entry
153      *
154      * @return
155      * the Search Result Entry
156      */

157     public SearchResultDone getSearchResultDone()
158     {
159         return searchResultDone;
160     }
161
162
163     /**
164      * Sets the Search Result Entry
165      *
166      * @param searchResultDone
167      * the Search Result Entry to set
168      */

169     public void setSearchResultDone( SearchResultDone searchResultDone )
170     {
171         this.searchResultDone = searchResultDone;
172     }
173 }
174
Popular Tags