1 package mircoders.storage;
8 import freemarker.template.*;
14 import mircoders.entity.*;
17 * <b>this class implements the access to the content-table</b>
22 public class DatabaseUploadedMedia extends Database implements StorageObject {
24 private static DatabaseUploadedMedia instance;
25 private static EntityRelation relationMediaType;
27 // Contructors / Singleton
29 public static DatabaseUploadedMedia getInstance()
30 throws StorageObjectException {
32 if (instance == null ) {
33 instance = new DatabaseUploadedMedia();
34 instance.myselfDatabase = instance;
39 private DatabaseUploadedMedia()
40 throws StorageObjectException {
43 this.theTable="uploaded_media";
44 this.theCoreTable="media";
45 relationMediaType = new EntityRelation("id", "to_media_type", DatabaseMediaType.getInstance(), EntityRelation.TO_ONE);
46 try { this.theEntityClass = Class.forName("mircoders.entity.EntityUploadedMedia"); }
47 catch (Exception e) { throw new StorageObjectException(e.toString()); }
54 * returns the comments that belong to the article (via entityrelation)
55 * where db-flag is_published is true
57 public SimpleList getMediaType(EntityUploadedMedia ent) {
58 SimpleList comments=null;
60 comments = relationMediaType.getManyAsSimpleList(ent,"webdb_create","is_published='1'");
62 catch (StorageObjectException e) {
63 theLog.printError("DatabaseUploadedMedia :: failed to get media_type");