Search in sources :

Example 1 with SqlDtDefinitionModel

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());
    }
}
Also used : HashMap(java.util.HashMap) DtDefinition(io.vertigo.dynamo.domain.metamodel.DtDefinition) ArrayList(java.util.ArrayList) List(java.util.List) AssociationSimpleDefinition(io.vertigo.dynamo.domain.metamodel.association.AssociationSimpleDefinition) SqlDtDefinitionModel(io.vertigo.studio.plugins.mda.domain.sql.model.SqlDtDefinitionModel) AssociationNNDefinition(io.vertigo.dynamo.domain.metamodel.association.AssociationNNDefinition)

Aggregations

DtDefinition (io.vertigo.dynamo.domain.metamodel.DtDefinition)1 AssociationNNDefinition (io.vertigo.dynamo.domain.metamodel.association.AssociationNNDefinition)1 AssociationSimpleDefinition (io.vertigo.dynamo.domain.metamodel.association.AssociationSimpleDefinition)1 SqlDtDefinitionModel (io.vertigo.studio.plugins.mda.domain.sql.model.SqlDtDefinitionModel)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 List (java.util.List)1