1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.juddi.v3.client.i18n;
18
19 import java.util.List;
20
21 import org.uddi.api_v3.Address;
22 import org.uddi.api_v3.Description;
23 import org.uddi.api_v3.Name;
24
25
26
27
28 public class EntityForLang {
29
30 public static Name getName(List<Name> entityList, String lang) {
31
32 if (entityList.size()==0) {
33 Name name = new Name();
34 name.setValue("");
35 name.setLang(lang);
36 entityList.add(name);
37 }
38 if (lang==null) return entityList.get(0);
39 for (Name entity : entityList) {
40 if (lang.equalsIgnoreCase(entity.getLang())) {
41 return entity;
42 }
43 }
44 return entityList.get(0);
45 }
46
47 public static Address getAddress(List<Address> entityList, String lang) {
48
49 if (entityList.size()==0) {
50 Address address = new Address();
51 address.setLang(lang);
52 entityList.add(address);
53 }
54 if (lang==null) return entityList.get(0);
55 for (Address entity : entityList) {
56 if (lang.equalsIgnoreCase(entity.getLang())) {
57 return entity;
58 }
59 }
60 return entityList.get(0);
61 }
62
63 public static Description getDescription(List<Description> entityList, String lang) {
64
65 if (entityList.size()==0) {
66 Description description = new Description();
67 description.setValue("");
68 description.setLang(lang);
69 entityList.add(description);
70 }
71 if (lang==null) return entityList.get(0);
72 for (Description entity : entityList) {
73 if (lang.equalsIgnoreCase(entity.getLang())) {
74 return entity;
75 }
76 }
77 return entityList.get(0);
78 }
79
80
81 }