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 org.apache.juddi.datatype.CategoryBag;
19  import org.apache.juddi.datatype.IdentifierBag;
20  import org.apache.juddi.datatype.KeyedReference;
21  import org.apache.juddi.datatype.Name;
22  import org.apache.juddi.datatype.RegistryObject;
23  
24  /***
25   * "Used to locate one or more tModel information structures. Returns a
26   *  tModelList structure."
27   *
28   * @author Steve Viens (sviens@apache.org)
29   */
30  public class FindTModel implements RegistryObject,Inquiry
31  {
32    String generic;
33    Name name;
34    IdentifierBag identifierBag;
35    CategoryBag categoryBag;
36    FindQualifiers findQualifiers;
37    int maxRows;
38  
39    /***
40     * Constructs a new empty find_tModel request.
41     */
42    public FindTModel()
43    {
44    }
45  
46    /***
47     *
48     * @param genericValue
49     */
50    public void setGeneric(String genericValue)
51    {
52      this.generic = genericValue;
53    }
54  
55    /***
56     *
57     * @return String UDDI request's generic value.
58     */
59    public String getGeneric()
60    {
61      return this.generic;
62    }
63  
64    /***
65     * Sets the name argument of the search to the given name. This value is a partial
66     * name. The tModelList return contains tModelInfo objects for tModels whose
67     * name matches the value passed (leftmost match).
68     *
69     * @param newName The name argument of the search.
70     */
71    public void setName(String newName)
72    {
73      setName(new Name(newName));
74    }
75  
76    /***
77     * Sets the name argument of the search to the given name. This value is a partial
78     * name. The tModelList return contains tModelInfo objects for tModels whose
79     * name matches the value passed (leftmost match).
80     *
81     * @param newname The name argument of the search.
82     */
83    public void setName(Name newname)
84    {
85      name = newname;
86    }
87  
88    /***
89     * Returns the name argument of the search. Null is returned if the name
90     * argument for this search has not been specified.
91     *
92     * @return The name argument of the search, or null if the argument has not been specified.
93     */
94    public Name getName()
95    {
96      return name;
97    }
98  
99    /***
100    * Returns the name argument of the search. Null is returned if the name
101    * argument for this search has not been specified.
102    *
103    * @return The name argument of the search as a String, or null if the argument has not been specified.
104    */
105   public String getNameString()
106   {
107     if (this.name != null)
108       return this.name.getValue();
109     else
110       return null;
111   }
112 
113   /***
114    * Adds a business identifier reference to the identifierBag argument of this search.
115    *
116    * @param ref The business identifer reference to add.
117    */
118   public void addIdentifier(KeyedReference ref)
119   {
120     // just return if the KeyedReference parameter is null (nothing to add)
121     if (ref == null)
122       return;
123 
124     // make sure the IdentifierBag has been initialized
125     if (this.identifierBag == null)
126       this.identifierBag = new IdentifierBag();
127 
128     this.identifierBag.addKeyedReference(ref);
129   }
130 
131   /***
132    * Sets this TModels IdentifierBag the the new TModelBag object passed in.
133    *
134    * @param bag The references to add.
135    */
136   public void setIdentifierBag(IdentifierBag bag)
137   {
138     this.identifierBag = bag;
139   }
140 
141   /***
142    * Returns the list of business identifier references as an enumeration. If the
143    * identifierBag has not been specified, an empty list is returned.
144    *
145    * @return The list of business identifier references.
146    */
147   public IdentifierBag getIdentifierBag()
148   {
149     return this.identifierBag;
150   }
151 
152   /***
153    * Adds a category reference to the categoryBag argument of this search.
154    *
155    * @param ref The category reference to add.
156    */
157   public void addCategory(KeyedReference ref)
158   {
159     // just return if the KeyedReference parameter is null (nothing to add)
160     if (ref == null)
161       return;
162 
163     // make sure the CategoryBag has been initialized
164     if (this.categoryBag == null)
165       this.categoryBag = new CategoryBag();
166 
167     this.categoryBag.addKeyedReference(ref);
168   }
169 
170   /***
171    * Sets the CategoryBag
172    *
173    * @param bag The new CategoryBag
174    */
175   public void setCategoryBag(CategoryBag bag)
176   {
177     this.categoryBag = bag;
178   }
179 
180   /***
181    * Returns the CategoryBag
182    *
183    * @return The current CategoryBag value.
184    */
185   public CategoryBag getCategoryBag()
186   {
187     return categoryBag;
188   }
189 
190   /***
191    *
192    */
193   public int getMaxRows()
194   {
195     return maxRows;
196   }
197 
198   /***
199    *
200    */
201   public void setMaxRows(int maxRows)
202   {
203     this.maxRows = maxRows;
204   }
205 
206   /***
207    *
208    */
209   public void setMaxRows(String maxRows)
210   {
211     setMaxRows(Integer.parseInt(maxRows));
212   }
213 
214   /***
215    *
216    */
217   public void addFindQualifier(FindQualifier findQualifier)
218   {
219     if (this.findQualifiers == null)
220       this.findQualifiers = new FindQualifiers();
221     this.findQualifiers.addFindQualifier(findQualifier);
222   }
223 
224   /***
225    *
226    */
227   public void setFindQualifiers(FindQualifiers qualifiers)
228   {
229     this.findQualifiers = qualifiers;
230   }
231 
232   /***
233    *
234    */
235   public FindQualifiers getFindQualifiers()
236   {
237     return this.findQualifiers;
238   }
239 }