Search in sources :

Example 66 with DtDefinition

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

the class ItemSearchLoader method loadData.

/**
 * {@inheritDoc}
 */
@Override
public List<SearchIndex<Item, Item>> loadData(final SearchChunk<Item> searchChunk) {
    final SearchIndexDefinition indexDefinition = searchManager.findFirstIndexDefinitionByKeyConcept(Item.class);
    try (final VTransactionWritable tx = getTransactionManager().createCurrentTransaction()) {
        final List<SearchIndex<Item, Item>> result = new ArrayList<>();
        final DtDefinition dtDefinition = DtObjectUtil.findDtDefinition(Item.class);
        for (final Item item : loadItems(searchChunk)) {
            final URI<Item> uri = new URI<>(dtDefinition, item.getId());
            result.add(SearchIndex.createIndex(indexDefinition, uri, item));
        }
        return result;
    }
}
Also used : Item(io.vertigo.dynamo.search.data.domain.Item) SearchIndexDefinition(io.vertigo.dynamo.search.metamodel.SearchIndexDefinition) SearchIndex(io.vertigo.dynamo.search.model.SearchIndex) ArrayList(java.util.ArrayList) DtDefinition(io.vertigo.dynamo.domain.metamodel.DtDefinition) VTransactionWritable(io.vertigo.commons.transaction.VTransactionWritable) URI(io.vertigo.dynamo.domain.model.URI)

Example 67 with DtDefinition

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

the class JavaEnvironmentManagerTest method testCommand.

@Test
public void testCommand() {
    final DefinitionSpace definitionSpace = getApp().getDefinitionSpace();
    final DtDefinition dtDefinition = definitionSpace.resolve("DT_COMMAND", DtDefinition.class);
    Assert.assertTrue(dtDefinition.isPersistent());
    Assert.assertEquals("io.vertigo.dynamo.environment.java.data.domain.Command", dtDefinition.getClassCanonicalName());
    Assert.assertEquals("io.vertigo.dynamo.environment.java.data.domain", dtDefinition.getPackageName());
    Assert.assertEquals("Command", dtDefinition.getClassSimpleName());
}
Also used : DtDefinition(io.vertigo.dynamo.domain.metamodel.DtDefinition) DefinitionSpace(io.vertigo.core.definition.DefinitionSpace) Test(org.junit.Test)

Example 68 with DtDefinition

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

the class JavaEnvironmentManagerTest method testCityFragment.

@Test
public void testCityFragment() {
    final DefinitionSpace definitionSpace = getApp().getDefinitionSpace();
    final DtDefinition dtDefinition = definitionSpace.resolve("DT_CITY_FRAGMENT", DtDefinition.class);
    Assert.assertFalse(dtDefinition.isPersistent());
    Assert.assertTrue(dtDefinition.getFragment().isPresent());
    Assert.assertTrue("City".equals(dtDefinition.getFragment().get().getClassSimpleName()));
    Assert.assertEquals("io.vertigo.dynamo.environment.java.data.domain.CityFragment", dtDefinition.getClassCanonicalName());
    Assert.assertEquals("io.vertigo.dynamo.environment.java.data.domain", dtDefinition.getPackageName());
    Assert.assertEquals("CityFragment", dtDefinition.getClassSimpleName());
    Assert.assertTrue("City".equals(dtDefinition.getField("CIT_ID").getFkDtDefinition().getClassSimpleName()));
}
Also used : DtDefinition(io.vertigo.dynamo.domain.metamodel.DtDefinition) DefinitionSpace(io.vertigo.core.definition.DefinitionSpace) Test(org.junit.Test)

Example 69 with DtDefinition

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

the class JavaParserStereotypesTest method testStereotypeKeyConcept.

/**
 * Test du stereotype keyConcept
 */
@Test
public void testStereotypeKeyConcept() {
    final DtDefinition dtDefinitionCommand = getDtDefinition("DT_COMMAND");
    Assert.assertNotNull(dtDefinitionCommand);
    Assert.assertEquals(DtStereotype.KeyConcept, dtDefinitionCommand.getStereotype());
}
Also used : DtDefinition(io.vertigo.dynamo.domain.metamodel.DtDefinition) Test(org.junit.Test)

Example 70 with DtDefinition

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

the class JavaParserStereotypesTest2 method testStereotypeKeyConcept.

/**
 * Test du stereotype keyConcept
 */
@Test
public void testStereotypeKeyConcept() {
    final DtDefinition dtDefinitionCommand = getDtDefinition("DT_COMMAND");
    Assert.assertNotNull(dtDefinitionCommand);
    Assert.assertEquals(DtStereotype.KeyConcept, dtDefinitionCommand.getStereotype());
}
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