X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=source%2Fmircoders%2Fstorage%2FDatabaseContentToMedia.java;h=5a4201047b8ad503a7a916cfad0bea040634ec70;hb=9065f22c307993d6dd19be86aafcef915f52f36d;hp=5bfe5af06fbda9ca11a1ecf170393191ecdb6bee;hpb=d59d1103c4930049bd96a6d4fcc5cc4543bbc1d7;p=mir.git diff --git a/source/mircoders/storage/DatabaseContentToMedia.java b/source/mircoders/storage/DatabaseContentToMedia.java index 5bfe5af0..5a420104 100755 --- a/source/mircoders/storage/DatabaseContentToMedia.java +++ b/source/mircoders/storage/DatabaseContentToMedia.java @@ -39,7 +39,7 @@ public class DatabaseContentToMedia extends Database implements StorageObject{ this.hasTimestamp = false; this.theTable="content_x_media"; } - + /** * get all the media-files belonging to a content entity * @@ -62,7 +62,7 @@ public class DatabaseContentToMedia extends Database implements StorageObject{ } return returnList; } - + /** * get all the images belonging to a content entity * @@ -92,7 +92,10 @@ public class DatabaseContentToMedia extends Database implements StorageObject{ * */ public EntityList getUploadedMedia(EntityContent content) - throws StorageObjectException { + throws StorageObjectException + { + /** @todo this should only fetch published media / rk */ + EntityList returnList=null; if (content != null) { // get all to_topic from media_x_topic @@ -101,8 +104,9 @@ public class DatabaseContentToMedia extends Database implements StorageObject{ String subselect = "id in (select media_id from " + theTable + " where content_id=" + id+")"; try { - returnList = DatabaseMedia.getInstance().selectByWhereClause(subselect,-1); + returnList = DatabaseMedia.getInstance().selectByWhereClause(subselect,"id"); } catch (Exception e) { + e.printStackTrace(); theLog.printDebugInfo("-- get uploadedMedia failed " + e.toString()); throw new StorageObjectException("-- get uploadedMedia failed " + e.toString()); } @@ -121,7 +125,7 @@ public class DatabaseContentToMedia extends Database implements StorageObject{ } //first delete all row with content_id=contentId String sql = "delete from "+ theTable +" where content_id=" + contentId; - + Connection con=null;Statement stmt=null; try { con = getPooledCon(); @@ -134,7 +138,7 @@ public class DatabaseContentToMedia extends Database implements StorageObject{ } finally { freeConnection(con,stmt); } - + //now insert //first delete all row with content_id=contentId for (int i=0;i