View Javadoc
1 /* 2 * Created on 2003-6-4 15:51:31 by joel guo 3 * 4 * vTradEx Information Technology Inc. 5 */ 6 package com.cyclops.dbdigger.schema.torque; 7 import java.util.HashMap; 8 9 import org.apache.commons.lang.StringUtils; 10 11 import com.cyclops.dbdigger.schema.DefaultDatabase; 12 /*** A database model to mount torque schema 13 * 14 * @author <a href="mailto:joeblack.guo@vtradex.com">joel guo</a> 15 * @since 2003-6-4 15:51:31 16 */ 17 public class TorqueDatabase { 18 private static final TorqueTable[] EMPTY_TABLE_ARRAY = new TorqueTable[0]; 19 private String description; 20 private String name; 21 private String pkg; 22 private HashMap tables = new HashMap(); 23 /*** Method addDatabase() 24 * @param td TorqueDatabase object 25 */ 26 public void addToDatabase(DefaultDatabase td) { 27 TorqueTable[] atables = getTables(); 28 for (int i = 0; i < atables.length; i++) { 29 TorqueTable table = atables[i]; 30 td.addTable(table); 31 } 32 } 33 /*** Method addTable() 34 * @param table TorqueTable object to be added 35 */ 36 public void addTable(TorqueTable table) { 37 tables.put(table.getName(), table); 38 if (StringUtils.isEmpty(pkg)) { 39 table.setJavaClassName(table.getJavaName()); 40 } else { 41 table.setJavaClassName(pkg + "." + table.getJavaName()); 42 } 43 } 44 /*** Method getDescription() 45 * @return Description 46 */ 47 public String getDescription() { 48 return description; 49 } 50 /*** Method getName() 51 * @return Name of this torque database model 52 */ 53 public String getName() { 54 return name; 55 } 56 /*** Method getPackage() 57 * @return Package of this torque database model 58 */ 59 public String getPackage() { 60 return pkg; 61 } 62 /*** Get all tables in this temporary database 63 * @return Table array 64 */ 65 public TorqueTable[] getTables() { 66 return (TorqueTable[]) tables.values().toArray(EMPTY_TABLE_ARRAY); 67 } 68 /*** Method setDescription() 69 * @param string Description 70 */ 71 public void setDescription(String string) { 72 description = string; 73 } 74 /*** Method setName() 75 * @param string Name of this database model 76 */ 77 public void setName(String string) { 78 name = string; 79 } 80 /*** Method setPackage() 81 * @param string Package of this schema 82 */ 83 public void setPackage(String string) { 84 pkg = string; 85 } 86 }

This page was automatically generated by Maven