1 package org.tigris.scarab.om.map; 2 3 import java.util.Date ; 4 import java.math.BigDecimal ; 5 6 import org.apache.torque.Torque; 7 import org.apache.torque.TorqueException; 8 import org.apache.torque.map.MapBuilder; 9 import org.apache.torque.map.DatabaseMap; 10 import org.apache.torque.map.TableMap; 11 12 14 public class AttachmentMapBuilder implements MapBuilder 15 { 16 19 public static final String CLASS_NAME = 20 "org.tigris.scarab.om.map.AttachmentMapBuilder"; 21 22 23 26 private DatabaseMap dbMap = null; 27 28 34 public boolean isBuilt() 35 { 36 return (dbMap != null); 37 } 38 39 44 public DatabaseMap getDatabaseMap() 45 { 46 return this.dbMap; 47 } 48 49 54 public void doBuild() throws TorqueException 55 { 56 dbMap = Torque.getDatabaseMap("scarab"); 57 58 dbMap.addTable("SCARAB_ATTACHMENT"); 59 TableMap tMap = dbMap.getTable("SCARAB_ATTACHMENT"); 60 61 tMap.setPrimaryKeyMethod(TableMap.ID_BROKER); 62 63 tMap.setPrimaryKeyMethodInfo(tMap.getName()); 64 65 tMap.addPrimaryKey("SCARAB_ATTACHMENT.ATTACHMENT_ID", new Long (0)); 66 tMap.addForeignKey( 67 "SCARAB_ATTACHMENT.ISSUE_ID", new Long (0) , "SCARAB_ISSUE" , 68 "ISSUE_ID"); 69 tMap.addForeignKey( 70 "SCARAB_ATTACHMENT.ATTACHMENT_TYPE_ID", new Integer (0) , "SCARAB_ATTACHMENT_TYPE" , 71 "ATTACHMENT_TYPE_ID"); 72 tMap.addColumn("SCARAB_ATTACHMENT.ATTACHMENT_NAME", ""); 73 tMap.addColumn("SCARAB_ATTACHMENT.ATTACHMENT_DATA", ""); 74 tMap.addColumn("SCARAB_ATTACHMENT.ATTACHMENT_FILE_PATH", ""); 75 tMap.addColumn("SCARAB_ATTACHMENT.ATTACHMENT_MIME_TYPE", ""); 76 tMap.addForeignKey( 77 "SCARAB_ATTACHMENT.MODIFIED_BY", new Integer (0) , "TURBINE_USER" , 78 "USER_ID"); 79 tMap.addForeignKey( 80 "SCARAB_ATTACHMENT.CREATED_BY", new Integer (0) , "TURBINE_USER" , 81 "USER_ID"); 82 tMap.addColumn("SCARAB_ATTACHMENT.MODIFIED_DATE", new Date ()); 83 tMap.addColumn("SCARAB_ATTACHMENT.CREATED_DATE", new Date ()); 84 tMap.addColumn("SCARAB_ATTACHMENT.DELETED", new Integer (0)); 85 } 86 } 87 | Popular Tags |