1 21 package oracle.toplink.essentials.internal.ejb.cmp3.metadata.sequencing; 23 24 import java.util.List ; 25 import java.util.ArrayList ; 26 27 import javax.persistence.TableGenerator; 28 import javax.persistence.UniqueConstraint; 29 30 37 public class MetadataTableGenerator extends MetadataGenerator { 38 protected TableGenerator m_tableGenerator; 39 protected List <String > m_uniqueConstraints; 40 41 44 protected MetadataTableGenerator(String entityClassName) { 45 super(entityClassName); 46 } 47 48 51 public MetadataTableGenerator(TableGenerator tableGenerator, String entityClassName) { 52 super(entityClassName); 53 m_tableGenerator = tableGenerator; 54 } 55 56 59 public boolean equals(Object objectToCompare) { 60 if (objectToCompare instanceof MetadataTableGenerator) { 61 MetadataTableGenerator generator = (MetadataTableGenerator) objectToCompare; 62 63 if (!generator.getName().equals(getName())) { 64 return false; 65 } 66 67 if (generator.getInitialValue() != getInitialValue()) { 68 return false; 69 } 70 71 if (generator.getAllocationSize() != getAllocationSize()) { 72 return false; 73 } 74 75 if (!generator.getPkColumnName().equals(getPkColumnName())) { 76 return false; 77 } 78 79 if (!generator.getValueColumnName().equals(getValueColumnName())) { 80 return false; 81 } 82 83 if (!generator.getPkColumnValue().equals(getPkColumnValue())) { 84 return false; 85 } 86 87 if (!generator.getTable().equals(getTable())) { 88 return false; 89 } 90 91 if (!generator.getSchema().equals(getSchema())) { 92 return false; 93 } 94 95 return generator.getCatalog().equals(getCatalog()); 96 } 97 98 return false; 99 } 100 101 104 public int getAllocationSize() { 105 return m_tableGenerator.allocationSize(); 106 } 107 108 112 public String getCatalog() { 113 return m_tableGenerator.catalog(); 114 } 115 116 119 public int getInitialValue() { 120 return m_tableGenerator.initialValue(); 121 } 122 123 126 public String getName() { 127 return m_tableGenerator.name(); 128 } 129 130 133 public String getPkColumnName() { 134 return m_tableGenerator.pkColumnName(); 135 } 136 137 140 public String getPkColumnValue() { 141 return m_tableGenerator.pkColumnValue(); 142 } 143 144 148 public String getSchema() { 149 return m_tableGenerator.schema(); 150 } 151 152 155 public String getTable() { 156 return m_tableGenerator.table(); 157 } 158 159 162 public List <String > getUniqueConstraints() { 163 if (m_uniqueConstraints == null) { 164 m_uniqueConstraints = new ArrayList (); 165 166 for (UniqueConstraint uniqueConstraint : m_tableGenerator.uniqueConstraints()) { 167 for (String columnName : uniqueConstraint.columnNames()) { 168 m_uniqueConstraints.add(columnName); 169 } 170 } 171 } 172 173 return m_uniqueConstraints; 174 } 175 176 179 public String getValueColumnName() { 180 return m_tableGenerator.valueColumnName(); 181 } 182 } 183 | Popular Tags |