X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=source%2Fmircoders%2Fmodule%2FModuleComment.java;h=f809b0f407964fc335aeeda0b5be6bb810c2184e;hb=23957979e0aa27f91d678cf7a748b9a7f097a621;hp=5b64cfc76824dc7cc2c29781a79febc3d7269a30;hpb=3a661e8f0f659ab5ed2ac0e4d982ac0b398d11f1;p=mir.git diff --git a/source/mircoders/module/ModuleComment.java b/source/mircoders/module/ModuleComment.java index 5b64cfc7..f809b0f4 100755 --- a/source/mircoders/module/ModuleComment.java +++ b/source/mircoders/module/ModuleComment.java @@ -26,18 +26,39 @@ import mircoders.storage.*; 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()); + } + } }