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())));
}
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);
}
}
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());
}
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());
}
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());
}
Aggregations