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 ActivityMapBuilder implements MapBuilder {
15: /**
16: * The name of this class
17: */
18: public static final String CLASS_NAME = "org.tigris.scarab.om.map.ActivityMapBuilder";
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_ACTIVITY");
53: TableMap tMap = dbMap.getTable("SCARAB_ACTIVITY");
54:
55: tMap.setPrimaryKeyMethod(TableMap.ID_BROKER);
56:
57: tMap.setPrimaryKeyMethodInfo(tMap.getName());
58:
59: tMap.addPrimaryKey("SCARAB_ACTIVITY.ACTIVITY_ID", new Long(0));
60: tMap.addForeignKey("SCARAB_ACTIVITY.ISSUE_ID", new Long(0),
61: "SCARAB_ISSUE", "ISSUE_ID");
62: tMap.addForeignKey("SCARAB_ACTIVITY.ATTRIBUTE_ID", new Integer(
63: 0), "SCARAB_ATTRIBUTE", "ATTRIBUTE_ID");
64: tMap.addForeignKey("SCARAB_ACTIVITY.TRANSACTION_ID",
65: new Long(0), "SCARAB_TRANSACTION", "TRANSACTION_ID");
66: tMap.addColumn("SCARAB_ACTIVITY.OLD_NUMERIC_VALUE",
67: new Integer(0));
68: tMap.addColumn("SCARAB_ACTIVITY.NEW_NUMERIC_VALUE",
69: new Integer(0));
70: tMap.addForeignKey("SCARAB_ACTIVITY.OLD_USER_ID",
71: new Integer(0), "TURBINE_USER", "USER_ID");
72: tMap.addForeignKey("SCARAB_ACTIVITY.NEW_USER_ID",
73: new Integer(0), "TURBINE_USER", "USER_ID");
74: tMap.addForeignKey("SCARAB_ACTIVITY.OLD_OPTION_ID",
75: new Integer(0), "SCARAB_ATTRIBUTE_OPTION", "OPTION_ID");
76: tMap.addForeignKey("SCARAB_ACTIVITY.NEW_OPTION_ID",
77: new Integer(0), "SCARAB_ATTRIBUTE_OPTION", "OPTION_ID");
78: tMap.addColumn("SCARAB_ACTIVITY.OLD_VALUE", "");
79: tMap.addColumn("SCARAB_ACTIVITY.NEW_VALUE", "");
80: tMap.addForeignKey("SCARAB_ACTIVITY.DEPEND_ID", new Integer(0),
81: "SCARAB_DEPEND", "DEPEND_ID");
82: tMap.addColumn("SCARAB_ACTIVITY.DESCRIPTION", "");
83: tMap.addColumn("SCARAB_ACTIVITY.END_DATE", new Date());
84: tMap.addForeignKey("SCARAB_ACTIVITY.ATTACHMENT_ID",
85: new Long(0), "SCARAB_ATTACHMENT", "ATTACHMENT_ID");
86: tMap.addColumn("SCARAB_ACTIVITY.ACTIVITY_TYPE", "");
87: }
88: }
|