Search in sources :

Example 61 with DtDefinition

use of io.vertigo.dynamo.domain.metamodel.DtDefinition in project vertigo by KleeGroup.

the class DomainGeneratorPlugin method generateJavaEnums.

private void generateJavaEnums(final FileGeneratorConfig fileGeneratorConfig, final MdaResultBuilder mdaResultBuilder) {
    final MasterDataValues masterDataValues = masterDataManagerOpt.isPresent() ? masterDataManagerOpt.get().getValues() : new MasterDataValues();
    Home.getApp().getDefinitionSpace().getAll(DtDefinition.class).stream().filter(dtDefinition -> dtDefinition.getStereotype() == DtStereotype.StaticMasterData).forEach(dtDefintion -> generateJavaEnum(fileGeneratorConfig, mdaResultBuilder, dtDefintion, masterDataValues.getOrDefault(dtDefintion.getClassCanonicalName(), Collections.emptyMap())));
}
Also used : MasterDataDefinitionModel(io.vertigo.studio.plugins.mda.domain.java.model.masterdata.MasterDataDefinitionModel) DtStereotype(io.vertigo.dynamo.domain.metamodel.DtStereotype) MapBuilder(io.vertigo.util.MapBuilder) MasterDataValues(io.vertigo.studio.masterdata.MasterDataValues) Inject(javax.inject.Inject) Home(io.vertigo.app.Home) MethodAnnotationsModel(io.vertigo.studio.plugins.mda.domain.java.model.MethodAnnotationsModel) GeneratorPlugin(io.vertigo.studio.impl.mda.GeneratorPlugin) FileGenerator(io.vertigo.studio.plugins.mda.FileGenerator) Map(java.util.Map) Assertion(io.vertigo.lang.Assertion) DomainUtil(io.vertigo.studio.plugins.mda.util.DomainUtil) Named(javax.inject.Named) DtDefinition(io.vertigo.dynamo.domain.metamodel.DtDefinition) Collection(java.util.Collection) FileGeneratorConfig(io.vertigo.studio.plugins.mda.FileGeneratorConfig) Collectors(java.util.stream.Collectors) List(java.util.List) MdaResultBuilder(io.vertigo.studio.mda.MdaResultBuilder) Entry(java.util.Map.Entry) Optional(java.util.Optional) DtDefinitionModel(io.vertigo.studio.plugins.mda.domain.java.model.DtDefinitionModel) MasterDataManager(io.vertigo.studio.masterdata.MasterDataManager) Collections(java.util.Collections) MasterDataValue(io.vertigo.studio.masterdata.MasterDataValue) DtDefinition(io.vertigo.dynamo.domain.metamodel.DtDefinition) MasterDataValues(io.vertigo.studio.masterdata.MasterDataValues)

Example 62 with DtDefinition

use of io.vertigo.dynamo.domain.metamodel.DtDefinition in project vertigo by KleeGroup.

the class DomainGeneratorPlugin method generateDtResources.

private static void generateDtResources(final String targetSubDir, final FileGeneratorConfig fileGeneratorConfig, final MdaResultBuilder mdaResultBuilder) {
    final String simpleClassName = "DtResources";
    final String resourcesTemplateName = "domain/java/template/resources.ftl";
    final String propertiesTemplateName = "domain/java/template/properties.ftl";
    // pour les .properties on force l'ISO-8859-1 comme la norme l'impose
    final FileGeneratorConfig propertiesFileConfig = new FileGeneratorConfig(fileGeneratorConfig.getTargetGenDir(), fileGeneratorConfig.getProjectPackageName(), "ISO-8859-1");
    /**
     * Génération des ressources afférentes au DT.
     */
    for (final Entry<String, Collection<DtDefinition>> entry : DomainUtil.getDtDefinitionCollectionMap().entrySet()) {
        final Collection<DtDefinition> dtDefinitions = entry.getValue();
        Assertion.checkNotNull(dtDefinitions);
        final String packageName = entry.getKey();
        final Map<String, Object> model = new MapBuilder<String, Object>().put("packageName", packageName).put("simpleClassName", simpleClassName).put("dtDefinitions", toModels(dtDefinitions)).build();
        FileGenerator.builder(fileGeneratorConfig).withModel(model).withFileName(simpleClassName + ".java").withGenSubDir(targetSubDir).withPackageName(packageName).withTemplateName(resourcesTemplateName).build().generateFile(mdaResultBuilder);
        FileGenerator.builder(propertiesFileConfig).withModel(model).withFileName(simpleClassName + ".properties").withGenSubDir(targetSubDir).withPackageName(packageName).withTemplateName(propertiesTemplateName).build().generateFile(mdaResultBuilder);
    }
}
Also used : FileGeneratorConfig(io.vertigo.studio.plugins.mda.FileGeneratorConfig) DtDefinition(io.vertigo.dynamo.domain.metamodel.DtDefinition) Collection(java.util.Collection) MapBuilder(io.vertigo.util.MapBuilder)

Example 63 with DtDefinition

use of io.vertigo.dynamo.domain.metamodel.DtDefinition in project vertigo by KleeGroup.

the class EAXmiEnvironmentManagerTest method testDtDefinition.

@Test
public void testDtDefinition() {
    final DtDefinition dtDefinition = definitionSpace.resolve("DT_FAMILLE", DtDefinition.class);
    Assert.assertEquals("io.vertigo.dynamock.domain.famille.Famille", dtDefinition.getClassCanonicalName());
    Assert.assertTrue(dtDefinition.isPersistent());
    Assert.assertEquals("io.vertigo.dynamock.domain.famille", dtDefinition.getPackageName());
}
Also used : DtDefinition(io.vertigo.dynamo.domain.metamodel.DtDefinition) Test(org.junit.Test)

Example 64 with DtDefinition

use of io.vertigo.dynamo.domain.metamodel.DtDefinition in project vertigo by KleeGroup.

the class OOMEnvironmentManagerTest method testDtDefinition.

@Test
public void testDtDefinition() {
    final DefinitionSpace definitionSpace = getApp().getDefinitionSpace();
    final DtDefinition dtDefinition = definitionSpace.resolve("DT_FAMILLE", DtDefinition.class);
    Assert.assertEquals("io.vertigo.dynamock.domain.famille.Famille", dtDefinition.getClassCanonicalName());
    Assert.assertTrue(dtDefinition.isPersistent());
    Assert.assertEquals("io.vertigo.dynamock.domain.famille", dtDefinition.getPackageName());
}
Also used : DtDefinition(io.vertigo.dynamo.domain.metamodel.DtDefinition) DefinitionSpace(io.vertigo.core.definition.DefinitionSpace) Test(org.junit.Test)

Example 65 with DtDefinition

use of io.vertigo.dynamo.domain.metamodel.DtDefinition in project vertigo by KleeGroup.

the class OOMParserIdentifiersTest method testIdentifiersVsPrimaryKey.

@Test
public void testIdentifiersVsPrimaryKey() {
    final DtDefinition loginDefinition = getDtDefinition("DT_LOGIN");
    Assert.assertTrue(loginDefinition.getIdField().isPresent());
}
Also used : DtDefinition(io.vertigo.dynamo.domain.metamodel.DtDefinition) Test(org.junit.Test)

Aggregations

DtDefinition (io.vertigo.dynamo.domain.metamodel.DtDefinition)91 DtField (io.vertigo.dynamo.domain.metamodel.DtField)29 Test (org.junit.Test)21 URI (io.vertigo.dynamo.domain.model.URI)18 List (java.util.List)17 ArrayList (java.util.ArrayList)16 Assertion (io.vertigo.lang.Assertion)12 Collectors (java.util.stream.Collectors)11 Home (io.vertigo.app.Home)10 Optional (java.util.Optional)10 Domain (io.vertigo.dynamo.domain.metamodel.Domain)9 Collections (java.util.Collections)8 DefinitionUtil (io.vertigo.core.definition.DefinitionUtil)7 DtObjectUtil (io.vertigo.dynamo.domain.util.DtObjectUtil)7 TaskDefinition (io.vertigo.dynamo.task.metamodel.TaskDefinition)7 Inject (javax.inject.Inject)7 Authorization (io.vertigo.account.authorization.metamodel.Authorization)6 SecuredEntity (io.vertigo.account.authorization.metamodel.SecuredEntity)6 Criterions (io.vertigo.dynamo.criteria.Criterions)6 DefinitionSpace (io.vertigo.core.definition.DefinitionSpace)5