propertiesInitializer = ModelStructurePropertiesInitializerFactory.getDataMartStructurePropertiesInitializer(dataSource);
}
public IModelStructure build() {
IModelStructure dataMartStructure;
List<IDataSourceConfiguration> subConfigurations;
String datamartName;
Map classMetadata;
dataMartStructure = new ModelStructure();
dataMartStructure.setName( getDataSource().getName() );
propertiesInitializer.addProperties(dataMartStructure);
subConfigurations = getDataSource().getSubConfigurations();
for(int i = 0; i < subConfigurations.size(); i++) {
datamartName = subConfigurations.get(i).getModelName();
Assert.assertNotNull(getDataSource(), "datasource cannot be null");
SessionFactory sf = getDataSource().getHibernateSessionFactory(datamartName);
if(sf == null) {
throw new MissingResourceException("Impossible to find the jar file associated to datamart named: [" + datamartName + "]"
, SessionFactory.class.getName()
, datamartName );
}
Map calculatedFields = subConfigurations.get(i).loadCalculatedFields();
dataMartStructure.setCalculatedFields(calculatedFields);
classMetadata = sf.getAllClassMetadata();
for(Iterator it = classMetadata.keySet().iterator(); it.hasNext(); ) {
String entityType = (String)it.next();
addEntity(dataMartStructure, datamartName, entityType);