X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=source%2Fmircoders%2Fstorage%2FDatabaseContent.java;h=2e3a4dcf7f9ec568d053060010ef28f749205536;hb=9065f22c307993d6dd19be86aafcef915f52f36d;hp=5a76432cfc348aa6f27942cf0ce90e0fd566c97b;hpb=b917564ca5b903a1832b001afc1c4d443b507299;p=mir.git diff --git a/source/mircoders/storage/DatabaseContent.java b/source/mircoders/storage/DatabaseContent.java index 5a76432c..2e3a4dcf 100755 --- a/source/mircoders/storage/DatabaseContent.java +++ b/source/mircoders/storage/DatabaseContent.java @@ -43,6 +43,7 @@ public class DatabaseContent extends Database implements StorageObject { super(); this.theTable="content"; this.theCoreTable="media"; + relationComments = new EntityRelation("id", "to_media", DatabaseComment.getInstance(), EntityRelation.TO_MANY); relationFeature = new EntityRelation("id", "to_feature", DatabaseFeature.getInstance(), EntityRelation.TO_ONE); try { this.theEntityClass = Class.forName("mircoders.entity.EntityContent"); } @@ -65,7 +66,7 @@ public class DatabaseContent extends Database implements StorageObject { stmt = con.createStatement(); executeUpdate(stmt,sql); } - catch (Exception e) {theLog.printDebugInfo("-- set unproduced failed");} + catch (Exception e) {_throwStorageObjectException(e, "-- set unproduced failed");} finally { freeConnection(con,stmt);} } @@ -73,13 +74,13 @@ public class DatabaseContent extends Database implements StorageObject { * returns the comments that belong to the article (via entityrelation) * where db-flag is_published is true */ - public SimpleList getComments(EntityContent entC) { + public SimpleList getComments(EntityContent entC) throws StorageObjectException { SimpleList comments=null; try { comments = relationComments.getManyAsSimpleList(entC,"webdb_create","is_published='1'"); } catch (StorageObjectException e) { - theLog.printError("DatabaseComments :: failed to get comments"); + _throwStorageObjectException(e, "DatabaseComments :: failed to get comments"); } return comments; } @@ -87,19 +88,19 @@ public class DatabaseContent extends Database implements StorageObject { /** * returns the features that belong to the article (via entityrelation) */ - public SimpleList getFeature(EntityContent entC) { + public SimpleList getFeature(EntityContent entC) throws StorageObjectException { SimpleList feature=null; try { feature = relationFeature.getManyAsSimpleList(entC); } catch (StorageObjectException e) { - theLog.printError("DatabaseComments :: failed to get features"); + _throwStorageObjectException(e, "DatabaseComments :: failed to get features"); } return feature; } - public boolean delete(String id) - throws StorageObjectException { + public boolean delete(String id) throws StorageObjectException + { DatabaseComment.getInstance().deleteByContentId(id); super.delete(id); return true;