View Javadoc

1   /*
2    * Copyright 2001-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  package org.apache.juddi.datatype.request;
17  
18  import java.util.Vector;
19  
20  import org.apache.juddi.datatype.CategoryBag;
21  import org.apache.juddi.datatype.DiscoveryURL;
22  import org.apache.juddi.datatype.DiscoveryURLs;
23  import org.apache.juddi.datatype.IdentifierBag;
24  import org.apache.juddi.datatype.KeyedReference;
25  import org.apache.juddi.datatype.Name;
26  import org.apache.juddi.datatype.RegistryObject;
27  import org.apache.juddi.datatype.TModelBag;
28  
29  /***
30   * Used to locate information about one or more businesses. Returns a
31   * businessList message that matches the conditions specified.
32   *
33   * @author Steve Viens (sviens@apache.org)
34   */
35  public class FindBusiness implements RegistryObject,Inquiry
36  {
37    String generic;
38    Vector nameVector;
39    IdentifierBag identifierBag;
40    CategoryBag categoryBag;
41    TModelBag tModelBag;
42    DiscoveryURLs discoveryURLs;
43    FindQualifiers findQualifiers;
44    int maxRows;
45  
46    /***
47     * Constructs a new empty find_business request.
48     */
49    public FindBusiness()
50    {
51    }
52  
53    /***
54     *
55     * @param genericValue
56     */
57    public void setGeneric(String genericValue)
58    {
59      this.generic = genericValue;
60    }
61  
62    /***
63     *
64     * @return String UDDI request's generic value.
65     */
66    public String getGeneric()
67    {
68      return this.generic;
69    }
70  
71    /***
72     * Sets the name argument of the search to the given name. This value is a partial
73     * name. The businessList return contains BusinessInfo objects for businesses whose
74     * name matches the value passed (leftmost match).
75     *
76     * @param nameValue The name argument of the search.
77     */
78    public void addName(Name nameValue)
79    {
80      if (this.nameVector == null)
81        this.nameVector = new Vector();
82      this.nameVector.add(nameValue);
83    }
84  
85    /***
86     * Sets the name argument of the search to the given name. This value is a partial
87     * name. The businessList return contains BusinessInfo objects for businesses whose
88     * name matches the value passed (leftmost match).
89     *
90     * @param names The name argument of the search.
91     */
92    public void setNameVector(Vector names)
93    {
94      this.nameVector = names;
95    }
96  
97    /***
98     * Returns the name argument of the search. Null is returned if the name
99     * argument for this search has not been specified.
100    *
101    * @return The vector of Name argument of the search, or null if the argument has not
102    *  been specified.
103    */
104   public Vector getNameVector()
105   {
106     return nameVector;
107   }
108 
109   /***
110    * Adds a business identifier reference to the identifierBag argument of this search.
111    *
112    * @param ref The business identifer reference to add.
113    */
114   public void addIdentifier(KeyedReference ref)
115   {
116     identifierBag.addKeyedReference(ref);
117   }
118 
119   /***
120    * Adds a collection of business identifier references to the bag argument
121    * of this search.
122    *
123    * @param bag The references to add.
124    */
125   public void setIdentifierBag(IdentifierBag bag)
126   {
127     this.identifierBag = bag;
128   }
129 
130   /***
131    * Returns the list of business identifier references as an enumeration. If the
132    * identifierBag has not been specified, an empty list is returned.
133    *
134    * @return The list of business identifier references.
135    */
136   public IdentifierBag getIdentifierBag()
137   {
138     return identifierBag;
139   }
140 
141   /***
142    * Adds a category reference to the categoryBag argument of this search.
143    *
144    * @param ref The category reference to add.
145    */
146   public void addCategory(KeyedReference ref)
147   {
148     // just return if the KeyedReference parameter is null (nothing to add)
149     if (ref == null)
150       return;
151 
152     // make sure the CategoryBag has been initialized
153     if (this.categoryBag == null)
154       this.categoryBag = new CategoryBag();
155 
156     this.categoryBag.addKeyedReference(ref);
157   }
158 
159   /***
160    * Adds a collection of category references to the bag argument of this search.
161    *
162    * @param bag of KeyedReferences.
163    */
164   public void setCategoryBag(CategoryBag bag)
165   {
166     this.categoryBag = bag;
167   }
168 
169   /***
170    * Returns the list of category references as an enumeration. If the categoryBag has
171    * not been specified, an empty list is returned.
172    *
173    * @return The list of category references.
174    */
175   public CategoryBag getCategoryBag()
176   {
177     return this.categoryBag;
178   }
179 
180   /***
181    * Adds a tModel reference to the tModelBag argument of this search. This tModelBag argument
182    * lets you search for businesses that have bindings that are compatible with a specific
183    * tModel pattern.
184    *
185    * @param key The tModel to add to the tModelBag.
186    */
187   public void addTModelKey(String key)
188   {
189     // just return if the TModel key parameter is null (nothing to add)
190     if (key == null)
191       return;
192 
193     // make sure the TModelBag has been initialized
194     if (this.tModelBag == null)
195       this.tModelBag = new TModelBag();
196 
197     this.tModelBag.addTModelKey(key);
198   }
199 
200   /***
201    * Returns the list of tModel references as an enumeration. If the tModelBag has not
202    * been specified, an empty list is returned.
203    *
204    * @return The list of the tModel references.
205    */
206   public TModelBag getTModelBag()
207   {
208     return this.tModelBag;
209   }
210 
211   /***
212    * Adds a collection of category references to the bag argument of this search.
213    *
214    * @param bag of TModelKeys.
215    */
216   public void setTModelBag(TModelBag bag)
217   {
218     this.tModelBag = bag;
219   }
220 
221   /***
222    * Adds a discoveryURL to the discoveryURLs argument of this search.
223    *
224    * @param url The discoveryURL to add to the discoveryURLs argument.
225    */
226   public void addDiscoveryURL(DiscoveryURL url)
227   {
228     // just return if the DiscoveryURL parameter is null (nothing to add)
229     if (url == null)
230       return;
231 
232     // make sure the DiscoveryURLs has been initialized
233     if (this.discoveryURLs == null)
234       this.discoveryURLs = new DiscoveryURLs();
235 
236     this.discoveryURLs.addDiscoveryURL(url);
237   }
238 
239   /***
240    * Sets the collection of discoveryURLs to the new discoveryURLs argument
241    *
242    * @param urls The new collection of discoveryURLs.
243    */
244   public void setDiscoveryURLs(DiscoveryURLs urls)
245   {
246     this.discoveryURLs = urls;
247   }
248 
249   /***
250    * Returns the list of discoveryURLs as an enumeration. If the discoveryURLs argument has
251    * not been specified, an empty list is returned.
252    *
253    * @return The list of discoveryURLs.
254    */
255   public DiscoveryURLs getDiscoveryURLs()
256   {
257     return discoveryURLs;
258   }
259 
260   /***
261    *
262    */
263   public int getMaxRows()
264   {
265     return maxRows;
266   }
267 
268   /***
269    *
270    */
271   public void setMaxRows(int maxRows)
272   {
273     this.maxRows = maxRows;
274   }
275 
276   /***
277    *
278    */
279   public void setMaxRows(String maxRows)
280   {
281     setMaxRows(Integer.parseInt(maxRows));
282   }
283 
284   /***
285    *
286    */
287   public void addFindQualifier(FindQualifier findQualifier)
288   {
289     if (this.findQualifiers == null)
290       this.findQualifiers = new FindQualifiers();
291     this.findQualifiers.addFindQualifier(findQualifier);
292   }
293 
294   /***
295    *
296    */
297   public void setFindQualifiers(FindQualifiers findQualifiers)
298   {
299     this.findQualifiers = findQualifiers;
300   }
301 
302   /***
303    *
304    */
305   public FindQualifiers getFindQualifiers()
306   {
307     return findQualifiers;
308   }
309 }