first cut of merge of STABLE-pre1_0 into HEAD. I won't even guarantee that it
[mir.git] / source / mircoders / storage / DatabaseAudio.java
diff --git a/source/mircoders/storage/DatabaseAudio.java b/source/mircoders/storage/DatabaseAudio.java
new file mode 100755 (executable)
index 0000000..4b4fd1b
--- /dev/null
@@ -0,0 +1,74 @@
+package mircoders.storage;
+
+import java.lang.*;
+import java.sql.*;
+import java.io.*;
+import java.util.*;
+
+import freemarker.template.*;
+
+import mir.storage.*;
+import mir.entity.*;
+import mir.misc.*;
+
+/**
+ * <b>Diese Klasse implementiert die Datenbankverbindung zur MetaObjekt-Tabelle
+ *
+ *
+ */
+
+public class DatabaseAudio extends Database implements StorageObject{
+
+       private static DatabaseAudio instance;
+       private static SimpleList publisherPopupData;
+
+       public static DatabaseAudio getInstance() throws StorageObjectException
+       {
+               if (instance == null) {
+                       instance = new DatabaseAudio();
+                       instance.myselfDatabase = instance;
+               }
+               return instance;
+       }
+
+       private DatabaseAudio() throws StorageObjectException
+       {
+               super();
+               this.hasTimestamp = true;
+               this.theTable="audio";
+               this.theCoreTable="media";
+               try {
+                       this.theEntityClass = Class.forName("mircoders.entity.EntityAudio");
+               }
+               catch (Exception e) { throw new StorageObjectException(e.toString());   }
+       }
+
+       public SimpleList getPopupData() throws StorageObjectException {
+               return getPopupData("title",true);
+       }
+
+       public void update(Entity theEntity) throws StorageObjectException
+       {
+               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
+       {
+               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
+
+}