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 StoredBlogMapBuilder implements MapBuilder 12 { 13 /*** 14 * The name of this class 15 */ 16 public static final String CLASS_NAME = 17 "net.sourceforge.blogentis.om.map.StoredBlogMapBuilder"; 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("Blog"); 56 TableMap tMap = dbMap.getTable("Blog"); 57 58 tMap.setPrimaryKeyMethod(TableMap.NATIVE); 59 60 tMap.setPrimaryKeyMethodInfo("Blog_SEQ"); 61 62 tMap.addPrimaryKey("Blog.BLOG_ID", new Integer(0)); 63 tMap.addColumn("Blog.NAME", new String()); 64 tMap.addColumn("Blog.TITLE", new String()); 65 tMap.addColumn("Blog.DESCRIPTION", new String()); 66 tMap.addColumn("Blog.OBJECT_DATA", new Object()); 67 } 68 }