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/DBKeywordMapBuilder.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 DBKeywordMapBuilder implements MapBuilder
14  {
15      /** the name of this class */
16      public static final String CLASS_NAME = "org.openscience.nmrshiftdb.om.map.DBKeywordMapBuilder";
17  
18      /** item */
19      public static String getTable( )
20      {
21          return "KEYWORD";
22      }
23  
24  
25      /** KEYWORD.KEYWORD_ID */
26      public static String getDBKeyword_KeywordId()
27      {
28          return getTable() + ".KEYWORD_ID";
29      }
30  
31      /** KEYWORD.KEYWORD */
32      public static String getDBKeyword_Keyword()
33      {
34          return getTable() + ".KEYWORD";
35      }
36  
37      /** KEYWORD.KEYWORD_SOUNDEX */
38      public static String getDBKeyword_KeywordSoundex()
39      {
40          return getTable() + ".KEYWORD_SOUNDEX";
41      }
42  
43      /**  the database map  */
44      private DatabaseMap dbMap = null;
45  
46      /**
47          tells us if this DatabaseMapBuilder is built so that we don't have
48          to re-build it every time
49      */
50      public boolean isBuilt()
51      {
52          if ( dbMap != null )
53              return true;
54          return false;
55      }
56  
57      /**  gets the databasemap this map builder built.  */
58      public DatabaseMap getDatabaseMap()
59      {
60          return this.dbMap;
61      }
62      /** the doBuild() method builds the DatabaseMap */
63      public void doBuild() throws Exception
64      {
65          dbMap = TurbineDB.getDatabaseMap("default");
66  
67          dbMap.addTable(getTable());
68          TableMap tMap = dbMap.getTable(getTable());
69  
70                  tMap.setPrimaryKeyMethod(TableMap.IDBROKERTABLE);
71          
72  
73  
74                    tMap.addPrimaryKey ( getDBKeyword_KeywordId(), new Integer(0) );
75            
76                    tMap.addColumn ( getDBKeyword_Keyword(), new String() );
77            
78                    tMap.addColumn ( getDBKeyword_KeywordSoundex(), new String() );
79            
80      }
81  
82  }