Search in sources :

Example 1 with TaskResult

use of io.vertigo.dynamo.task.model.TaskResult in project vertigo by KleeGroup.

the class OracleSqlStoreManagerTest method nativeInsertCar.

@Override
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,MAKE, MODEL, DESCRIPTION, YEAR, KILO, PRICE, MOTOR_TYPE) values " + "(SEQ_CAR.nextval, #DTO_CAR.FAM_ID#, #DTO_CAR.MAKE#, #DTO_CAR.MODEL#, #DTO_CAR.DESCRIPTION#, #DTO_CAR.YEAR#, #DTO_CAR.KILO#, #DTO_CAR.PRICE#, #DTO_CAR.MOTOR_TYPE#)").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 2 with TaskResult

use of io.vertigo.dynamo.task.model.TaskResult 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 3 with TaskResult

use of io.vertigo.dynamo.task.model.TaskResult in project vertigo by KleeGroup.

the class TaskProxyMethod method invoke.

@Override
public Object invoke(final Method method, final Object[] args) {
    final TaskDefinition taskDefinition = createTaskDefinition(method);
    final Task task = createTask(taskDefinition, method, args);
    final TaskResult taskResult = getTaskManager().execute(task);
    if (taskDefinition.getOutAttributeOption().isPresent()) {
        return taskResult.getResult();
    }
    return Void.TYPE;
}
Also used : TaskDefinition(io.vertigo.dynamo.task.metamodel.TaskDefinition) Task(io.vertigo.dynamo.task.model.Task) TaskResult(io.vertigo.dynamo.task.model.TaskResult)

Aggregations

TaskDefinition (io.vertigo.dynamo.task.metamodel.TaskDefinition)3 Task (io.vertigo.dynamo.task.model.Task)3 TaskResult (io.vertigo.dynamo.task.model.TaskResult)3 DefinitionSpace (io.vertigo.core.definition.DefinitionSpace)2 Domain (io.vertigo.dynamo.domain.metamodel.Domain)2 TaskEngineProc (io.vertigo.dynamox.task.TaskEngineProc)2