public class ModuleComment extends AbstractModule
{
- static Logfile theLog;
-
- // Contructor
- public ModuleComment(StorageObject theStorage)
- {
- if (theLog == null) theLog = Logfile.getInstance(Configuration.getProperty("Home") + Configuration.getProperty("Module.Comment.Logfile"));
- if (theStorage == null) theLog.printWarning("StorageObject was null!");
- this.theStorage = theStorage;
- }
-
- // Methoden
- public SimpleList getCommentAsSimpleList() {
- return ((DatabaseComment)theStorage).getPopupData();
- }
+ static Logfile theLog;
+
+ // Contructor
+ public ModuleComment(StorageObject theStorage)
+ {
+ if (theLog == null) theLog = Logfile.getInstance(MirConfig.getProp("Home") + MirConfig.getProp("Module.Comment.Logfile"));
+ if (theStorage == null) theLog.printWarning("StorageObject was null!");
+ this.theStorage = theStorage;
+ }
+
+ // Methoden
+ public SimpleList getCommentAsSimpleList() {
+ return ((DatabaseComment)theStorage).getPopupData();
+ }
+
+ /**
+ * setValues in the Entity and updates them on the StorageObject
+ */
+ public String set(HashMap theValues) throws ModuleException
+ {
+ try {
+ Entity theEntity = theStorage.selectById((String)theValues.get("id"));
+ if (theEntity == null)
+ throw new ModuleException("No Objekt with id in Database id: " + theValues.get("id"));
+ theEntity.setValues(theValues);
+ theEntity.update();
+ //set content to unproduced
+ DatabaseContent.getInstance().setUnproduced("id=" + theEntity.getValue("to_media"));
+ return theEntity.getId();
+ }
+ catch (StorageObjectException e){
+ e.printStackTrace(System.err);
+ throw new ModuleException(e.toString());
+ }
+ }
}