change the way, size, height, OID, etc is entered in the DB: do it via the Entity...
authormh <mh>
Thu, 5 Dec 2002 08:40:18 +0000 (08:40 +0000)
committermh <mh>
Thu, 5 Dec 2002 08:40:18 +0000 (08:40 +0000)
source/mircoders/entity/EntityImages.java

index 6f71820..942cd12 100755 (executable)
@@ -54,7 +54,7 @@ import mir.storage.*;
  * Diese Klasse enthält die Daten eines MetaObjekts
  *
  * @author RK, mh
- * @version $Id: EntityImages.java,v 1.6.4.4 2002/11/27 21:16:54 mh Exp $
+ * @version $Id: EntityImages.java,v 1.6.4.5 2002/12/05 08:40:18 mh Exp $
  */
 
 
@@ -152,21 +152,18 @@ public class EntityImages extends EntityUploadedMedia
         webdbImage.setIcon(lobIcon.getOutputStream());
         lobImage.close();
         lobIcon.close();
-        String sql = "update images set img_height='"
-                      +webdbImage.getImageHeight() +
-                      "',img_width='"   + webdbImage.getImageWidth() +
-                      "',icon_height='" + webdbImage.getIconHeight() +
-                      "',icon_width='"  + webdbImage.getIconWidth()
-                      +  "', image_data="+oidImage+", icon_data="+oidIcon
-                      +" where id="+getId();
-        theLog.printDebugInfo("settimage :: updating sizes: "+ sql);
-        pstmt = con.prepareStatement(sql);
-        //pstmt.setBytes(1, imageData);
-        //pstmt.setBytes(2, iconData);
-        pstmt.executeUpdate();
-        sql="update content set is_produced='0' where to_media="+getId();
-        pstmt = con.prepareStatement(sql);
-        pstmt.executeUpdate();
+
+        setValueForProperty("img_height",
+                          new Integer(webdbImage.getImageHeight()).toString());
+        setValueForProperty("img_width",
+                          new Integer(webdbImage.getImageWidth()).toString());
+        setValueForProperty("icon_height",
+                          new Integer(webdbImage.getIconHeight()).toString());
+        setValueForProperty("icon_width",
+                          new Integer(webdbImage.getIconWidth()).toString());
+        setValueForProperty("image_data", new Integer(oidImage).toString());
+        setValueForProperty("icon_data", new Integer(oidIcon).toString());
+        update();
                        }
                        catch (Exception e) {throwStorageObjectException(e, "settimage :: setImage gescheitert: ");}
                        finally {
@@ -181,24 +178,6 @@ public class EntityImages extends EntityUploadedMedia
                }
        }
 
-       public void update() throws StorageObjectException {
-               super.update();
-               try {
-                       theStorageObject.executeUpdate("update content set is_produced='0' where to_media="+getId());
-               } catch (SQLException e) {
-                       throwStorageObjectException(e, "EntityImages :: update :: failed!! ");
-               }
-       }
-
-       public void setValues(HashMap theStringValues)
-       {
-               if (theStringValues != null) {
-                       if (!theStringValues.containsKey("is_published"))
-                        theStringValues.put("is_published","0");
-               }
-               super.setValues(theStringValues);
-       }
-
   /**
    * Takes an OutputStream as an argument and reads in the data
    * from the DB and writes it to the OutputStream.