Search in sources :

Example 71 with DtDefinition

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

the class JavaParserStereotypesTest2 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 72 with DtDefinition

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

the class JavaParserStereotypesTest2 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 73 with DtDefinition

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

the class MultiResourcesEnvironmentManagerTest method testSplittedModules.

@Test
public void testSplittedModules() {
    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 74 with DtDefinition

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

the class CacheStoreManagerInitializer method init.

/**
 * {@inheritDoc}
 */
@Override
public void init() {
    final DtDefinition dtDefinition = DtObjectUtil.findDtDefinition(Car.class);
    storeManager.getDataStoreConfig().registerCacheable(dtDefinition, 3600, true, true);
    storeManager.getDataStoreConfig().registerCacheable(DtObjectUtil.findDtDefinition(Famille.class), 120, true, true);
}
Also used : Famille(io.vertigo.dynamo.store.data.domain.famille.Famille) DtDefinition(io.vertigo.dynamo.domain.metamodel.DtDefinition)

Example 75 with DtDefinition

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

the class MandatoryPkValidator method checkMultiFieldConstraints.

/**
 * NO checkMonoFieldConstraints.
 * Can't check that PK was set in a checkMonoFieldConstraints.
 * Because it was called for modified fields only, if PK is undefined it will not be checked.
 */
/**
 * {@inheritDoc}
 */
@Override
protected void checkMultiFieldConstraints(final E entity, final Set<String> modifiedFieldNameSet, final DtObjectErrors dtObjectErrors) {
    final DtDefinition dtDefinition = DtObjectUtil.findDtDefinition(entity);
    final DtField idField = dtDefinition.getIdField().get();
    final String camelCaseFieldName = getCamelCaseFieldName(idField);
    if (!dtObjectErrors.hasError(camelCaseFieldName)) {
        if (DtObjectUtil.getId(entity) == null) {
            dtObjectErrors.addError(camelCaseFieldName, MessageText.of("Id is mandatory"));
        }
    }
}
Also used : DtDefinition(io.vertigo.dynamo.domain.metamodel.DtDefinition) 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