Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: org/openscience/nmrshiftdb/om/map/DBReviewGroupDBUserMapBuilder.java


1   package org.openscience.nmrshiftdb.om.map;
2   
3   import java.util.*;
4   import java.math.*;
5   import org.apache.turbine.services.db.PoolBrokerService;
6   import org.apache.turbine.services.db.TurbineDB;
7   import org.apache.turbine.util.db.map.MapBuilder;
8   import org.apache.turbine.util.db.map.DatabaseMap;
9   import org.apache.turbine.util.db.map.TableMap;
10  
11  /**
12   */
13  public class DBReviewGroupDBUserMapBuilder implements MapBuilder
14  {
15      /** the name of this class */
16      public static final String CLASS_NAME = "org.openscience.nmrshiftdb.om.map.DBReviewGroupDBUserMapBuilder";
17  
18      /** item */
19      public static String getTable( )
20      {
21          return "REVIEWGROUP_USER";
22      }
23  
24  
25      /** REVIEWGROUP_USER.REVIEWGROUP_ID */
26      public static String getDBReviewGroupDBUser_ReviewgroupId()
27      {
28          return getTable() + ".REVIEWGROUP_ID";
29      }
30  
31      /** REVIEWGROUP_USER.USER_ID */
32      public static String getDBReviewGroupDBUser_UserId()
33      {
34          return getTable() + ".USER_ID";
35      }
36  
37      /**  the database map  */
38      private DatabaseMap dbMap = null;
39  
40      /**
41          tells us if this DatabaseMapBuilder is built so that we don't have
42          to re-build it every time
43      */
44      public boolean isBuilt()
45      {
46          if ( dbMap != null )
47              return true;
48          return false;
49      }
50  
51      /**  gets the databasemap this map builder built.  */
52      public DatabaseMap getDatabaseMap()
53      {
54          return this.dbMap;
55      }
56      /** the doBuild() method builds the DatabaseMap */
57      public void doBuild() throws Exception
58      {
59          dbMap = TurbineDB.getDatabaseMap("default");
60  
61          dbMap.addTable(getTable());
62          TableMap tMap = dbMap.getTable(getTable());
63  
64                  tMap.setPrimaryKeyMethod("none");
65          
66  
67  
68                    tMap.addForeignPrimaryKey ( getDBReviewGroupDBUser_ReviewgroupId(), new Integer(0) , "REVIEWGROUP" , "REVIEWGROUP_ID" );
69            
70                    tMap.addForeignPrimaryKey ( getDBReviewGroupDBUser_UserId(), new Integer(0) , "NMRSHIFTDB_USER" , "USER_ID" );
71            
72      }
73  
74  }