1 package mircoders.entity;
13 * Diese Klasse enthält die Daten eines MetaObjekts
20 public class EntityVideo extends Entity
22 private static int instances;
30 public EntityVideo(StorageObject theStorage) {
32 setStorage(theStorage);
38 public byte[] getVideoData()
41 Connection con=null;Statement stmt=null;
42 byte[] video_data=null;
45 con = theStorageObject.getPooledCon();
46 con.setAutoCommit(false);
47 stmt = con.createStatement();
48 ResultSet rs = theStorageObject.executeSql(stmt,"select video_data from video where id="+getId());
51 video_data = rs.getBytes(1);
56 catch (Exception e) {theLog.printDebugInfo("-- getImage gescheitert: "+e.toString());}
58 try {con.setAutoCommit(true); } catch (Exception e) {;}
59 theStorageObject.freeConnection(con,stmt); }
64 public void setVideoData(byte[] uploadData)
66 if (uploadData!=null) {
67 Connection con=null;PreparedStatement pstmt=null;
70 con = theStorageObject.getPooledCon();
71 con.setAutoCommit(false);
72 theLog.printDebugInfo("setvideo :: trying to insert video");
75 String sql = "update videos set image_data=? where id="+getId();
76 theLog.printDebugInfo("setvideo: "+ sql);
77 pstmt = con.prepareStatement(sql);
78 pstmt.setBytes(1, uploadData);
79 pstmt.executeUpdate();
80 sql="update content set is_produced='0' where to_media="+getId();
81 pstmt = con.prepareStatement(sql);
82 pstmt.executeUpdate();
84 catch (Exception e) {theLog.printDebugInfo("setvideo :: setvideo gescheitert: "+e.toString());}
86 try {con.setAutoCommit(true); } catch (Exception e) {;}
87 theStorageObject.freeConnection(con,pstmt); }
91 public void update() throws StorageObjectException {
94 theStorageObject.executeUpdate("update content set is_produced='0' where to_media="+getId());
95 } catch (SQLException e) {
96 theLog.printError("video :: update :: failed!! "+ e.toString());
100 public void setValues(HashMap theStringValues)
102 if (theStringValues != null) {
103 if (!theStringValues.containsKey("is_published"))
104 theStringValues.put("is_published","0");
106 super.setValues(theStringValues);
110 public void finalize() {