filter page bugs resolved
[mir.git] / source / mir / entity / AbstractEntity.java
index ee35074..108f424 100755 (executable)
@@ -36,15 +36,15 @@ import java.util.Map;
 
 import mir.config.MirPropertiesConfiguration;
 import mir.log.LoggerWrapper;
+import mir.storage.DatabaseExc;
+import mir.storage.DatabaseFailure;
 import mir.storage.Database;
-import mir.storage.StorageObjectExc;
-import mir.storage.StorageObjectFailure;
 
 /**
  * Base class the entities are derived from. Provides base functionality of
  * an entity.
  *
- * @version $Id: AbstractEntity.java,v 1.8.2.6 2005/02/10 16:22:30 rhindes Exp $
+ * @version $Id: AbstractEntity.java,v 1.8.2.8 2005/10/30 00:46:57 zapata Exp $
  */
 
 public class AbstractEntity implements Entity {
@@ -52,11 +52,8 @@ public class AbstractEntity implements Entity {
 
   protected Map values;
   protected Database database;
-  protected LoggerWrapper logger;
 
   public AbstractEntity() {
-    logger = new LoggerWrapper("Entity");
-
     values = new HashMap();
   }
 
@@ -89,17 +86,18 @@ public class AbstractEntity implements Entity {
   }
 
   /** {@inheritDoc} */
-  public String insert() throws StorageObjectExc {
-    logger.debug("Entity: trying to insert ...");
+  public String insert() throws DatabaseExc {
+    getLogger().debug("Entity: trying to insert ...");
 
     if (database != null) {
       return database.insert(this);
     }
-               throw new StorageObjectExc("database == null!");
+
+    throw new DatabaseExc("database == null!");
   }
 
   /** {@inheritDoc} */
-  public void update() throws StorageObjectFailure {
+  public void update() throws DatabaseFailure {
     database.update(this);
   }
 
@@ -123,30 +121,34 @@ public class AbstractEntity implements Entity {
    * supplied was not found in the Entity.
    * @param theProp The field name whose value has to be set
    * @param theValue The new value of the field
-   * @exception StorageObjectFailure
+   * @exception DatabaseFailure
    */
-  public void setFieldValue(String theProp, String theValue) throws StorageObjectFailure {
+  public void setFieldValue(String theProp, String theValue) throws DatabaseFailure {
     if (hasField(theProp))
       values.put(theProp, theValue);
     else {
-      logger.warn("Entity.setFieldValue: Property not found: " + theProp + " (" + theValue + ")");
+      getLogger().warn("Entity.setFieldValue: Property not found: " + theProp + " (" + theValue + ")");
     }
   }
 
   /**
    * Returns the field names of the Entity
    */
-  public List getFieldNames() throws StorageObjectFailure {
+  public List getFieldNames() throws DatabaseFailure {
     return database.getFieldNames();
   }
 
   /** Returns whether fieldName is a valid field name of this Entity.
    * @param fieldName
    * @return true in case fieldName is a field name, else false.
-   * @exception StorageObjectFailure
+   * @exception DatabaseFailure
    */
-  public boolean hasField(String fieldName) throws StorageObjectFailure {
+  public boolean hasField(String fieldName) throws DatabaseFailure {
     return getFieldNames().contains(fieldName);
   }
+
+  protected LoggerWrapper getLogger() {
+    return new LoggerWrapper("Entity");
+  }
 }