1 16 package org.getahead.dwrdemo.address; 17 18 import java.util.HashMap ; 19 import java.util.Map ; 20 21 import org.directwebremoting.util.LocalUtil; 22 23 26 public class AddressLookup 27 { 28 29 private static final String LINE4 = "line4"; 30 31 private static final String LINE3 = "line3"; 32 33 private static final String LINE2 = "line2"; 34 35 39 public Map fillAddress(String origpostcode) 40 { 41 Map reply = new HashMap (); 42 String postcode = LocalUtil.replace(origpostcode, " ", ""); 43 44 if (postcode.equalsIgnoreCase("LE167TR")) 45 { 46 reply.put(LINE2, "Church Lane"); 47 reply.put(LINE3, "Thorpe Langton"); 48 reply.put(LINE4, "MARKET HARBOROUGH"); 49 } 50 else if (postcode.equalsIgnoreCase("NR147SL")) 51 { 52 reply.put(LINE2, "Rectory Lane"); 53 reply.put(LINE3, "Poringland"); 54 reply.put(LINE4, "NORWICH"); 55 } 56 else if (postcode.equalsIgnoreCase("B927TT")) 57 { 58 reply.put(LINE2, "Olton Mere"); 59 reply.put(LINE3, "Warwick Road"); 60 reply.put(LINE4, "SOLIHULL"); 61 } 62 else if (postcode.equalsIgnoreCase("E178YT")) 63 { 64 reply.put(LINE2, ""); 65 reply.put(LINE3, "PO Box 43108 "); 66 reply.put(LINE4, "LONDON"); 67 } 68 else if (postcode.equalsIgnoreCase("SN48QS")) 69 { 70 reply.put(LINE2, "Binknoll"); 71 reply.put(LINE3, "Wootton Bassett"); 72 reply.put(LINE4, "SWINDON"); 73 } 74 else if (postcode.equalsIgnoreCase("NN57HT")) 75 { 76 reply.put(LINE2, "Heathville"); 77 reply.put(LINE3, ""); 78 reply.put(LINE4, "NORTHAMPTON"); 79 } 80 else 81 { 82 reply.put(LINE2, "Postcode not found"); 83 reply.put(LINE3, ""); 84 reply.put(LINE4, ""); 85 } 86 87 return reply; 88 } 89 } 90
| Popular Tags
|