Took the ChangeTracker reporting out of GeneratingProducerNode and put it into the...
[mir.git] / source / mircoders / entity / EntityContent.java
index b87ae15..96ab2dc 100755 (executable)
@@ -37,40 +37,24 @@ import java.util.Map;
 
 import mir.entity.AbstractEntity;
 import mir.log.LoggerWrapper;
-import mir.storage.StorageObject;
-import mir.storage.StorageObjectFailure;
+import mir.storage.DatabaseFailure;
 import mircoders.storage.DatabaseContentToMedia;
 
 /**
  * this class implements mapping of one line of the database table content
  * to a java object
  *
- * @version $Id: EntityContent.java,v 1.19.2.6 2004/02/08 21:05:02 zapata Exp $
+ * @version $Id: EntityContent.java,v 1.19.2.12 2005/10/30 00:46:58 zapata Exp $
  * @author mir-coders group
  *
  */
 
 
 public class EntityContent extends AbstractEntity {
-  // constructors
-
-  public EntityContent()
-  {
-    super();
-
-    logger = new LoggerWrapper("Entity.Content");
-  }
-
-  public EntityContent(StorageObject theStorage) {
-    this();
-
-    setStorage(theStorage);
-  }
-
   /**
    * set is_produced flag for the article
    */
-  public void setProduced(boolean yesno) throws StorageObjectFailure
+  public void setProduced(boolean yesno) throws DatabaseFailure
   {
     String value = (yesno) ? "1":"0";
     if (value.equals( getFieldValue("is_produced") )) return;
@@ -78,19 +62,19 @@ public class EntityContent extends AbstractEntity {
     Connection con=null;Statement stmt=null;
     String sql = "update content set is_produced='" + value + "' where id='" + getId()+"'";
     try {
-      con = storageObject.getPooledCon();
+      con = database.obtainConnection();
       /** todo should be preparedStatement: faster!! */
       stmt = con.createStatement();
-      storageObject.executeUpdate(stmt,sql);
+      database.executeUpdate(stmt,sql);
     }
-    catch (StorageObjectFailure e) {
+    catch (DatabaseFailure e) {
       throw e;
     }
     catch (SQLException e) {
-      throw new StorageObjectFailure(e);
+      throw new DatabaseFailure(e);
     }
     finally {
-      storageObject.freeConnection(con,stmt);
+      database.freeConnection(con,stmt);
     }
   }
 
@@ -99,9 +83,9 @@ public class EntityContent extends AbstractEntity {
    *
    * @param anArticleId
    * @param aMediaId
-   * @throws StorageObjectFailure
+   * @throws DatabaseFailure
    */
-  public void dettach(String anArticleId, String aMediaId) throws StorageObjectFailure
+  public void dettach(String anArticleId, String aMediaId) throws DatabaseFailure
   {
     if (aMediaId!=null){
       DatabaseContentToMedia.getInstance().delete(anArticleId, aMediaId);
@@ -114,14 +98,14 @@ public class EntityContent extends AbstractEntity {
    * Attaches media to the article
    */
 
-  public void attach(String aMediaId) throws StorageObjectFailure
+  public void attach(String aMediaId) throws DatabaseFailure
   {
     if (aMediaId!=null) {
       DatabaseContentToMedia.getInstance().addMedia(getId(),aMediaId);
       setProduced(false);
     }
     else {
-      logger.error("EntityContent: attach without mid");
+      getLogger().error("EntityContent: attach without mid");
     }
   }