1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.apache.juddi.datatype.business;
17
18 import java.util.Vector;
19
20 import org.apache.juddi.datatype.CategoryBag;
21 import org.apache.juddi.datatype.Description;
22 import org.apache.juddi.datatype.DiscoveryURL;
23 import org.apache.juddi.datatype.DiscoveryURLs;
24 import org.apache.juddi.datatype.IdentifierBag;
25 import org.apache.juddi.datatype.KeyedReference;
26 import org.apache.juddi.datatype.Name;
27 import org.apache.juddi.datatype.RegistryObject;
28 import org.apache.juddi.datatype.service.BusinessService;
29 import org.apache.juddi.datatype.service.BusinessServices;
30
31 /***
32 * "Top-level information manager for all of the information about a
33 * particular set of information related to a business unit"
34 * - technical whitepaper
35 *
36 * "Information about the party who publishes information about a service"
37 * - XML Structure Reference
38 *
39 * @author Steve Viens (sviens@apache.org)
40 */
41 public class BusinessEntity implements RegistryObject
42 {
43 String businessKey;
44 String authorizedName;
45 String operator;
46 DiscoveryURLs discoveryURLs;
47 Vector nameVector;
48 Vector descVector;
49 Contacts contacts;
50 BusinessServices businessServices;
51 IdentifierBag identifierBag;
52 CategoryBag categoryBag;
53
54 /***
55 * Constructs a new BusinessEntity instance.
56 */
57 public BusinessEntity()
58 {
59 }
60
61 /***
62 * Sets the business key of this business entity to the given key.
63 * @param key The new key of this business entity.
64 */
65 public void setBusinessKey(String key)
66 {
67 this.businessKey = key;
68 }
69
70 /***
71 * Returns the business key of this business entity.
72 * @return The business key of this business entity.
73 */
74 public String getBusinessKey()
75 {
76 return this.businessKey;
77 }
78
79 /***
80 * Sets the authorized name of this business entity to the given name.
81 * @param name The new authorized name of this business entity.
82 */
83 public void setAuthorizedName(String name)
84 {
85 this.authorizedName = name;
86 }
87
88 /***
89 * Returns the authorized name of this business entity.
90 * @return The authorized name of this business entity, or null if
91 * this business entity doesn't have an authorized name.
92 */
93 public String getAuthorizedName()
94 {
95 return this.authorizedName;
96 }
97
98 /***
99 * Sets the operator of this business entity to the given operator.
100 * @param operator The new operator of this business entity.
101 */
102 public void setOperator(String operator)
103 {
104 this.operator = operator;
105 }
106
107 /***
108 * Returns the operator of this business entity.
109 * @return The operator of this business entity, or null if this business entity
110 * doesn't have an operator.
111 */
112 public String getOperator()
113 {
114 return this.operator;
115 }
116
117 /***
118 * Adds a new discoveryURL to this business enitity's set of discoverURLs.
119 * The discoveryURL is added to the end of the set. When a businessEntity is
120 * saved a new discoveryURL is generated automatically, eg,
121 * http://www.some-operator.com?businessKey=BE3D2F08-CEB3-11D3-849F-0050DA1803C0
122 * Each time the businessEntity is saved this set is augmented with a newly
123 * generated discoveryURL.
124 *
125 * @param url The discoveryURL to add.
126 */
127 public void addDiscoveryURL(DiscoveryURL url)
128 {
129
130 if (url == null)
131 return;
132
133
134 if (this.discoveryURLs == null)
135 this.discoveryURLs = new DiscoveryURLs();
136
137 discoveryURLs.addDiscoveryURL(url);
138 }
139
140 /***
141 * Sets the collection of discoveryURLs to this business entity.
142 * @param urls The set of discoveryURLs to add.
143 */
144 public void setDiscoveryURLs(DiscoveryURLs urls)
145 {
146 this.discoveryURLs = urls;
147 }
148
149 /***
150 * Returns the set of discoveryURLs used for finding this business entity.
151 *
152 * @return The set of discoveryURLs. If this business entity doesn't
153 * have a any discoveryURL, an empty enumeration is returned.
154 */
155 public DiscoveryURLs getDiscoveryURLs()
156 {
157 return this.discoveryURLs;
158 }
159
160 /***
161 * Adds the given description.
162 *
163 * @param descr The description to add.
164 */
165 public void addDescription(Description descr)
166 {
167
168 if (descr == null)
169 return;
170
171 if (this.descVector == null)
172 this.descVector = new Vector();
173 this.descVector.add(descr);
174 }
175
176 /***
177 * Sets the description list to the current one. Ignores any object in the
178 * collection that is not an "instanceof" the Description class.
179 *
180 * @param descr Collection of Description objects to set
181 */
182 public void setDescriptionVector(Vector descr)
183 {
184 this.descVector = descr;
185 }
186
187 /***
188 * Returns the descriptions.
189 *
190 * @return the descriptions. If the aren't any descriptions, an empty
191 * enumeration is returned.
192 */
193 public Vector getDescriptionVector()
194 {
195 return this.descVector;
196 }
197
198 /***
199 * Add a contact to this business entity.
200 *
201 * @param contact The contact to add.
202 */
203 public void addContact(Contact contact)
204 {
205
206 if (contact == null)
207 return;
208
209
210 if (this.contacts == null)
211 this.contacts = new Contacts();
212 this.contacts.addContact(contact);
213 }
214
215 /***
216 * Set the set of contacts of this business entity to the given set.
217 *
218 * @param contacts The new set of contacts.
219 */
220 public void setContacts(Contacts contacts)
221 {
222 this.contacts = contacts;
223 }
224
225 /***
226 * Returns the contacts of this business entity.
227 *
228 * @return The contacts of thes business entity. If this business
229 * entity doesn't have any contacts, an empty set is returned.
230 */
231 public Contacts getContacts()
232 {
233 return this.contacts;
234 }
235
236
237 /***
238 * Add a name to this business entity.
239 *
240 * @param name The Name to add.
241 */
242 public void addName(Name name)
243 {
244
245 if (name == null)
246 return;
247
248 if (this.nameVector == null)
249 this.nameVector = new Vector();
250 this.nameVector.add(name);
251 }
252
253 /***
254 * Set the set of names of this business entity to the given set.
255 *
256 * @param names The new set of contacts.
257 */
258 public void setNameVector(Vector names)
259 {
260 this.nameVector = names;
261 }
262
263 /***
264 * Returns the names of this business entity.
265 *
266 * @return The names of thes business entity. If this business entity
267 * doesn't have any names, an empty set is returned.
268 */
269 public Vector getNameVector()
270 {
271 return this.nameVector;
272 }
273
274 /***
275 * Add a business service to this business entity.
276 *
277 * @param service The service to add.
278 */
279 public void addBusinessService(BusinessService service)
280 {
281
282 if (service == null)
283 return;
284
285
286 if (this.businessServices == null)
287 this.businessServices = new BusinessServices();
288 this.businessServices.addBusinessService(service);
289 }
290
291 /***
292 * Sets business services to this business services list.
293 * @param services The set of business services to add.
294 */
295 public void setBusinessServices(BusinessServices services)
296 {
297 this.businessServices = services;
298 }
299
300 /***
301 * Returns the business services of this business entity.
302 *
303 * @return The business services of this business entity. If this
304 * business entity doesn't have any services, an empty enumeration is
305 * returned.
306 */
307 public BusinessServices getBusinessServices()
308 {
309 return this.businessServices;
310 }
311
312 /***
313 * Add an identifier to the identifierbag of this business entity.
314 * @param keyref The identifier to add.
315 */
316 public void addIdentifier(KeyedReference keyref)
317 {
318
319 if (keyref == null)
320 return;
321
322
323 if (this.identifierBag == null)
324 this.identifierBag = new IdentifierBag();
325
326 this.identifierBag.addKeyedReference(keyref);
327 }
328
329 /***
330 * Set the identifierbag of this business entity to the given one.
331 * @param bag The new identifierbag.
332 */
333 public void setIdentifierBag(IdentifierBag bag)
334 {
335 this.identifierBag = bag;
336 }
337
338 /***
339 * Returns the identifierbag of this business entity.
340 * @return The identifierbag of this business entity. If this business entity doesn't
341 * contain any identifiers, an empty bag is returned.
342 */
343 public IdentifierBag getIdentifierBag()
344 {
345 return this.identifierBag;
346 }
347
348 /***
349 * Add a category to the categorybag of this business entity.
350 *
351 * @param keyref The category to add.
352 */
353 public void addCategory(KeyedReference keyref)
354 {
355
356 if (keyref == null)
357 return;
358
359
360 if (this.categoryBag == null)
361 this.categoryBag = new CategoryBag();
362
363 this.categoryBag.addKeyedReference(keyref);
364 }
365
366 /***
367 * Set the categorybag of this business entity to the given one.
368 *
369 * @param bag The new categorybag.
370 */
371 public void setCategoryBag(CategoryBag bag)
372 {
373 this.categoryBag = bag;
374 }
375
376 /***
377 * Returns the categorybag of this business entity.
378 *
379 * @return The categorybag of this business entity. If this business entity doesn't
380 * contain any categories, an empty bag is returned.
381 */
382 public CategoryBag getCategoryBag()
383 {
384 return this.categoryBag;
385 }
386 }