1 package mircoders.storage;
8 import freemarker.template.*;
15 * <b>Diese Klasse implementiert die Datenbankverbindung zur MetaObjekt-Tabelle
20 public class DatabaseAudio extends Database implements StorageObject{
22 private static DatabaseAudio instance;
23 private static SimpleList publisherPopupData;
25 // the following *has* to be sychronized cause this static method
26 // could get preemted and we could end up with 2 instances of DatabaseFoo..
27 // see the "Singletons with needles and thread" article at JavaWorld -mh
28 public synchronized static DatabaseAudio getInstance()
29 throws StorageObjectException
31 if (instance == null) {
32 instance = new DatabaseAudio();
33 instance.myselfDatabase = instance;
38 private DatabaseAudio() throws StorageObjectException
41 this.hasTimestamp = true;
42 this.theTable="audio";
43 this.theCoreTable="media";
45 this.theEntityClass = Class.forName("mircoders.entity.EntityAudio");
47 catch (Exception e) { throw new StorageObjectException(e.toString()); }
50 public SimpleList getPopupData() throws StorageObjectException {
51 return getPopupData("title",true);
54 public void update(Entity theEntity) throws StorageObjectException
56 String date = theEntity.getValue("date");
58 date = StringUtil.date2webdbDate(new GregorianCalendar());
59 theEntity.setValueForProperty("date",date);
62 super.update(theEntity);
66 public String insert(Entity theEntity) throws StorageObjectException
68 String date = theEntity.getValue("date");
70 date = StringUtil.date2webdbDate(new GregorianCalendar());
71 theEntity.setValueForProperty("date",date);
73 return super.insert(theEntity);
76 // initialisierungen aus den statischen Tabellen