1 package mircoders.entity;
15 * This class maps one line of the comment-table to a java-object.
22 public class EntityComment extends Entity
25 public EntityComment()
30 public EntityComment(StorageObject theStorage) {
32 setStorage(theStorage);
37 * overridden method setValues to patch creator_main_url
39 public void setValues(HashMap theStringValues)
41 if (theStringValues != null) {
42 if (!theStringValues.containsKey("is_published")) {
43 theStringValues.put("is_published","0");
46 if (theStringValues.containsKey("main_url")){
47 if (((String)theStringValues.get("main_url")).equalsIgnoreCase("http://")) {
48 theStringValues.remove("main_url");
49 } else if ((!((String)theStringValues.get("main_url")).startsWith("http://"))
50 && ((String)theStringValues.get("main_url")).length()>0){
51 theStringValues.put("main_url","http://"+((String)theStringValues.get("main_url")));
56 super.setValues(theStringValues);
60 * overridden method getValue to include formatted date into every
64 public String getValue(String field)
66 String returnField = null;
69 if (field.equals("date_formatted") || field.equals("webdb_create_short"))
71 if (hasValueForField("webdb_create"))
72 returnField = StringUtil.dateToReadableDate(getValue("webdb_create"));
74 else if (field.equals("description_parsed")) {
75 /** @todo the config stuff should be moved to StringUtil */
76 String extLinkName = MirConfig.getProp("Producer.ExtLinkName");
77 String intLinkName = MirConfig.getProp("Producer.IntLinkName");
78 String mailLinkName = MirConfig.getProp("Producer.MailLinkName");
79 String imageRoot = MirConfig.getProp("Producer.ImageRoot");
80 returnField = StringUtil.createHTML(getValue("description"),imageRoot,mailLinkName,extLinkName,intLinkName);
83 return super.getValue(field);