first cut of merge of STABLE-pre1_0 into HEAD. I won't even guarantee that it
[mir.git] / source / mircoders / storage / DatabaseContent.java
index 72286ff..624b116 100755 (executable)
@@ -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"); }
@@ -55,7 +56,7 @@ public class DatabaseContent extends Database implements StorageObject {
    * sets the database flag is_produced to unproduced
    */
 
-  public void setUnproduced(String where)
+  public void setUnproduced(String where) throws StorageObjectException
   {
     Connection con=null;Statement stmt=null;
     String sql = "update content set is_produced='0' where " + where;
@@ -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,33 +74,19 @@ 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) {
-    SimpleList comments=null;
-    try {
-      comments = relationComments.getManyAsSimpleList(entC,"webdb_create","is_published='1'");
-    }
-    catch (StorageObjectException e) {
-      theLog.printError("DatabaseComments :: failed to get comments");
-    }
-    return comments;
+  public EntityList getComments(EntityContent entC) throws StorageObjectException {
+    return relationComments.getMany(entC,"webdb_create","is_published='1'");
   }
 
   /**
    * returns the features that belong to the article (via entityrelation)
    */
-  public SimpleList getFeature(EntityContent entC) {
-    SimpleList feature=null;
-    try {
-      feature = relationFeature.getManyAsSimpleList(entC);
-    }
-    catch (StorageObjectException e) {
-      theLog.printError("DatabaseComments :: failed to get features");
-    }
-    return feature;
+  public EntityList getFeature(EntityContent entC) throws StorageObjectException {
+    return relationFeature.getMany(entC);
   }
 
-  public boolean delete(String id)
-    throws StorageObjectException {
+  public boolean delete(String id) throws StorageObjectException
+  {
     DatabaseComment.getInstance().deleteByContentId(id);
     super.delete(id);
     return true;