Search in sources :

Example 21 with Domain

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

the class ItemSearchLoader method getTaskDefinition.

private TaskDefinition getTaskDefinition(final SearchChunk<Item> searchChunk) {
    final Domain doItems = definitionSpace.resolve("DO_DT_ITEM_DTC", Domain.class);
    final String sql = searchChunk.getAllURIs().stream().map(uri -> uri.getId().toString()).collect(Collectors.joining(", ", "select * from ITEM where ID in (", ")"));
    return TaskDefinition.builder("TK_LOAD_ALL_ITEMS").withEngine(TaskEngineSelect.class).withRequest(sql).withPackageName(TaskEngineSelect.class.getPackage().getName()).withOutRequired("dtc", doItems).build();
}
Also used : AbstractSqlSearchLoader(io.vertigo.dynamox.search.AbstractSqlSearchLoader) SearchChunk(io.vertigo.dynamo.search.metamodel.SearchChunk) TaskDefinition(io.vertigo.dynamo.task.metamodel.TaskDefinition) Item(io.vertigo.dynamo.search.data.domain.Item) DtDefinition(io.vertigo.dynamo.domain.metamodel.DtDefinition) URI(io.vertigo.dynamo.domain.model.URI) DtObjectUtil(io.vertigo.dynamo.domain.util.DtObjectUtil) VTransactionWritable(io.vertigo.commons.transaction.VTransactionWritable) Domain(io.vertigo.dynamo.domain.metamodel.Domain) Task(io.vertigo.dynamo.task.model.Task) DefinitionSpace(io.vertigo.core.definition.DefinitionSpace) DtList(io.vertigo.dynamo.domain.model.DtList) SearchIndex(io.vertigo.dynamo.search.model.SearchIndex) Collectors(java.util.stream.Collectors) VTransactionManager(io.vertigo.commons.transaction.VTransactionManager) SearchIndexDefinition(io.vertigo.dynamo.search.metamodel.SearchIndexDefinition) ArrayList(java.util.ArrayList) Inject(javax.inject.Inject) Home(io.vertigo.app.Home) List(java.util.List) TaskManager(io.vertigo.dynamo.task.TaskManager) SearchManager(io.vertigo.dynamo.search.SearchManager) TaskEngineSelect(io.vertigo.dynamox.task.TaskEngineSelect) Assertion(io.vertigo.lang.Assertion) Domain(io.vertigo.dynamo.domain.metamodel.Domain)

Example 22 with Domain

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

the class AbstractStoreManagerTest method nativeInsertCar.

protected void nativeInsertCar(final Car car) {
    Assertion.checkArgument(car.getId() == null, "L'id n'est pas null {0}", car.getId());
    // -----
    final DefinitionSpace definitionSpace = getApp().getDefinitionSpace();
    final Domain doCar = definitionSpace.resolve("DO_DT_CAR_DTO", Domain.class);
    final TaskDefinition taskDefinition = TaskDefinition.builder("TK_INSERT_CAR").withEngine(TaskEngineProc.class).withRequest("insert into CAR (ID, FAM_ID,MANUFACTURER, MODEL, DESCRIPTION, YEAR, KILO, PRICE, MTY_CD) values " + "(NEXT VALUE FOR SEQ_CAR, #DTO_CAR.FAM_ID#, #DTO_CAR.MANUFACTURER#, #DTO_CAR.MODEL#, #DTO_CAR.DESCRIPTION#, #DTO_CAR.YEAR#, #DTO_CAR.KILO#, #DTO_CAR.PRICE#, #DTO_CAR.MTY_CD#)").addInRequired("DTO_CAR", doCar).build();
    final Task task = Task.builder(taskDefinition).addValue("DTO_CAR", car).build();
    final TaskResult taskResult = taskManager.execute(task);
    nop(taskResult);
}
Also used : TaskDefinition(io.vertigo.dynamo.task.metamodel.TaskDefinition) Task(io.vertigo.dynamo.task.model.Task) DefinitionSpace(io.vertigo.core.definition.DefinitionSpace) TaskEngineProc(io.vertigo.dynamox.task.TaskEngineProc) TaskResult(io.vertigo.dynamo.task.model.TaskResult) Domain(io.vertigo.dynamo.domain.metamodel.Domain)

Example 23 with Domain

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

the class TaskDefinitionProvider method buildTaskDefinition2.

private TaskDefinition buildTaskDefinition2(final DefinitionSpace definitionSpace, final String taskDefinitionName, final String params) {
    final Domain doIntegers = definitionSpace.resolve("DO_INTEGERS", Domain.class);
    final Domain doInteger = definitionSpace.resolve("DO_INTEGER", Domain.class);
    return TaskDefinition.builder(taskDefinitionName).withEngine(TaskEngineMock2.class).withRequest(params).withPackageName(TaskEngineMock.class.getPackage().getName()).addInRequired(ATTR_IN_INTEGERS, doIntegers).withOutRequired(ATTR_OUT, doInteger).build();
}
Also used : Domain(io.vertigo.dynamo.domain.metamodel.Domain)

Example 24 with Domain

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

the class JavaEnvironmentManagerTest method testDomain.

@Test
public void testDomain() {
    final DefinitionSpace definitionSpace = getApp().getDefinitionSpace();
    final io.vertigo.dynamo.domain.metamodel.Domain domain = definitionSpace.resolve("DO_ID", Domain.class);
    Assert.assertEquals(DataType.Long, domain.getDataType());
    Assert.assertEquals(FormatterDefault.class.getName(), domain.getFormatterClassName());
}
Also used : DefinitionSpace(io.vertigo.core.definition.DefinitionSpace) Domain(io.vertigo.dynamo.domain.metamodel.Domain) FormatterDefault(io.vertigo.dynamox.domain.formatter.FormatterDefault) Test(org.junit.Test)

Example 25 with Domain

use of io.vertigo.dynamo.domain.metamodel.Domain 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)

Aggregations

Domain (io.vertigo.dynamo.domain.metamodel.Domain)26 DefinitionSpace (io.vertigo.core.definition.DefinitionSpace)8 DtDefinition (io.vertigo.dynamo.domain.metamodel.DtDefinition)7 TaskDefinition (io.vertigo.dynamo.task.metamodel.TaskDefinition)7 Task (io.vertigo.dynamo.task.model.Task)7 TaskEngineSelect (io.vertigo.dynamox.task.TaskEngineSelect)7 Test (org.junit.Test)6 DslDefinition (io.vertigo.dynamo.plugins.environment.dsl.dynamic.DslDefinition)5 ArrayList (java.util.ArrayList)4 AutoCloseableApp (io.vertigo.app.AutoCloseableApp)3 AppConfig (io.vertigo.app.config.AppConfig)3 DtList (io.vertigo.dynamo.domain.model.DtList)3 SearchIndexDefinition (io.vertigo.dynamo.search.metamodel.SearchIndexDefinition)3 FormatterDefault (io.vertigo.dynamox.domain.formatter.FormatterDefault)3 Assertion (io.vertigo.lang.Assertion)3 List (java.util.List)3 Collectors (java.util.stream.Collectors)3 Home (io.vertigo.app.Home)2 VTransactionManager (io.vertigo.commons.transaction.VTransactionManager)2 VTransactionWritable (io.vertigo.commons.transaction.VTransactionWritable)2