3 |
import org.apache.commons.lang3.StringUtils; |
import org.apache.commons.lang3.StringUtils; |
4 |
import org.apache.commons.lang3.text.WordUtils; |
import org.apache.commons.lang3.text.WordUtils; |
5 |
|
|
6 |
|
import dk.daoas.daoadresseservice.beans.Address; |
7 |
|
|
8 |
public class AddressUtils { |
public class AddressUtils { |
9 |
|
|
10 |
public static class SplitResult { |
public static class SplitResult { |
34 |
return 'u'; |
return 'u'; |
35 |
|
|
36 |
case 'ö': |
case 'ö': |
37 |
return 'o'; |
return 'ø'; |
38 |
case 'ô': |
case 'ô': |
39 |
return 'o'; |
return 'o'; |
40 |
|
|
41 |
case 'ä': |
case 'ä': |
42 |
return 'a'; |
return 'æ'; |
43 |
case 'â': |
case 'â': |
44 |
return 'a'; |
return 'a'; |
45 |
|
|
71 |
} |
} |
72 |
|
|
73 |
public static String injectIntoBk(String bkrute, String injected) { |
public static String injectIntoBk(String bkrute, String injected) { |
74 |
|
if (bkrute == null) |
75 |
|
return null; |
76 |
|
|
77 |
String parts[] = bkrute.split("/"); |
String parts[] = bkrute.split("/"); |
78 |
|
|
79 |
if (parts.length != 4) { |
if (parts.length != 4) { |
|
System.out.println(">BK " + bkrute); |
|
80 |
return bkrute; |
return bkrute; |
81 |
} |
} |
82 |
|
|
178 |
|
|
179 |
if (current != 'Æ'&& current != 'Ø' && current != 'Å') { |
if (current != 'Æ'&& current != 'Ø' && current != 'Å') { |
180 |
if ( (i+1 == len || |
if ( (i+1 == len || |
181 |
(Character.isAlphabetic(indAdresse.charAt(i+1)) == false |
(Character.isAlphabetic(indAdresse.charAt(i+1) ) == false |
182 |
/*&& indAdresse.charAt(i+1) != '.'*/) |
/*&& indAdresse.charAt(i+1) != '.'*/ |
183 |
|
|
184 |
|
&& checkCo(indAdresse,i) == false // Fra sortér C/O |
185 |
|
) |
186 |
) |
) |
187 |
) { |
) { |
188 |
result.litra = "" + current; |
result.litra = "" + current; |
286 |
return result; |
return result; |
287 |
} |
} |
288 |
|
|
289 |
|
public static boolean checkCo(String addr, int pos) { |
290 |
|
|
291 |
|
if ( StringUtils.substring(addr, pos, pos+3).equalsIgnoreCase("C/O") ) |
292 |
|
return true; |
293 |
|
|
294 |
|
return false; |
295 |
|
|
296 |
|
} |
297 |
|
|
298 |
|
public static void updateDaekningstype(Address a) { |
299 |
|
if (a.rute != null && a.rute.length()> 0) { |
300 |
|
a.daekningsType = DaekningsType.DAEKNING_DIREKTE; |
301 |
|
} else { |
302 |
|
a.daekningsType = DaekningsType.DAEKNING_IKKEDAEKKET; |
303 |
|
} |
304 |
|
} |
305 |
|
|
306 |
} |
} |
307 |
|
|
308 |
|
|