fixed / clean ups
authorzapata <zapata>
Sun, 18 Jan 2004 17:30:55 +0000 (17:30 +0000)
committerzapata <zapata>
Sun, 18 Jan 2004 17:30:55 +0000 (17:30 +0000)
104 files changed:
bundles/admin_en.properties
source/Mir.java
source/mir/entity/AbstractEntity.java [new file with mode: 0755]
source/mir/entity/Entity.java
source/mir/entity/EntityBrowser.java
source/mir/entity/EntityList.java
source/mir/entity/GenericEntity.java
source/mir/entity/StorableObjectEntity.java
source/mir/entity/adapter/EntityAdapter.java
source/mir/entity/adapter/EntityAdapterDefinition.java
source/mir/entity/adapter/EntityIteratorAdapter.java
source/mir/module/AbstractModule.java
source/mir/producer/EntityModifyingProducerNode.java
source/mir/rss/RSSReader.java
source/mir/storage/Database.java
source/mir/storage/StorageObject.java
source/mir/storage/store/StoreContainerType.java
source/mir/storage/store/StoreIdentifier.java
source/mir/storage/store/StoreUtil.java
source/mir/util/EntityUtility.java [new file with mode: 0755]
source/mir/util/InternetFunctions.java
source/mircoders/accesscontrol/AccessControl.java
source/mircoders/entity/EntityComment.java
source/mircoders/entity/EntityContent.java
source/mircoders/entity/EntityImages.java
source/mircoders/entity/EntityUploadedMedia.java
source/mircoders/entity/EntityUsers.java
source/mircoders/entity/EntityVideo.java
source/mircoders/global/Abuse.java
source/mircoders/global/MirGlobal.java
source/mircoders/localizer/basic/MirBasicAdminInterfaceLocalizer.java
source/mircoders/localizer/basic/MirBasicAntiAbuseFilterTypes.java
source/mircoders/localizer/basic/MirBasicArticlePostingHandler.java
source/mircoders/localizer/basic/MirBasicChildArticlePostingHandler.java
source/mircoders/localizer/basic/MirBasicCommentPostingHandler.java
source/mircoders/localizer/basic/MirBasicDataModelLocalizer.java
source/mircoders/media/MediaHandlerGeneric.java
source/mircoders/media/MediaHandlerImages.java
source/mircoders/media/MediaHandlerImagesExtern.java
source/mircoders/media/MediaHandlerMp3.java
source/mircoders/media/MediaHandlerOgg.java
source/mircoders/media/MediaHandlerRealAudio.java
source/mircoders/media/MediaHandlerRealVideo.java
source/mircoders/media/MediaHelper.java
source/mircoders/media/MediaUploadProcessor.java
source/mircoders/media/URLMediaHandler.java
source/mircoders/module/ModuleArticleType.java
source/mircoders/module/ModuleBreaking.java
source/mircoders/module/ModuleComment.java
source/mircoders/module/ModuleCommentStatus.java
source/mircoders/module/ModuleContent.java
source/mircoders/module/ModuleImages.java
source/mircoders/module/ModuleLanguage.java
source/mircoders/module/ModuleMediaType.java
source/mircoders/module/ModuleMediafolder.java
source/mircoders/module/ModuleMessage.java
source/mircoders/module/ModuleTopics.java
source/mircoders/module/ModuleUploadedMedia.java
source/mircoders/module/ModuleUsers.java
source/mircoders/pdf/PDFGenerator.java
source/mircoders/producer/ContentMarkingProducerNode.java
source/mircoders/producer/ContentModifyingProducerNode.java
source/mircoders/producer/IndexingProducerNode.java
source/mircoders/producer/MediaGeneratingProducerNode.java
source/mircoders/producer/PDFPreFormattingProducerNode.java
source/mircoders/producer/UnIndexingProducerNode.java
source/mircoders/search/ContentSearchTerm.java
source/mircoders/search/ImagesSearchTerm.java
source/mircoders/search/KeywordSearchTerm.java
source/mircoders/search/TextSearchTerm.java
source/mircoders/search/TopicMatrixSearchTerm.java
source/mircoders/search/TopicSearchTerm.java
source/mircoders/search/UnIndexedSearchTerm.java
source/mircoders/search/UnStoredSearchTerm.java
source/mircoders/servlet/ServletHelper.java
source/mircoders/servlet/ServletModuleAbuse.java
source/mircoders/servlet/ServletModuleContent.java
source/mircoders/servlet/ServletModuleUploadedMedia.java
source/mircoders/servlet/ServletModuleUsers.java
source/mircoders/storage/DatabaseArticleType.java
source/mircoders/storage/DatabaseAudio.java
source/mircoders/storage/DatabaseBreaking.java
source/mircoders/storage/DatabaseComment.java
source/mircoders/storage/DatabaseCommentStatus.java
source/mircoders/storage/DatabaseCommentToMedia.java
source/mircoders/storage/DatabaseContent.java
source/mircoders/storage/DatabaseContentToMedia.java
source/mircoders/storage/DatabaseContentToTopics.java
source/mircoders/storage/DatabaseImageColor.java
source/mircoders/storage/DatabaseImageFormat.java
source/mircoders/storage/DatabaseImageLayout.java
source/mircoders/storage/DatabaseImageType.java
source/mircoders/storage/DatabaseImages.java
source/mircoders/storage/DatabaseLanguage.java
source/mircoders/storage/DatabaseMediaType.java
source/mircoders/storage/DatabaseMediafolder.java
source/mircoders/storage/DatabaseMessages.java
source/mircoders/storage/DatabaseOther.java
source/mircoders/storage/DatabaseRights.java
source/mircoders/storage/DatabaseTopics.java
source/mircoders/storage/DatabaseUploadedMedia.java
source/mircoders/storage/DatabaseUsers.java
source/mircoders/storage/DatabaseVideo.java
templates/admin/abuse.filters.template

index 1e0ef2b..a5c7253 100755 (executable)
@@ -1,6 +1,6 @@
 ########## admin ##########
 # language: english
-# $Id: admin_en.properties,v 1.48.2.21 2004/01/11 20:35:50 zapata Exp $
+# $Id: admin_en.properties,v 1.48.2.22 2004/01/18 17:30:55 zapata Exp $
 
 languagename=English
 
@@ -483,6 +483,8 @@ abuse.log.filterexpression=Expression
 abuse.filters = Filters
 abuse.filters.movedown = down
 abuse.filters.moveup = up
+abuse.filters.movebottom = bottom
+abuse.filters.movetop = top
 
 abuse.filter.type = Type
 abuse.filter.expression = Expression
index a2e8b15..d367342 100755 (executable)
@@ -70,7 +70,7 @@ import org.apache.struts.util.MessageResources;
  * Mir.java - main servlet, that dispatches to servletmodules
  *
  * @author $Author: zapata $
- * @version $Id: Mir.java,v 1.49.2.10 2004/01/11 20:35:51 zapata Exp $
+ * @version $Id: Mir.java,v 1.49.2.11 2004/01/18 17:30:56 zapata Exp $
  *
  */
 public class Mir extends AbstractServlet {
@@ -225,7 +225,7 @@ public class Mir extends AbstractServlet {
           }
         }
         else if (moduleName.equals("logout")) {
-          logger.info(userEntity.getValue("login") + " has logged out");
+          logger.info(userEntity.getFieldValue("login") + " has logged out");
           session.invalidate();
           _sendLoginPage(aResponse, aRequest);
           return;
diff --git a/source/mir/entity/AbstractEntity.java b/source/mir/entity/AbstractEntity.java
new file mode 100755 (executable)
index 0000000..925ff8d
--- /dev/null
@@ -0,0 +1,174 @@
+/*
+ * Copyright (C) 2001, 2002 The Mir-coders group
+ *
+ * This file is part of Mir.
+ *
+ * Mir is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Mir is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Mir; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * In addition, as a special exception, The Mir-coders gives permission to link
+ * the code of this program with  any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two.  You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries.  If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
+ */
+package  mir.entity;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import mir.config.MirPropertiesConfiguration;
+import mir.config.MirPropertiesConfiguration.PropertiesConfigExc;
+import mir.log.LoggerWrapper;
+import mir.storage.StorageObject;
+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.1 2004/01/18 17:30:56 zapata Exp $
+ */
+
+public class AbstractEntity implements Entity {
+  protected static MirPropertiesConfiguration configuration;
+
+  protected Map values;
+  protected StorageObject storageObject;
+  protected LoggerWrapper logger;
+
+  static {
+    try {
+      configuration = MirPropertiesConfiguration.instance();
+    }
+    catch (PropertiesConfigExc e) {
+      throw new RuntimeException(e.getMessage());
+    }
+  }
+
+  public AbstractEntity() {
+    logger = new LoggerWrapper("Entity");
+
+    values = new HashMap();
+  }
+
+  /**
+   * Constructor
+   * @param StorageObject The StorageObject of the Entity.
+   */
+
+  public AbstractEntity(StorageObject StorageObject) {
+    this();
+
+    setStorage(StorageObject);
+  }
+
+  public void setStorage(StorageObject storage) {
+    this.storageObject = storage;
+  }
+
+  /** {@inheritDoc} */
+  public void setValues(Map aMap) {
+    if (aMap!=null) {
+      Iterator i = aMap.entrySet().iterator();
+      synchronized(this) {
+        while (i.hasNext()) {
+          Map.Entry entry = (Map.Entry) i.next();
+
+          setFieldValue( (String) entry.getKey(), (String) entry.getValue());
+        }
+      }
+    }
+  }
+
+  /** {@inheritDoc} */
+  public String getId() {
+    return getFieldValue(storageObject.getIdName());
+  }
+
+  /** {@inheritDoc} */
+  public void setId(String id) {
+    setFieldValue(storageObject.getIdName(), id);
+  }
+
+  /** {@inheritDoc} */
+  public String insert() throws StorageObjectExc {
+    logger.debug("Entity: trying to insert ...");
+
+    if (storageObject != null) {
+      return storageObject.insert(this);
+    }
+    else
+      throw new StorageObjectExc("storageObject == null!");
+  }
+
+  /** {@inheritDoc} */
+  public void update() throws StorageObjectFailure {
+    storageObject.update(this);
+  }
+
+  /** {@inheritDoc} */
+  public String getFieldValue(String aFieldName) {
+    String returnValue = null;
+
+    if (aFieldName != null) {
+      returnValue = (String) values.get(aFieldName);
+    }
+    return returnValue;
+  }
+
+  /** {@inheritDoc} */
+  public boolean hasFieldValue(String aFieldName) {
+    return values.containsKey(aFieldName);
+  }
+
+  /**
+   * Sets the value for a field. Issues a log message if the field name
+   * 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
+   */
+  public void setFieldValue(String theProp, String theValue) throws StorageObjectFailure {
+    if (hasField(theProp))
+      values.put(theProp, theValue);
+    else {
+      logger.warn("Entity.setFieldValue: Property not found: " + theProp + " (" + theValue + ")");
+    }
+  }
+
+  /**
+   * Returns the field names of the Entity
+   */
+  public List getFieldNames() throws StorageObjectFailure {
+    return storageObject.getFields();
+  }
+
+  /** 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
+   */
+  public boolean hasField(String fieldName) throws StorageObjectFailure {
+    return getFieldNames().contains(fieldName);
+  }
+}
+
index e2e19c4..adfe2d0 100755 (executable)
@@ -40,61 +40,17 @@ import mir.log.LoggerWrapper;
 import mir.storage.StorageObject;
 import mir.storage.StorageObjectExc;
 import mir.storage.StorageObjectFailure;
-import mir.util.*;
 
 /**
- * Base class the entities are derived from. Provides base functionality of
- * an entity. Entities are used to represent rows of a database table.<p>
- *
- * @version $Id: Entity.java,v 1.21.2.6 2003/12/21 13:32:03 zapata Exp $
- * @author rk
+ * An <code>Entity</code> represents a persistent data object, typically
+ *   stored in a database.<p>
  *
+ * @version $Id: Entity.java,v 1.21.2.7 2004/01/18 17:30:56 zapata Exp $
  */
 
-public class Entity
+public interface Entity
 {
-  protected static MirPropertiesConfiguration configuration;
-
-//  protected Map theValuesHash; // tablekey / value
-  protected Map values;
-  protected StorageObject theStorageObject;
-  protected List streamedInput = null;
-  protected LoggerWrapper logger;
-
-  static {
-    try {
-      configuration = MirPropertiesConfiguration.instance();
-    }
-    catch (PropertiesConfigExc e) {
-      throw new RuntimeException(e.getMessage());
-    }
-  }
-
-  public Entity() {
-    logger = new LoggerWrapper("Entity");
-
-    values = new HashMap();
-  }
-
-  /**
-   * Constructor
-   * @param StorageObject The StorageObject of the Entity.
-   */
-
-  public Entity(StorageObject StorageObject) {
-    this();
-
-    setStorage(StorageObject);
-  }
-
-  /**
-   *
-   * @param storage
-   */
-
-  public void setStorage(StorageObject storage) {
-    this.theStorageObject = storage;
-  }
+  public void setStorage(StorageObject storage);
 
   /**
    * Sets the values of the Entity. (Only to be called by the Storage Object)
@@ -102,175 +58,58 @@ public class Entity
    * @param aMap Map containing the new values of the Entity
    */
 
-  public void setValues(Map aMap) {
-    if (aMap!=null) {
-      Iterator i = aMap.entrySet().iterator();
-      synchronized(this) {
-        while (i.hasNext()) {
-          Map.Entry entry = (Map.Entry) i.next();
-
-          setValueForProperty( (String) entry.getKey(), (String) entry.getValue());
-        }
-      }
-    }
-  }
+  public void setValues(Map aMap);
 
   /**
    * Returns the primary key of the Entity.
    * @return String Id
    */
-  public String getId() {
-    return (String) getValue(theStorageObject.getIdName());
-  }
+  public String getId();
 
   /**
    * Defines the primary key of the Entity (only to be set by the StorageObject)
    * @param id
    */
-  public void setId(String id) {
-    setValueForProperty(theStorageObject.getIdName(), id);
-  }
-
-  /**
-   * Returns the value of a field by field name.
-   * @param field The name of the field
-   * @return value of the field
-   */
-  public String getValue(String field) {
-    String returnValue = null;
-
-    if (field != null) {
-      returnValue = (String) values.get(field);
-    }
-    return returnValue;
-  }
-
-  public boolean hasValueForField(String field) {
-    return values.containsKey(field);
-  }
+  public void setId(String id);
 
   /**
    * Insers Entity into the database via StorageObject
    * @return Primary Key of the Entity
-   * @exception StorageObjectException
+   * @exception StorageObjectExc
    */
-  public String insert() throws StorageObjectExc {
-    logger.debug("Entity: trying to insert ...");
-
-    if (theStorageObject != null) {
-      return theStorageObject.insert(this);
-    }
-    else
-      throw new StorageObjectExc("theStorageObject == null!");
-  }
+  public String insert() throws StorageObjectExc;
 
   /**
    * Saves changes of this Entity to the database
-   * @exception StorageObjectException
+   * @exception StorageObjectFailure
    */
-  public void update() throws StorageObjectFailure {
-    theStorageObject.update(this);
-  }
+  public void update() throws StorageObjectFailure;
 
   /**
    * Sets the value for a field. Issues a log message if the field name
    * 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 StorageObjectException
+   * @exception StorageObjectFailure
    */
-  public void setValueForProperty(String theProp, String theValue) throws StorageObjectFailure {
-    try {
-      if (isField(theProp))
-        values.put(theProp, theValue);
-      else {
-        logger.warn("Entity.setValueForProperty: Property not found: " + theProp + " (" + theValue + ")");
-      }
-    }
-    catch (Throwable t) {
-      logger.error("Entity.setValueForProperty: " + t.toString());
-      t.printStackTrace(logger.asPrintWriter(LoggerWrapper.DEBUG_MESSAGE));
-
-      throw new StorageObjectFailure(t);
-    }
-  }
+  public void setFieldValue(String theProp, String theValue);
 
   /**
-   * Returns the field names of the Entity as ArrayListe.
-   * @return ArrayList with field names
-       * @exception StorageObjectException is throuwn if database access was impossible
+   * Returns the field names of the Entity
    */
-  public List getFields() throws StorageObjectFailure {
-    return theStorageObject.getFields();
-  }
-
-  /**
-   * Returns an int[] with the types of the fields
-   * @return int[] that contains the types of the fields
-   * @exception StorageObjectException
-   */
-  public int[] getTypes() throws StorageObjectFailure {
-    return theStorageObject.getTypes();
-  }
-
-  /**
-   * Returns an ArrayList with field names
-   * @return List with field names
-   * @exception StorageObjectException
-   */
-  public List getLabels() throws StorageObjectFailure {
-    return theStorageObject.getLabels();
-  }
-
+  public List getFieldNames() throws StorageObjectFailure;
 
   /**
-   * Returns an ArrayList with all database fields that can
-   * be evaluated as streamedInput.
-   * Could be automated by the types (blob, etc.)
-   * Until now to be created manually in the inheriting class
-   *
-   *  Liefert einen ArrayList mit allen Datenbankfeldern, die
-   *  als streamedInput ausgelesen werden muessen.
-   *  Waere automatisierbar ueber die types (blob, etc.)
-   *  Bisher manuell anzulegen in der erbenden Klasse
+   * Returns the value of a field by field name.
+   * @param field The name of the field
+   * @return value of the field
    */
+  public String getFieldValue(String field);
 
-  public List streamedInput() {
-    return streamedInput;
-  }
+  public boolean hasFieldValue(String field);
 
   /** 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 StorageObjectException
-   */
-  public boolean isField(String fieldName) throws StorageObjectFailure {
-    return theStorageObject.getFields().contains(fieldName);
-  }
-
-  protected void throwStorageObjectFailure(Throwable e, String wo) throws StorageObjectFailure {
-    logger.error(e.toString() + " function: " + wo);
-    e.printStackTrace(logger.asPrintWriter(LoggerWrapper.DEBUG_MESSAGE));
-
-    throw new StorageObjectFailure("Storage Object Exception in entity", e);
-  }
-
-  /**
-   * Helper method to append a line to a field
    */
-  public void appendLineToField(String aFieldName, String aLine) {
-    StringBuffer fieldContent = new StringBuffer();
-    try {
-      fieldContent.append(StringRoutines.interpretAsString(getValue(aFieldName)));
-    }
-    catch (Throwable t) {
-    }
-    if (fieldContent.length() > 0 && fieldContent.charAt(fieldContent.length() - 1) != '\n') {
-      fieldContent.append('\n');
-    }
-
-    fieldContent.append(aLine);
-    setValueForProperty(aFieldName, fieldContent.toString());
-  }
+  public boolean hasField(String aFieldName) throws StorageObjectFailure;
 }
 
index e3ab6ee..77bc559 100755 (executable)
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
  * In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with  any library licensed under the Apache Software License, 
- * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library 
- * (or with modified versions of the above that use the same license as the above), 
- * and distribute linked combinations including the two.  You must obey the 
- * GNU General Public License in all respects for all of the code used other than 
- * the above mentioned libraries.  If you modify this file, you may extend this 
- * exception to your version of the file, but you are not obligated to do so.  
+ * the code of this program with  any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two.  You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries.  If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
  * If you do not wish to do so, delete this exception statement from your version.
  */
 
@@ -44,7 +44,6 @@ public class EntityBrowser implements RewindableIterator {
   private String whereClause;
   private String orderByClause;
   private int batchSize;
-  private int toFetch;
   private EntityList currentBatch;
 
   private int skip;
@@ -65,7 +64,7 @@ public class EntityBrowser implements RewindableIterator {
     batchSize=aBatchSize;
     skip=aSkip;
     limit=aLimit;
-    
+
     rewind();
   }
 
index 0de6bba..fad20bf 100755 (executable)
@@ -98,7 +98,6 @@ public class EntityList implements StorableObject {
     return whereClause;
   }
 
-
   /**
    * Sets the sorting criterium of this EntityList
    * @param oc
@@ -243,8 +242,8 @@ public class EntityList implements StorableObject {
    */
 
   public Entity elementAt(int i) {
-    /** @todo check if i is in list.size() */
-    return (Entity)theEntityArrayList.get(i);
+    /** todo check if i is in list.size() */
+    return (Entity) theEntityArrayList.get(i);
   }
 
 
index d5632e1..2a9f7b3 100755 (executable)
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
  * In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with  any library licensed under the Apache Software License, 
- * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library 
- * (or with modified versions of the above that use the same license as the above), 
- * and distribute linked combinations including the two.  You must obey the 
- * GNU General Public License in all respects for all of the code used other than 
- * the above mentioned libraries.  If you modify this file, you may extend this 
- * exception to your version of the file, but you are not obligated to do so.  
+ * the code of this program with  any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two.  You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries.  If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
  * If you do not wish to do so, delete this exception statement from your version.
  */
 package mir.entity;
@@ -38,7 +38,7 @@ package mir.entity;
  * @author /rk
  * @version 1.2
  */
-public class GenericEntity extends Entity {}
+public class GenericEntity extends AbstractEntity {}
 
 
 
index 796d560..b955d68 100755 (executable)
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
  * In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with  any library licensed under the Apache Software License, 
- * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library 
- * (or with modified versions of the above that use the same license as the above), 
- * and distribute linked combinations including the two.  You must obey the 
- * GNU General Public License in all respects for all of the code used other than 
- * the above mentioned libraries.  If you modify this file, you may extend this 
- * exception to your version of the file, but you are not obligated to do so.  
+ * the code of this program with  any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two.  You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries.  If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
  * If you do not wish to do so, delete this exception statement from your version.
  */
 package mir.entity;
@@ -47,7 +47,7 @@ import mir.storage.store.StorableObject;
 import mir.storage.store.StoreIdentifier;
 
 
-public class StorableObjectEntity extends Entity
+public class StorableObjectEntity extends AbstractEntity
                implements StorableObject {
 
   /**
@@ -59,8 +59,8 @@ public class StorableObjectEntity extends Entity
    */
   public StoreIdentifier getStoreIdentifier() {
     String id = getId();
-    if ( id!=null && theStorageObject!= null )
-     return new StoreIdentifier(this, id+"@"+theStorageObject.getTableName());
+    if ( id!=null && storageObject!= null )
+     return new StoreIdentifier(this, id+"@"+storageObject.getTableName());
     return null;
   }
 
@@ -72,10 +72,10 @@ public class StorableObjectEntity extends Entity
         return new StoreIdentifier(theEntityClass, id + "@" + theTable);
      }
   }
-  
+
   public static final StoreIdentifier getStoreIdentifier(Database theStorage,
      Class theEntityClass, ResultSet rs) throws SQLException {
-     
+
         String idcol = theStorage.getIdName();
         String idval = rs.getObject(idcol).toString();
 
@@ -83,7 +83,7 @@ public class StorableObjectEntity extends Entity
            return getStoreIdentifier(theEntityClass,
               theStorage.getTableName(), idval);
         }
-     
+
      return null;
   }
 
index 1b21f3e..e223981 100755 (executable)
@@ -55,9 +55,8 @@ public class EntityAdapter implements Map {
   public boolean containsKey(Object aKey) {
     try {
       if (aKey instanceof String)
-        return     entity.hasValueForField((String) aKey)
-                || definition.hasCalculatedField((String) aKey)
-                || entity.getFields().contains(aKey);
+        return     entity.hasField((String) aKey)
+                || definition.hasCalculatedField((String) aKey);
     }
     catch (Throwable t) {
     }
@@ -95,7 +94,7 @@ public class EntityAdapter implements Map {
       return result;
     }
     else if (aKey instanceof String) {
-      return entity.getValue((String) aKey);
+      return entity.getFieldValue((String) aKey);
     }
     else {
       return null;
@@ -146,10 +145,10 @@ public class EntityAdapter implements Map {
     String aWhereClause, String anOrderByClause, String aDefinition) {
     try {
       return
-          new CachingRewindableIterator(          
-            new EntityIteratorAdapter(aMainTablePrefix, someExtraTables, 
+          new CachingRewindableIterator(
+            new EntityIteratorAdapter(aMainTablePrefix, someExtraTables,
                 aWhereClause, anOrderByClause,
-                -1, getModel(), aDefinition, -1, 0)    
+                -1, getModel(), aDefinition, -1, 0)
             );
     }
     catch (Throwable t) {
index 80cb423..571df52 100755 (executable)
@@ -137,7 +137,7 @@ public class EntityAdapterDefinition {
     public Object getValue(EntityAdapter anEntityAdapter) {
 
          Object result = null;
-         String textValue = anEntityAdapter.getEntity().getValue(fieldName);
+         String textValue = anEntityAdapter.getEntity().getFieldValue(fieldName);
          Calendar calendar = GregorianCalendar.getInstance();
          int year;
          int month;
@@ -176,7 +176,7 @@ public class EntityAdapterDefinition {
 
     public Object getValue(EntityAdapter anEntityAdapter) {
       Object result = null;
-      String text = anEntityAdapter.getEntity().getValue(fieldName);
+      String text = anEntityAdapter.getEntity().getFieldValue(fieldName);
 
       if (text!=null) {
         try {
index 49df936..dfa9ae7 100755 (executable)
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
  * In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with  any library licensed under the Apache Software License, 
- * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library 
- * (or with modified versions of the above that use the same license as the above), 
- * and distribute linked combinations including the two.  You must obey the 
- * GNU General Public License in all respects for all of the code used other than 
- * the above mentioned libraries.  If you modify this file, you may extend this 
- * exception to your version of the file, but you are not obligated to do so.  
+ * the code of this program with  any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two.  You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries.  If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
  * If you do not wish to do so, delete this exception statement from your version.
  */
 package mir.entity.adapter;
@@ -59,7 +59,7 @@ public class EntityIteratorAdapter implements RewindableIterator {
     this(new EntityBrowser(aModel.getMappingForName(aDefinitionName).getStorage(), aWhereClause, anOrderByClause, aBatchSize, aLimit, aSkip), aModel, aDefinitionName);
   }
 
-  public EntityIteratorAdapter(String aMainTablePrefix, List someExtraTables, 
+  public EntityIteratorAdapter(String aMainTablePrefix, List someExtraTables,
           String aWhereClause, String anOrderByClause,
           int aBatchSize, EntityAdapterModel aModel, String aDefinitionName,
           int aLimit, int aSkip) throws StorageObjectFailure, EntityAdapterExc {
index aa9b631..f1bba19 100755 (executable)
@@ -30,6 +30,7 @@
 package  mir.module;
 
 import java.util.Map;
+import java.sql.SQLException;
 
 import mir.entity.Entity;
 import mir.entity.EntityList;
@@ -49,10 +50,10 @@ import mir.storage.StorageObject;
  */
 
 public class AbstractModule {
-  protected StorageObject theStorage;
+  protected StorageObject storage;
 
   public void setStorage(StorageObject storage) {
-    this.theStorage = storage;
+    this.storage = storage;
   }
 
   /**
@@ -60,19 +61,14 @@ public class AbstractModule {
    * @return Standard-StorageObject
    */
   public StorageObject getStorageObject () {
-    return theStorage;
+    return storage;
   }
 
-  /**
-   *   Holt eine Entity anhand der Id via StorageObject
-   *   @param String der Entity
-   *   @return Entity
-   */
   public Entity getById (String id) throws ModuleExc, ModuleFailure {
     try {
-      if (theStorage == null)
+      if (storage == null)
         throw  new ModuleExc("AbstractModule.getById: No StorageObject set!");
-      Entity entity = (Entity)theStorage.selectById(id);
+      Entity entity = storage.selectById(id);
 
       if (entity == null)
         throw new ModuleExc("AbstractModule.getById: No object for id = " + id);
@@ -84,59 +80,12 @@ public class AbstractModule {
     }
   }
 
-  /**
-   *   Holt eine EntityListe anhand des WhereClause via StorageObject
-   *   @param String whereclause
-   *   @param offset - ab welchem Datensatz die gematchten Entities zurueckgeliefert werden
-   *   @return EntityList Liste der gematchten Datens?tze
-   */
   public EntityList getByWhereClause (String whereClause, int offset) throws ModuleExc, ModuleFailure {
     try {
-      if (theStorage == null)
+      if (storage == null)
         throw  new ModuleExc("AbstractModule.getByWhereClause: No StorageObject set!");
 
-      return theStorage.selectByWhereClause(whereClause, offset);
-    }
-    catch (Throwable e) {
-      throw new ModuleFailure(e);
-    }
-  }
-
-  /**
-   *   Holt eine EntityListe anhand des WhereClause aus dem StorageObject
-   *   @param String where WhereClause
-   *   @param String order Sortierreihenfolge
-   *   @param offset - ab welchem Datensatz die gematchten Entities zurueckgeliefert werden
-   *   @return EntityList Liste der gematchten Datens?tze
-   */
-  public EntityList getByWhereClause (String where, String order, int offset) throws ModuleExc, ModuleFailure {
-    try {
-      if (theStorage==null)
-        throw new ModuleExc("AbstractModule.getByWhereClause: No StorageObject set!");
-
-      return theStorage.selectByWhereClause(where, order, offset);
-    }
-    catch (Throwable e) {
-      throw new ModuleFailure(e);
-    }
-  }
-  /**
-   *   Executes a where clause on the StorageObject with order criteria
-   *   fetching from offset the number of limit objects
-   *
-   *   @param String where
-   *   @param String order
-   *   @param int offset
-   *   @param int limit
-   *   @return EntityList
-   */
-
-  public EntityList getByWhereClause(String where, String order, int offset, int limit) throws ModuleExc, ModuleFailure   {
-    try {
-      if (theStorage==null)
-        throw new ModuleExc("AbstractModule.getByWhereClause: StorageObject not set!");
-
-      return theStorage.selectByWhereClause(where, order, offset, limit);
+      return storage.selectByWhereClause(whereClause, offset);
     }
     catch (Throwable e) {
       throw new ModuleFailure(e);
@@ -144,19 +93,6 @@ public class AbstractModule {
   }
 
   /**
-   *   Holt eine EntityListe anhand des Wertes aValue von Feld aField aus dem StorageObject
-   *   @param String aField - Feldname im StorageObject
-   *   @param String aValue - Wert in Feld im StorageObject
-   *   @param offset - ab welchem Datensatz die gematchten Entities zurueckgeliefert werden
-   *   @return EntityList Liste der gematchten Datens?tze
-   */
-  public EntityList getByFieldValue (String aField, String aValue, int offset) throws ModuleExc, ModuleFailure {
-    String whereClause;
-    whereClause = aField + " like '%" + aValue + "%'";
-    return getByWhereClause(whereClause, offset);
-  }
-
-  /**
    *    * Standardfunktion, um einen Datensatz via StorageObject einzuf?gen
    * @param theValues Hash mit Spalte/Wert-Paaren
    * @return Id des eingef?gten Objekts
@@ -165,8 +101,8 @@ public class AbstractModule {
    */
   public String add (Map theValues) throws ModuleExc, ModuleFailure {
     try {
-      Entity theEntity = (Entity)theStorage.getEntityClass().newInstance();
-      theEntity.setStorage(theStorage);
+      Entity theEntity = (Entity)storage.getEntityClass().newInstance();
+      theEntity.setStorage(storage);
       theEntity.setValues(theValues);
       return theEntity.insert();
     }
@@ -177,16 +113,11 @@ public class AbstractModule {
 
   /**
    * This function creates an Entity without yet storing it in the database
-   *
-   * @param theValues
-   * @return
-   * @throws ModuleExc
-   * @throws ModuleFailure
    */
   public Entity createNew() throws ModuleExc, ModuleFailure {
     try {
-      Entity result = (Entity)theStorage.getEntityClass().newInstance();
-      result.setStorage(theStorage);
+      Entity result = (Entity)storage.getEntityClass().newInstance();
+      result.setStorage(storage);
 
       return result;
     }
@@ -204,7 +135,7 @@ public class AbstractModule {
    */
   public String set (Map theValues) throws ModuleExc, ModuleFailure {
     try {
-      Entity theEntity = theStorage.selectById((String)theValues.get("id"));
+      Entity theEntity = storage.selectById((String)theValues.get("id"));
       if (theEntity == null)
         throw new ModuleExc("No object found with id " + theValues.get("id"));
       theEntity.setValues(theValues);
@@ -224,7 +155,7 @@ public class AbstractModule {
    */
   public void deleteById (String idParam) throws ModuleExc, ModuleFailure {
     try {
-      theStorage.delete(idParam);
+      storage.delete(idParam);
     }
     catch (Throwable e) {
       throw new ModuleFailure(e);
@@ -236,10 +167,10 @@ public class AbstractModule {
    */
   public int getSize(String where) throws ModuleExc, ModuleFailure {
     try {
-      return theStorage.getSize(where);
+      return storage.getSize(where);
     }
-    catch (Throwable e) {
-      throw new ModuleFailure(e);
+    catch (SQLException e) {
+      throw new ModuleFailure("Can't retrieve number of entities: " + e.toString(), e);
     }
   }
 
index d0c9c4d..ec3e0c7 100755 (executable)
@@ -86,11 +86,11 @@ public class EntityModifyingProducerNode implements ProducerNode {
           Object value = ParameterExpander.evaluateExpression(aValueMap, valueExpression);
 
           if (value instanceof String)
-            entity.setValueForProperty(entityField, (String) value);
+            entity.setFieldValue(entityField, (String) value);
           else if (value instanceof EntityAdapter)
-            entity.setValueForProperty(entityField, ((EntityAdapter) value).getEntity().getId());
+            entity.setFieldValue(entityField, ((EntityAdapter) value).getEntity().getId());
           else if (value instanceof Date) {
-            entity.setValueForProperty(entityField, JDBCStringRoutines.formatDate((Date) value));
+            entity.setFieldValue(entityField, JDBCStringRoutines.formatDate((Date) value));
           }
           else
             aLogger.warn("Can't set value " + value + " for field " + entityField);
index 4b6f120..1d7bf40 100755 (executable)
@@ -279,7 +279,7 @@ public class RSSReader {
     public void endElement(mir.util.xml.SectionHandler aHandler) throws XMLParserExc {
       if (aHandler instanceof PropertyValueSectionHandler) {
         usePropertyValueSectionHandler(resource, (PropertyValueSectionHandler) aHandler, currentTag);
-//        resource.set(makeQualifiedName(currentTag), ( (PropertyValueSectionHandler) aHandler).getValue());
+//        resource.set(makeQualifiedName(currentTag), ( (PropertyValueSectionHandler) aHandler).getFieldValue());
       }
     };
 
index 599af40..38e7583 100755 (executable)
@@ -75,56 +75,33 @@ import com.codestudio.util.SQLManager;
  * Treiber, Host, User und Passwort, ueber den der Zugriff auf die
  * Datenbank erfolgt.
  *
- * @version $Id: Database.java,v 1.44.2.20 2003/11/28 17:21:50 rk Exp $
+ * @version $Id: Database.java,v 1.44.2.21 2004/01/18 17:30:57 zapata Exp $
  * @author rk
  *
  */
 public class Database implements StorageObject {
   private static Class GENERIC_ENTITY_CLASS = mir.entity.StorableObjectEntity.class;
-  private static Class STORABLE_OBJECT_ENTITY_CLASS = mir.entity.StorableObjectEntity.class;
-
-
-  private static Map POPUP_EMPTYLINE = new HashMap();
   protected static final ObjectStore o_store = ObjectStore.getInstance();
   private static final int _millisPerHour = 60 * 60 * 1000;
-  private static final int _millisPerMinute = 60 * 1000;
-
-  static {
-    // always same object saves a little space
-    POPUP_EMPTYLINE.put("key", "");
-    POPUP_EMPTYLINE.put("value", "--");
-  }
 
   protected LoggerWrapper logger;
   protected MirPropertiesConfiguration configuration;
-  protected String theTable;
-  protected String theCoreTable = null;
-  protected String thePKeyName = "id";
-  protected int thePKeyType;
-  protected int thePKeyIndex;
+  protected String mainTable;
+  protected String primaryKeySequence = null;
+  protected String primaryKeyField = "id";
+
   protected boolean evaluatedMetaData = false;
   protected ArrayList metadataFields;
   protected ArrayList metadataLabels;
   protected ArrayList metadataNotNullFields;
   protected int[] metadataTypes;
   protected Class theEntityClass;
-  protected List popupCache = null;
-  protected boolean hasPopupCache = false;
-  protected Map hashCache = null;
   protected boolean hasTimestamp = true;
-  private String database_driver;
-  private String database_url;
   private int defaultLimit;
 
   TimeZone timezone;
   SimpleDateFormat internalDateFormat;
   SimpleDateFormat userInputDateFormat;
-/*
-  private SimpleDateFormat _dateFormatterOut;
-  private SimpleDateFormat _dateFormatterIn;
-  _dateFormatterOut = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-  _dateFormatterIn = new SimpleDateFormat("yyyy-MM-dd HH:mm");
-*/
 
   /**
    * Kontruktor bekommt den Filenamen des Konfigurationsfiles ?bergeben.
@@ -133,8 +110,6 @@ public class Database implements StorageObject {
    * <code>Database.Host</code> und <code>Database.Adaptor</code>
    * ausgelesen und ein Broker f?r die Verbindugen zur Datenbank
    * erzeugt.
-   *
-   * @param   String confFilename Dateiname der Konfigurationsdatei
    */
   public Database() throws StorageObjectFailure {
     try {
@@ -151,7 +126,6 @@ public class Database implements StorageObject {
     userInputDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm");
     userInputDateFormat.setTimeZone(timezone);
 
-
     String theAdaptorName = configuration.getString("Database.Adaptor");
     defaultLimit = Integer.parseInt(configuration.getString("Database.Limit"));
 
@@ -191,7 +165,7 @@ public class Database implements StorageObject {
    * @return Name des Primary-Keys
    */
   public String getIdName() {
-    return thePKeyName;
+    return primaryKeyField;
   }
 
   /**
@@ -200,29 +174,27 @@ public class Database implements StorageObject {
    * @return Name der Tabelle
    */
   public String getTableName() {
-    return theTable;
+    return mainTable;
   }
 
-  /*
-  *   Dient dazu vererbte Tabellen bei objectrelationalen DBMS
-  *   zu speichern, wenn die id einer Tabelle in der parenttabelle verwaltet
-  *   wird.
-  *   @return liefert theCoreTabel als String zurueck, wenn gesetzt, sonst
-  *    the Table
+  /**
+   * Returns the id that was most recently added to the database
    */
-  public String getCoreTable() {
-    if (theCoreTable != null) {
-      return theCoreTable;
-    }
-    else {
-      return theTable;
-    }
+  private String getLatestInsertedId(Connection aConnection) throws SQLException {
+    if (primaryKeySequence==null)
+      primaryKeySequence = mainTable+"_id_seq";
+
+    PreparedStatement statement = aConnection.prepareStatement("select currval('" + primaryKeySequence + "')");
+
+    ResultSet rs = statement.executeQuery();
+    rs.next();
+    return rs.getString(1);
   }
 
   /**
    * Liefert Feldtypen der Felder der Tabelle zurueck (s.a. java.sql.Types)
    * @return int-Array mit den Typen der Felder
-   * @exception StorageObjectException
+   * @exception StorageObjectFailure
    */
   public int[] getTypes() throws StorageObjectFailure {
     if (metadataTypes == null) {
@@ -234,8 +206,6 @@ public class Database implements StorageObject {
 
   /**
    * Liefert eine Liste der Labels der Tabellenfelder
-   * @return ArrayListe mit Labeln
-   * @exception StorageObjectException
    */
   public List getLabels() throws StorageObjectFailure {
     if (metadataLabels == null) {
@@ -248,7 +218,6 @@ public class Database implements StorageObject {
   /**
    * Liefert eine Liste der Felder der Tabelle
    * @return ArrayList mit Feldern
-   * @exception StorageObjectException
    */
   public List getFields() throws StorageObjectFailure {
     if (metadataFields == null) {
@@ -262,7 +231,7 @@ public class Database implements StorageObject {
    *   Gets value out of ResultSet according to type and converts to String
    *   @param rs  ResultSet.
    *   @param aType  a type from java.sql.Types.*
-   *   @param index  index in ResultSet
+   *   @param valueIndex  index in ResultSet
    *   @return returns the value as String. If no conversion is possible
    *                            /unsupported value/ is returned
    */
@@ -293,7 +262,7 @@ public class Database implements StorageObject {
 
           case java.sql.Types.NUMERIC:
 
-            /** @todo Numeric can be float or double depending upon
+            /** todo Numeric can be float or double depending upon
              *  metadata.getScale() / especially with oracle */
             long outl = rs.getLong(valueIndex);
 
@@ -405,7 +374,7 @@ public class Database implements StorageObject {
       String uniqueId = id;
 
       if (theEntityClass.equals(StorableObjectEntity.class)) {
-        uniqueId += ("@" + theTable);
+        uniqueId += ("@" + mainTable);
       }
 
       StoreIdentifier search_sid = new StoreIdentifier(theEntityClass, uniqueId);
@@ -425,9 +394,9 @@ public class Database implements StorageObject {
     try {
       ResultSet rs;
 
-      /** @todo better prepared statement */
+      /** todo better prepared statement */
       String selectSql =
-        "select * from " + theTable + " where " + thePKeyName + "=" + id;
+        "select * from " + mainTable + " where " + primaryKeyField + "=" + id;
       stmt = con.createStatement();
       rs = executeSql(stmt, selectSql);
 
@@ -440,13 +409,13 @@ public class Database implements StorageObject {
           returnEntity = makeEntityFromResultSet(rs);
         }
         else {
-          logger.warn("No data for id: " + id + " in table " + theTable);
+          logger.warn("No data for id: " + id + " in table " + mainTable);
         }
 
         rs.close();
       }
       else {
-        logger.warn("No Data for Id " + id + " in Table " + theTable);
+        logger.warn("No Data for Id " + id + " in Table " + mainTable);
       }
     }
     catch (SQLException sqe) {
@@ -465,7 +434,7 @@ public class Database implements StorageObject {
 
   /**
    * This method makes it possible to make selects across multiple tables
-   * 
+   *
    * @param mainTablePrefix prefix for the mainTable
    * @param extraTables a vector of tables for relational select
    * @param aWhereClause whereClause
@@ -473,7 +442,7 @@ public class Database implements StorageObject {
    * @throws StorageObjectFailure
    */
 
-  public EntityList selectByWhereClauseWithExtraTables(String mainTablePrefix, 
+  public EntityList selectByWhereClauseWithExtraTables(String mainTablePrefix,
                                                List extraTables, String aWhereClause )
    throws StorageObjectFailure {
        return selectByWhereClause( mainTablePrefix, extraTables, aWhereClause, "", 0, defaultLimit);
@@ -481,8 +450,8 @@ public class Database implements StorageObject {
 
   /**
    *   select-Operator um Datensaetze zu bekommen, die key = value erfuellen.
-   *   @param key  Datenbankfeld der Bedingung.
-   *   @param value  Wert die der key anehmen muss.
+   *   @param aField  Datenbankfeld der Bedingung.
+   *   @param aValue  Wert die der key anehmen muss.
    *   @return EntityList mit den gematchten Entities
    */
   public EntityList selectByFieldValue(String aField, String aValue) throws StorageObjectFailure {
@@ -491,8 +460,8 @@ public class Database implements StorageObject {
 
   /**
    *   select-Operator um Datensaetze zu bekommen, die key = value erfuellen.
-   *   @param key  Datenbankfeld der Bedingung.
-   *   @param value  Wert die der key anehmen muss.
+   *   @param aField  Datenbankfeld der Bedingung.
+   *   @param aValue  Wert die der key anehmen muss.
    *   @param offset  Gibt an ab welchem Datensatz angezeigt werden soll.
    *   @return EntityList mit den gematchten Entities
    */
@@ -504,9 +473,9 @@ public class Database implements StorageObject {
    * select-Operator liefert eine EntityListe mit den gematchten Datens?tzen zur?ck.
    * Also offset wird der erste Datensatz genommen.
    *
-   * @param wc where-Clause
+   * @param where where-Clause
    * @return EntityList mit den gematchten Entities
-   * @exception StorageObjectException
+   * @exception StorageObjectFailure
    */
   public EntityList selectByWhereClause(String where) throws StorageObjectFailure {
     return selectByWhereClause(where, 0);
@@ -516,10 +485,10 @@ public class Database implements StorageObject {
    * select-Operator liefert eine EntityListe mit den gematchten Datens?tzen zur?ck.
    * Als maximale Anzahl wird das Limit auf der Konfiguration genommen.
    *
-   * @param wc where-Clause
+   * @param whereClause where-Clause
    * @param offset ab welchem Datensatz.
    * @return EntityList mit den gematchten Entities
-   * @exception StorageObjectException
+   * @exception StorageObjectFailure
    */
   public EntityList selectByWhereClause(String whereClause, int offset) throws StorageObjectFailure {
     return selectByWhereClause(whereClause, null, offset);
@@ -530,10 +499,10 @@ public class Database implements StorageObject {
    * Also offset wird der erste Datensatz genommen.
    * Als maximale Anzahl wird das Limit auf der Konfiguration genommen.
    *
-   * @param wc where-Clause
-   * @param ob orderBy-Clause
+   * @param where where-Clause
+   * @param order orderBy-Clause
    * @return EntityList mit den gematchten Entities
-   * @exception StorageObjectException
+   * @exception StorageObjectFailure
    */
   public EntityList selectByWhereClause(String where, String order) throws StorageObjectFailure {
     return selectByWhereClause(where, order, 0);
@@ -547,11 +516,11 @@ public class Database implements StorageObject {
    * select-Operator liefert eine EntityListe mit den gematchten Datens?tzen zur?ck.
    * Als maximale Anzahl wird das Limit auf der Konfiguration genommen.
    *
-   * @param wc where-Clause
-   * @param ob orderBy-Clause
+   * @param whereClause where-Clause
+   * @param orderBy orderBy-Clause
    * @param offset ab welchem Datensatz
    * @return EntityList mit den gematchten Entities
-   * @exception StorageObjectException
+   * @exception StorageObjectFailure
    */
   public EntityList selectByWhereClause(String whereClause, String orderBy, int offset) throws StorageObjectFailure {
     return selectByWhereClause(whereClause, orderBy, offset, defaultLimit);
@@ -564,11 +533,11 @@ public class Database implements StorageObject {
    * @param offset ab welchem Datensatz
    * @param limit wieviele Datens?tze
    * @return EntityList mit den gematchten Entities
-   * @exception StorageObjectException
+   * @exception StorageObjectFailure
    */
   public EntityList selectByWhereClause(String aWhereClause, String anOrderByClause,
             int offset, int limit) throws StorageObjectFailure {
-    return selectByWhereClause("", null, aWhereClause, anOrderByClause, offset, limit);              
+    return selectByWhereClause("", null, aWhereClause, anOrderByClause, offset, limit);
   }
 
 
@@ -579,35 +548,35 @@ public class Database implements StorageObject {
    * @param offset ab welchem Datensatz
    * @param limit wieviele Datens?tze
    * @return EntityList mit den gematchten Entities
-   * @exception StorageObjectException
+   * @exception StorageObjectFailure
    */
   public EntityList selectByWhereClause(String mainTablePrefix, List extraTables,
       String aWhereClause, String anOrderByClause,
                        int offset, int limit) throws StorageObjectFailure {
-    
+
     // TODO get rid of emtpy Strings in extraTables
     // make extraTables null, if single empty String in it
-    // cause StringUtil.splitString puts in emptyString        
+    // cause StringUtil.splitString puts in emptyString
     if (extraTables != null && ((String)extraTables.get(0)).trim().equals(""))
       {
         logger.debug("+++ made extraTables to null!");
         extraTables=null;
       }
-    
-      String useTable = theTable;
+
+      String useTable = mainTable;
           String selectStar = "*";
           if (mainTablePrefix!=null && mainTablePrefix.trim().length()>0) {
             useTable+=" "+mainTablePrefix;
             selectStar=mainTablePrefix.trim() + ".*";
           }
-    
+
     // check o_store for entitylist
     // only if no relational select
     if (extraTables==null) {
       if (StoreUtil.extendsStorableEntity(theEntityClass)) {
          StoreIdentifier searchSid = new StoreIdentifier(theEntityClass,
                StoreContainerType.STOC_TYPE_ENTITYLIST,
-               StoreUtil.getEntityListUniqueIdentifierFor(theTable, 
+               StoreUtil.getEntityListUniqueIdentifierFor(mainTable,
                 aWhereClause, anOrderByClause, offset, limit));
          EntityList hit = (EntityList) o_store.use(searchSid);
 
@@ -635,17 +604,17 @@ public class Database implements StorageObject {
       new StringBuffer("select count(*) from ").append(useTable);
     StringBuffer selectSql =
       new StringBuffer("select "+selectStar+" from ").append(useTable);
+
     // append extratables, if necessary
     if (extraTables!=null) {
       for (int i=0;i < extraTables.size();i++) {
-        if (!extraTables.get(i).equals("")) {        
+        if (!extraTables.get(i).equals("")) {
           countSql.append( ", " + extraTables.get(i));
           selectSql.append( ", " + extraTables.get(i));
         }
       }
     }
-    
+
     if (aWhereClause != null) {
       selectSql.append(" where ").append(aWhereClause);
       countSql.append(" where ").append(aWhereClause);
@@ -757,7 +726,6 @@ public class Database implements StorageObject {
     Entity returnEntity = null;
 
     try {
-      // ask object store for object @ thePKeyIndex
       if (StoreUtil.extendsStorableEntity(theEntityClass)) {
          StoreIdentifier searchSid = StorableObjectEntity.getStoreIdentifier(this,
                theEntityClass, rs);
@@ -805,7 +773,7 @@ public class Database implements StorageObject {
         returnEntity.setValues(theResultHash);
 
         if (returnEntity instanceof StorableObject) {
-          logger.debug("CACHE: ( in) " + returnEntity.getId() + " :" + theTable);
+          logger.debug("CACHE: ( in) " + returnEntity.getId() + " :" + mainTable);
           o_store.add(((StorableObject) returnEntity).getStoreIdentifier());
         }
       } else {
@@ -853,7 +821,6 @@ public class Database implements StorageObject {
     PreparedStatement pstmt = null;
 
     try {
-      List streamedInput = theEntity.streamedInput();
       StringBuffer f = new StringBuffer();
       StringBuffer v = new StringBuffer();
       String aField;
@@ -864,26 +831,21 @@ public class Database implements StorageObject {
       for (int i = 0; i < getFields().size(); i++) {
         aField = (String) getFields().get(i);
 
-        if (!aField.equals(thePKeyName)) {
+        if (!aField.equals(primaryKeyField)) {
           aValue = null;
 
           // exceptions
-          if (!theEntity.hasValueForField(aField) && (
+          if (!theEntity.hasFieldValue(aField) && (
               aField.equals("webdb_create") ||
               aField.equals("webdb_lastchange"))) {
             aValue = "NOW()";
           }
           else {
-            if ((streamedInput != null) && streamedInput.contains(aField)) {
-              aValue = "?";
-            }
-            else {
-              if (theEntity.hasValueForField(aField)) {
+              if (theEntity.hasFieldValue(aField)) {
                 aValue =
                   "'" +
-                   JDBCStringRoutines.escapeStringLiteral((String) theEntity.getValue(aField)) + "'";
+                   JDBCStringRoutines.escapeStringLiteral(theEntity.getFieldValue(aField)) + "'";
               }
-            }
           }
 
           // wenn Wert gegeben, dann einbauen
@@ -905,7 +867,7 @@ public class Database implements StorageObject {
 
       // insert into db
       StringBuffer sqlBuf =
-        new StringBuffer("insert into ").append(theTable).append("(").append(f)
+        new StringBuffer("insert into ").append(mainTable).append("(").append(f)
                                         .append(") values (").append(v).append(")");
       String sql = sqlBuf.toString();
 
@@ -914,14 +876,6 @@ public class Database implements StorageObject {
       con.setAutoCommit(false);
       pstmt = con.prepareStatement(sql);
 
-      if (streamedInput != null) {
-        for (int i = 0; i < streamedInput.size(); i++) {
-          String inputString =
-            (String) theEntity.getValue((String) streamedInput.get(i));
-          pstmt.setBytes(i + 1, inputString.getBytes());
-        }
-      }
-
       int ret = pstmt.executeUpdate();
 
       if (ret == 0) {
@@ -929,11 +883,9 @@ public class Database implements StorageObject {
         return null;
       }
 
-      pstmt = con.prepareStatement("select currval('" + getCoreTable() + "_id_seq')");
+//      pstmt = con.prepareStatement("select currval('" +  + "_id_seq')");
 
-      ResultSet rs = pstmt.executeQuery();
-      rs.next();
-      returnId = rs.getString(1);
+      returnId = getLatestInsertedId(con);
       theEntity.setId(returnId);
     }
     catch (SQLException sqe) {
@@ -949,7 +901,7 @@ public class Database implements StorageObject {
       freeConnection(con, pstmt);
     }
 
-    /** @todo store entity in o_store */
+    /** todo store entity in o_store */
     return returnId;
   }
 
@@ -962,13 +914,13 @@ public class Database implements StorageObject {
     Connection con = null;
     PreparedStatement pstmt = null;
 
-    /** @todo this is stupid: why do we prepare statement, when we
+    /** todo this is stupid: why do we prepare statement, when we
      *  throw it away afterwards. should be regular statement
      *  update/insert could better be one routine called save()
      *  that chooses to either insert or update depending if we
      *  have a primary key in the entity. i don't know if we
      *  still need the streamed input fields. // rk  */
-    /** @todo extension: check if Entity did change, otherwise we don't need
+    /** todo extension: check if Entity did change, otherwise we don't need
      *  the roundtrip to the database */
     /** invalidating corresponding entitylists in o_store*/
     if (StoreUtil.extendsStorableEntity(theEntityClass)) {
@@ -978,7 +930,6 @@ public class Database implements StorageObject {
       o_store.invalidate(stoc_type);
     }
 
-    List streamedInput = theEntity.streamedInput();
     String id = theEntity.getId();
     String aField;
     StringBuffer fv = new StringBuffer();
@@ -992,11 +943,11 @@ public class Database implements StorageObject {
       aField = (String) metadataFields.get(i);
 
       // only normal cases
-      if (  !(aField.equals(thePKeyName) ||
+      // todo if entity.hasFieldValue returns false, then the value should be stored as null
+      if (!(aField.equals(primaryKeyField) ||
             aField.equals("webdb_create") ||
-            aField.equals("webdb_lastchange") ||
-            ((streamedInput != null) && streamedInput.contains(aField)))) {
-        if (theEntity.hasValueForField(aField)) {
+            aField.equals("webdb_lastchange"))) {
+        if (theEntity.hasFieldValue(aField)) {
           if (firstField == false) {
             fv.append(", ");
           }
@@ -1004,15 +955,15 @@ public class Database implements StorageObject {
             firstField = false;
           }
 
-          fv.append(aField).append("='").append(JDBCStringRoutines.escapeStringLiteral((String) theEntity.getValue(aField))).append("'");
+          fv.append(aField).append("='").append(JDBCStringRoutines.escapeStringLiteral(theEntity.getFieldValue(aField))).append("'");
 
-          //              fv.append(aField).append("='").append(StringUtil.quote((String)theEntity.getValue(aField))).append("'");
+          //              fv.append(aField).append("='").append(StringUtil.quote((String)theEntity.getFieldValue(aField))).append("'");
         }
       }
     }
 
     StringBuffer sql =
-      new StringBuffer("update ").append(theTable).append(" set ").append(fv);
+      new StringBuffer("update ").append(mainTable).append(" set ").append(fv);
 
     // exceptions
     if (metadataFields.contains("webdb_lastchange")) {
@@ -1022,10 +973,10 @@ public class Database implements StorageObject {
     // special case: the webdb_create requires the field in yyyy-mm-dd HH:mm
     // format so anything extra will be ignored. -mh
     if (metadataFields.contains("webdb_create") &&
-        theEntity.hasValueForField("webdb_create")) {
+        theEntity.hasFieldValue("webdb_create")) {
       // minimum of 10 (yyyy-mm-dd)...
-      if (theEntity.getValue("webdb_create").length() >= 10) {
-        String dateString = theEntity.getValue("webdb_create");
+      if (theEntity.getFieldValue("webdb_create").length() >= 10) {
+        String dateString = theEntity.getFieldValue("webdb_create");
 
         // if only 10, then add 00:00 so it doesn't throw a ParseException
         if (dateString.length() == 10) {
@@ -1044,12 +995,6 @@ public class Database implements StorageObject {
       }
     }
 
-    if (streamedInput != null) {
-      for (int i = 0; i < streamedInput.size(); i++) {
-        sql.append(",").append(streamedInput.get(i)).append("=?");
-      }
-    }
-
     sql.append(" where id=").append(id);
     logger.info("UPDATE: " + sql);
 
@@ -1058,14 +1003,6 @@ public class Database implements StorageObject {
       con.setAutoCommit(false);
       pstmt = con.prepareStatement(sql.toString());
 
-      if (streamedInput != null) {
-        for (int i = 0; i < streamedInput.size(); i++) {
-          String inputString =
-            theEntity.getValue((String) streamedInput.get(i));
-          pstmt.setBytes(i + 1, inputString.getBytes());
-        }
-      }
-
       pstmt.executeUpdate();
     }
     catch (SQLException sqe) {
@@ -1096,7 +1033,7 @@ public class Database implements StorageObject {
       String uniqueId = id;
 
       if (theEntityClass.equals(StorableObjectEntity.class)) {
-        uniqueId += ("@" + theTable);
+        uniqueId += ("@" + mainTable);
       }
 
       logger.debug("CACHE: (del) " + id);
@@ -1107,12 +1044,12 @@ public class Database implements StorageObject {
       o_store.invalidate(search_sid);
     }
 
-    /** @todo could be prepared Statement */
+    /** todo could be prepared Statement */
     Statement stmt = null;
     Connection con = null;
     int res = 0;
     String sql =
-      "delete from " + theTable + " where " + thePKeyName + "='" + id + "'";
+      "delete from " + mainTable + " where " + primaryKeyField + "='" + id + "'";
 
     //theLog.printInfo("DELETE " + sql);
     try {
@@ -1146,7 +1083,7 @@ public class Database implements StorageObject {
     Connection con = null;
     int res = 0;
     String sql =
-      "delete from " + theTable + " where " + aWhereClause;
+      "delete from " + mainTable + " where " + aWhereClause;
 
     //theLog.printInfo("DELETE " + sql);
     try {
@@ -1173,20 +1110,14 @@ public class Database implements StorageObject {
     return false;
   }
 
-  /* invalidates the popupCache
-   */
   protected void invalidatePopupCache() {
-    /** @todo  invalidates toooo much */
-    popupCache = null;
-    hashCache = null;
+    /** todo  invalidates toooo much */
   }
 
   /**
    * Diese Methode fuehrt den Sqlstring <i>sql</i> aus und timed im Logfile.
    * @param stmt Statemnt
    * @param sql Sql-String
-   * @return ResultSet
-   * @exception StorageObjectException
    */
   public ResultSet executeSql(Statement stmt, String sql)
                             throws StorageObjectFailure, SQLException {
@@ -1206,7 +1137,7 @@ public class Database implements StorageObject {
     return rs;
   }
 
-  private Map processRow(ResultSet aResultSet) throws StorageObjectFailure, StorageObjectExc {
+  private Map processRow(ResultSet aResultSet) throws StorageObjectFailure {
     try {
       Map result = new HashMap();
       ResultSetMetaData metaData = aResultSet.getMetaData();
@@ -1288,10 +1219,10 @@ public class Database implements StorageObject {
    * returns the number of rows in the table
    */
   public int getSize(String mainTablePrefix, List extraTables, String where) throws SQLException, StorageObjectFailure {
-    
+
     long startTime = System.currentTimeMillis();
-    
-    String useTable = theTable;
+
+    String useTable = mainTable;
     if (mainTablePrefix!=null && mainTablePrefix.trim().length()>0) {
           useTable+=" "+mainTablePrefix;
     }
@@ -1300,7 +1231,7 @@ public class Database implements StorageObject {
         // append extratables, if necessary
       if (extraTables!=null) {
         for (int i=0;i < extraTables.size();i++) {
-          if (!extraTables.get(i).equals("")) {        
+          if (!extraTables.get(i).equals("")) {
             countSql.append( ", " + extraTables.get(i));
           }
         }
@@ -1380,7 +1311,6 @@ public class Database implements StorageObject {
   /**
    * Wertet ResultSetMetaData aus und setzt interne Daten entsprechend
    * @param md ResultSetMetaData
-   * @exception StorageObjectException
    */
   private void evalMetaData(ResultSetMetaData md) throws StorageObjectFailure {
     this.evaluatedMetaData = true;
@@ -1402,9 +1332,7 @@ public class Database implements StorageObject {
         aType = md.getColumnType(i);
         metadataTypes[i - 1] = aType;
 
-        if (aField.equals(thePKeyName)) {
-          thePKeyType = aType;
-          thePKeyIndex = i;
+        if (aField.equals(primaryKeyField)) {
         }
 
         if (md.isNullable(i) == ResultSetMetaData.columnNullable) {
@@ -1424,7 +1352,7 @@ public class Database implements StorageObject {
   private void get_meta_data() throws StorageObjectFailure {
     Connection con = null;
     PreparedStatement pstmt = null;
-    String sql = "select * from " + theTable + " where 0=1";
+    String sql = "select * from " + mainTable + " where 0=1";
 
     try {
       con = getPooledCon();
@@ -1467,8 +1395,7 @@ public class Database implements StorageObject {
   /**
    * Wertet SQLException aus und wirft dannach eine StorageObjectException
    * @param sqe SQLException
-   * @param wo Funktonsname, in der die SQLException geworfen wurde
-   * @exception StorageObjectException
+   * @param aFunction Funktonsname, in der die SQLException geworfen wurde
    */
   protected void throwSQLException(SQLException sqe, String aFunction) throws StorageObjectFailure {
     String state = "";
@@ -1505,8 +1432,8 @@ public class Database implements StorageObject {
   /**
    * Loggt Fehlermeldung mit dem Parameter Message und wirft dannach
    * eine StorageObjectException
-   * @param message Nachricht mit dem Fehler
-   * @exception StorageObjectException
+   * @param aMessage Nachricht mit dem Fehler
+   * @exception StorageObjectFailure
    */
   void throwStorageObjectException(String aMessage) throws StorageObjectFailure {
     logger.error(aMessage);
index 78a9712..62617e2 100755 (executable)
@@ -39,211 +39,78 @@ import java.util.Map;
 import mir.entity.Entity;
 import mir.entity.EntityList;
 
-
 /**
- * Implementiert Interface f?r die Speicherschicht.
- * Bislang gibt es in der Bibliothek nur die M?glichkeit
- * in einer Datenbank zu speichern.
- * @author RK
- * @version        29.6.1999
+ * Interface for low-level database actions.
  */
+
 public interface StorageObject {
-  /**
-   * Dokumentation siehe Database.java
-   * @param id
-   * @return Entity
-   * @exception StorageObjectException
-   */
-  abstract public Entity selectById(String id) throws StorageObjectExc;
+  public Entity selectById(String id) throws StorageObjectExc;
 
-  /**
-   * Dokumentation siehe Database.java
-   * @param aField
-   * @param aValue
-   * @return EntityList
-   * @exception StorageObjectException
-   */
-  abstract public EntityList selectByFieldValue(String aField, String aValue)
-    throws StorageObjectFailure;
+  public EntityList selectByFieldValue(String aField, String aValue) throws StorageObjectFailure;
 
-  /**
-   * Dokumentation siehe Database.java
-   * @param whereClause
-   * @return EntityList
-   * @exception StorageObjectException
-   */
-  abstract public EntityList selectByWhereClause(String whereClause)
-    throws StorageObjectFailure;
+  public EntityList selectByWhereClause(String whereClause) throws StorageObjectFailure;
 
-  /**
-   * Dokumentation siehe Database.java
-   * @param whereClause
-   * @param offset
-   * @return EntityList
-   * @exception StorageObjectException
-   */
-  abstract public EntityList selectByWhereClause(String whereClause, int offset)
-    throws StorageObjectFailure;
+  public EntityList selectByWhereClause(String whereClause, int offset) throws StorageObjectFailure;
 
-  /**
-   * Dokumentation siehe Database.java
-   * @param whereClause
-   * @param orderBy
-   * @param offset
-   * @return EntityList
-   * @exception StorageObjectException
-   */
-  abstract public EntityList selectByWhereClause(String whereClause,
-    String orderBy, int offset) throws StorageObjectFailure;
+  public EntityList selectByWhereClause(String whereClause, String orderBy, int offset) throws StorageObjectFailure;
 
-  /**
-   * Dokumentation siehe Database.java
-   * @param whereClause
-   * @param orderBy
-   * @param offset
-   * @param limit
-   * @return EntityList
-   * @exception StorageObjectException
-   */
-  abstract public EntityList selectByWhereClause(String whereClause,
-    String orderBy, int offset, int limit) throws StorageObjectFailure;
-  
-  abstract public EntityList selectByWhereClause(String mainTablePrefix, List extraTables,
-      String aWhereClause, String anOrderByClause,
-      int offset, int limit) throws StorageObjectFailure;
+  public EntityList selectByWhereClause(String whereClause, String orderBy, int offset, int limit) throws StorageObjectFailure;
 
-  /**
-   * Dokumentation siehe Database.java
-   * @param id
-   * @return boolen
-   * @exception StorageObjectException
-   */
-  abstract public boolean delete(String id) throws StorageObjectFailure;
+  public EntityList selectByWhereClause(String mainTablePrefix, List extraTables, String aWhereClause, String anOrderByClause, int offset, int limit) throws StorageObjectFailure;
+
+  public boolean delete(String id) throws StorageObjectFailure;
 
   /**
    * Deletes entities based on a where clause
-   *
-   * @param aWhereClause
-   * @return
-   * @throws StorageObjectFailure
    */
   public int deleteByWhereClause(String aWhereClause) throws StorageObjectFailure;
 
-  /**
-   * Dokumentation siehe Database.java
-   * @return ArrayList
-   * @exception StorageObjectException
-   */
-  abstract public List getFields() throws StorageObjectFailure;
+  public List getFields() throws StorageObjectFailure;
 
-  /**
-   * Dokumentation siehe Database.java
-   * @return int[]
-   * @exception StorageObjectException
-   */
-  abstract public int[] getTypes() throws StorageObjectFailure;
+  public int[] getTypes() throws StorageObjectFailure;
 
-  /**
-   * Dokumentation siehe Database.java
-   * @return ArrayList
-   * @exception StorageObjectException
-   */
-  abstract public List getLabels() throws StorageObjectFailure;
+  public List getLabels() throws StorageObjectFailure;
 
-  /**
-   * Dokumentation siehe Database.java
-   * @param a
-   * @exception StorageObjectException
-   */
-  abstract public void update(Entity a) throws StorageObjectFailure;
-  
+  public void update(Entity a) throws StorageObjectFailure;
 
-  /**
-   * Dokumentation siehe Database.java
-   * @param a
-   * @return String id
-   * @exception StorageObjectException
-   */
-  abstract public String insert(Entity a) throws StorageObjectFailure;
+  public String insert(Entity a) throws StorageObjectFailure;
 
-  /**
-   * Dokumentation siehe Database.java
-   * @return Class Klasse der Entity
-   */
-  abstract public Class getEntityClass();
+  public Class getEntityClass();
 
-  /**
-   * put your documentation comment here
-   * @return
-   */
-  abstract public String getIdName();
+  public String getIdName();
 
-  /**
-   * Dokumentation siehe Database.java
-   * @return String
-   */
-  abstract public String getTableName();
+  public String getTableName();
 
-  /**
-   * Dokumentation siehe Database.java
-   * @return Connection
-   * @exception StorageObjectException
-   */
-  abstract public Connection getPooledCon() throws StorageObjectFailure;
+  public Connection getPooledCon() throws StorageObjectFailure;
 
-  /**
-   *
-   * @param a
-   * @param sql
-   * @return
-   * @throws StorageObjectFailure
-   * @throws SQLException
-   */
-  abstract public ResultSet executeSql(Statement a, String sql) throws StorageObjectFailure, SQLException;
+  public ResultSet executeSql(Statement a, String sql) throws StorageObjectFailure, SQLException;
 
   /**
-   * Executes 1 sql statement and returns the results as a <code>List</code> of <code>Map</code>s
-   *
-   * @param sql
-   * @return
-   * @throws StorageObjectFailure
-   * @throws StorageObjectExc
+   * Executes 1 sql statement and returns the results as a <code>List</code> of
+   * <code>Map</code>s
    */
-  abstract public List executeFreeSql(String sql, int aLimit) throws StorageObjectFailure, StorageObjectExc;
+  public List executeFreeSql(String sql, int aLimit) throws StorageObjectFailure, StorageObjectExc;
 
   /**
    * Executes 1 sql statement and returns the first result row as a <<code>Map</code>s
    * (<code>null</code> if there wasn't any row)
-   *
-   * @param sql
-   * @return
-   * @throws StorageObjectFailure
-   * @throws StorageObjectExc
    */
-  abstract public Map executeFreeSingleRowSql(String sql) throws StorageObjectFailure, StorageObjectExc ;
+  public Map executeFreeSingleRowSql(String sql) throws StorageObjectFailure, StorageObjectExc ;
 
   /**
    * Executes 1 sql statement and returns the first column of the first result row as a <<code>String</code>s
    * (<code>null</code> if there wasn't any row)
-   *
-   * @param sql
-   * @return
-   * @throws StorageObjectFailure
-   * @throws StorageObjectExc
    */
-  abstract public String executeFreeSingleValueSql(String sql) throws StorageObjectFailure, StorageObjectExc ;
+  public String executeFreeSingleValueSql(String sql) throws StorageObjectFailure, StorageObjectExc ;
 
-  /**
-   * @param con
-   * @param stmt
-   */
-  abstract public void freeConnection(Connection con, Statement stmt) throws StorageObjectFailure;
+  public void freeConnection(Connection con, Statement stmt) throws StorageObjectFailure;
+
+  public int executeUpdate(Statement a, String sql) throws StorageObjectFailure, SQLException;
 
-  abstract public int executeUpdate(Statement a, String sql) throws StorageObjectFailure, SQLException;
+  public int executeUpdate(String sql) throws StorageObjectFailure, SQLException;
 
-  abstract public int executeUpdate(String sql) throws StorageObjectFailure, SQLException;
+  public int getSize(String where) throws SQLException, StorageObjectFailure;
 
-  abstract public int getSize(String where) throws SQLException, StorageObjectFailure;
-  abstract public int getSize(String mainTablePrefix, List extraTables, String where) throws SQLException, StorageObjectFailure;
+  public int getSize(String mainTablePrefix, List extraTables, String where) throws SQLException, StorageObjectFailure;
 
 }
index 4f913c3..8e8bbcb 100755 (executable)
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
  * In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with  any library licensed under the Apache Software License, 
- * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library 
- * (or with modified versions of the above that use the same license as the above), 
- * and distribute linked combinations including the two.  You must obey the 
- * GNU General Public License in all respects for all of the code used other than 
- * the above mentioned libraries.  If you modify this file, you may extend this 
- * exception to your version of the file, but you are not obligated to do so.  
+ * the code of this program with  any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two.  You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries.  If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
  * If you do not wish to do so, delete this exception statement from your version.
  */
 package mir.storage.store;
index 26f8af1..358a5c5 100755 (executable)
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
  * In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with  any library licensed under the Apache Software License, 
- * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library 
- * (or with modified versions of the above that use the same license as the above), 
- * and distribute linked combinations including the two.  You must obey the 
- * GNU General Public License in all respects for all of the code used other than 
- * the above mentioned libraries.  If you modify this file, you may extend this 
- * exception to your version of the file, but you are not obligated to do so.  
+ * the code of this program with  any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two.  You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries.  If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
  * If you do not wish to do so, delete this exception statement from your version.
  */
 package mir.storage.store;
index 378d3d7..917ceb9 100755 (executable)
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
  * In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with  any library licensed under the Apache Software License, 
- * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library 
- * (or with modified versions of the above that use the same license as the above), 
- * and distribute linked combinations including the two.  You must obey the 
- * GNU General Public License in all respects for all of the code used other than 
- * the above mentioned libraries.  If you modify this file, you may extend this 
- * exception to your version of the file, but you are not obligated to do so.  
+ * the code of this program with  any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two.  You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries.  If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
  * If you do not wish to do so, delete this exception statement from your version.
  */
 package mir.storage.store;
@@ -85,7 +85,8 @@ public final class StoreUtil {
         if (superclass != null) {
            if (superclass == StorableObjectEntity.class) {
               return true;
-           } else {
+           }
+           else {
               return extendsStorableEntity(superclass);
            }
         }
diff --git a/source/mir/util/EntityUtility.java b/source/mir/util/EntityUtility.java
new file mode 100755 (executable)
index 0000000..aca1e66
--- /dev/null
@@ -0,0 +1,62 @@
+/*\r
+ * Copyright (C) 2001, 2002 The Mir-coders group\r
+ *\r
+ * This file is part of Mir.\r
+ *\r
+ * Mir is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * Mir is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with Mir; if not, write to the Free Software\r
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
+ *\r
+ * In addition, as a special exception, The Mir-coders gives permission to link\r
+ * the code of this program with  any library licensed under the Apache Software License,\r
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library\r
+ * (or with modified versions of the above that use the same license as the above),\r
+ * and distribute linked combinations including the two.  You must obey the\r
+ * GNU General Public License in all respects for all of the code used other than\r
+ * the above mentioned libraries.  If you modify this file, you may extend this\r
+ * exception to your version of the file, but you are not obligated to do so.\r
+ * If you do not wish to do so, delete this exception statement from your version.\r
+ */\r
+package mir.util;\r
+\r
+import mir.entity.Entity;\r
+\r
+/**\r
+ * Utility methods for entity manipulation\r
+ */\r
+public class EntityUtility {\r
+  /**\r
+   * This class should never get instances\r
+   */\r
+  private EntityUtility() {\r
+\r
+  }\r
+\r
+  /**\r
+   * Helper method to append a line to a field\r
+   */\r
+  public static void appendLineToField(Entity anEntity, String aFieldName, String aLine) {\r
+    StringBuffer fieldContent = new StringBuffer();\r
+    try {\r
+      fieldContent.append(StringRoutines.interpretAsString(anEntity.getFieldValue(aFieldName)));\r
+    }\r
+    catch (Throwable t) {\r
+    }\r
+    if (fieldContent.length() > 0 && fieldContent.charAt(fieldContent.length() - 1) != '\n') {\r
+      fieldContent.append('\n');\r
+    }\r
+\r
+    fieldContent.append(aLine);\r
+    anEntity.setFieldValue(aFieldName, fieldContent.toString());\r
+  }\r
+}\r
index 171e8f8..2dd057b 100755 (executable)
@@ -54,7 +54,6 @@ public class InternetFunctions {
   public static long parseIPAddress(String anIpAddress) throws Exception {
     int[] parts = {0,0,0,0};
     int i;
-    long result;
     List stringParts = StringRoutines.splitString(anIpAddress, ".");
 
     if (stringParts.size()!=4)
index 9f0dc3b..42cece2 100755 (executable)
@@ -122,11 +122,11 @@ public class AccessControl {
     }
 
     public boolean mayAddUsers(EntityUsers aSubject) {
-      return superusers.contains(aSubject.getValue("login"));
+      return superusers.contains(aSubject.getFieldValue("login"));
     }
 
     protected boolean isSuperUser(EntityUsers aUser) {
-      return superusers.contains(aUser.getValue("login"));
+      return superusers.contains(aUser.getFieldValue("login"));
     }
 
     public void assertMayEditUser(EntityUsers aSubject, EntityUsers anObject) throws AuthorizationExc, AuthorizationFailure {
@@ -141,11 +141,11 @@ public class AccessControl {
     }
 
     public boolean mayEditUser(EntityUsers aSubject, EntityUsers anObject) {
-      return superusers.contains(aSubject.getValue("login"));
+      return superusers.contains(aSubject.getFieldValue("login"));
     }
 
     public boolean mayEditUsers(EntityUsers aSubject) {
-      return superusers.contains(aSubject.getValue("login"));
+      return superusers.contains(aSubject.getFieldValue("login"));
     }
 
     public void assertMayDeleteUser(EntityUsers aSubject, EntityUsers anObject) throws AuthorizationExc, AuthorizationFailure {
@@ -159,15 +159,15 @@ public class AccessControl {
     }
 
     public boolean mayDeleteUser(EntityUsers aSubject, EntityUsers anObject) {
-      return superusers.contains(aSubject.getValue("login"));
+      return superusers.contains(aSubject.getFieldValue("login"));
     }
 
     public boolean mayDeleteUsers(EntityUsers aSubject) {
-      return superusers.contains(aSubject.getValue("login"));
+      return superusers.contains(aSubject.getFieldValue("login"));
     }
 
     public boolean mayChangeUserPassword(EntityUsers aSubject, EntityUsers anObject) {
-      return aSubject.getId().equals(anObject.getId()) || superusers.contains(aSubject.getValue("login"));
+      return aSubject.getId().equals(anObject.getId()) || superusers.contains(aSubject.getFieldValue("login"));
     }
 
     public void assertMayChangeUserPassword(EntityUsers aSubject, EntityUsers anObject) throws AuthorizationExc, AuthorizationFailure {
index 9e7046f..b8baf80 100755 (executable)
@@ -32,7 +32,7 @@ package mircoders.entity;
 
 import java.util.Map;
 
-import mir.entity.Entity;
+import mir.entity.AbstractEntity;
 import mir.storage.StorageObject;
 import mir.storage.StorageObjectFailure;
 import mircoders.storage.DatabaseCommentToMedia;
@@ -42,12 +42,11 @@ import mircoders.storage.DatabaseContent;
  * This class maps one line of the comment-table to a java-object.
  *
  * @author $Author: zapata $
- * @version $Revision: 1.16.2.1 $ $Date: 2003/07/29 22:01:59 $
+ * @version $Revision: 1.16.2.2 $ $Date: 2004/01/18 17:30:58 $
  */
 
 
-public class EntityComment extends Entity
-{
+public class EntityComment extends AbstractEntity {
 
   public EntityComment()
   {
@@ -90,14 +89,8 @@ public class EntityComment extends Entity
   public void dettach(String aCommentId,String aMediaId) throws StorageObjectFailure
   {
     if (aMediaId!=null){
-      try{
-        DatabaseCommentToMedia.getInstance().delete(aCommentId, aMediaId);
-      }
-      catch (Exception e){
-        throwStorageObjectFailure(e, "dettach: failed to get instance");
-      }
-
-      DatabaseContent.getInstance().setUnproduced("id="+getValue("to_media"));
+      DatabaseCommentToMedia.getInstance().delete(aCommentId, aMediaId);
+      DatabaseContent.getInstance().setUnproduced("id="+getFieldValue("to_media"));
     }
   }
 
@@ -110,14 +103,8 @@ public class EntityComment extends Entity
   public void attach(String aMediaId) throws StorageObjectFailure
   {
     if (aMediaId!=null) {
-      try{
-        DatabaseCommentToMedia.getInstance().addMedia(getId(), aMediaId);
-      }
-      catch(StorageObjectFailure e){
-        throwStorageObjectFailure(e, "attach: could not get the instance");
-      }
-
-      DatabaseContent.getInstance().setUnproduced("id="+getValue("to_media"));
+      DatabaseCommentToMedia.getInstance().addMedia(getId(), aMediaId);
+      DatabaseContent.getInstance().setUnproduced("id="+getFieldValue("to_media"));
     }
     else {
       logger.error("EntityContent: attach without mid");
index 59ed478..f9c5fdf 100755 (executable)
@@ -35,25 +35,23 @@ import java.sql.SQLException;
 import java.sql.Statement;
 import java.util.Map;
 
-import mir.entity.Entity;
+import mir.entity.AbstractEntity;
 import mir.log.LoggerWrapper;
 import mir.storage.StorageObject;
 import mir.storage.StorageObjectFailure;
-import mir.util.StringRoutines;
 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.4 2003/12/21 13:32:04 zapata Exp $
+ * @version $Id: EntityContent.java,v 1.19.2.5 2004/01/18 17:30:58 zapata Exp $
  * @author mir-coders group
  *
  */
 
 
-public class EntityContent extends Entity
-{
+public class EntityContent extends AbstractEntity {
   // constructors
 
   public EntityContent()
@@ -69,34 +67,30 @@ public class EntityContent extends Entity
     setStorage(theStorage);
   }
 
-  //
-  // methods
-
   /**
    * set is_produced flag for the article
    */
-
   public void setProduced(boolean yesno) throws StorageObjectFailure
   {
     String value = (yesno) ? "1":"0";
-    if (value.equals( getValue("is_produced") )) return;
+    if (value.equals( getFieldValue("is_produced") )) return;
 
     Connection con=null;Statement stmt=null;
     String sql = "update content set is_produced='" + value + "' where id='" + getId()+"'";
     try {
-      con = theStorageObject.getPooledCon();
-      /** @todo should be preparedStatement: faster!! */
+      con = storageObject.getPooledCon();
+      /** todo should be preparedStatement: faster!! */
       stmt = con.createStatement();
-      theStorageObject.executeUpdate(stmt,sql);
+      storageObject.executeUpdate(stmt,sql);
     }
     catch (StorageObjectFailure e) {
-      throwStorageObjectFailure(e, "\n -- set produced failed");
+      throw e;
     }
     catch (SQLException e) {
-      throwStorageObjectFailure(e, "\n -- set produced failed");
+      throw new StorageObjectFailure(e);
     }
     finally {
-      theStorageObject.freeConnection(con,stmt);
+      storageObject.freeConnection(con,stmt);
     }
   }
 
@@ -110,33 +104,20 @@ public class EntityContent extends Entity
   public void dettach(String anArticleId, String aMediaId) throws StorageObjectFailure
   {
     if (aMediaId!=null){
-      try{
-        DatabaseContentToMedia.getInstance().delete(anArticleId, aMediaId);
-      }
-      catch (Exception e){
-        throwStorageObjectFailure(e, "\n -- failed to get instance");
-      }
+      DatabaseContentToMedia.getInstance().delete(anArticleId, aMediaId);
 
       setProduced(false);
     }
   }
 
   /**
-   * Attaches media to an article
-   *
-   * @param mid
-   * @throws StorageObjectFailure
+   * Attaches media to the article
    */
 
   public void attach(String aMediaId) throws StorageObjectFailure
   {
     if (aMediaId!=null) {
-      try{
-        DatabaseContentToMedia.getInstance().addMedia(getId(),aMediaId);
-      }
-      catch(StorageObjectFailure e){
-        throwStorageObjectFailure(e, "attach: could not get the instance");
-      }
+      DatabaseContentToMedia.getInstance().addMedia(getId(),aMediaId);
       setProduced(false);
     }
     else {
index f821483..82be8d5 100755 (executable)
@@ -53,7 +53,7 @@ import org.postgresql.largeobject.LargeObjectManager;
 /**
  *
  * @author RK, mh, mir-coders
- * @version $Id: EntityImages.java,v 1.21.2.3 2003/12/14 16:37:07 zapata Exp $
+ * @version $Id: EntityImages.java,v 1.21.2.4 2004/01/18 17:30:58 zapata Exp $
  */
 
 
@@ -87,13 +87,14 @@ public class EntityImages extends EntityUploadedMedia
     Statement stmt=null;
     BlobInputStream in;
     InputStream img_in = null;
+
     try {
-      con = theStorageObject.getPooledCon();
+      con = storageObject.getPooledCon();
       con.setAutoCommit(false);
       LargeObjectManager lom;
       java.sql.Connection jCon;
       stmt = con.createStatement();
-      ResultSet rs = theStorageObject.executeSql(stmt,
+      ResultSet rs = storageObject.executeSql(stmt,
           "select image_data from images where id="+getId());
       jCon = ((com.codestudio.sql.PoolManConnectionHandle)con)
            .getNativeConnection();
@@ -120,19 +121,21 @@ public class EntityImages extends EntityUploadedMedia
       }
 
       try {
-        theStorageObject.freeConnection(con, stmt);
+        storageObject.freeConnection(con, stmt);
       }
       catch (Throwable e) {
         logger.error("EntityImages.getImage freeing connection failed: " +e.toString());
       }
 
-      throwStorageObjectFailure(t, "EntityImages -- getImage failed: ");
+      throw new StorageObjectFailure(t);
     }
+
     return img_in;
   }
 
   public void setImage(InputStream in, String type) throws StorageObjectFailure {
-
+    // todo: failures should be treated in a better way: exception -> rollback instead
+    //  of commit
     if (in != null) {
 
       Connection con = null;
@@ -146,7 +149,7 @@ public class EntityImages extends EntityUploadedMedia
         FileUtil.write(f, in);
         ImageProcessor processor = new ImageProcessor(f);
 
-        con = theStorageObject.getPooledCon();
+        con = storageObject.getPooledCon();
         con.setAutoCommit(false);
         LargeObjectManager lom;
         java.sql.Connection connection;
@@ -159,8 +162,8 @@ public class EntityImages extends EntityUploadedMedia
         processor.descaleImage(maxImageSize, minDescaleRatio, minDescaleReduction);
         processor.writeScaledData(lobImage.getOutputStream(), type);
         lobImage.close();
-        setValueForProperty("img_height", new Integer(processor.getScaledHeight()).toString());
-        setValueForProperty("img_width", new Integer(processor.getScaledWidth()).toString());
+        setFieldValue("img_height", new Integer(processor.getScaledHeight()).toString());
+        setFieldValue("img_width", new Integer(processor.getScaledWidth()).toString());
 
         int oidIcon = lom.create();
         LargeObject lobIcon = lom.open(oidIcon);
@@ -168,27 +171,39 @@ public class EntityImages extends EntityUploadedMedia
         processor.writeScaledData(lobIcon.getOutputStream(), type);
         lobIcon.close();
 
-        setValueForProperty("icon_height", new Integer(processor.getScaledHeight()).toString());
-        setValueForProperty("icon_width", new Integer(processor.getScaledWidth()).toString());
+        setFieldValue("icon_height", new Integer(processor.getScaledHeight()).toString());
+        setFieldValue("icon_width", new Integer(processor.getScaledWidth()).toString());
 
-        setValueForProperty("image_data", new Integer(oidImage).toString());
-        setValueForProperty("icon_data", new Integer(oidIcon).toString());
+        setFieldValue("image_data", new Integer(oidImage).toString());
+        setFieldValue("icon_data", new Integer(oidIcon).toString());
         update();
       }
       catch (Exception e) {
-        throwStorageObjectFailure(e, "settimage :: setImage failed: ");
+        throw new StorageObjectFailure(e);
       }
       finally {
         try {
           if (con!=null)
             con.setAutoCommit(true);
           // get rid of the temp. file
+        }
+        catch (Throwable e) {
+          logger.error("EntityImages.setImage: unable to reset the connection to auto-commit:" + e.toString());
+        }
+        try {
           f.delete();
-        } catch (SQLException e) {
-          throwStorageObjectFailure(e,"Resetting transaction-mode failed");
         }
-        if (con!=null)
-          theStorageObject.freeConnection(con,pstmt);
+        catch (Throwable t) {
+          logger.error("EntityImages.setImage: unable to delete the temporary file:" + t.toString());
+        }
+
+        try {
+          if (con!=null)
+            storageObject.freeConnection(con,pstmt);
+        }
+        catch (Throwable t) {
+          logger.error("EntityImages.setImage: unable to free the connection:" + t.toString());
+        }
       }
     }
   }
@@ -206,12 +221,12 @@ public class EntityImages extends EntityUploadedMedia
     ImageInputStream img_in=null;
 
     try {
-      con = theStorageObject.getPooledCon();
+      con = storageObject.getPooledCon();
       con.setAutoCommit(false);
       LargeObjectManager lom;
       java.sql.Connection jCon;
       stmt = con.createStatement();
-      ResultSet rs = theStorageObject.executeSql(stmt, "select icon_data from images where id="+getId());
+      ResultSet rs = storageObject.executeSql(stmt, "select icon_data from images where id="+getId());
       jCon = ((com.codestudio.sql.PoolManConnectionHandle)con)
            .getNativeConnection();
       lom = ((org.postgresql.Connection)jCon).getLargeObjectAPI();
@@ -237,13 +252,13 @@ public class EntityImages extends EntityUploadedMedia
         e.printStackTrace(logger.asPrintWriter(LoggerWrapper.DEBUG_MESSAGE));
       }
       try {
-        theStorageObject.freeConnection(con, stmt);
+        storageObject.freeConnection(con, stmt);
       }
       catch (Throwable e) {
        logger.error("EntityImages -- freeing connection failed: " + e.getMessage());
       }
 
-      throwStorageObjectFailure(t, "EntityImages -- getIcon failed:");
+      throw new StorageObjectFailure(t);
     }
 
     return img_in;
@@ -270,7 +285,7 @@ public class EntityImages extends EntityUploadedMedia
       _in.close();
       try {
         _con.setAutoCommit(true);
-        theStorageObject.freeConnection(_con,_stmt);
+        storageObject.freeConnection(_con,_stmt);
       }
       catch (Exception e) {
         throw new IOException("close(): "+e.toString());
index 8c38e50..436cdb0 100755 (executable)
 package mircoders.entity;
 
 import java.sql.SQLException;
-import java.util.List;
 import java.util.Map;
 
+import mir.entity.AbstractEntity;
 import mir.entity.Entity;
 import mir.log.LoggerWrapper;
-import mircoders.media.MediaHelper;
-import mir.media.MediaHandler;
-import mir.misc.NumberUtils;
 import mir.storage.StorageObject;
 import mir.storage.StorageObjectFailure;
 import mircoders.storage.DatabaseUploadedMedia;
@@ -45,11 +42,10 @@ import mircoders.storage.DatabaseUploadedMedia;
 /**
  *
  * @author mh, mir-coders group
- * @version $Id: EntityUploadedMedia.java,v 1.26.2.5 2003/12/21 13:32:04 zapata Exp $
+ * @version $Id: EntityUploadedMedia.java,v 1.26.2.6 2004/01/18 17:30:58 zapata Exp $
  */
 
-
-public class EntityUploadedMedia extends Entity {
+public class EntityUploadedMedia extends AbstractEntity {
   public EntityUploadedMedia() {
     super();
 
@@ -66,11 +62,11 @@ public class EntityUploadedMedia extends Entity {
     super.update();
 
     try {
-      theStorageObject.executeUpdate( "update content set is_produced='0' where exists(select * from content_x_media where content_id=content.id and media_id=" + getId()+")");
-      theStorageObject.executeUpdate( "update content set is_produced='0' where exists(select * from comment_x_media, comment where comment_x_media.comment_id=comment.id and comment.to_media=content.id and comment_x_media.media_id=" + getId()+")");
+      storageObject.executeUpdate( "update content set is_produced='0' where exists(select * from content_x_media where content_id=content.id and media_id=" + getId()+")");
+      storageObject.executeUpdate( "update content set is_produced='0' where exists(select * from comment_x_media, comment where comment_x_media.comment_id=comment.id and comment.to_media=content.id and comment_x_media.media_id=" + getId()+")");
     }
     catch (SQLException e) {
-      throwStorageObjectFailure(e, "EntityUploadedMedia :: update :: failed!! ");
+      throw new StorageObjectFailure(e);
     }
   }
 
@@ -94,7 +90,7 @@ public class EntityUploadedMedia extends Entity {
       ent = DatabaseUploadedMedia.getInstance().getMediaType(this);
     }
     catch (StorageObjectFailure e) {
-      throwStorageObjectFailure(e, "get MediaType failed -- ");
+      throw new StorageObjectFailure(e);
     }
     return ent;
   }
index 8cf339d..ceedeee 100755 (executable)
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
  * In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with  any library licensed under the Apache Software License, 
- * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library 
- * (or with modified versions of the above that use the same license as the above), 
- * and distribute linked combinations including the two.  You must obey the 
- * GNU General Public License in all respects for all of the code used other than 
- * the above mentioned libraries.  If you modify this file, you may extend this 
- * exception to your version of the file, but you are not obligated to do so.  
+ * the code of this program with  any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two.  You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries.  If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
  * If you do not wish to do so, delete this exception statement from your version.
  */
 package mircoders.entity;
 
 import mir.entity.Entity;
+import mir.entity.AbstractEntity;
 import mir.storage.StorageObject;
 
 /**
@@ -40,8 +41,7 @@ import mir.storage.StorageObject;
  */
 
 
-public class EntityUsers extends Entity
-{
+public class EntityUsers extends AbstractEntity {
 
                public EntityUsers()
                {
@@ -57,7 +57,7 @@ public class EntityUsers extends Entity
 
        public boolean isAdmin()
        {
-               String admin=getValue("is_admin");
+               String admin=getFieldValue("is_admin");
                //theLog.printDebugInfo("admin::::"+admin);
                return (admin!=null&&admin.equals("1"))?true:false;
        }
index a0e299e..879fc2c 100755 (executable)
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
  * In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with  any library licensed under the Apache Software License, 
- * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library 
- * (or with modified versions of the above that use the same license as the above), 
- * and distribute linked combinations including the two.  You must obey the 
- * GNU General Public License in all respects for all of the code used other than 
- * the above mentioned libraries.  If you modify this file, you may extend this 
- * exception to your version of the file, but you are not obligated to do so.  
+ * the code of this program with  any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two.  You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries.  If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
  * If you do not wish to do so, delete this exception statement from your version.
  */
 package mircoders.entity;
index 14eb503..19859a3 100755 (executable)
@@ -54,6 +54,7 @@ import mir.session.Request;
 import mir.util.DateTimeFunctions;
 import mir.util.GeneratorFormatAdapters;
 import mir.util.StringRoutines;
+import mir.util.EntityUtility;
 import mircoders.entity.EntityComment;
 import mircoders.entity.EntityContent;
 import mircoders.localizer.MirAdminInterfaceLocalizer;
@@ -185,7 +186,7 @@ public class Abuse {
 
         line.append(" ");
         line.append(filterRule.getType() +" ("+ filterRule.getExpression()+")");
-        aComment.appendLineToField("comment", line.toString());
+        EntityUtility.appendLineToField(aComment, "comment", line.toString());
 
         MirGlobal.performCommentOperation(null, aComment, filterRule.getCommentAction());
         setCookie(aResponse);
@@ -225,7 +226,7 @@ public class Abuse {
 
         line.append(" ");
         line.append(filterRule.getType() +" ("+ filterRule.getExpression()+")");
-        anArticle.appendLineToField("comment", line.toString());
+        EntityUtility.appendLineToField(anArticle, "comment", line.toString());
 
         MirGlobal.performArticleOperation(null, anArticle, filterRule.getArticleAction());
         setCookie(aResponse);
@@ -531,6 +532,14 @@ public class Abuse {
     moveFilter(filterRules, anIdentifier, 1);
   }
 
+  public void moveFilterToTop(String anIdentifier) {
+    setFilterPosition(filterRules, anIdentifier, 0);
+  }
+
+  public void moveFilterToBottom(String anIdentifier) {
+    setFilterPosition(filterRules, anIdentifier, Integer.MAX_VALUE);
+  }
+
   private String addFilter(List aFilters, String aType, String anExpression, String aComments, String aCommentAction, String anArticleAction, Date aLastHit) {
     MirAntiAbuseFilterType type = (MirAntiAbuseFilterType) filterTypes.get(aType);
 
@@ -598,6 +607,26 @@ public class Abuse {
     return null;
   }
 
+  private void setFilterPosition(List aFilters, String anIdentifier, int aPosition) {
+    synchronized (aFilters) {
+      if (aPosition<0)
+        aPosition=0;
+
+      for (int i = 0; i < aFilters.size(); i++) {
+        FilterRule rule = (FilterRule) aFilters.get(i);
+
+        if (rule.getId().equals(anIdentifier)) {
+          aFilters.remove(rule);
+
+          if (aPosition<aFilters.size())
+            aFilters.add(aPosition, rule);
+          else
+            aFilters.add(rule);
+          break;
+        }
+      }
+    }
+  }
   private void moveFilter(List aFilters, String anIdentifier, int aDirection) {
     synchronized (aFilters) {
       for (int i = 0; i < aFilters.size(); i++) {
index 5856cdd..4d328f8 100755 (executable)
@@ -284,7 +284,7 @@ public class MirGlobal {
       if (config().getString("Mir.Admin.LogAdminActivity", "0").equals("1")) {\r
         String user = "unknown (" + aUser.toString() + ")";\r
         if (aUser != null)\r
-          user = aUser.getValue("login");\r
+          user = aUser.getFieldValue("login");\r
         adminUsageLogger.info(user + " | " + anObject + " | " + aDescription);\r
       }\r
     }\r
index 2eaab93..224d980 100755 (executable)
@@ -46,6 +46,7 @@ import mir.log.LoggerWrapper;
 import mir.misc.StringUtil;
 import mir.storage.StorageObjectFailure;
 import mir.util.DateTimeFunctions;
+import mir.util.EntityUtility;
 import mircoders.entity.EntityComment;
 import mircoders.entity.EntityContent;
 import mircoders.global.MirGlobal;
@@ -172,7 +173,7 @@ public class MirBasicAdminInterfaceLocalizer implements MirAdminInterfaceLocaliz
 
             line.append(" ");
             line.append(getName());
-            entity.appendLineToField("comment", line.toString());
+            EntityUtility.appendLineToField(entity, "comment", line.toString());
           }
           catch (Throwable t) {
             logger.error("Error while trying to log an article operation: " + t.toString());
@@ -205,7 +206,7 @@ public class MirBasicAdminInterfaceLocalizer implements MirAdminInterfaceLocaliz
 
     protected void performModification(EntityAdapter aUser, Entity anEntity) throws StorageObjectFailure {
       performModification(aUser, (EntityComment) anEntity);
-      DatabaseContent.getInstance().setUnproduced("id="+anEntity.getValue("to_media"));
+      DatabaseContent.getInstance().setUnproduced("id="+anEntity.getFieldValue("to_media"));
     };
 
     protected abstract boolean isAvailable(EntityComment aComment) throws StorageObjectFailure ;
@@ -223,7 +224,7 @@ public class MirBasicAdminInterfaceLocalizer implements MirAdminInterfaceLocaliz
 
     protected void performModification(EntityAdapter aUser, Entity anEntity) throws StorageObjectFailure {
       performModification(aUser, (EntityContent) anEntity);
-      anEntity.setValueForProperty("is_produced", "0");
+      anEntity.setFieldValue("is_produced", "0");
     };
 
     protected abstract boolean isAvailable(EntityContent anArticle) throws StorageObjectFailure ;
@@ -246,7 +247,7 @@ public class MirBasicAdminInterfaceLocalizer implements MirAdminInterfaceLocaliz
     }
 
     protected void performModification(EntityAdapter aUser, EntityComment aComment) throws StorageObjectFailure {
-      aComment.setValueForProperty(field, value);
+      aComment.setFieldValue(field, value);
     }
   }
 
@@ -271,7 +272,7 @@ public class MirBasicAdminInterfaceLocalizer implements MirAdminInterfaceLocaliz
 
       while (i.hasNext()) {
         Map.Entry entry = (Map.Entry) i.next();
-        aComment.setValueForProperty((String) entry.getKey(), (String) entry.getValue());
+        aComment.setFieldValue((String) entry.getKey(), (String) entry.getValue());
       }
     }
   }
@@ -289,11 +290,11 @@ public class MirBasicAdminInterfaceLocalizer implements MirAdminInterfaceLocaliz
     }
 
     protected boolean isAvailable(EntityComment aComment) {
-      return aComment.getValue(field) == null || !aComment.getValue(field).equals(value);
+      return aComment.getFieldValue(field) == null || !aComment.getFieldValue(field).equals(value);
     }
 
     protected void performModification(EntityAdapter aUser, EntityComment aComment) throws StorageObjectFailure {
-      aComment.setValueForProperty(field, value);
+      aComment.setFieldValue(field, value);
     }
   }
 
@@ -313,7 +314,7 @@ public class MirBasicAdminInterfaceLocalizer implements MirAdminInterfaceLocaliz
     }
 
     protected void performModification(EntityAdapter aUser, EntityContent anArticle) throws StorageObjectFailure {
-      anArticle.setValueForProperty(field, value);
+      anArticle.setFieldValue(field, value);
     }
   }
 
@@ -329,11 +330,11 @@ public class MirBasicAdminInterfaceLocalizer implements MirAdminInterfaceLocaliz
     }
 
     protected boolean isAvailable(EntityContent anArticle) {
-      return anArticle.getValue(field) == null || !anArticle.getValue(field).equals(value);
+      return anArticle.getFieldValue(field) == null || !anArticle.getFieldValue(field).equals(value);
     }
 
     protected void performModification(EntityAdapter aUser, EntityContent anArticle) throws StorageObjectFailure {
-      anArticle.setValueForProperty(field, value);
+      anArticle.setFieldValue(field, value);
     }
   }
 
@@ -354,11 +355,11 @@ public class MirBasicAdminInterfaceLocalizer implements MirAdminInterfaceLocaliz
     }
 
     protected boolean isAvailable(EntityContent anArticle) {
-      return anArticle.getValue(field) != null && oldValues.contains(anArticle.getValue(field));
+      return anArticle.getFieldValue(field) != null && oldValues.contains(anArticle.getFieldValue(field));
     }
 
     protected void performModification(EntityAdapter aUser, EntityContent anArticle) throws StorageObjectFailure {
-      anArticle.setValueForProperty(field, newValue);
+      anArticle.setFieldValue(field, newValue);
     }
   }
 }
index ef148e2..2ab4d57 100755 (executable)
@@ -190,10 +190,10 @@ public class MirBasicAntiAbuseFilterTypes {
             if (selectedFields != null)
               j = selectedFields.iterator();
             else
-              j = anEntity.getFields().iterator();
+              j = anEntity.getFieldNames().iterator();
 
             while (j.hasNext()) {
-              String field = anEntity.getValue( (String) j.next());
+              String field = anEntity.getFieldValue( (String) j.next());
 
               if (exactMatch) {
                 if (field != null && regularExpression.isMatch(field)) {
index 0e0c391..26a5b65 100755 (executable)
@@ -104,15 +104,15 @@ public class MirBasicArticlePostingHandler extends MirBasicPostingSessionHandler
 
   public void finalizeArticle(Request aRequest, Session aSession, EntityContent anArticle) throws SessionExc, SessionFailure {
     try {
-      anArticle.setValueForProperty("is_published", "1");
-      anArticle.setValueForProperty("is_produced", "0");
-      anArticle.setValueForProperty("date", StringUtil.date2webdbDate(new GregorianCalendar()));
-      anArticle.setValueForProperty("is_html", "0");
-      anArticle.setValueForProperty("publish_path", StringUtil.webdbDate2path(anArticle. getValue("date")));
+      anArticle.setFieldValue("is_published", "1");
+      anArticle.setFieldValue("is_produced", "0");
+      anArticle.setFieldValue("date", StringUtil.date2webdbDate(new GregorianCalendar()));
+      anArticle.setFieldValue("is_html", "0");
+      anArticle.setFieldValue("publish_path", StringUtil.webdbDate2path(anArticle. getFieldValue("date")));
 
       ModuleArticleType module = new ModuleArticleType(DatabaseArticleType.getInstance());
-      anArticle.setValueForProperty("to_article_type", module.articleTypeIdForName(configuration.getString("Localizer.OpenSession.article.DefaultArticleType")));
-      anArticle.setValueForProperty("to_publisher", "1");
+      anArticle.setFieldValue("to_article_type", module.articleTypeIdForName(configuration.getString("Localizer.OpenSession.article.DefaultArticleType")));
+      anArticle.setFieldValue("to_publisher", "1");
     }
     catch (Throwable t) {
       throw new SessionFailure(t);
index 3525fcd..8e4cdcb 100755 (executable)
@@ -47,7 +47,7 @@ public class MirBasicChildArticlePostingHandler extends MirBasicArticlePostingHa
   public void finalizeArticle(Request aRequest, Session aSession, EntityContent anArticle) throws SessionExc, SessionFailure {
     super.finalizeArticle(aRequest, aSession, anArticle);
 
-    anArticle.setValueForProperty("to_content", (String) aSession.getAttribute("to_content"));
+    anArticle.setFieldValue("to_content", (String) aSession.getAttribute("to_content"));
   }
 
   protected void initializeSession(Request aRequest, Session aSession) throws SessionExc, SessionFailure {
index 567f31e..fe8a692 100755 (executable)
@@ -109,11 +109,11 @@ public class MirBasicCommentPostingHandler extends MirBasicPostingSessionHandler
 
   public void finalizeComment(Request aRequest, Session aSession, EntityComment aComment) throws SessionExc, SessionFailure {
     try {
-      aComment.setValueForProperty("is_published", "1");
+      aComment.setFieldValue("is_published", "1");
       ModuleCommentStatus module = new ModuleCommentStatus(DatabaseCommentStatus.getInstance());
-      aComment.setValueForProperty("to_comment_status", module.commentStatusIdForName(configuration.getString("Localizer.OpenSession.comment.DefaultCommentStatus")));
-      aComment.setValueForProperty("is_html", "0");
-      aComment.setValueForProperty("to_media", (String) aSession.getAttribute("to_media"));
+      aComment.setFieldValue("to_comment_status", module.commentStatusIdForName(configuration.getString("Localizer.OpenSession.comment.DefaultCommentStatus")));
+      aComment.setFieldValue("is_html", "0");
+      aComment.setFieldValue("to_media", (String) aSession.getAttribute("to_media"));
     }
     catch (Throwable t) {
       throw new SessionFailure(t);
@@ -169,7 +169,7 @@ public class MirBasicCommentPostingHandler extends MirBasicPostingSessionHandler
     catch (Throwable t) {
       throw new SessionFailure(t);
     }
-    DatabaseContent.getInstance().setUnproduced("id=" + comment.getValue("to_media"));
+    DatabaseContent.getInstance().setUnproduced("id=" + comment.getFieldValue("to_media"));
     logger.info("Comment posted");
   };
 
index 937e9c4..e3d2d17 100755 (executable)
@@ -388,7 +388,7 @@ public class MirBasicDataModelLocalizer implements MirDataModelLocalizer {
   protected class ContentToParentField implements EntityAdapterDefinition.CalculatedField {\r
     public Object getValue(EntityAdapter anEntityAdapter) {\r
       try {\r
-        logger.debug("ContentToParentField.getValue");\r
+        logger.debug("ContentToParentField.getFieldValue");\r
         return anEntityAdapter.getToOneRelation(\r
                     "id="+anEntityAdapter.get("to_content"),\r
                     "id",\r
@@ -745,12 +745,8 @@ public class MirBasicDataModelLocalizer implements MirDataModelLocalizer {
       }\r
     }\r
   }\r
+\r
   protected class ContentToUserField implements EntityAdapterDefinition.CalculatedField {\r
-    /**\r
-     *\r
-     * @param aFieldName the source field. will be mapped to the id field in the user\r
-     *    table\r
-     */\r
     private String fieldName;\r
 \r
     public ContentToUserField(String aFieldName) {\r
index 0f76167..69fa6b7 100755 (executable)
@@ -65,7 +65,7 @@ import mir.misc.StringUtil;
  *
  * @see mir.media.MirMediaHandler
  * @author mh <mh@nadir.org>
- * @version $Id: MediaHandlerGeneric.java,v 1.20.2.5 2003/12/14 16:37:07 zapata Exp $
+ * @version $Id: MediaHandlerGeneric.java,v 1.20.2.6 2004/01/18 17:30:58 zapata Exp $
  */
 
 public class MediaHandlerGeneric implements MediaHandler
@@ -91,15 +91,15 @@ public class MediaHandlerGeneric implements MediaHandler
     }
 
     public void store (InputStream in, Entity ent, Entity mediaTypeEnt ) throws MediaExc, MediaFailure {
-      String ext = mediaTypeEnt.getValue("name");
+      String ext = mediaTypeEnt.getFieldValue("name");
       String mediaFname = ent.getId() + "." + ext;
-      String date = ent.getValue("date");
+      String date = ent.getFieldValue("date");
       String datePath = StringUtil.webdbDate2path(date);
       try {
         long size = FileUtil.write(getStoragePath() + File.separator + datePath +
                                    File.separator + mediaFname, in);
-        ent.setValueForProperty("publish_path", datePath + mediaFname);
-        ent.setValueForProperty("size", new Long(size).toString());
+        ent.setFieldValue("publish_path", datePath + mediaFname);
+        ent.setFieldValue("size", new Long(size).toString());
         ent.update();
       }
       catch (Throwable e) {
@@ -112,16 +112,16 @@ public class MediaHandlerGeneric implements MediaHandler
       //check first if the media file exist since produced
       //location is also the storage location
 
-      String date = ent.getValue("date");
+      String date = ent.getFieldValue("date");
       String datePath = StringUtil.webdbDate2path(date);
-      String relPath = datePath+ent.getId()+"."+mediaTypeEnt.getValue("name");
+      String relPath = datePath+ent.getId()+"."+mediaTypeEnt.getFieldValue("name");
       String fname = getStoragePath()+relPath;
       if(! new File(fname).exists())
         throw new MediaExc("error in MirMediaHandler.produce(): " + relPath + " does not exist!");
     }
 
     public InputStream getMedia (Entity ent, Entity mediaTypeEnt) throws MediaExc, MediaFailure {
-      String publishPath = ent.getValue("publish_path");
+      String publishPath = ent.getFieldValue("publish_path");
       String fname = getStoragePath()+publishPath;
       File f = new File(fname);
       if(! f.exists())
@@ -144,7 +144,7 @@ public class MediaHandlerGeneric implements MediaHandler
 
     public String getThumbnailMimeType (Entity aMediaEntity, Entity aMediaType) throws MediaExc, MediaFailure {
       ServletContext servletContext = MirPropertiesConfiguration.getContext();
-      String fileName = aMediaEntity.getId()+"."+aMediaType.getValue("name");
+      String fileName = aMediaEntity.getId()+"."+aMediaType.getFieldValue("name");
 
       return servletContext.getMimeType(fileName);
     };
@@ -188,7 +188,7 @@ public class MediaHandlerGeneric implements MediaHandler
 
     public String getDescr( Entity mediaType)
     {
-      return mediaType.getValue("mime_type");
+      return mediaType.getFieldValue("mime_type");
     }
 
 }
index 38da566..1e4f9fa 100755 (executable)
@@ -59,7 +59,7 @@ import mircoders.entity.EntityImages;
  *
  * @see mir.media.MirMediaHandler
  * @author mh
- * @version $Id: MediaHandlerImages.java,v 1.23.2.3 2003/12/14 16:37:07 zapata Exp $
+ * @version $Id: MediaHandlerImages.java,v 1.23.2.4 2004/01/18 17:30:58 zapata Exp $
  */
 
 
@@ -115,25 +115,25 @@ public abstract class MediaHandlerImages implements MediaHandler
   }
 
   public void produce(Entity ent, Entity mediaTypeEnt) throws MediaExc, MediaFailure {
-    String date = ent.getValue("date");
+    String date = ent.getFieldValue("date");
     String datePath = StringUtil.webdbDate2path(date);
-    String ext = "."+mediaTypeEnt.getValue("name");
+    String ext = "."+mediaTypeEnt.getFieldValue("name");
     String filepath = datePath+ent.getId()+ext;
     String iconFilePath = configuration.getString("Producer.StorageRoot")
                           +getIconStoragePath() + filepath;
     String productionFilePath = getStoragePath() + File.separator + filepath;
 
 
-    if (ent.getValue("icon_data")!= null &&
-        ent.getValue("image_data")!= null) {
+    if (ent.getFieldValue("icon_data")!= null &&
+        ent.getFieldValue("image_data")!= null) {
       // make icon
       try {
         InputStream in = ((EntityImages)ent).getIcon();
         FileUtil.write(iconFilePath, in);
         in = ((EntityImages)ent).getImage();
         FileUtil.write(productionFilePath, in);
-        ent.setValueForProperty("icon_path",getIconStoragePath()+filepath);
-        ent.setValueForProperty("publish_path",filepath);
+        ent.setFieldValue("icon_path",getIconStoragePath()+filepath);
+        ent.setFieldValue("publish_path",filepath);
         ent.update();
       }
       catch (Throwable e) {
index 5df1112..7d90b7f 100755 (executable)
@@ -75,9 +75,9 @@ public class MediaHandlerImagesExtern extends MediaHandlerGeneric
 
   public void produce(Entity anImageEntity, Entity mediaTypeEnt) throws MediaExc, MediaFailure {
     try {
-      String date = anImageEntity.getValue("date");
+      String date = anImageEntity.getFieldValue("date");
       String datePath = StringUtil.webdbDate2path(date);
-      String ext = "." + mediaTypeEnt.getValue("name");
+      String ext = "." + mediaTypeEnt.getFieldValue("name");
       String fileBasePath = datePath + anImageEntity.getId();
       String filePath = fileBasePath + ext;
       String iconPath = getIconStoragePath() + fileBasePath + ".jpg";
@@ -100,14 +100,14 @@ public class MediaHandlerImagesExtern extends MediaHandlerGeneric
         }
         processor.writeScaledData(iconFile, "JPEG");
 
-        anImageEntity.setValueForProperty("img_height", new Integer(processor.getHeight()).toString());
-        anImageEntity.setValueForProperty("img_width", new Integer(processor.getWidth()).toString());
+        anImageEntity.setFieldValue("img_height", new Integer(processor.getHeight()).toString());
+        anImageEntity.setFieldValue("img_width", new Integer(processor.getWidth()).toString());
 
-        anImageEntity.setValueForProperty("icon_height", new Integer(processor.getScaledHeight()).toString());
-        anImageEntity.setValueForProperty("icon_width", new Integer(processor.getScaledWidth()).toString());
+        anImageEntity.setFieldValue("icon_height", new Integer(processor.getScaledHeight()).toString());
+        anImageEntity.setFieldValue("icon_width", new Integer(processor.getScaledWidth()).toString());
 
-        anImageEntity.setValueForProperty("icon_path", iconPath);
-        anImageEntity.setValueForProperty("publish_path", filePath);
+        anImageEntity.setFieldValue("icon_path", iconPath);
+        anImageEntity.setFieldValue("publish_path", filePath);
 
         anImageEntity.update();
 
@@ -125,7 +125,7 @@ public class MediaHandlerImagesExtern extends MediaHandlerGeneric
   public InputStream getIcon(Entity anImageEntity) throws MediaExc, MediaFailure {
     try {
       String filePath =
-          configuration.getString("Producer.StorageRoot") + anImageEntity.getValue("icon_path");
+          configuration.getString("Producer.StorageRoot") + anImageEntity.getFieldValue("icon_path");
 
       logger.info(filePath);
 
index f1dbe8d..ed96887 100755 (executable)
@@ -67,7 +67,7 @@ import mir.misc.StringUtil;
  *
  * @see mir.media.MediaHandler
  * @author mh <mh@nadir.org>
- * @version $Id: MediaHandlerMp3.java,v 1.15.2.3 2003/12/14 16:37:08 zapata Exp $
+ * @version $Id: MediaHandlerMp3.java,v 1.15.2.4 2004/01/18 17:30:59 zapata Exp $
  */
 
 public class MediaHandlerMp3 extends MediaHandlerAudio implements MediaHandler
@@ -83,9 +83,9 @@ public class MediaHandlerMp3 extends MediaHandlerAudio implements MediaHandler
     super.produce(ent, mediaTypeEnt);
 
     String baseName = ent.getId();
-    String date = ent.getValue("date");
+    String date = ent.getFieldValue("date");
     String datePath = StringUtil.webdbDate2path(date);
-    String mp3Pointer = getPublishHost() + ent.getValue("publish_path");
+    String mp3Pointer = getPublishHost() + ent.getFieldValue("publish_path");
     String mpegURLFile = baseName + ".m3u";
     String playlistFile = baseName + ".pls";
 
@@ -108,24 +108,24 @@ public class MediaHandlerMp3 extends MediaHandlerAudio implements MediaHandler
   public List getURL(Entity ent, Entity mediaTypeEnt) {
     List theList = new Vector();
 
-    //String stringSize = ent.getValue("size");
+    //String stringSize = ent.getFieldValue("size");
     //int size = Integer.parseInt(stringSize, 10)/1024;
     theList.add(ent);
 
-    String basePath = StringUtil.regexpReplace(ent.getValue("publish_path"),
+    String basePath = StringUtil.regexpReplace(ent.getFieldValue("publish_path"),
                                                ".mp3$", "");
 
     // @todo the texts ("title") below urgently need to be sanely localizaeble
     // somehow
     Map m3uHash = new HashMap();
     m3uHash.put("publish_path", basePath + ".m3u");
-    m3uHash.put("publish_server", ent.getValue("publish_server"));
+    m3uHash.put("publish_server", ent.getFieldValue("publish_server"));
     m3uHash.put("title", "stream URL");
     theList.add(m3uHash);
 
     Map plsHash = new HashMap();
     plsHash.put("publish_path", basePath + ".pls");
-    plsHash.put("publish_server", ent.getValue("publish_server"));
+    plsHash.put("publish_server", ent.getFieldValue("publish_server"));
     plsHash.put("title", "playlist URL");
     theList.add(plsHash);
 
index f3c537f..d518f8b 100755 (executable)
@@ -83,9 +83,9 @@ public class MediaHandlerOgg extends MediaHandlerAudio implements MediaHandler
     super.produce(ent, mediaTypeEnt);
 
     String baseName = ent.getId();
-    String date = ent.getValue("date");
+    String date = ent.getFieldValue("date");
     String datePath = StringUtil.webdbDate2path(date);
-    String oggPointer = getPublishHost() + ent.getValue("publish_path");
+    String oggPointer = getPublishHost() + ent.getFieldValue("publish_path");
     //String mpegURLFile = baseName + ".m3u";
     String playlistFile = baseName + ".pls";
 
@@ -109,11 +109,11 @@ public class MediaHandlerOgg extends MediaHandlerAudio implements MediaHandler
   public List getURL(Entity ent, Entity mediaTypeEnt) {
     List theList = new Vector();
 
-    //String stringSize = ent.getValue("size");
+    //String stringSize = ent.getFieldValue("size");
     //int size = Integer.parseInt(stringSize, 10)/1024;
     theList.add(ent);
 
-    String basePath = StringUtil.regexpReplace(ent.getValue("publish_path"),
+    String basePath = StringUtil.regexpReplace(ent.getFieldValue("publish_path"),
                                                ".ogg$", "");
 
     // @todo the texts ("title") below urgently need to be sanely localizaeble
@@ -121,13 +121,13 @@ public class MediaHandlerOgg extends MediaHandlerAudio implements MediaHandler
     //no .m3u!
     //Map m3uHash = new HashMap();
     //m3uHash.put("publish_path", basePath + ".m3u");
-    //m3uHash.put("publish_server", ent.getValue("publish_server"));
+    //m3uHash.put("publish_server", ent.getFieldValue("publish_server"));
     //m3uHash.put("title", "stream URL");
     //theList.add(m3uHash);
 
     Map plsHash = new HashMap();
     plsHash.put("publish_path", basePath + ".pls");
-    plsHash.put("publish_server", ent.getValue("publish_server"));
+    plsHash.put("publish_server", ent.getFieldValue("publish_server"));
     plsHash.put("title", "playlist URL");
     theList.add(plsHash);
 
index dca1bf1..7e0ce64 100755 (executable)
@@ -53,7 +53,7 @@ import mir.misc.StringUtil;
  * @see mir.media.MediaHandlerGeneric
  * @see mir.media.MediaHandler
  * @author john <john@manifestor.org>, mh <heckmann@hbe.ca>
- * @version $Id: MediaHandlerRealAudio.java,v 1.19.2.3 2003/12/21 13:32:05 zapata Exp $
+ * @version $Id: MediaHandlerRealAudio.java,v 1.19.2.4 2004/01/18 17:30:59 zapata Exp $
  */
 
 
@@ -69,12 +69,12 @@ public class MediaHandlerRealAudio extends MediaHandlerAudio implements MediaHan
     super.produce(ent, mediaTypeEnt);
 
     String baseName = ent.getId();
-    String date = ent.getValue("date");
+    String date = ent.getFieldValue("date");
     String datePath = StringUtil.webdbDate2path(date);
     String rtspDir = configuration.getString("Producer.RealMedia.Path");
     String rtspMediaHost = configuration.getString("Producer.RealMedia.Host");
 
-    String RealMediaPointer = rtspMediaHost+ent.getValue("publish_path");
+    String RealMediaPointer = rtspMediaHost+ent.getFieldValue("publish_path");
     String RealMediaFile = datePath+ent.getId()+".ram";
     try {
       //write an rm (ram?. -mh) file
@@ -91,11 +91,11 @@ public class MediaHandlerRealAudio extends MediaHandlerAudio implements MediaHan
   {
     List theList = new Vector();
 
-    //String stringSize = ent.getValue("size");
+    //String stringSize = ent.getFieldValue("size");
     //int size = Integer.parseInt(stringSize, 10)/1024;
     theList.add(ent);
 
-    String basePath=StringUtil.regexpReplace(ent.getValue("publish_path"),
+    String basePath=StringUtil.regexpReplace(ent.getFieldValue("publish_path"),
                                             ".ra$","");
 
     // @todo the texts ("title") below urgently need to be sanely localizaeble
index 1d1b5ef..849461c 100755 (executable)
@@ -54,7 +54,7 @@ import mir.misc.StringUtil;
  * @see mir.media.MediaHandlerGeneric
  * @see mir.media.MediaHandler
  * @author john <john@manifestor.org>, mh <mh@nadir.org>
- * @version $Id: MediaHandlerRealVideo.java,v 1.19.2.3 2003/12/14 16:37:08 zapata Exp $
+ * @version $Id: MediaHandlerRealVideo.java,v 1.19.2.4 2004/01/18 17:30:59 zapata Exp $
  */
 
 
@@ -70,12 +70,12 @@ public class MediaHandlerRealVideo extends MediaHandlerVideo implements MediaHan
     super.produce(ent, mediaTypeEnt);
 
     String baseName = ent.getId();
-    String date = ent.getValue("date");
+    String date = ent.getFieldValue("date");
     String datePath = StringUtil.webdbDate2path(date);
     String rtspDir = configuration.getString("Producer.RealMedia.Path");
     String rtspMediaHost = configuration.getString("Producer.RealMedia.Host");
 
-    String RealMediaPointer = rtspMediaHost+ent.getValue("publish_path");
+    String RealMediaPointer = rtspMediaHost+ent.getFieldValue("publish_path");
     String RealMediaFile = datePath+ent.getId()+".ram";
     try {
       //write an rm (ram?. -mh) file
@@ -92,11 +92,11 @@ public class MediaHandlerRealVideo extends MediaHandlerVideo implements MediaHan
   public List getURL(Entity ent, Entity mediaTypeEnt) {
     List theList = new Vector();
 
-    //String stringSize = ent.getValue("size");
+    //String stringSize = ent.getFieldValue("size");
     //int size = Integer.parseInt(stringSize, 10)/1024;
     theList.add(ent);
 
-    String basePath=StringUtil.regexpReplace(ent.getValue("publish_path"),
+    String basePath=StringUtil.regexpReplace(ent.getFieldValue("publish_path"),
                                             ".rm$","");
 
     // @todo the texts ("title") below urgently need to be sanely localizaeble
index 71bdd49..bad3d16 100755 (executable)
@@ -57,7 +57,7 @@ public final class MediaHelper {
   }
 
   public static MediaHandler getHandler(Entity aMediaType) throws MediaExc, MediaFailure {
-    String handlerName = aMediaType.getValue("classname");
+    String handlerName = aMediaType.getFieldValue("classname");
 
     try {
       return MirGlobal.localizer().media().getHandler(handlerName);
index cd2220c..e7d2eb7 100755 (executable)
@@ -73,7 +73,7 @@ public class MediaUploadProcessor {
 
       try {
         mediaHandler = MediaHelper.getHandler(mediaType);
-        mediaStorage = MediaHelper.getStorage(mediaType, mediaType.getValue("tablename"));
+        mediaStorage = MediaHelper.getStorage(mediaType, mediaType.getFieldValue("tablename"));
       }
       catch (Throwable e) {
         throw new MediaFailure(e);
index 55b8602..6603d1c 100755 (executable)
@@ -46,7 +46,7 @@ public class URLMediaHandler implements MediaHandler {
 
   public List getURL(Entity aMediaEntity, Entity aMediaTypeEntity) throws MediaExc, MediaFailure {
     List result = new ArrayList();
-    result.add(aMediaTypeEntity.getValue("publish_server")+aMediaTypeEntity.getValue("publish_path"));
+    result.add(aMediaTypeEntity.getFieldValue("publish_server")+aMediaTypeEntity.getFieldValue("publish_path"));
 
     return result;
   }
index 85b1a1a..8a12767 100755 (executable)
@@ -44,12 +44,12 @@ public class ModuleArticleType extends AbstractModule {
     if (theStorage == null)
       logger.warn("ModuleArticleType -- StorageObject was null!");
 
-    this.theStorage = theStorage;
+    this.storage = theStorage;
   }
 
   public String articleTypeIdForName(String aName) throws ModuleExc, ModuleFailure {
     try {
-      return theStorage.executeFreeSingleValueSql("select id from article_type where name = '" + JDBCStringRoutines.escapeStringLiteral(aName) + "'");
+      return storage.executeFreeSingleValueSql("select id from article_type where name = '" + JDBCStringRoutines.escapeStringLiteral(aName) + "'");
     }
     catch (Throwable t) {
       throw new ModuleFailure(t);
index ff7bcde..16dba4c 100755 (executable)
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
  * In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with  any library licensed under the Apache Software License, 
- * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library 
- * (or with modified versions of the above that use the same license as the above), 
- * and distribute linked combinations including the two.  You must obey the 
- * GNU General Public License in all respects for all of the code used other than 
- * the above mentioned libraries.  If you modify this file, you may extend this 
- * exception to your version of the file, but you are not obligated to do so.  
+ * the code of this program with  any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two.  You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries.  If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
  * If you do not wish to do so, delete this exception statement from your version.
  */
 package mircoders.module;
 
-import mir.entity.EntityList;
 import mir.log.LoggerWrapper;
 import mir.module.AbstractModule;
 import mir.storage.StorageObject;
@@ -50,18 +49,8 @@ public class ModuleBreaking extends AbstractModule
   public ModuleBreaking (StorageObject theStorage)
   {
     if (theStorage == null) logger.warn("ModuleBreaking -- StorageObject was null!");
-    this.theStorage = theStorage;
+    this.storage = theStorage;
   }
 
 // Methoden
-  public EntityList getBreakingNews() {
-    EntityList returnList = null;
-    try {
-      returnList = getByWhereClause(null,"webdb_create desc",0,5);
-    }
-    catch (Exception ex) {
-      logger.error("--getBreakingNews(): could not fetch Breaking News" + ex.toString());
-    }
-    return returnList;
-  }
 }
index 7e52745..efef4cc 100755 (executable)
@@ -53,14 +53,14 @@ public class ModuleComment extends AbstractModule
   public ModuleComment(StorageObject theStorage)
   {
     if (theStorage == null) logger.warn("StorageObject was null!");
-    this.theStorage = theStorage;
+    this.storage = theStorage;
   }
 
   public void deleteById (String anId) throws ModuleExc, ModuleFailure {
     try {
-      Entity theEntity = theStorage.selectById((String)anId);
+      Entity theEntity = storage.selectById((String)anId);
       if (theEntity != null)
-        DatabaseContent.getInstance().setUnproduced("id=" + theEntity.getValue("to_media"));
+        DatabaseContent.getInstance().setUnproduced("id=" + theEntity.getFieldValue("to_media"));
 
       super.deleteById(anId);
     }
@@ -79,10 +79,10 @@ public class ModuleComment extends AbstractModule
 
   public String set(Map theValues) throws ModuleExc, ModuleFailure {
     try {
-      Entity theEntity = theStorage.selectById((String)theValues.get("id"));
+      Entity theEntity = storage.selectById((String)theValues.get("id"));
       if (theEntity == null)
          throw new ModuleExc("No Object in the database with id " + theValues.get("id"));
-      DatabaseContent.getInstance().setUnproduced("id=" + theEntity.getValue("to_media"));
+      DatabaseContent.getInstance().setUnproduced("id=" + theEntity.getFieldValue("to_media"));
       theEntity.setValues(theValues);
       theEntity.update();
       return theEntity.getId();
index 43b1c09..f0d9a98 100755 (executable)
@@ -43,12 +43,12 @@ public class ModuleCommentStatus extends AbstractModule {
     if (theStorage == null)
       logger.warn("ModuleCommentStatus -- StorageObject was null!");
 
-    this.theStorage = theStorage;
+    this.storage = theStorage;
   }
 
   public String commentStatusIdForName(String aName) throws ModuleExc, ModuleFailure {
     try {
-      return theStorage.executeFreeSingleValueSql("select id from comment_status where name = '" + JDBCStringRoutines.escapeStringLiteral(aName) + "'");
+      return storage.executeFreeSingleValueSql("select id from comment_status where name = '" + JDBCStringRoutines.escapeStringLiteral(aName) + "'");
     }
     catch (Throwable t) {
       throw new ModuleFailure(t);
index ae16645..7ba9082 100755 (executable)
@@ -55,7 +55,7 @@ public class ModuleContent extends AbstractModule
   }
 
   public ModuleContent(StorageObject aStorage) {
-    theStorage = aStorage;
+    storage = aStorage;
   }
 
   public void expireArticleLock(String anId, String aUserId) {
@@ -82,7 +82,7 @@ public class ModuleContent extends AbstractModule
       if (!aForce)
         query = query + " and to_locking_user is null";
 
-      return theStorage.executeUpdate(query) > 0;
+      return storage.executeUpdate(query) > 0;
     }
     catch (Throwable t) {
       return false;
@@ -107,7 +107,7 @@ public class ModuleContent extends AbstractModule
       if (!aForce)
         query = query + " and to_locking_user = "+JDBCStringRoutines.escapeStringLiteral(aUserId);
 
-      return theStorage.executeUpdate(query) > 0;
+      return storage.executeUpdate(query) > 0;
     }
     catch (Throwable t) {
       return false;
@@ -122,7 +122,7 @@ public class ModuleContent extends AbstractModule
    */
   public String queryArticleLock(String anId)  {
     try {
-      String result = theStorage.executeFreeSingleValueSql("select to_locking_user from content where id = " + JDBCStringRoutines.escapeStringLiteral(anId));
+      String result = storage.executeFreeSingleValueSql("select to_locking_user from content where id = " + JDBCStringRoutines.escapeStringLiteral(anId));
 
       if (result!=null && !MirGlobal.isUserLoggedIn(result)) {
         expireArticleLock(anId, result);
index b20d989..eaef33f 100755 (executable)
@@ -39,6 +39,6 @@ public class ModuleImages extends AbstractModule {
   public ModuleImages(StorageObject theStorage) {
     if (theStorage == null)
       logger.warn("ModuleImages: StorageObject was null!");
-    this.theStorage = theStorage;
+    this.storage = theStorage;
   }
 }
index b78444b..e33de75 100755 (executable)
@@ -52,12 +52,12 @@ public class ModuleLanguage extends AbstractModule {
     if (theStorage == null)
       logger.warn("ModuleLanguage -- StorageObject was null!");
 
-    this.theStorage = theStorage;
+    this.storage = theStorage;
   }
 
   public String languageIdForCode(String aCode) throws ModuleExc, ModuleFailure {
     try {
-      return theStorage.executeFreeSingleValueSql("select id from language where code = '" + JDBCStringRoutines.escapeStringLiteral(aCode) + "'");
+      return storage.executeFreeSingleValueSql("select id from language where code = '" + JDBCStringRoutines.escapeStringLiteral(aCode) + "'");
     }
     catch (Throwable t) {
       throw new ModuleFailure(t);
index b6d5dad..8a75c37 100755 (executable)
@@ -51,7 +51,7 @@ public class ModuleMediaType extends AbstractModule {
   }
 
   public ModuleMediaType(StorageObject aStorage) {
-    this.theStorage = aStorage;
+    this.storage = aStorage;
   }
 
   public Entity findMediaTypeForMimeType(String aMimeType) throws ModuleExc, ModuleFailure {
index 287338c..fe97a7e 100755 (executable)
@@ -55,11 +55,11 @@ public class ModuleMediafolder extends AbstractModule
     if (aStorage == null)
       logger.warn("ModuleMediafolder: StorageObject was null!");
 
-    theStorage = aStorage;
+    storage = aStorage;
   }
   public String mediaFolderIdForName(String aName) throws ModuleExc, ModuleFailure {
     try {
-      return theStorage.executeFreeSingleValueSql("select id from media_folder where name = '" + JDBCStringRoutines.escapeStringLiteral(aName) + "'");
+      return storage.executeFreeSingleValueSql("select id from media_folder where name = '" + JDBCStringRoutines.escapeStringLiteral(aName) + "'");
     }
     catch (Throwable t) {
       throw new ModuleFailure(t);
index bd04bd2..79def2b 100755 (executable)
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
  * In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with  any library licensed under the Apache Software License, 
- * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library 
- * (or with modified versions of the above that use the same license as the above), 
- * and distribute linked combinations including the two.  You must obey the 
- * GNU General Public License in all respects for all of the code used other than 
- * the above mentioned libraries.  If you modify this file, you may extend this 
- * exception to your version of the file, but you are not obligated to do so.  
+ * the code of this program with  any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two.  You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries.  If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
  * If you do not wish to do so, delete this exception statement from your version.
  */
 package mircoders.module;
@@ -51,6 +51,6 @@ public class ModuleMessage extends AbstractModule
   {
     if (theStorage == null) logger.warn("ModuleMessage -- StorageObject was null!");
 
-    this.theStorage = theStorage;
+    this.storage = theStorage;
   }
 }
\ No newline at end of file
index e52a7c6..85d9990 100755 (executable)
@@ -32,7 +32,6 @@ package mircoders.module;
 import java.util.Map;
 
 import mir.entity.Entity;
-import mir.entity.EntityList;
 import mir.log.LoggerWrapper;
 import mir.module.AbstractModule;
 import mir.module.ModuleExc;
@@ -44,36 +43,19 @@ public class ModuleTopics extends AbstractModule {
   static LoggerWrapper logger = new LoggerWrapper("Module.Topics");
 
   public ModuleTopics(StorageObject theStorage) {
-    this.theStorage = theStorage;
-  }
-
-  /**
-   *  Method getTopicList
-   *
-   *  @return SimpleList of all Topics sorted by title
-   *
-   */
-  public EntityList getTopicsList() throws ModuleExc, ModuleFailure {
-    try {
-      return getByWhereClause("", "title", -1);
-    }
-    catch (Throwable e) {
-      logger.error("ModuleTopics.getTopicsList: topics could not be fetched: " + e.getMessage());
-
-      throw new ModuleFailure("ModuleTopics.getTopicsList: topics could not be fetched: " + e.getMessage(), e);
-    }
+    this.storage = theStorage;
   }
 
   /**
    * Overrides the AbstractModule.set(),
    * All dependent ContentEntities are set unproduced.
+   *
    * @param theValues Hash mit Spalte/Wert-Paaren
    * @return Id des eingef?gten Objekts
-   * @exception ModuleException
    */
   public String set(Map theValues) throws ModuleExc, ModuleFailure {
     try {
-      Entity theEntity = theStorage.selectById((String) theValues.get("id"));
+      Entity theEntity = storage.selectById((String) theValues.get("id"));
       if (theEntity == null) {
         throw new ModuleExc("No topic with id  " + theValues.get("id") + " found");
       }
index 95a3fee..8eaf59f 100755 (executable)
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
  * In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with  any library licensed under the Apache Software License, 
- * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library 
- * (or with modified versions of the above that use the same license as the above), 
- * and distribute linked combinations including the two.  You must obey the 
- * GNU General Public License in all respects for all of the code used other than 
- * the above mentioned libraries.  If you modify this file, you may extend this 
- * exception to your version of the file, but you are not obligated to do so.  
+ * the code of this program with  any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two.  You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries.  If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
  * If you do not wish to do so, delete this exception statement from your version.
  */
 
@@ -49,6 +49,6 @@ public class ModuleUploadedMedia extends AbstractModule
   static LoggerWrapper logger = new LoggerWrapper("Module.UploadedMedia");
 
   public ModuleUploadedMedia(StorageObject aStorage) {
-    theStorage = aStorage;
+    storage = aStorage;
   }
 }
\ No newline at end of file
index c99bd9e..eaf4ff0 100755 (executable)
@@ -60,7 +60,7 @@ public class ModuleUsers extends AbstractModule
     if (aStorage == null)
       logger.warn("ModuleUsers(): StorageObject was null!");
 
-    theStorage = aStorage;
+    storage = aStorage;
   }
 
   /**
@@ -87,10 +87,9 @@ public class ModuleUsers extends AbstractModule
       if (userList != null && userList.getCount() == 1) {
         EntityUsers result = (EntityUsers) userList.elementAt(0);
 
-        if (result.getValue("is_disabled") == null ||
-            result.getValue("is_disabled").equals("0"))
+        if (result.getFieldValue("is_disabled") == null ||
+            result.getFieldValue("is_disabled").equals("0"))
             return result;
-
       }
 
       return null;
@@ -102,7 +101,7 @@ public class ModuleUsers extends AbstractModule
 
   public boolean checkUserPassword(EntityUsers aUser, String aPassword) throws ModuleExc, ModuleFailure {
     try {
-      return aUser.getValue("password").equals(MirGlobal.localizer().adminInterface().makePasswordDigest(aPassword));
+      return aUser.getFieldValue("password").equals(MirGlobal.localizer().adminInterface().makePasswordDigest(aPassword));
     }
     catch (Throwable t) {
       throw new ModuleFailure(t);
@@ -165,7 +164,7 @@ public class ModuleUsers extends AbstractModule
     try {
       String sql = "update webdb_users set lastlogin=now() where id = " + aUser.getId();
 
-      theStorage.executeUpdate(sql);
+      storage.executeUpdate(sql);
     }
     catch (Throwable t) {
 //      no propagation of this error for now, to allow mir to still function
index 0d5d6b3..3676ddb 100755 (executable)
@@ -260,8 +260,8 @@ public class PDFGenerator{
     try {
 
       ColumnText ict = new ColumnText(cb);
-      String theTitle = entityContent.getValue("title");
-      String theCreator = entityContent.getValue("creator");
+      String theTitle = entityContent.getFieldValue("title");
+      String theCreator = entityContent.getFieldValue("creator");
       Phrase titleP=new Phrase(" - " +  theTitle,new Font(indexFontFamily,indexFontSize,Font.BOLD));
       Phrase creatorP=new Phrase( " :: " + theCreator,new Font(indexFontFamily,indexFontSize));
       float toYPosition = currentYPosition - indexLineHeight;
@@ -440,8 +440,8 @@ public class PDFGenerator{
     while (images.hasNext()){
 
       EntityImages currentImage=(EntityImages) images.next();
-      float img_width=(new Float(currentImage.getValue("img_width"))).floatValue();
-      float img_height=(new Float(currentImage.getValue("img_height"))).floatValue();
+      float img_width=(new Float(currentImage.getFieldValue("img_width"))).floatValue();
+      float img_height=(new Float(currentImage.getFieldValue("img_height"))).floatValue();
       if (img_height>maxImageHeight){
   img_width=(new Float((new Float(img_width*(maxImageHeight/img_height))).intValue())).floatValue();
   img_height=maxImageHeight;
@@ -451,8 +451,8 @@ public class PDFGenerator{
   img_width=maxImageWidth;
       }
 
-      String img_title=currentImage.getValue("title");
-      String img_path=currentImage.getValue("publish_path");
+      String img_title=currentImage.getFieldValue("title");
+      String img_path=currentImage.getFieldValue("publish_path");
 
       if ((status & ColumnText.NO_MORE_TEXT) == 0){
   // there is still text, so add an image which will have text wrapped around it, then add the text which
@@ -645,18 +645,18 @@ public class PDFGenerator{
         "cxm.content_id="+entityContent.getId()+"and cxm.media_id=i.id",
         "i.id desc", 30, -1, 0);
 
-    String isHTML  = entityContent.getValue("is_html");
-    String theTitle = entityContent.getValue("title");
-    String theCreator = entityContent.getValue("creator");
+    String isHTML  = entityContent.getFieldValue("is_html");
+    String theTitle = entityContent.getFieldValue("title");
+    String theCreator = entityContent.getFieldValue("creator");
     String theDate = DateTimeFunctions.advancedDateFormat(
         configuration.getString("RDF.Meta.DateFormat"),
-        StringUtil.convertMirInternalDateToDate(entityContent.getValue("webdb_create")),
+        StringUtil.convertMirInternalDateToDate(entityContent.getFieldValue("webdb_create")),
         configuration.getString("Mir.DefaultTimezone"));
 
 
-    String theDescriptionRaw = entityContent.getValue("description");
-    String theContentRaw = entityContent.getValue("content_data");
-    String theSource =  configuration.getString("Producer.PublicationHost") + "/" + configuration.getString("StandardLanguage") + entityContent.getValue("publish_path") + entityContent.getValue("id") + ".shtml";
+    String theDescriptionRaw = entityContent.getFieldValue("description");
+    String theContentRaw = entityContent.getFieldValue("content_data");
+    String theSource =  configuration.getString("Producer.PublicationHost") + "/" + configuration.getString("StandardLanguage") + entityContent.getFieldValue("publish_path") + entityContent.getFieldValue("id") + ".shtml";
 
 
 
index cb100d8..94a2a2b 100755 (executable)
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
  * In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with  any library licensed under the Apache Software License, 
- * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library 
- * (or with modified versions of the above that use the same license as the above), 
- * and distribute linked combinations including the two.  You must obey the 
- * GNU General Public License in all respects for all of the code used other than 
- * the above mentioned libraries.  If you modify this file, you may extend this 
- * exception to your version of the file, but you are not obligated to do so.  
+ * the code of this program with  any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two.  You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries.  If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
  * If you do not wish to do so, delete this exception statement from your version.
  */
 package mircoders.producer;
index 3f78883..787923e 100755 (executable)
@@ -76,8 +76,8 @@ public class ContentModifyingProducerNode implements ProducerNode {
       value = ParameterExpander.expandExpression(aValueMap, valueExpression);
       fieldName = ParameterExpander.expandExpression(aValueMap, fieldNameExpression);
 
-      entity.setValueForProperty("is_produced", "0");
-      entity.setValueForProperty(fieldName, value);
+      entity.setFieldValue("is_produced", "0");
+      entity.setFieldValue(fieldName, value);
       entity.update();
 
       aLogger.info("  Modified content " + entity.getId() + ": " + fieldName + " = " + value );
index 22b3a19..685a2c1 100755 (executable)
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
  * In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with  any library licensed under the Apache Software License, 
- * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library 
- * (or with modified versions of the above that use the same license as the above), 
- * and distribute linked combinations including the two.  You must obey the 
- * GNU General Public License in all respects for all of the code used other than 
- * the above mentioned libraries.  If you modify this file, you may extend this 
- * exception to your version of the file, but you are not obligated to do so.  
+ * the code of this program with  any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two.  You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries.  If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
  * If you do not wish to do so, delete this exception statement from your version.
  */
 package mircoders.producer;
@@ -98,7 +98,7 @@ public class IndexingProducerNode implements ProducerNode {
           entity.getClass().getName() + " adapter", null);
       }
 
-      aLogger.info("Indexing " + (String) entity.getValue("id") + " into " +
+      aLogger.info("Indexing " + (String) entity.getFieldValue("id") + " into " +
         index);
 
       // create an index here if one did not already exist
@@ -124,7 +124,7 @@ public class IndexingProducerNode implements ProducerNode {
       //this initialization should go somewhere global like an xml file....
       (new KeywordSearchTerm("id", "", "id", "", "id")).index(theDoc, entity);
 
-      String textValue = entity.getValue("webdb_create");
+      String textValue = entity.getFieldValue("webdb_create");
       Calendar calendar = GregorianCalendar.getInstance();
       int year;
       int month;
@@ -155,11 +155,11 @@ public class IndexingProducerNode implements ProducerNode {
       (new KeywordSearchTerm("webdb_create_formatted", "search_date",
         "webdb_create_formatted", "webdb_create_formatted",
         "webdb_create_formatted")).indexValue(theDoc,formattedDate);
-     
+
 
       (new UnIndexedSearchTerm("", "", "", "where", "where")).indexValue(theDoc,
-        StringUtil.webdbDate2path(entity.getValue("date")) +
-        entity.getValue("id") + ".shtml");
+        StringUtil.webdbDate2path(entity.getFieldValue("date")) +
+        entity.getFieldValue("id") + ".shtml");
 
       (new TextSearchTerm("creator", "search_creator", "creator", "creator",
         "creator")).index(theDoc, entity);
@@ -171,8 +171,8 @@ public class IndexingProducerNode implements ProducerNode {
         "creationDate", "creationDate", "creationDate")).index(theDoc, entity);
 
       (new ContentSearchTerm("content_data", "search_content", "content", "", "")).indexValue(theDoc,
-        entity.getValue("content_data") + " " + entity.getValue("description") +
-        " " + entity.getValue("title"));
+        entity.getFieldValue("content_data") + " " + entity.getFieldValue("description") +
+        " " + entity.getFieldValue("title"));
 
       (new TopicSearchTerm()).index(theDoc, entity);
 
index 1c0b531..501e893 100755 (executable)
@@ -75,20 +75,20 @@ public class MediaGeneratingProducerNode implements ProducerNode {
 
       currentMediaHandler = MediaHelper.getHandler( mediaType );
       currentMediaHandler.produce(entity, mediaType);
-      entity.setValueForProperty("publish_server", currentMediaHandler.getPublishHost());
-      entity.setValueForProperty("icon_is_produced", "1");
-      entity.setValueForProperty("is_produced", "1");
+      entity.setFieldValue("publish_server", currentMediaHandler.getPublishHost());
+      entity.setFieldValue("icon_is_produced", "1");
+      entity.setFieldValue("is_produced", "1");
       entity.update();
 
-      aLogger.info("media with id "+uploadedMediaEntity.getValue("id") + ", mediaType " + mediaType.getValue("name") + " successfully produced");
+      aLogger.info("media with id "+uploadedMediaEntity.getFieldValue("id") + ", mediaType " + mediaType.getFieldValue("name") + " successfully produced");
     }
     catch (Throwable t) {
       String message = "Error while generating media";
       try {
         if (uploadedMediaEntity!=null)
-          message = message +  " with id "+uploadedMediaEntity.getValue("id");
+          message = message +  " with id "+uploadedMediaEntity.getFieldValue("id");
         if (mediaType!=null) {
-          message = message + ", mediaType " + mediaType.getValue("name");
+          message = message + ", mediaType " + mediaType.getFieldValue("name");
         }
       }
       catch (Throwable s) {
index 50e69bf..e7c8034 100755 (executable)
@@ -112,7 +112,7 @@ public class PDFPreFormattingProducerNode implements ProducerNode {
           "cxm.content_id="+entity.getId()+"and cxm.media_id=i.id",
           "i.id desc", 30, -1, 0);
 
-      String theContent = ((EntityContent) entity).getValue("content_data");
+      String theContent = ((EntityContent) entity).getFieldValue("content_data");
       //remove pesky characters
       theContent = HTMLRoutines.encodeXML(theContent);
       //put in the <BR> tags so we can turn them to empty blocks
@@ -144,8 +144,8 @@ public class PDFPreFormattingProducerNode implements ProducerNode {
               Map row1 = new HashMap();
               Map row2 = new HashMap();
               EntityImages currentImage=(EntityImages) images.next();
-              float img_width=(new Float(currentImage.getValue("img_width"))).floatValue();
-              float img_height=(new Float(currentImage.getValue("img_height"))).floatValue();
+              float img_width=(new Float(currentImage.getFieldValue("img_width"))).floatValue();
+              float img_height=(new Float(currentImage.getFieldValue("img_height"))).floatValue();
 
               //oversize images must be shrunk
               if (img_width>250){
@@ -162,7 +162,7 @@ public class PDFPreFormattingProducerNode implements ProducerNode {
 
               row1.put("text_widthCM",Float.toString(text_widthCM));
 
-              row1.put("img_title",currentImage.getValue("title"));
+              row1.put("img_title",currentImage.getFieldValue("title"));
 
               row1.put("img_width",Float.toString(img_width));
               row1.put("img_height",Float.toString(img_height));
@@ -170,7 +170,7 @@ public class PDFPreFormattingProducerNode implements ProducerNode {
               aLogger.debug("img_width " +Float.toString(img_width));
               aLogger.debug("img_height "+Float.toString(img_height));
 
-              row1.put("img_src",currentImage.getValue("publish_path"));
+              row1.put("img_src",currentImage.getFieldValue("publish_path"));
               row1.put("hasImage","1");
               if (! outOfText){
                   try {
index 77a25d5..8589f75 100755 (executable)
@@ -71,7 +71,7 @@ public class UnIndexingProducerNode implements ProducerNode {
       if (! (entity instanceof EntityContent)) {
         throw new ProducerFailure("UnIndexingProducerNode: value of '"+contentKey+"' is not a content EntityAdapter, but a " + entity.getClass().getName() + " adapter", null);
       }
-      aLogger.info("UnIndexing " + (String) entity.getValue("id") + " out of " + index);
+      aLogger.info("UnIndexing " + (String) entity.getFieldValue("id") + " out of " + index);
 
       IndexUtil.unindexEntity((EntityContent) entity, index);
     }
index 636d1ec..8ea3d6f 100755 (executable)
@@ -54,7 +54,7 @@ public class ContentSearchTerm extends SearchTerm{
   }
 
   public void index(Document doc, Entity entity){
-    doc.add(Field.UnStored(matchField,entity.getValue(partOfEntity)));
+    doc.add(Field.UnStored(matchField,entity.getFieldValue(partOfEntity)));
   }
 
   public void indexValue(Document doc, String value){
index 4039373..b1fa9ae 100755 (executable)
@@ -59,7 +59,7 @@ public class ImagesSearchTerm extends SearchTerm{
         if (k != 0){
           imageURLString = imageURLString + ":";
         }
-        imageURLString = imageURLString + (images.elementAt(k)).getValue("icon_path");
+        imageURLString = imageURLString + (images.elementAt(k)).getFieldValue("icon_path");
       }
       doc.add(Field.UnIndexed("images",imageURLString));
     }
index 0cd904d..dfee688 100755 (executable)
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
  * In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with  any library licensed under the Apache Software License, 
- * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library 
- * (or with modified versions of the above that use the same license as the above), 
- * and distribute linked combinations including the two.  You must obey the 
- * GNU General Public License in all respects for all of the code used other than 
- * the above mentioned libraries.  If you modify this file, you may extend this 
- * exception to your version of the file, but you are not obligated to do so.  
+ * the code of this program with  any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two.  You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries.  If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
  * If you do not wish to do so, delete this exception statement from your version.
  */
 
@@ -54,7 +54,7 @@ public class KeywordSearchTerm extends SearchTerm{
 
 
   public void index(Document doc, Entity entity){
-    doc.add(Field.Keyword(matchField,entity.getValue(partOfEntity)));
+    doc.add(Field.Keyword(matchField,entity.getFieldValue(partOfEntity)));
   }
 
   public void indexValue(Document doc, String value){
index 9f4e433..334a424 100755 (executable)
@@ -50,7 +50,7 @@ public class TextSearchTerm extends SearchTerm{
   }
 
   public void index(Document doc, Entity entity){
-    String value =entity.getValue(partOfEntity);
+    String value =entity.getFieldValue(partOfEntity);
 
     if (value==null) value="";
 
index f02d9e4..e6be2a1 100755 (executable)
@@ -52,7 +52,7 @@ public class TopicMatrixSearchTerm extends SearchTerm{
     EntityList topics = DatabaseContentToTopics.getInstance().getTopics((EntityContent) entity);
     if (topics != null && topics.size()>0){
       for(int k=0;k<topics.size();k++){
-        doc.add(Field.UnStored(matchField,(topics.elementAt(k)).getValue("title")));
+        doc.add(Field.UnStored(matchField,(topics.elementAt(k)).getFieldValue("title")));
       }
     }
   }
index 398a4bc..cc1e279 100755 (executable)
@@ -52,7 +52,7 @@ public class TopicSearchTerm extends SearchTerm{
     EntityList topics = DatabaseContentToTopics.getInstance().getTopics((EntityContent) entity);
     if (topics != null && topics.size()>0){
       for(int k=0;k<topics.size();k++){
-        doc.add(Field.UnStored(matchField,(topics.elementAt(k)).getValue("title")));
+        doc.add(Field.UnStored(matchField,(topics.elementAt(k)).getFieldValue("title")));
       }
     }
   }
index d835e3e..ced2c02 100755 (executable)
@@ -50,7 +50,7 @@ public class UnIndexedSearchTerm extends SearchTerm{
   }
 
   public void index(Document doc, Entity entity){
-    doc.add(Field.Text(dataField,entity.getValue(partOfEntity)));
+    doc.add(Field.Text(dataField,entity.getFieldValue(partOfEntity)));
   }
 
   public void indexValue(Document doc, String value){
index fcd2d79..d0aa297 100755 (executable)
@@ -49,7 +49,7 @@ public class UnStoredSearchTerm extends SearchTerm{
   }
 
   public void index(Document doc, Entity entity){
-    doc.add(Field.UnStored(matchField,entity.getValue(partOfEntity)));
+    doc.add(Field.UnStored(matchField,entity.getFieldValue(partOfEntity)));
   }
 
   public void indexValue(Document doc, String value){
index ea2db02..f9f4971 100755 (executable)
@@ -149,7 +149,7 @@ public class ServletHelper {
     EntityUsers user = getUser(aRequest);\r
 \r
     if (user!=null)\r
-      return user.getValue("login");\r
+      return user.getFieldValue("login");\r
     else\r
       return "nobody";\r
   }\r
index 0f046e6..4882598 100755 (executable)
@@ -117,8 +117,6 @@ public class ServletModuleAbuse extends ServletModule {
 
     String errorMessage;
 
-    String userName = ServletHelper.getUserName(aRequest);
-
     if (id.equals("")) {
       errorMessage = MirGlobal.abuse().addFilter(type, expression,comments, commentaction, articleaction);
       logAdminUsage(aRequest, "?", "object added");
@@ -173,6 +171,30 @@ public class ServletModuleAbuse extends ServletModule {
     showfilters(aRequest, aResponse);
   }
 
+  public void movetop(HttpServletRequest aRequest, HttpServletResponse aResponse) {
+    HTTPRequestParser requestParser = new HTTPRequestParser(aRequest);
+
+    String id=requestParser.getParameterWithDefault("id", "");
+    MirGlobal.abuse().moveFilterToTop(id);
+
+    MirGlobal.abuse().save();
+    logAdminUsage(aRequest, id, "object moved to the top");
+
+    showfilters(aRequest, aResponse);
+  }
+
+  public void movebottom(HttpServletRequest aRequest, HttpServletResponse aResponse) {
+    HTTPRequestParser requestParser = new HTTPRequestParser(aRequest);
+
+    String id=requestParser.getParameterWithDefault("id", "");
+    MirGlobal.abuse().moveFilterToBottom(id);
+
+    MirGlobal.abuse().save();
+    logAdminUsage(aRequest, id, "object moved to the bottom");
+
+    showfilters(aRequest, aResponse);
+  }
+
   public void add(HttpServletRequest aRequest, HttpServletResponse aResponse) throws ServletModuleExc {
     editfilter(aRequest, aResponse, "", "", "", "", "", "", "");
   }
@@ -256,7 +278,6 @@ public class ServletModuleAbuse extends ServletModule {
 
   public void showlog(HttpServletRequest aRequest, HttpServletResponse aResponse) {
     URLBuilder urlBuilder = new URLBuilder();
-    int count;
 
     try {
       Map responseData = ServletHelper.makeGenerationData(aRequest, aResponse, new Locale[] { getLocale(aRequest), getFallbackLocale(aRequest)});
index 4080dac..912df40 100755 (executable)
@@ -64,7 +64,7 @@ import mircoders.storage.DatabaseContentToTopics;
  *  ServletModuleContent -
  *  deliver html for the article admin form.
  *
- * @version $Id: ServletModuleContent.java,v 1.52.2.13 2003/12/21 13:32:06 zapata Exp $
+ * @version $Id: ServletModuleContent.java,v 1.52.2.14 2004/01/18 17:31:00 zapata Exp $
  * @author rk, mir-coders
  *
  */
@@ -621,7 +621,7 @@ public class ServletModuleContent extends ServletModule
 
     try {
       EntityContent article = (EntityContent) mainModule.getById(articleId);
-      article.setValueForProperty("to_content", parentId);
+      article.setFieldValue("to_content", parentId);
       article.setProduced(false);
       article.update();
       logAdminUsage(aRequest, articleId, "parent set to " + parentId);
@@ -642,7 +642,7 @@ public class ServletModuleContent extends ServletModule
 
     try {
       EntityContent article = (EntityContent) mainModule.getById(articleId);
-      article.setValueForProperty("to_content", "");
+      article.setFieldValue("to_content", "");
       article.setProduced(false);
       article.update();
       logAdminUsage(aRequest, articleId, "parent cleared");
index beb0690..976d76a 100755 (executable)
@@ -449,7 +449,7 @@ public abstract class ServletModuleUploadedMedia extends ServletModule {
         MediaHandler mediaHandler;
 
         ServletContext ctx = MirPropertiesConfiguration.getContext();
-        String fName = entity.getId()+"."+mediaType.getValue("name");
+        String fName = entity.getId()+"."+mediaType.getFieldValue("name");
 
         mediaHandler = MediaHelper.getHandler(mediaType);
         InputStream in = mediaHandler.getMedia(entity, mediaType);
index 3338360..28521ab 100755 (executable)
@@ -216,7 +216,7 @@ public class ServletModuleUsers extends ServletModule
 
       String newPassword=validatePassword(ServletHelper.getUser(aRequest), requestParser);
       if (newPassword!=null) {
-        user.setValueForProperty("password", MirGlobal.localizer().adminInterface().makePasswordDigest(newPassword));
+        user.setFieldValue("password", MirGlobal.localizer().adminInterface().makePasswordDigest(newPassword));
         user.update();
 
         logAdminUsage(aRequest, id, "password changed");
index f7936be..84fff6c 100755 (executable)
@@ -60,9 +60,10 @@ public class DatabaseArticleType extends Database implements StorageObject{
 
   private DatabaseArticleType() throws StorageObjectFailure {
     super();
+
     logger = new LoggerWrapper("Database.ArticleType");
     this.hasTimestamp = false;
-    this.theTable = "article_type";
+    this.mainTable = "article_type";
   }
 
 }
index 4611766..c8c316a 100755 (executable)
@@ -57,26 +57,26 @@ public class DatabaseAudio extends Database implements StorageObject{
     logger = new LoggerWrapper("Database.Audio");
 
     hasTimestamp = true;
-    theTable = "audio";
-    theCoreTable = "media";
+    mainTable = "audio";
+    primaryKeySequence = "media_id_seq";
     theEntityClass = mircoders.entity.EntityAudio.class;
   }
 
   public void update(Entity theEntity) throws StorageObjectFailure {
-    String date = theEntity.getValue("date");
+    String date = theEntity.getFieldValue("date");
     if (date == null) {
       date = StringUtil.date2webdbDate(new GregorianCalendar());
-      theEntity.setValueForProperty("date", date);
+      theEntity.setFieldValue("date", date);
     }
 
     super.update(theEntity);
   }
 
   public String insert(Entity theEntity) throws StorageObjectFailure {
-    String date = theEntity.getValue("date");
+    String date = theEntity.getFieldValue("date");
     if (date == null) {
       date = StringUtil.date2webdbDate(new GregorianCalendar());
-      theEntity.setValueForProperty("date", date);
+      theEntity.setFieldValue("date", date);
     }
     return super.insert(theEntity);
   }
index f7c0c87..a0a6849 100755 (executable)
@@ -59,7 +59,7 @@ public class DatabaseBreaking extends Database implements StorageObject{
   {
     super();
     logger = new LoggerWrapper("Database.Breaking");
-    this.theTable="breaking";
+    this.mainTable="breaking";
   }
 
 
index ba67579..98e8f8e 100755 (executable)
@@ -60,7 +60,7 @@ public class DatabaseComment extends Database implements StorageObject{
   private DatabaseComment() {
     super();
     hasTimestamp = false;
-    theTable = "comment";
+    mainTable = "comment";
     logger = new LoggerWrapper("Database.Comment");
 
     this.theEntityClass = mircoders.entity.EntityComment.class;
@@ -73,7 +73,7 @@ public class DatabaseComment extends Database implements StorageObject{
     int res = 0;
 
     /** @todo comments and topics should be deleted */
-    sql = "delete from " + theTable + " where to_media=" + id;
+    sql = "delete from " + mainTable + " where to_media=" + id;
     logger.info("DELETE "+ sql);
 
     try {
index 7fe19ef..40c3937 100755 (executable)
@@ -60,7 +60,7 @@ public class DatabaseCommentStatus extends Database implements StorageObject{
   private DatabaseCommentStatus() throws StorageObjectFailure {
     super();
     hasTimestamp = false;
-    theTable = "comment_status";
+    mainTable = "comment_status";
     logger = new LoggerWrapper("Database.CommentStatus");
   }
 }
\ No newline at end of file
index b7976ec..c71043d 100755 (executable)
@@ -48,7 +48,7 @@ import mircoders.entity.EntityUploadedMedia;
  * <b>implements abstract DB connection to the comment_x_media SQL table
  *
  * @author RK, mir-coders group
- * @version $Id: DatabaseCommentToMedia.java,v 1.3.2.5 2003/11/26 19:23:16 rk Exp $
+ * @version $Id: DatabaseCommentToMedia.java,v 1.3.2.6 2004/01/18 17:31:01 zapata Exp $
  *
  */
 
@@ -67,7 +67,7 @@ public class DatabaseCommentToMedia extends Database implements StorageObject{
     super();
     logger = new LoggerWrapper("Database.CommentToMedia");
     hasTimestamp = false;
-    theTable = "comment_x_media";
+    mainTable = "comment_x_media";
     theEntityClass = mir.entity.GenericEntity.class;
   }
 
@@ -92,19 +92,19 @@ public class DatabaseCommentToMedia extends Database implements StorageObject{
 
   private EntityList getMultiMediaForComment(StorageObject store, EntityComment comment)
       throws StorageObjectFailure {
-    
+
       EntityList returnList = null;
       if (comment != null) {
         String id = comment.getId();
-        try {        
+        try {
           Vector extraTable = new Vector();
-          extraTable.add(theTable+" cxm");
+          extraTable.add(mainTable+" cxm");
           // media should stay in uploaded order. this is especially important
           // for photo stories which require a specific chronologic order.
-          // this is why we have the the second parameter "id"       
-          store.selectByWhereClause("m", extraTable, 
+          // this is why we have the the second parameter "id"
+          store.selectByWhereClause("m", extraTable,
             "m.id=cxm.media_id and cxm.comment_id="+id, "id", -1, -1);
-                
+
         } catch (Exception e) {
           logger.error("DatabaseCommenttToMedia.getMultiMediaForComment: " + e.toString());
           throw new StorageObjectFailure("DatabaseContentToMedia.etMultiMediaForComment: " +
@@ -159,7 +159,7 @@ public class DatabaseCommentToMedia extends Database implements StorageObject{
       return;
     }
     //first delete all row with comment_id=commentId
-    String sql = "delete from " + theTable + " where comment_id=" + commentId;
+    String sql = "delete from " + mainTable + " where comment_id=" + commentId;
 
     Connection con = null;
     Statement stmt = null;
@@ -180,7 +180,7 @@ public class DatabaseCommentToMedia extends Database implements StorageObject{
     //now insert
     //first delete all row with comment_id=commentId
     for (int i = 0; i < mediaId.length; i++) {
-      sql = "insert into " + theTable + " (comment_id,media_id) values ("
+      sql = "insert into " + mainTable + " (comment_id,media_id) values ("
           + commentId + "," + mediaId[i] + ")";
       try {
         con = getPooledCon();
@@ -208,7 +208,7 @@ public class DatabaseCommentToMedia extends Database implements StorageObject{
     Statement stmt = null;
     //now insert
 
-    String sql = "insert into " + theTable + " (comment_id,media_id) values ("
+    String sql = "insert into " + mainTable + " (comment_id,media_id) values ("
         + commentId + "," + mediaId + ")";
     try {
       con = getPooledCon();
@@ -231,7 +231,7 @@ public class DatabaseCommentToMedia extends Database implements StorageObject{
       return;
     }
     //first delete all row with comment_id=commentId
-    String sql = "delete from " + theTable + " where comment_id=" + commentId;
+    String sql = "delete from " + mainTable + " where comment_id=" + commentId;
 
     Connection con = null;
     Statement stmt = null;
@@ -252,7 +252,7 @@ public class DatabaseCommentToMedia extends Database implements StorageObject{
     //now insert
     //first delete all row with comment_id=commentId
 
-    sql = "insert into " + theTable + " (comment_id,media_id) values ("
+    sql = "insert into " + mainTable + " (comment_id,media_id) values ("
         + commentId + "," + mediaId + ")";
     try {
       con = getPooledCon();
@@ -275,7 +275,7 @@ public class DatabaseCommentToMedia extends Database implements StorageObject{
       return;
     }
     //delete all row with comment_id=commentId
-    String sql = "delete from " + theTable + " where comment_id=" + commentId;
+    String sql = "delete from " + mainTable + " where comment_id=" + commentId;
 
     Connection con = null;
     Statement stmt = null;
@@ -301,7 +301,7 @@ public class DatabaseCommentToMedia extends Database implements StorageObject{
       return;
     }
     //delete all row with comment_id=commentId
-    String sql = "delete from " + theTable + " where media_id=" + mediaId;
+    String sql = "delete from " + mainTable + " where media_id=" + mediaId;
 
     Connection con = null;
     Statement stmt = null;
@@ -328,7 +328,7 @@ public class DatabaseCommentToMedia extends Database implements StorageObject{
       return;
     }
     //delete all row with comment_id=commentId and media_id=mediaId
-    String sql = "delete from " + theTable + " where media_id=" + mediaId +
+    String sql = "delete from " + mainTable + " where media_id=" + mediaId +
         " and comment_id= " + commentId;
 
     Connection con = null;
@@ -351,19 +351,19 @@ public class DatabaseCommentToMedia extends Database implements StorageObject{
 
   public EntityList getComment(EntityUploadedMedia media) throws
       StorageObjectFailure {
-        
+
     EntityList returnList = null;
     if (media != null) {
 
       String id = media.getId();
       Vector extraTables = new Vector();
-      extraTables.add(theTable + " cxm");
-  
+      extraTables.add(mainTable + " cxm");
+
       String mediaSelect = "cxm.comment_id=c.id and cxm.media_id="+id;
       try {
         returnList = DatabaseComment.getInstance().selectByWhereClause("c",
           extraTables, mediaSelect, "c.id" );
-    
+
       }
       catch (Exception e) {
         logger.error("-- get comment failed");
@@ -374,21 +374,21 @@ public class DatabaseCommentToMedia extends Database implements StorageObject{
   }
 
   /**
-   * Returns a EntityList with all comment-objects having 
+   * Returns a EntityList with all comment-objects having
    *  a relation to a media
    */
 
   public EntityList getComment() throws StorageObjectFailure {
     EntityList returnList = null;
-  
+
     Vector extraTables = new Vector();
-    extraTables.add(theTable + " cxm");
-    
+    extraTables.add(mainTable + " cxm");
+
     String mediaSelect = "cxm.comment_id=c.id";
     try {
       returnList = DatabaseComment.getInstance().selectByWhereClause("c",
         extraTables, mediaSelect, "c.webdb_lastchange desc" );
-      
+
     }
     catch (Exception e) {
       logger.error("-- get comment failed");
index 6d17273..8d5e809 100755 (executable)
@@ -64,8 +64,8 @@ public class DatabaseContent extends Database implements StorageObject {
   private DatabaseContent() throws StorageObjectFailure {
 
     super();
-    theTable="content";
-    theCoreTable="media";
+    mainTable="content";
+    primaryKeySequence="media_id_seq";
     logger = new LoggerWrapper("Database.Content");
 
     theEntityClass = mircoders.entity.EntityContent.class;
index 425e13a..c99bf76 100755 (executable)
@@ -48,7 +48,7 @@ import mircoders.entity.EntityUploadedMedia;
  * <b>implements abstract DB connection to the content_x_media SQL table
  *
  * @author RK, mir-coders group
- * @version $Id: DatabaseContentToMedia.java,v 1.19.2.4 2003/11/26 19:21:06 rk Exp $
+ * @version $Id: DatabaseContentToMedia.java,v 1.19.2.5 2004/01/18 17:31:01 zapata Exp $
  *
  */
 
@@ -68,14 +68,14 @@ public class DatabaseContentToMedia extends Database implements StorageObject{
 
     logger = new LoggerWrapper("Database.ContentToMedia");
     hasTimestamp = false;
-    theTable = "content_x_media";
+    mainTable = "content_x_media";
     theEntityClass = mir.entity.GenericEntity.class;
   }
 
   public boolean hasMedia(EntityContent content) throws StorageObjectFailure,
       StorageObjectExc {
     if (content != null) {
-      try {        
+      try {
         return (getSize("content_id=" + content.getId()) == 0) ? false:true;
       }
       catch (Exception e) {
@@ -93,19 +93,19 @@ public class DatabaseContentToMedia extends Database implements StorageObject{
 
   private EntityList getMultiMediaForContent(StorageObject store, EntityContent content)
     throws StorageObjectFailure {
-    
+
     EntityList returnList = null;
     if (content != null) {
       String id = content.getId();
-      try {        
+      try {
         Vector extraTable = new Vector();
-        extraTable.add(theTable+" cxm");
+        extraTable.add(mainTable+" cxm");
         // media should stay in uploaded order. this is especially important
         // for photo stories which require a specific chronologic order.
-        // this is why we have the the second parameter "id"       
-        store.selectByWhereClause("m", extraTable, 
+        // this is why we have the the second parameter "id"
+        store.selectByWhereClause("m", extraTable,
           "m.id=cxm.media_id and cxm.content_id="+id, "id", -1, -1);
-                                       
+
                        } catch (Exception e) {
         logger.error("DatabaseContentToMedia.getMultiMediaForContent: " + e.toString());
         throw new StorageObjectFailure("DatabaseContentToMedia.etMultiMediaForContent: " +
@@ -114,7 +114,7 @@ public class DatabaseContentToMedia extends Database implements StorageObject{
     }
     return returnList;
   }
-    
+
   /**
    * get all the audio belonging to a content entity
    */
@@ -156,7 +156,7 @@ public class DatabaseContentToMedia extends Database implements StorageObject{
       return;
     }
     //first delete all row with content_id=contentId
-    String sql = "delete from " + theTable + " where content_id=" + contentId;
+    String sql = "delete from " + mainTable + " where content_id=" + contentId;
 
     Connection con = null;
     Statement stmt = null;
@@ -177,7 +177,7 @@ public class DatabaseContentToMedia extends Database implements StorageObject{
     //now insert
     //first delete all row with content_id=contentId
     for (int i = 0; i < mediaId.length; i++) {
-      sql = "insert into " + theTable + " (content_id,media_id) values ("
+      sql = "insert into " + mainTable + " (content_id,media_id) values ("
           + contentId + "," + mediaId[i] + ")";
       try {
         con = getPooledCon();
@@ -205,7 +205,7 @@ public class DatabaseContentToMedia extends Database implements StorageObject{
     Statement stmt = null;
     //now insert
 
-    String sql = "insert into " + theTable + " (content_id,media_id) values ("
+    String sql = "insert into " + mainTable + " (content_id,media_id) values ("
         + contentId + "," + mediaId + ")";
     try {
       con = getPooledCon();
@@ -228,7 +228,7 @@ public class DatabaseContentToMedia extends Database implements StorageObject{
       return;
     }
     //first delete all row with content_id=contentId
-    String sql = "delete from " + theTable + " where content_id=" + contentId;
+    String sql = "delete from " + mainTable + " where content_id=" + contentId;
 
     Connection con = null;
     Statement stmt = null;
@@ -249,7 +249,7 @@ public class DatabaseContentToMedia extends Database implements StorageObject{
     //now insert
     //first delete all row with content_id=contentId
 
-    sql = "insert into " + theTable + " (content_id,media_id) values ("
+    sql = "insert into " + mainTable + " (content_id,media_id) values ("
         + contentId + "," + mediaId + ")";
     try {
       con = getPooledCon();
@@ -272,7 +272,7 @@ public class DatabaseContentToMedia extends Database implements StorageObject{
       return;
     }
     //delete all row with content_id=contentId
-    String sql = "delete from " + theTable + " where content_id=" + contentId;
+    String sql = "delete from " + mainTable + " where content_id=" + contentId;
 
     Connection con = null;
     Statement stmt = null;
@@ -293,13 +293,13 @@ public class DatabaseContentToMedia extends Database implements StorageObject{
   }
 
   public void deleteByMediaId(String mediaId) throws StorageObjectFailure {
-  
+
     if (mediaId == null) {
       //theLog.printDebugInfo("-- delete topics failed -- no topic id");
       return;
     }
     //delete all row with content_id=contentId
-    String sql = "delete from " + theTable + " where media_id=" + mediaId;
+    String sql = "delete from " + mainTable + " where media_id=" + mediaId;
 
     Connection con = null;
     Statement stmt = null;
@@ -326,7 +326,7 @@ public class DatabaseContentToMedia extends Database implements StorageObject{
       return;
     }
     //delete all row with content_id=contentId and media_id=mediaId
-    String sql = "delete from " + theTable + " where media_id=" + mediaId +
+    String sql = "delete from " + mainTable + " where media_id=" + mediaId +
         " and content_id= " + contentId;
 
     Connection con = null;
@@ -349,19 +349,19 @@ public class DatabaseContentToMedia extends Database implements StorageObject{
 
   public EntityList getContent(EntityUploadedMedia media) throws
       StorageObjectFailure {
-        
+
     EntityList returnList = null;
     if (media != null) {
 
       String id = media.getId();
       Vector extraTables = new Vector();
-      extraTables.add(theTable + " cxm");
-      
+      extraTables.add(mainTable + " cxm");
+
       String mediaSelect = "cxm.content_id=c.id and cxm.media_id="+id;
       try {
         returnList = DatabaseContent.getInstance().selectByWhereClause("c",
           extraTables, mediaSelect, "c.id" );
-        
+
       }
       catch (Exception e) {
         logger.error("-- get content failed");
@@ -378,15 +378,15 @@ public class DatabaseContentToMedia extends Database implements StorageObject{
   public EntityList getContent() throws StorageObjectFailure {
 
     EntityList returnList = null;
-  
+
     Vector extraTables = new Vector();
-    extraTables.add(theTable + " cxm");
-    
+    extraTables.add(mainTable + " cxm");
+
     String mediaSelect = "cxm.content_id=c.id";
     try {
       returnList = DatabaseContent.getInstance().selectByWhereClause("c",
         extraTables, mediaSelect, "c.webdb_lastchange desc" );
-      
+
     }
     catch (Exception e) {
       logger.error("-- get content failed");
index eca6c29..2ad9fb2 100755 (executable)
@@ -70,7 +70,7 @@ public class DatabaseContentToTopics extends Database implements StorageObject{
     logger = new LoggerWrapper("Database.ContentToTopics");
 
     hasTimestamp = false;
-    theTable="content_x_topic";
+    mainTable="content_x_topic";
     theEntityClass = mir.entity.GenericEntity.class;
   }
 
@@ -86,10 +86,10 @@ public class DatabaseContentToTopics extends Database implements StorageObject{
       String id = content.getId();
       try {
         Vector extraTables = new Vector();
-        extraTables.add(theTable+" cxt");
+        extraTables.add(mainTable+" cxt");
         returnList = DatabaseTopics.getInstance()
-                      .selectByWhereClauseWithExtraTables("t",extraTables, 
-                                              "t.id=cxt.topic_id and  cxt.content_id="+id );        
+                      .selectByWhereClauseWithExtraTables("t",extraTables,
+                                              "t.id=cxt.topic_id and  cxt.content_id="+id );
       }
       catch (Exception e) {
         logger.error("-- get topics failed " + e.toString());
@@ -107,7 +107,7 @@ public class DatabaseContentToTopics extends Database implements StorageObject{
     ArrayList returnList = new ArrayList();
 
     if (contentId != null) {
-      String sql = "select topic_id from " + theTable + " where content_id=" + contentId;
+      String sql = "select topic_id from " + mainTable + " where content_id=" + contentId;
       Connection con=null;Statement stmt=null;
       try {
         con = getPooledCon();
@@ -171,9 +171,9 @@ public class DatabaseContentToTopics extends Database implements StorageObject{
     logger.debug("to add = " + topicsToAdd.toString());
 
 
-    if (!topicsToDelete.isEmpty()) {      
+    if (!topicsToDelete.isEmpty()) {
       String sql =
-          "delete from " + theTable + " " +
+          "delete from " + mainTable + " " +
           "where content_id=" + anArticleId +
           "        and topic_id in (" + getIdListExpression(topicsToDelete) + ")";
 
@@ -200,7 +200,7 @@ public class DatabaseContentToTopics extends Database implements StorageObject{
     while (i.hasNext()) {
       Integer topicId = (Integer) i.next();
       String sql =
-          "insert into " + theTable + " (content_id, topic_id) "+
+          "insert into " + mainTable + " (content_id, topic_id) "+
           "values (" + anArticleId + "," + topicId + ")";
       Connection connection=null;
       Statement statement=null;
@@ -230,7 +230,7 @@ public class DatabaseContentToTopics extends Database implements StorageObject{
       return;
     }
     //delete all row with content_id=contentId
-    String sql = "delete from "+ theTable +" where content_id=" + contentId;
+    String sql = "delete from "+ mainTable +" where content_id=" + contentId;
 
     Connection con=null;Statement stmt=null;
     try {
@@ -252,7 +252,7 @@ public class DatabaseContentToTopics extends Database implements StorageObject{
       return;
     }
     //delete all row with content_id=contentId
-    String sql = "delete from "+ theTable +" where topic_id=" + topicId;
+    String sql = "delete from "+ mainTable +" where topic_id=" + topicId;
 
     Connection con=null;Statement stmt=null;
     try {
@@ -268,7 +268,7 @@ public class DatabaseContentToTopics extends Database implements StorageObject{
       freeConnection(con,stmt);
     }
   }
-  
+
 /**
  * Returns list of Content for a specific topic
  * @param topic
@@ -282,10 +282,10 @@ public class DatabaseContentToTopics extends Database implements StorageObject{
       String id = topic.getId();
       try {
         Vector extraTables = new Vector();
-        extraTables.add(theTable+" cxt");
+        extraTables.add(mainTable+" cxt");
         returnList = DatabaseContent.getInstance()
-                      .selectByWhereClauseWithExtraTables("c",extraTables, 
-                          "c.id=cxt.content_id and cxt.topic_id="+id );    
+                      .selectByWhereClauseWithExtraTables("c",extraTables,
+                          "c.id=cxt.content_id and cxt.topic_id="+id );
       }
       catch (Exception e) {
         logger.error("-- get content failed");
index cb364bf..6881eba 100755 (executable)
@@ -58,7 +58,7 @@ public class DatabaseImageColor extends Database implements StorageObject{
     super();
     logger = new LoggerWrapper("Database.ImageColor");
     hasTimestamp = false;
-    theTable = "img_color";
+    mainTable = "img_color";
   }
 
 }
index 76a3f29..210dfb2 100755 (executable)
@@ -58,6 +58,6 @@ public class DatabaseImageFormat extends Database implements StorageObject{
     super();
     logger = new LoggerWrapper("Database.ImageFormat");
     hasTimestamp = false;
-    theTable = "img_format";
+    mainTable = "img_format";
   }
 }
index 2e517d5..8e48eb3 100755 (executable)
@@ -59,6 +59,6 @@ public class DatabaseImageLayout extends Database implements StorageObject{
 
     logger = new LoggerWrapper("Database.ImageLayout");
     hasTimestamp = false;
-    theTable = "img_layout";
+    mainTable = "img_layout";
   }
 }
index 87e3000..8bf91f4 100755 (executable)
@@ -58,6 +58,6 @@ public class DatabaseImageType extends Database implements StorageObject{
     logger = new LoggerWrapper("Database.ImageType");
 
     hasTimestamp = false;
-    theTable = "img_type";
+    mainTable = "img_type";
   }
 }
index 606963b..33a0769 100755 (executable)
@@ -62,27 +62,27 @@ public class DatabaseImages extends Database implements StorageObject{
     logger = new LoggerWrapper("Database.Images");
 
     hasTimestamp = true;
-    theTable = "images";
-    theCoreTable = "media";
+    mainTable = "images";
+    primaryKeySequence = "media_id_seq";
     theEntityClass = mircoders.entity.EntityImages.class;
   }
 
   public void update(Entity theEntity) throws StorageObjectFailure {
-    String date = theEntity.getValue("date");
+    String date = theEntity.getFieldValue("date");
     if (date == null) {
       date = StringUtil.date2webdbDate(new GregorianCalendar());
-      theEntity.setValueForProperty("date", date);
+      theEntity.setFieldValue("date", date);
     }
 
     super.update(theEntity);
   }
 
   public String insert(Entity theEntity) throws StorageObjectFailure {
-    String date = theEntity.getValue("date");
+    String date = theEntity.getFieldValue("date");
 
     if (date == null) {
       date = StringUtil.date2webdbDate(new GregorianCalendar());
-      theEntity.setValueForProperty("date", date);
+      theEntity.setFieldValue("date", date);
     }
 
     return super.insert(theEntity);
index 7595fd0..61f9958 100755 (executable)
@@ -72,7 +72,7 @@ public class DatabaseLanguage extends Database implements StorageObject{
     logger = new LoggerWrapper("Database.Language");
 
     this.hasTimestamp = false;
-    this.theTable = "language";
+    this.mainTable = "language";
   }
 
   public List getPopupData() throws StorageObjectFailure {
@@ -83,7 +83,7 @@ public class DatabaseLanguage extends Database implements StorageObject{
       Entity e = (Entity) i.next();
       Map entry = new HashMap();
       entry.put("key", e.getId());
-      entry.put("value", e.getValue("name"));
+      entry.put("value", e.getFieldValue("name"));
 
       result.add(entry);
     }
index cd2cf1a..fd900f9 100755 (executable)
@@ -58,7 +58,7 @@ public class DatabaseMediaType extends Database implements StorageObject{
     logger = new LoggerWrapper("Database.MediaType");
 
     hasTimestamp = false;
-    theTable="media_type";
+    mainTable="media_type";
     theEntityClass = mir.entity.GenericEntity.class;
   }
 
index 3e96708..a9d3dd4 100755 (executable)
@@ -54,6 +54,6 @@ public class DatabaseMediafolder extends Database implements StorageObject{
     logger = new LoggerWrapper("Database.Mediafolder");
 
     hasTimestamp = false;
-    theTable="media_folder";
+    mainTable="media_folder";
   }
 }
index 81ad696..efac2e7 100755 (executable)
@@ -61,7 +61,7 @@ public class DatabaseMessages extends Database implements StorageObject{
 
     logger = new LoggerWrapper("Database.Messages");
 
-    this.theTable="messages";
+    this.mainTable="messages";
   }
 
 
index 167ba85..c4c422b 100755 (executable)
@@ -68,26 +68,26 @@ public class DatabaseOther extends Database implements StorageObject{
     logger = new LoggerWrapper("Database.OtherMedia");
 
     hasTimestamp = true;
-    theTable = "other_media";
-    theCoreTable = "media";
+    mainTable = "other_media";
+    primaryKeySequence = "media_id_seq";
     theEntityClass = mircoders.entity.EntityOther.class;
   }
 
   public void update(Entity theEntity) throws StorageObjectFailure {
-    String date = theEntity.getValue("date");
+    String date = theEntity.getFieldValue("date");
     if (date == null) {
       date = StringUtil.date2webdbDate(new GregorianCalendar());
-      theEntity.setValueForProperty("date", date);
+      theEntity.setFieldValue("date", date);
     }
 
     super.update(theEntity);
   }
 
   public String insert(Entity theEntity) throws StorageObjectFailure {
-    String date = theEntity.getValue("date");
+    String date = theEntity.getFieldValue("date");
     if (date == null) {
       date = StringUtil.date2webdbDate(new GregorianCalendar());
-      theEntity.setValueForProperty("date", date);
+      theEntity.setFieldValue("date", date);
     }
     return super.insert(theEntity);
   }
index 5bdbd08..d2a5c63 100755 (executable)
@@ -61,6 +61,6 @@ public class DatabaseRights extends Database implements StorageObject{
     logger = new LoggerWrapper("Database.Rights");
 
     hasTimestamp = false;
-    theTable = "rights";
+    mainTable = "rights";
   }
 }
index e18e92e..252ae0b 100755 (executable)
@@ -69,7 +69,7 @@ public class DatabaseTopics extends Database implements StorageObject{
     logger = new LoggerWrapper("Database.Topics");
 
     hasTimestamp = false;
-    theTable = "topic";
+    mainTable = "topic";
     theEntityClass = mircoders.entity.EntityTopics.class;
   }
 
@@ -81,7 +81,7 @@ public class DatabaseTopics extends Database implements StorageObject{
       Entity e = (Entity) i.next();
       Map entry = new HashMap();
       entry.put("key", e.getId());
-      entry.put("value", e.getValue("title"));
+      entry.put("value", e.getFieldValue("title"));
 
       result.add(entry);
     }
index 8c4e0bc..ce42e11 100755 (executable)
@@ -55,8 +55,8 @@ public class DatabaseUploadedMedia extends Database implements StorageObject {
 
     logger = new LoggerWrapper("Database.UploadedMedia");
 
-    theTable="uploaded_media";
-    theCoreTable="media";
+    mainTable="uploaded_media";
+    primaryKeySequence="media_id_seq";
     theEntityClass = mircoders.entity.EntityUploadedMedia.class;
   }
 
@@ -68,7 +68,7 @@ public class DatabaseUploadedMedia extends Database implements StorageObject {
   public Entity getMediaType(Entity ent) throws StorageObjectFailure {
     Entity type=null;
     try {
-      Iterator i = new EntityBrowser(DatabaseMediaType.getInstance(), ent.getValue("to_media_type") + " = id" , "id", 1);
+      Iterator i = new EntityBrowser(DatabaseMediaType.getInstance(), ent.getFieldValue("to_media_type") + " = id" , "id", 1);
       if (i.hasNext())
         type = (Entity) i.next();
     }
index 29dddac..3e2c4b3 100755 (executable)
@@ -65,7 +65,7 @@ public class DatabaseUsers extends Database implements StorageObject{
     logger = new LoggerWrapper("Database.Users");
 
     hasTimestamp = false;
-    theTable = "webdb_users";
+    mainTable = "webdb_users";
     theEntityClass = mircoders.entity.EntityUsers.class;
   }
 }
index d5609ea..4595bef 100755 (executable)
@@ -69,26 +69,26 @@ public class DatabaseVideo extends Database implements StorageObject{
     logger = new LoggerWrapper("Database.Video");
 
     hasTimestamp = true;
-    theTable = "video";
-    theCoreTable = "media";
+    mainTable = "video";
+    primaryKeySequence = "media_id_seq";
     theEntityClass = mircoders.entity.EntityVideo.class;
   }
 
   public void update(Entity theEntity) throws StorageObjectFailure {
-    String date = theEntity.getValue("date");
+    String date = theEntity.getFieldValue("date");
     if (date == null) {
       date = StringUtil.date2webdbDate(new GregorianCalendar());
-      theEntity.setValueForProperty("date", date);
+      theEntity.setFieldValue("date", date);
     }
 
     super.update(theEntity);
   }
 
   public String insert(Entity theEntity) throws StorageObjectFailure {
-    String date = theEntity.getValue("date");
+    String date = theEntity.getFieldValue("date");
     if (date == null) {
       date = StringUtil.date2webdbDate(new GregorianCalendar());
-      theEntity.setValueForProperty("date", date);
+      theEntity.setFieldValue("date", date);
     }
     return super.insert(theEntity);
   }
index 50503c1..5c9db62 100755 (executable)
@@ -41,8 +41,9 @@
                 f.lastHit.format(config["Mir.DefaultDateTimeFormat"], config["Mir.DefaultTimezone"])
                 ], 
                 "module=Abuse&id="+f.id, 
-                ["&do=moveup", "&do=movedown"], 
-                [lang("abuse.filters.moveup"), lang("abuse.filters.movedown")])
+                ["&do=moveup", "&do=movedown", "&do=movetop", "&do=movebottom"], 
+                [lang("abuse.filters.moveup"), lang("abuse.filters.movedown"),
+                 lang("abuse.filters.movetop"), lang("abuse.filters.movebottom")])
               >
           <else>
               <call ListEntry([
@@ -52,8 +53,9 @@
                 "-"
                 ], 
                 "module=Abuse&id="+f.id, 
-                ["&do=moveup", "&do=movedown"], 
-                [lang("abuse.filters.moveup"), lang("abuse.filters.movedown")])
+                ["&do=moveup", "&do=movedown", "&do=movetop", "&do=movebottom"], 
+                [lang("abuse.filters.moveup"), lang("abuse.filters.movedown"),
+                 lang("abuse.filters.movetop"), lang("abuse.filters.movebottom")])
               >
           </if>
         <tr height="2" class="${TABLE_HEAD_CLASS}"><td colspan="6"> </td></tr>