first cut of merge of STABLE-pre1_0 into HEAD. I won't even guarantee that it
[mir.git] / source / mircoders / module / ModuleTopics.java
1 package mircoders.module;
2
3 import java.io.*;
4 import java.lang.*;
5 import java.util.*;
6 import java.sql.*;
7 import javax.servlet.*;
8 import javax.servlet.http.*;
9
10 import freemarker.template.*;
11
12 import mir.servlet.*;
13 import mir.module.*;
14 import mir.entity.*;
15 import mir.misc.*;
16 import mir.storage.*;
17
18 import mircoders.storage.*;
19
20 /*
21  *  ThemenModule -
22  *
23  *
24  * @author RK
25  */
26
27 public class ModuleTopics extends AbstractModule
28 {
29
30     static Logfile theLog;
31
32     public ModuleTopics(StorageObject theStorage) {
33             this.theStorage = theStorage;
34             if (theLog == null)
35               theLog = Logfile.getInstance(MirConfig.getProp("Home") + MirConfig.getProp("Module.Themen.Logfile"));
36     }
37
38     public SimpleList getTopicsAsSimpleList() throws ModuleException {
39       try {
40               return ((DatabaseTopics)theStorage).getPopupData();
41       } catch(StorageObjectException e) {
42         throw new ModuleException(e.toString());
43       }
44     }
45
46
47     /**
48      *  Method getTopicList
49      *
50      *  @return SimpleList of all Topics sorted by title
51      *
52      */
53     public EntityList getTopicsList()
54     {
55       EntityList returnList=null;
56       try {
57         returnList=getByWhereClause("","title",-1);
58       }
59       catch (Exception e)
60       {
61         theLog.printWarning("--getTopicsList: topics could not be fetched");
62       }
63       return returnList;
64     }
65
66 }