1 package mircoders.module;
7 import javax.servlet.*;
8 import javax.servlet.http.*;
10 import freemarker.template.*;
18 import mircoders.storage.*;
22 * ModuleComment - methods and access for comments
27 public class ModuleComment extends AbstractModule
29 static Logfile theLog;
32 public ModuleComment(StorageObject theStorage)
34 if (theLog == null) theLog = Logfile.getInstance(MirConfig.getProp("Home") + MirConfig.getProp("Module.Comment.Logfile"));
35 if (theStorage == null) theLog.printWarning("StorageObject was null!");
36 this.theStorage = theStorage;
40 public SimpleList getCommentAsSimpleList() {
41 return ((DatabaseComment)theStorage).getPopupData();
45 * setValues in the Entity and updates them on the StorageObject
47 public String set(HashMap theValues) throws ModuleException
50 Entity theEntity = theStorage.selectById((String)theValues.get("id"));
51 if (theEntity == null)
52 throw new ModuleException("No Objekt with id in Database id: " + theValues.get("id"));
53 theEntity.setValues(theValues);
55 //set content to unproduced
56 DatabaseContent.getInstance().setUnproduced("id=" + theEntity.getValue("to_media"));
57 return theEntity.getId();
59 catch (StorageObjectException e){
60 e.printStackTrace(System.err);
61 throw new ModuleException(e.toString());