1 package mircoders.storage;
8 import freemarker.template.*;
15 * <b>Diese Klasse implementiert die Datenbankverbindung zur MetaObjekt-Tabelle
20 public class DatabaseMedia extends Database implements StorageObject{
22 private static DatabaseMedia instance;
23 private static EntityRelation relationMediaType;
25 public static DatabaseMedia getInstance() throws StorageObjectException {
26 if (instance == null) {
27 instance = new DatabaseMedia();
28 instance.myselfDatabase = instance;
33 private DatabaseMedia() throws StorageObjectException
36 //this.cache = new DatabaseCache(100);
37 this.hasTimestamp = false;
38 this.theTable="media";
39 relationMediaType = new EntityRelation("to_media_type", "id",
40 DatabaseMediaType.getInstance(), EntityRelation.TO_ONE);
42 this.theEntityClass = Class.forName("mircoders.entity.EntityMedia");
45 throw new StorageObjectException(e.toString());
53 * returns the comments that belong to the article (via entityrelation)
54 * where db-flag is_published is true
56 public Entity getMediaType(Entity ent) throws StorageObjectException {
59 type = relationMediaType.getOne(ent);
61 catch (StorageObjectException e) {
62 theLog.printError("DatabaseMedia :: failed to get media_type");
63 throw new StorageObjectException("DatabaseMedia :"+e.toString());