1 25 26 package net.killingar.forum.actions.area; 27 28 import net.killingar.forum.internal.Message; 29 30 import java.sql.SQLException ; 31 import java.util.HashMap ; 32 import java.util.Map ; 33 import java.util.regex.Matcher ; 34 import java.util.regex.Pattern ; 35 36 public class GuestbookMessageData extends Message 37 { 38 Map fields = new HashMap (); 39 boolean guestbookEntry; 40 static final Pattern p = Pattern.compile("[\n\r]\\p{Print}+\\:[\n\r]"); 41 42 public GuestbookMessageData(Message inMessage) 43 throws SQLException 44 { 45 super(inMessage); 46 47 body = "\n"+body; 48 49 Matcher matcher = p.matcher(body); 50 51 String [] values = p.split(body); 52 53 for (int i = 0; matcher.find(); i++) 54 { 55 String g = matcher.group(); 56 fields.put(g.substring(1, g.length()-2), values[i+1]); 57 } 58 59 guestbookEntry = fields.size() != 0; 60 } 61 62 public boolean getGuestbookEntry() { return guestbookEntry; } 63 public Map getFields() { return fields; } 64 } 65 | Popular Tags |