use of io.vertigo.dynamo.domain.metamodel.DtDefinition in project vertigo by KleeGroup.
the class JavaParserStereotypesTest method testStereotypeData.
@Test
public void testStereotypeData() {
final DtDefinition dtDefinitionAttachment = getDtDefinition("DT_COMMAND_CRITERIA");
Assert.assertNotNull(dtDefinitionAttachment);
Assert.assertEquals(DtStereotype.ValueObject, dtDefinitionAttachment.getStereotype());
}
use of io.vertigo.dynamo.domain.metamodel.DtDefinition in project vertigo by KleeGroup.
the class JavaParserStereotypesTest method testStereotypeEntity.
/**
* Test du stereotype Data
*/
@Test
public void testStereotypeEntity() {
final DtDefinition dtDefinitionAttachment = getDtDefinition("DT_ATTACHMENT");
Assert.assertNotNull(dtDefinitionAttachment);
Assert.assertEquals(DtStereotype.Entity, dtDefinitionAttachment.getStereotype());
final DtDefinition dtDefinitionCommandValidation = getDtDefinition("DT_COMMAND_VALIDATION");
Assert.assertNotNull(dtDefinitionCommandValidation);
Assert.assertEquals(DtStereotype.Entity, dtDefinitionCommandValidation.getStereotype());
}
use of io.vertigo.dynamo.domain.metamodel.DtDefinition in project vertigo by KleeGroup.
the class JavaParserStereotypesTest2 method testStereotypeMasterData.
/**
* Test du stereotype MasterData
*/
@Test
public void testStereotypeMasterData() {
final DtDefinition dtDefinitionCity = getDtDefinition("DT_CITY");
Assert.assertNotNull(dtDefinitionCity);
Assert.assertEquals(DtStereotype.MasterData, dtDefinitionCity.getStereotype());
final DtDefinition dtDefinitionCommandType = getDtDefinition("DT_COMMAND_TYPE");
Assert.assertNotNull(dtDefinitionCommandType);
Assert.assertEquals(DtStereotype.MasterData, dtDefinitionCommandType.getStereotype());
}
use of io.vertigo.dynamo.domain.metamodel.DtDefinition in project vertigo by KleeGroup.
the class MultiResourcesEnvironmentManagerTest method testMergedResources.
@Test
public void testMergedResources() {
final AppConfig appConfig = prepareDefaultAppConfigBuilder().addModule(ModuleConfig.builder("myApp").addDefinitionProvider(DefinitionProviderConfig.builder(DynamoDefinitionProvider.class).addDefinitionResource("kpr", "io/vertigo/dynamo/environment/multi/data/execution.kpr").addDefinitionResource("classes", DtDefinitions.class.getCanonicalName()).build()).build()).build();
try (final AutoCloseableApp app = new AutoCloseableApp(appConfig)) {
final Domain doString = app.getDefinitionSpace().resolve("DO_STRING", Domain.class);
Assert.assertNotNull(doString);
final DtDefinition dtItem = app.getDefinitionSpace().resolve("DT_ITEM", DtDefinition.class);
Assert.assertNotNull(dtItem);
}
}
use of io.vertigo.dynamo.domain.metamodel.DtDefinition in project vertigo by KleeGroup.
the class AbstractESSearchServicesPlugin method updateTypeMapping.
/**
* Update template definition of this type.
* @param indexDefinition Index concerné
*/
private void updateTypeMapping(final SearchIndexDefinition indexDefinition, final boolean sortableNormalizer) {
Assertion.checkNotNull(indexDefinition);
// -----
try (final XContentBuilder typeMapping = XContentFactory.jsonBuilder()) {
typeMapping.startObject().startObject("properties").startObject(ESDocumentCodec.FULL_RESULT).field("type", "binary").endObject();
/* 3 : Les champs du dto index */
final Set<DtField> copyFromFields = indexDefinition.getIndexCopyFromFields();
final DtDefinition indexDtDefinition = indexDefinition.getIndexDtDefinition();
for (final DtField dtField : indexDtDefinition.getFields()) {
final IndexType indexType = IndexType.readIndexType(dtField.getDomain());
typeMapping.startObject(dtField.getName());
appendIndexTypeMapping(typeMapping, indexType);
if (copyFromFields.contains(dtField)) {
appendIndexCopyToMapping(indexDefinition, typeMapping, dtField);
}
if (indexType.isIndexSubKeyword()) {
typeMapping.startObject("fields");
typeMapping.startObject("keyword");
typeMapping.field("type", "keyword");
if (sortableNormalizer) {
typeMapping.field("normalizer", "sortable");
}
typeMapping.endObject();
typeMapping.endObject();
}
if (indexType.isIndexFieldData()) {
typeMapping.field("fielddata", true);
}
typeMapping.endObject();
}
// end properties
typeMapping.endObject().endObject();
final PutMappingResponse putMappingResponse = esClient.admin().indices().preparePutMapping(obtainIndexName(indexDefinition)).setType(indexDefinition.getName().toLowerCase(Locale.ROOT)).setSource(typeMapping).get();
putMappingResponse.isAcknowledged();
} catch (final IOException e) {
throw WrappedException.wrap(e, "Serveur ElasticSearch indisponible");
}
}
Aggregations