use of org.finos.symphony.toolkit.workflow.actions.FormAction in project spring-bot by finos.
the class TestTableEdit method editRow.
protected void editRow(String testStem, Object toChange, Object newRow, String spel) throws Exception {
EntityJson ej = new EntityJson();
ej.put(WorkResponse.OBJECT_KEY, toChange);
FormAction ea = new FormAction(room, u, toChange, spel + TableEditRow.EDIT_SUFFIX, ej);
editRow.accept(ea);
// should get a new form back.
String jsonStr = testTemplating("abc123", testStem + "1.ml", testStem + "1.json");
EntityJson json = ejc.readValue(jsonStr);
ea = new FormAction(room, u, newRow, spel + TableEditRow.UPDATE_SUFFIX, json);
Mockito.reset(messagesApi);
editRow.accept(ea);
testTemplating("abc123", testStem + "2.ml", testStem + "2.json");
}
use of org.finos.symphony.toolkit.workflow.actions.FormAction in project spring-bot by finos.
the class EntityMapResolverFactory method createResolver.
@Override
public WorkflowResolver createResolver(ChatHandlerExecutor che) {
return new WorkflowResolver() {
@Override
public Optional<Object> resolve(MethodParameter mp) {
if (che.action() instanceof FormAction) {
Class<?> t = mp.getParameterType();
FormAction fa = (FormAction) che.action();
Map<String, Object> entityMap = fa.getData();
return entityMap.values().stream().filter(v -> v.getClass().isAssignableFrom(t)).findFirst();
} else {
return Optional.empty();
}
}
@Override
public boolean canResolve(MethodParameter mp) {
return resolve(mp).isPresent();
}
};
}
Aggregations