1 29 30 package com.caucho.amber.cfg; 31 32 import com.caucho.vfs.Path; 33 34 import java.util.HashMap ; 35 36 39 public class EntityMappingsConfig { 40 private Path _root; 41 42 private String _version; 44 45 private String _description; 47 private PersistenceUnitMetaDataConfig _persistenceUnitMetaData; 48 private String _package; 49 private String _schema; 50 private String _catalog; 51 private AccessType _access; 52 53 private HashMap <String , SequenceGeneratorConfig> _sequenceGeneratorMap 54 = new HashMap <String , SequenceGeneratorConfig>(); 55 56 private HashMap <String , TableGeneratorConfig> _tableGeneratorMap 57 = new HashMap <String , TableGeneratorConfig>(); 58 59 private HashMap <String , NamedQueryConfig> _namedQueryMap 60 = new HashMap <String , NamedQueryConfig>(); 61 62 private HashMap <String , NamedNativeQueryConfig> _namedNativeQueryMap 63 = new HashMap <String , NamedNativeQueryConfig>(); 64 65 private HashMap <String , SqlResultSetMappingConfig> _sqlResultSetMappingMap 66 = new HashMap <String , SqlResultSetMappingConfig>(); 67 68 private HashMap <String , MappedSuperclassConfig> _mappedSuperclassMap 69 = new HashMap <String , MappedSuperclassConfig>(); 70 71 private HashMap <String , EntityConfig> _entityMap 72 = new HashMap <String , EntityConfig>(); 73 74 private HashMap <String , EmbeddableConfig> _embeddableMap 75 = new HashMap <String , EmbeddableConfig>(); 76 77 78 public AccessType getAccess() 79 { 80 return _access; 81 } 82 83 public String getCatalog() 84 { 85 return _catalog; 86 } 87 88 public String getDescription() 89 { 90 return _description; 91 } 92 93 public String getPackage() 94 { 95 return _package; 96 } 97 98 public PersistenceUnitMetaDataConfig getPersistenceUnitMetaData() 99 { 100 return _persistenceUnitMetaData; 101 } 102 103 public void setPersistenceUnitMetaData(PersistenceUnitMetaDataConfig persistenceUnitMetaData) 104 { 105 _persistenceUnitMetaData = persistenceUnitMetaData; 106 } 107 108 public Path getRoot() 109 { 110 return _root; 111 } 112 113 public String getSchema() 114 { 115 return _schema; 116 } 117 118 public String getVersion() 119 { 120 return _version; 121 } 122 123 public void setAccess(String access) 124 { 125 _access = AccessType.valueOf(access); 126 } 127 128 public void setCatalog(String catalog) 129 { 130 _catalog = catalog; 131 } 132 133 public void setDescription(String description) 134 { 135 _description = description; 136 } 137 138 public void setPackage(String packageName) 139 { 140 _package = packageName; 141 } 142 143 public void setRoot(Path root) 144 { 145 _root = root; 146 } 147 148 public void setSchema(String schema) 149 { 150 _schema = schema; 151 } 152 153 public void setVersion(String version) 154 { 155 _version = version; 156 } 157 158 161 public void setSchemaLocation(String schema) 162 { 163 } 164 165 168 public void addEntity(EntityConfig entity) 169 { 170 String className = entity.getClassName(); 171 172 if ((_package == null) || className.startsWith(_package + ".")) 174 _entityMap.put(entity.getClassName(), entity); 175 else 176 _entityMap.put(_package + "." + entity.getClassName(), 177 entity); 178 } 179 180 183 public EntityConfig getEntityConfig(String name) 184 { 185 return _entityMap.get(name); 186 } 187 188 191 public HashMap <String , EntityConfig> getEntityMap() 192 { 193 return _entityMap; 194 } 195 196 public void addSequenceGenerator(SequenceGeneratorConfig sequenceGenerator) 197 { 198 _sequenceGeneratorMap.put(sequenceGenerator.getName(), sequenceGenerator); 199 } 200 201 public SequenceGeneratorConfig getSequenceGenerator(String name) 202 { 203 return _sequenceGeneratorMap.get(name); 204 } 205 206 public HashMap <String , SequenceGeneratorConfig> getSequenceGeneratorMap() 207 { 208 return _sequenceGeneratorMap; 209 } 210 211 public void addTableGenerator(TableGeneratorConfig tableGenerator) 212 { 213 _tableGeneratorMap.put(tableGenerator.getName(), tableGenerator); 214 } 215 216 public TableGeneratorConfig getTableGenerator(String name) 217 { 218 return _tableGeneratorMap.get(name); 219 } 220 221 public HashMap <String , TableGeneratorConfig> getTableGeneratorMap() 222 { 223 return _tableGeneratorMap; 224 } 225 226 public void addNamedQuery(NamedQueryConfig namedQuery) 227 { 228 _namedQueryMap.put(namedQuery.getName(), namedQuery); 229 } 230 231 public NamedQueryConfig getNamedQuery(String name) 232 { 233 return _namedQueryMap.get(name); 234 } 235 236 public HashMap <String , NamedQueryConfig> getNamedQueryMap() 237 { 238 return _namedQueryMap; 239 } 240 241 public void addNamedNativeQuery(NamedNativeQueryConfig namedNativeQuery) 242 { 243 _namedNativeQueryMap.put(namedNativeQuery.getName(), namedNativeQuery); 244 } 245 246 public NamedNativeQueryConfig getNamedNativeQuery(String name) 247 { 248 return _namedNativeQueryMap.get(name); 249 } 250 251 public HashMap <String , NamedNativeQueryConfig> getNamedNativeQueryMap() 252 { 253 return _namedNativeQueryMap; 254 } 255 256 public void addSqlResultSetMapping(SqlResultSetMappingConfig sqlResultSetMapping) 257 { 258 _sqlResultSetMappingMap.put(sqlResultSetMapping.getName(), sqlResultSetMapping); 259 } 260 261 public SqlResultSetMappingConfig getSqlResultSetMapping(String name) 262 { 263 return _sqlResultSetMappingMap.get(name); 264 } 265 266 public HashMap <String , SqlResultSetMappingConfig> getSqlResultSetMappingMap() 267 { 268 return _sqlResultSetMappingMap; 269 } 270 271 public void addMappedSuperclass(MappedSuperclassConfig mappedSuperclass) 272 { 273 _mappedSuperclassMap.put(mappedSuperclass.getClassName(), mappedSuperclass); 274 } 275 276 public MappedSuperclassConfig getMappedSuperclass(String name) 277 { 278 return _mappedSuperclassMap.get(name); 279 } 280 281 public HashMap <String , MappedSuperclassConfig> getMappedSuperclassMap() 282 { 283 return _mappedSuperclassMap; 284 } 285 286 public void addEmbeddable(EmbeddableConfig embeddable) 287 { 288 _embeddableMap.put(embeddable.getClassName(), embeddable); 289 } 290 291 public EmbeddableConfig getEmbeddable(String name) 292 { 293 return _embeddableMap.get(name); 294 } 295 296 public HashMap <String , EmbeddableConfig> getEmbeddableMap() 297 { 298 return _embeddableMap; 299 } 300 301 public String toString() 302 { 303 return _entityMap.toString(); 304 } 305 } 306 | Popular Tags |