1 21 package oracle.toplink.essentials.internal.ejb.cmp3.metadata.tables; 23 24 import javax.persistence.Table; 25 import javax.persistence.UniqueConstraint; 26 27 import oracle.toplink.essentials.internal.ejb.cmp3.metadata.MetadataHelper; 28 29 import oracle.toplink.essentials.internal.helper.DatabaseTable; 30 31 37 public class MetadataTable { 38 protected String m_name; 39 protected String m_schema; 40 protected String m_catalog; 41 protected DatabaseTable m_databaseTable; 42 43 46 public MetadataTable() { 47 m_databaseTable = new DatabaseTable(); 48 } 49 50 53 public MetadataTable(Table table) { 54 this(); 55 56 if (table != null) { 57 m_name = table.name(); 58 m_schema = table.schema(); 59 m_catalog = table.catalog(); 60 61 processName(); 62 processUniqueConstraints(table.uniqueConstraints()); 63 } 64 } 65 66 69 public String getCatalog() { 70 return m_catalog; 71 } 72 73 76 public DatabaseTable getDatabaseTable() { 77 return m_databaseTable; 78 } 79 80 83 public String getName() { 84 return m_name; 85 } 86 87 90 public String getSchema() { 91 return m_schema; 92 } 93 94 97 public boolean loadedFromXML() { 98 return false; 99 } 100 101 104 protected void processName() { 105 if (! m_name.equals("")) { 107 setName(MetadataHelper.getFullyQualifiedTableName(m_name, m_catalog, m_schema)); 108 } 109 } 110 111 115 protected void processUniqueConstraints(UniqueConstraint[] uniqueConstraints) { 116 for (UniqueConstraint uniqueConstraint : uniqueConstraints) { 117 m_databaseTable.addUniqueConstraints(uniqueConstraint.columnNames()); 118 } 119 } 120 121 124 public void setName(String name) { 125 m_databaseTable.setPossiblyQualifiedName(name); 126 } 127 } 128 | Popular Tags |