Initial revision
[mir.git] / source / mircoders / storage / DatabaseImages.java
diff --git a/source/mircoders/storage/DatabaseImages.java b/source/mircoders/storage/DatabaseImages.java
new file mode 100755 (executable)
index 0000000..8890c0d
--- /dev/null
@@ -0,0 +1,76 @@
+package mircoders.storage;
+
+import java.lang.*;
+import java.sql.*;
+import java.io.*;
+import java.util.*;
+
+import freemarker.template.*;
+
+import webdb.storage.*;
+import webdb.entity.*;
+import webdb.misc.*;
+
+/**
+ * <b>Diese Klasse implementiert die Datenbankverbindung zur MetaObjekt-Tabelle
+ *
+ *
+ */
+
+public class DatabaseImages extends Database implements StorageObject{
+
+       private static DatabaseImages instance;
+       private static SimpleList publisherPopupData;
+
+       public static DatabaseImages getInstance() throws StorageObjectException
+       {
+               if (instance == null) {
+                       instance = new DatabaseImages();
+                       instance.myselfDatabase = instance;
+               }
+               return instance;
+       }
+
+       private DatabaseImages() throws StorageObjectException
+       {
+               super();
+               this.hasTimestamp = true;
+               this.theTable="images";
+               this.theCoreTable="media";
+               try {
+                       this.theEntityClass = Class.forName("mir.entity.EntityImage");
+               }
+               catch (Exception e) { throw new StorageObjectException(e.toString());   }
+       }
+
+       public SimpleList getPopupData() {
+               return getPopupData("title",true);
+       }
+
+       public void update(Entity theEntity) throws StorageObjectException
+       {
+               theEntity.setValueForProperty("to_media_type","1");
+               String date = theEntity.getValue("date");
+               if (date==null){
+                       date = StringUtil.date2webdbDate(new GregorianCalendar());
+                       theEntity.setValueForProperty("date",date);
+               }
+
+               super.update(theEntity);
+       }
+
+
+       public String insert(Entity theEntity) throws StorageObjectException
+       {
+               theEntity.setValueForProperty("to_media_type","1");
+               String date = theEntity.getValue("date");
+               if (date==null){
+                       date = StringUtil.date2webdbDate(new GregorianCalendar());
+                       theEntity.setValueForProperty("date",date);
+               }
+               return super.insert(theEntity);
+       }
+
+       // initialisierungen aus den statischen Tabellen
+
+}