use of io.vertigo.dynamo.task.metamodel.TaskDefinition 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;
}
use of io.vertigo.dynamo.task.metamodel.TaskDefinition in project vertigo by KleeGroup.
the class BrokerBatchImpl method getList.
private DtList<E> getList(final DtDefinition dtDefinition, final String fieldName, final DtList<E> dtc) {
// On splitte la collection par paquet
final List<DtList<E>> paquet = new ArrayList<>();
DtList<E> tmp = null;
for (int i = 0; i < dtc.size(); i++) {
if (i % GET_LIST_PAQUET_SIZE == 0) {
tmp = new DtList<>(dtc.getDefinition());
paquet.add(tmp);
}
if (tmp != null) {
tmp.add(dtc.get(i));
}
}
// On génère la requête
// Corps de la requete
// On génère maintenant la requête proc batch
final DtDefinition dtDef = dtc.getDefinition();
final String dtcName = getDtcName(dtDef);
final String inDtcName = dtcName + "_IN";
final String request = new StringBuilder("select * from ").append(dtDef.getLocalName()).append(" where ").append(fieldName).append(" in (#").append(inDtcName).append(".ROWNUM.").append(fieldName).append("#)").toString();
// Exécution de la tache
final Domain dtcDomain = Home.getApp().getDefinitionSpace().resolve(DOMAIN_PREFIX + SEPARATOR + dtDef.getName() + "_DTC", Domain.class);
final String taskName = "TK_LOAD_BY_LST_" + fieldName + "_" + dtDef.getLocalName();
final TaskDefinition taskDefinition = TaskDefinition.builder(taskName).withEngine(TaskEngineSelect.class).withDataSpace(dtDef.getDataSpace()).withRequest(request).addInRequired(inDtcName, dtcDomain).withOutRequired("out", dtcDomain).build();
// On exécute par paquet
final DtList<E> ret = new DtList<>(dtDefinition);
for (final DtList<E> paq : paquet) {
/* Création de la tache. */
final Task task = Task.builder(taskDefinition).addValue(inDtcName, paq).build();
// Exécution de la tache
final DtList<E> result = taskManager.execute(task).getResult();
ret.addAll(result);
}
return ret;
}
Aggregations