View Javadoc

1   package net.sourceforge.blogentis.om.map;
2   
3   import org.apache.torque.Torque;
4   import org.apache.torque.TorqueException;
5   import org.apache.torque.map.DatabaseMap;
6   import org.apache.torque.map.MapBuilder;
7   import org.apache.torque.map.TableMap;
8   
9   /***
10    */
11  public class TurbineRolePermissionMapBuilder implements MapBuilder
12  {
13      /***
14       * The name of this class
15       */
16      public static final String CLASS_NAME =
17          "net.sourceforge.blogentis.om.map.TurbineRolePermissionMapBuilder";
18  
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      {
33          return (dbMap != null);
34      }
35  
36      /***
37       * Gets the databasemap this map builder built.
38       *
39       * @return the databasemap
40       */
41      public DatabaseMap getDatabaseMap()
42      {
43          return this.dbMap;
44      }
45  
46      /***
47       * The doBuild() method builds the DatabaseMap
48       *
49       * @throws TorqueException
50       */
51      public void doBuild() throws TorqueException
52      {
53          dbMap = Torque.getDatabaseMap("blogentis");
54  
55          dbMap.addTable("TURBINE_ROLE_PERMISSION");
56          TableMap tMap = dbMap.getTable("TURBINE_ROLE_PERMISSION");
57  
58          tMap.setPrimaryKeyMethod(TableMap.NATIVE);
59  
60          tMap.setPrimaryKeyMethodInfo("TURBINE_ROLE_PERMISSION_SEQ");
61  
62                tMap.addForeignPrimaryKey(
63                  "TURBINE_ROLE_PERMISSION.ROLE_ID", new Integer(0) , "TURBINE_ROLE" ,
64                  "ROLE_ID");
65                      tMap.addForeignPrimaryKey(
66                  "TURBINE_ROLE_PERMISSION.PERMISSION_ID", new Integer(0) , "TURBINE_PERMISSION" ,
67                  "PERMISSION_ID");
68            }
69  }