1 package mircoders.module;
7 import javax.servlet.*;
8 import javax.servlet.http.*;
10 import freemarker.template.*;
18 import mircoders.storage.*;
19 import mircoders.entity.*;
28 public class ModuleTopics extends AbstractModule
31 static Logfile theLog;
33 public ModuleTopics(StorageObject theStorage) {
34 this.theStorage = theStorage;
36 theLog = Logfile.getInstance(MirConfig.getProp("Home") + MirConfig.getProp("Module.Themen.Logfile"));
39 public SimpleList getTopicsAsSimpleList() throws ModuleException {
41 return ((DatabaseTopics)theStorage).getPopupData();
42 } catch(StorageObjectException e) {
43 throw new ModuleException(e.toString());
51 * @return SimpleList of all Topics sorted by title
54 public EntityList getTopicsList()
56 EntityList returnList=null;
58 returnList=getByWhereClause("","title",-1);
62 theLog.printWarning("--getTopicsList: topics could not be fetched");
68 * Overrides the AbstractModule.set(),
69 * All dependent ContentEntities are set unproduced.
70 * @param theValues Hash mit Spalte/Wert-Paaren
71 * @return Id des eingefügten Objekts
72 * @exception ModuleException
74 public String set (HashMap theValues) throws ModuleException {
76 Entity theEntity = theStorage.selectById((String)theValues.get("id"));
77 if (theEntity == null){
78 throw new ModuleException("Kein Objekt mit id in Datenbank id: " + theValues.get("id"));
80 theEntity.setValues(theValues);
81 DatabaseContentToTopics db = DatabaseContentToTopics.getInstance();
82 DatabaseContent dbc = DatabaseContent.getInstance();
83 EntityList contentList = db.getContent((EntityTopics)theEntity);
84 for (int i = 0; i < contentList.size(); i++){
85 dbc.setUnproduced("id="+((EntityContent)contentList.elementAt(i)).getId());
88 return theEntity.getId();
89 } catch (StorageObjectException e){
90 e.printStackTrace(System.err);
91 throw new ModuleException(e.toString());