01: package org.tigris.scarab.om.map;
02:
03: import java.util.Date;
04: import java.math.BigDecimal;
05:
06: import org.apache.torque.Torque;
07: import org.apache.torque.TorqueException;
08: import org.apache.torque.map.MapBuilder;
09: import org.apache.torque.map.DatabaseMap;
10: import org.apache.torque.map.TableMap;
11:
12: /**
13: */
14: public class QueryMapBuilder implements MapBuilder {
15: /**
16: * The name of this class
17: */
18: public static final String CLASS_NAME = "org.tigris.scarab.om.map.QueryMapBuilder";
19:
20: /**
21: * The database map.
22: */
23: private DatabaseMap dbMap = null;
24:
25: /**
26: * Tells us if this DatabaseMapBuilder is built so that we
27: * don't have to re-build it every time.
28: *
29: * @return true if this DatabaseMapBuilder is built
30: */
31: public boolean isBuilt() {
32: return (dbMap != null);
33: }
34:
35: /**
36: * Gets the databasemap this map builder built.
37: *
38: * @return the databasemap
39: */
40: public DatabaseMap getDatabaseMap() {
41: return this .dbMap;
42: }
43:
44: /**
45: * The doBuild() method builds the DatabaseMap
46: *
47: * @throws TorqueException
48: */
49: public void doBuild() throws TorqueException {
50: dbMap = Torque.getDatabaseMap("scarab");
51:
52: dbMap.addTable("SCARAB_QUERY");
53: TableMap tMap = dbMap.getTable("SCARAB_QUERY");
54:
55: tMap.setPrimaryKeyMethod(TableMap.ID_BROKER);
56:
57: tMap.setPrimaryKeyMethodInfo(tMap.getName());
58:
59: tMap.addPrimaryKey("SCARAB_QUERY.QUERY_ID", new Long(0));
60: tMap.addForeignKey("SCARAB_QUERY.USER_ID", new Integer(0),
61: "TURBINE_USER", "USER_ID");
62: tMap.addColumn("SCARAB_QUERY.NAME", "");
63: tMap.addColumn("SCARAB_QUERY.DESCRIPTION", "");
64: tMap.addColumn("SCARAB_QUERY.VALUE", "");
65: tMap.addForeignKey("SCARAB_QUERY.SCOPE_ID", new Integer(0),
66: "SCARAB_SCOPE", "SCOPE_ID");
67: tMap.addForeignKey("SCARAB_QUERY.ISSUE_TYPE_ID",
68: new Integer(0), "SCARAB_ISSUE_TYPE", "ISSUE_TYPE_ID");
69: tMap.addForeignKey("SCARAB_QUERY.MODULE_ID", new Integer(0),
70: "SCARAB_MODULE", "MODULE_ID");
71: tMap.addForeignKey("SCARAB_QUERY.LIST_ID", new Long(0),
72: "SCARAB_MIT_LIST", "LIST_ID");
73: tMap.addColumn("SCARAB_QUERY.DELETED", new Integer(0));
74: tMap.addColumn("SCARAB_QUERY.APPROVED", new Integer(0));
75: tMap.addColumn("SCARAB_QUERY.CREATED_DATE", new Date());
76: tMap.addForeignKey("SCARAB_QUERY.SUBSCRIPTION_FREQUENCY_ID",
77: new Integer(0), "SCARAB_FREQUENCY", "FREQUENCY_ID");
78: tMap.addColumn("SCARAB_QUERY.HOME_PAGE", new Integer(0));
79: tMap.addColumn("SCARAB_QUERY.PREFERRED_ORDER", new Integer(0));
80: }
81: }
|