super();
this.theTable="uploaded_media";
this.theCoreTable="media";
- relationMediaType = new EntityRelation("id", "to_media_type", DatabaseMediaType.getInstance(), EntityRelation.TO_ONE);
- try { this.theEntityClass = Class.forName("mircoders.entity.EntityContent"); }
+ relationMediaType = new EntityRelation("to_media_type", "id", DatabaseMediaType.getInstance(), EntityRelation.TO_ONE);
+ try { this.theEntityClass = Class.forName("mircoders.entity.EntityUploadedMedia"); }
catch (Exception e) { throw new StorageObjectException(e.toString()); }
}
/**
- * returns the comments that belong to the article (via entityrelation)
+ * returns the media_type that belongs to the media item (via entityrelation)
* where db-flag is_published is true
*/
- public SimpleList getMediaType(EntityUploadedMedia ent) {
- SimpleList comments=null;
+ public Entity getMediaType(Entity ent) throws StorageObjectException {
+ Entity type=null;
try {
- comments = relationMediaType.getManyAsSimpleList(ent,"webdb_create","is_published='1'");
+ type = relationMediaType.getOne(ent);
}
catch (StorageObjectException e) {
theLog.printError("DatabaseUploadedMedia :: failed to get media_type");
+ throw new StorageObjectException("DatabaseUploadedMedia :: failed to get media_type"+ e.toString());
}
- return comments;
+ return type;
}
}