1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.apache.juddi.v3.client.mapping;
17
18 import java.util.ArrayList;
19 import java.util.List;
20 import org.apache.juddi.v3.client.UDDIConstants;
21 import org.uddi.api_v3.Description;
22
23
24
25
26
27 public abstract class Common2UDDI {
28
29 public static List<Description> mapDescription(String content, String lang) {
30
31 List<Description> ret = new ArrayList<Description>();
32 if (content == null) {
33 return ret;
34 }
35 if (content.length() > UDDIConstants.MAX_description_length) {
36 int offset = 0;
37 while (offset < content.length()) {
38 Description description = new Description();
39 description.setLang(lang);
40 int trim = offset + UDDIConstants.MAX_description_length;
41 if (trim > content.length()) {
42 trim = content.length()-1;
43 }
44 description.setValue(content.substring(offset, trim));
45 offset = offset + UDDIConstants.MAX_description_length;
46 ret.add(description);
47
48 }
49 } else {
50 ret.add(new Description(content, lang));
51 }
52 return ret;
53
54 }
55 }