c41b3af8b5391aad80af2093efde14ed9cc6c629
[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 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
38   /**
39    * overridden method setValues to patch creator_main_url
40    */
41   public void setValues(HashMap theStringValues)
42   {
43     if (theStringValues != null) {
44       if (!theStringValues.containsKey("is_published"))
45        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           theStringValues.put("main_url","http://"+((String)theStringValues.get("main_url")));
51         }
52     }
53     super.setValues(theStringValues);
54   }
55
56
57   public void finalize() {
58     instances--;
59     super.finalize();
60   }
61 }