use of io.vertigo.studio.plugins.mda.domain.sql.model.SqlDtDefinitionModel in project vertigo by KleeGroup.
the class SqlGeneratorPlugin method generateSql.
private void generateSql(final FileGeneratorConfig fileGeneratorConfig, final MdaResultBuilder mdaResultBuilder) {
final Map<String, List<SqlDtDefinitionModel>> mapListDtDef = new HashMap<>();
for (final DtDefinition dtDefinition : DomainUtil.sortDefinitionCollection(DomainUtil.getDtDefinitions())) {
if (dtDefinition.isPersistent()) {
final SqlDtDefinitionModel templateDef = new SqlDtDefinitionModel(dtDefinition);
final String dataSpace = dtDefinition.getDataSpace();
final List<SqlDtDefinitionModel> listDtDef = obtainListDtDefinitionPerDataSpace(mapListDtDef, dataSpace);
listDtDef.add(templateDef);
}
}
//
final Collection<AssociationSimpleDefinition> collectionSimpleAll = DomainUtil.getSimpleAssociations();
final Collection<AssociationNNDefinition> collectionNNAll = DomainUtil.getNNAssociations();
//
for (final Entry<String, List<SqlDtDefinitionModel>> entry : mapListDtDef.entrySet()) {
final String dataSpace = entry.getKey();
final Collection<AssociationSimpleDefinition> associationSimpleDefinitions = filterAssociationSimple(collectionSimpleAll, dataSpace);
final Collection<AssociationNNDefinition> associationNNDefinitions = filterAssociationNN(collectionNNAll, dataSpace);
generateSqlByDataSpace(fileGeneratorConfig, mdaResultBuilder, associationSimpleDefinitions, associationNNDefinitions, dataSpace, entry.getValue());
}
}
Aggregations