mass update mir codeswitch
[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
49         public void setValues(HashMap theStringValues)
50         {
51                 if (theStringValues != null) {
52                         if (!theStringValues.containsKey("is_published"))
53                          theStringValues.put("is_published","0");
54                         if (theStringValues.containsKey("main_url"))
55                                 if (((String)theStringValues.get("main_url")).equalsIgnoreCase("http://")) {
56                                         theStringValues.remove("main_url");
57         } else if (!((String)theStringValues.get("main_url")).startsWith("http://")){
58           theStringValues.put("main_url","http://"+((String)theStringValues.get("main_url")));
59         }
60                 }
61                 super.setValues(theStringValues);
62         }
63
64
65         public void finalize() {
66     instances--;
67     super.finalize();
68   }
69 }