mass update mir codeswitch
[mir.git] / source / mircoders / storage / DatabaseVideos.java
1 package mircoders.storage;
2
3 import java.lang.*;
4 import java.sql.*;
5 import java.io.*;
6 import java.util.*;
7
8 import freemarker.template.*;
9
10 import mir.storage.*;
11 import mir.entity.*;
12 import mir.misc.*;
13
14 /**
15  * <b>Diese Klasse implementiert die Datenbankverbindung zur MetaObjekt-Tabelle
16  *
17  *
18  */
19
20 public class DatabaseVideos extends Database implements StorageObject{
21
22         private static DatabaseVideos instance;
23         private static SimpleList publisherPopupData;
24
25         public static DatabaseVideos getInstance() throws StorageObjectException
26         {
27                 if (instance == null) {
28                         instance = new DatabaseVideos();
29                         instance.myselfDatabase = instance;
30                 }
31                 return instance;
32         }
33
34         private DatabaseVideos() throws StorageObjectException
35         {
36                 super();
37                 this.hasTimestamp = true;
38                 this.theTable="videos";
39                 this.theCoreTable="media";
40                 try {
41                         this.theEntityClass = Class.forName("mir.entity.EntityVideo");
42                 }
43                 catch (Exception e) { throw new StorageObjectException(e.toString());   }
44         }
45
46         public SimpleList getPopupData() {
47                 return getPopupData("title",true);
48         }
49
50         public void update(Entity theEntity) throws StorageObjectException
51         {
52                 theEntity.setValueForProperty("to_media_type","3");
53                 String date = theEntity.getValue("date");
54                 if (date==null){
55                         date = StringUtil.date2webdbDate(new GregorianCalendar());
56                         theEntity.setValueForProperty("date",date);
57                 }
58
59                 super.update(theEntity);
60         }
61
62
63         public String insert(Entity theEntity) throws StorageObjectException
64         {
65                 theEntity.setValueForProperty("to_media_type","3");
66                 String date = theEntity.getValue("date");
67                 if (date==null){
68                         date = StringUtil.date2webdbDate(new GregorianCalendar());
69                         theEntity.setValueForProperty("date",date);
70                 }
71                 return super.insert(theEntity);
72         }
73
74 }