producer content now htmlize the comments
[mir.git] / source / mircoders / entity / EntityComment.java
1 package mircoders.entity;
2
3 import java.lang.*;
4 import java.io.*;
5 import java.util.*;
6 import java.sql.*;
7
8 import mir.entity.*;
9 import mir.misc.*;
10 import mir.storage.*;
11
12 import mir.storage.*;
13
14 /**
15  * This class maps one line of the comment-table to a java-object.
16  *
17  * @author RK
18  * @version 1.0
19  */
20
21
22 public class EntityComment extends AbstractEntity implements Entity
23 {
24   private static int instances;
25
26   public EntityComment()
27   {
28     super();
29     instances++;
30   }
31
32   public EntityComment(StorageObject theStorage) {
33     this();
34     setStorage(theStorage);
35   }
36
37   public HashMap getValues() {
38     HashMap returnHash = super.getValues();
39     String create = (String)returnHash.get("webdb_create");
40     returnHash.put("date",StringUtil.dateToReadableDate(create));
41
42     return returnHash;
43   }
44
45   /**
46    * overridden method setValues to patch creator_main_url
47    */
48   public void setValues(HashMap theStringValues)
49   {
50     if (theStringValues != null) {
51       if (!theStringValues.containsKey("is_published"))
52        theStringValues.put("is_published","0");
53       if (theStringValues.containsKey("main_url"))
54         if (((String)theStringValues.get("main_url")).equalsIgnoreCase("http://")) {
55           theStringValues.remove("main_url");
56         } else if (!((String)theStringValues.get("main_url")).startsWith("http://")){
57           theStringValues.put("main_url","http://"+((String)theStringValues.get("main_url")));
58         }
59     }
60     super.setValues(theStringValues);
61   }
62
63
64   public void finalize() {
65     instances--;
66     super.finalize();
67   }
68 }