1 package org.apache.james.mailboxmanager.torque.om.map;
2
3 import java.util.Date;
4
5 import org.apache.torque.Torque;
6 import org.apache.torque.TorqueException;
7 import org.apache.torque.map.DatabaseMap;
8 import org.apache.torque.map.MapBuilder;
9 import org.apache.torque.map.TableMap;
10
11
12
13
14
15
16
17 public class MessageMapBuilder implements MapBuilder {
18
19
20
21 public static final String CLASS_NAME = "org.apache.james.mailboxmanager.torque.om.map.MessageMapBuilder";
22
23
24
25
26 private DatabaseMap dbMap = null;
27
28
29
30
31
32
33
34 public boolean isBuilt() {
35 return (dbMap != null);
36 }
37
38
39
40
41
42
43 public DatabaseMap getDatabaseMap() {
44 return this.dbMap;
45 }
46
47
48
49
50
51
52 public void doBuild() throws TorqueException {
53 dbMap = Torque.getDatabaseMap("mailboxmanager");
54
55 dbMap.addTable("message");
56 TableMap tMap = dbMap.getTable("message");
57
58 tMap.setPrimaryKeyMethod("none");
59
60 tMap.addForeignPrimaryKey("message.MAILBOX_ID", new Long(0), "mailbox",
61 "mailbox_id");
62 tMap.addPrimaryKey("message.UID", new Long(0));
63 tMap.addColumn("message.FLAGS", new Integer(0));
64 tMap.addColumn("message.INTERNAL_DATE", new Date());
65 }
66 }