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