1 package mircoders.entity;
13 * Diese Klasse enthält die Daten eines MetaObjekts
20 public class EntityVideo extends EntityUploadedMedia
28 public EntityVideo(StorageObject theStorage) {
30 setStorage(theStorage);
36 public byte[] getVideoData() throws StorageObjectException
39 Connection con=null;Statement stmt=null;
40 byte[] video_data=null;
43 con = theStorageObject.getPooledCon();
44 con.setAutoCommit(false);
45 stmt = con.createStatement();
46 ResultSet rs = theStorageObject.executeSql(stmt,"select video_data from video where id="+getId());
49 video_data = rs.getBytes(1);
54 catch (Exception e) {theLog.printDebugInfo("-- getImage gescheitert: "+e.toString());}
56 try {con.setAutoCommit(true); } catch (Exception e) {;}
57 theStorageObject.freeConnection(con,stmt); }
62 public void setVideoData(byte[] uploadData) throws StorageObjectException
64 if (uploadData!=null) {
65 Connection con=null;PreparedStatement pstmt=null;
68 con = theStorageObject.getPooledCon();
69 con.setAutoCommit(false);
70 theLog.printDebugInfo("setvideo :: trying to insert video");
73 String sql = "update videos set image_data=? where id="+getId();
74 theLog.printDebugInfo("setvideo: "+ sql);
75 pstmt = con.prepareStatement(sql);
76 pstmt.setBytes(1, uploadData);
77 pstmt.executeUpdate();
78 sql="update content set is_produced='0' where to_media="+getId();
79 pstmt = con.prepareStatement(sql);
80 pstmt.executeUpdate();
82 catch (Exception e) {theLog.printDebugInfo("setvideo :: setvideo gescheitert: "+e.toString());}
84 try {con.setAutoCommit(true); } catch (Exception e) {;}
85 theStorageObject.freeConnection(con,pstmt); }
89 public void update() throws StorageObjectException {
92 theStorageObject.executeUpdate("update content set is_produced='0' where to_media="+getId());
93 } catch (SQLException e) {
94 theLog.printError("video :: update :: failed!! "+ e.toString());
98 public void setValues(HashMap theStringValues)
100 if (theStringValues != null) {
101 if (!theStringValues.containsKey("is_published"))
102 theStringValues.put("is_published","0");
104 super.setValues(theStringValues);