Search in sources :

Example 41 with DtDefinition

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());
}
Also used : DtDefinition(io.vertigo.dynamo.domain.metamodel.DtDefinition) Test(org.junit.Test)

Example 42 with DtDefinition

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());
}
Also used : DtDefinition(io.vertigo.dynamo.domain.metamodel.DtDefinition) Test(org.junit.Test)

Example 43 with DtDefinition

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());
}
Also used : DtDefinition(io.vertigo.dynamo.domain.metamodel.DtDefinition) Test(org.junit.Test)

Example 44 with DtDefinition

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);
    }
}
Also used : AutoCloseableApp(io.vertigo.app.AutoCloseableApp) AppConfig(io.vertigo.app.config.AppConfig) DtDefinition(io.vertigo.dynamo.domain.metamodel.DtDefinition) DynamoDefinitionProvider(io.vertigo.dynamo.plugins.environment.DynamoDefinitionProvider) Domain(io.vertigo.dynamo.domain.metamodel.Domain) Test(org.junit.Test)

Example 45 with DtDefinition

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");
    }
}
Also used : DtDefinition(io.vertigo.dynamo.domain.metamodel.DtDefinition) PutMappingResponse(org.elasticsearch.action.admin.indices.mapping.put.PutMappingResponse) IOException(java.io.IOException) XContentBuilder(org.elasticsearch.common.xcontent.XContentBuilder) DtField(io.vertigo.dynamo.domain.metamodel.DtField)

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