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.KeyedReference;
20  import org.apache.juddi.datatype.RegistryObject;
21  import org.apache.juddi.datatype.TModelBag;
22  
23  /***
24   * "Used to locate specific bindings within a registered
25   *  businessService. Returns a bindingDetail message."
26   *
27   * @author Steve Viens (sviens@apache.org)
28   */
29  public class FindBinding implements RegistryObject,Inquiry
30  {
31    String serviceKey;
32    String generic;
33    CategoryBag categoryBag;
34    TModelBag tModelBag;
35    FindQualifiers findQualifiers;
36    int maxRows;
37  
38    /***
39     *
40     */
41    public FindBinding()
42    {
43    }
44  
45  
46    /***
47     * Construct a new find_binding request. The bindings searched for must be part of the
48     * businessService with the given serviceKey.
49     *
50     * @param serviceKey The key of the businessService to search in.
51     * @throws NullPointerException If the given key is null.
52     */
53    public FindBinding(String serviceKey)
54    {
55      setServiceKey(serviceKey);
56    }
57  
58    /***
59     * Sets the servicekey of this find_binding request to the given key. Only bindingTemplates
60     * of the referenced businessService are searched.
61     *
62     * @param key A reference to the businessService.
63     */
64    public void setServiceKey(String key)
65    {
66      serviceKey = key;
67    }
68  
69    /***
70     * Returns the servicekey of this find_binding request. Only bindingTemplates of the
71     * reference businessService are searched.
72     *
73     * @return The servicekey of the referenced businessService.
74     */
75    public String getServiceKey()
76    {
77      return serviceKey;
78    }
79  
80    /***
81     *
82     * @param genericValue
83     */
84    public void setGeneric(String genericValue)
85    {
86      this.generic = genericValue;
87    }
88  
89    /***
90     *
91     * @return String UDDI request's generic value.
92     */
93    public String getGeneric()
94    {
95      return this.generic;
96    }
97  
98    /***
99     * Adds a category reference to the categoryBag argument of this search.
100    *
101    * @param ref The category reference to add.
102    */
103   public void addCategory(KeyedReference ref)
104   {
105     // just return if the KeyedReference parameter is null (nothing to add)
106     if (ref == null)
107       return;
108 
109     // make sure the CategoryBag has been initialized
110     if (this.categoryBag == null)
111       this.categoryBag = new CategoryBag();
112 
113     this.categoryBag.addKeyedReference(ref);
114   }
115 
116   /***
117    * Sets the CategoryBag value
118    *
119    * @param bag The new CategoryBag
120    */
121   public void setCategoryBag(CategoryBag bag)
122   {
123     categoryBag = bag;
124   }
125 
126   /***
127    * Returns the CategoryBag value
128    *
129    * @return The CategoryBag value
130    */
131   public CategoryBag getCategoryBag()
132   {
133     return this.categoryBag;
134   }
135 
136   /***
137    * Adds a tModel reference to the tModelBag argument of this search. This tModelBag argument
138    * lets you search for bindings that are compatible with a specific tModel pattern.
139    *
140    * @param key The key of the tModel to add to the tModelBag argument.
141    */
142   public void addTModelKey(String key)
143   {
144     // just return if the TModel key parameter is null (nothing to add)
145     if (key == null)
146       return;
147 
148     // make sure the TModelBag has been initialized
149     if (this.tModelBag == null)
150       this.tModelBag = new TModelBag();
151 
152     this.tModelBag.addTModelKey(key);
153   }
154 
155   /***
156    * Sets the TModelBag value
157    *
158    * @param bag The new TModelBag value
159    */
160   public void setTModelBag(TModelBag bag)
161   {
162     this.tModelBag = bag;
163   }
164 
165   /***
166    * Returns the TModelBag value.
167    *
168    * @return The current TModelBag value
169    */
170   public TModelBag getTModelBag()
171   {
172     return tModelBag;
173   }
174 
175   /***
176    *
177    */
178   public int getMaxRows()
179   {
180     return maxRows;
181   }
182 
183   /***
184    *
185    */
186   public void setMaxRows(int maxRows)
187   {
188     this.maxRows = maxRows;
189   }
190 
191   /***
192    *
193    */
194   public void setMaxRows(String maxRows)
195   {
196     setMaxRows(Integer.parseInt(maxRows));
197   }
198 
199   /***
200    *
201    */
202   public void addFindQualifier(FindQualifier findQualifier)
203   {
204     if (this.findQualifiers == null)
205       this.findQualifiers = new FindQualifiers();
206     this.findQualifiers.addFindQualifier(findQualifier);
207   }
208 
209   /***
210    *
211    */
212   public void setFindQualifiers(FindQualifiers findQualifiers)
213   {
214     this.findQualifiers = findQualifiers;
215   }
216 
217   /***
218    *
219    */
220   public FindQualifiers getFindQualifiers()
221   {
222     return this.findQualifiers;
223   }
224 }