use of org.finos.symphony.toolkit.workflow.form.Button in project spring-bot by finos.
the class ButtonsResponseHandler method accept.
@Override
public void accept(Response t) {
if (t instanceof WorkResponse) {
Object o = ((WorkResponse) t).getFormObject();
WorkMode wm = ((WorkResponse) t).getMode();
ButtonList obl = (ButtonList) ((WorkResponse) t).getData().get(ButtonList.KEY);
if ((obl != null) && (obl.getContents().size() > 0)) {
return;
}
obl = new ButtonList();
((WorkResponse) t).getData().put(ButtonList.KEY, obl);
final ButtonList bl = obl;
initExposedHandlerMappings();
exposedHandlerMappings.stream().flatMap(hm -> hm.getAllHandlers(t.getAddress(), null).stream()).filter(cm -> exposedMatchesObject(cm.getMapping(), o)).filter(cm -> cm.isButtonFor(o, wm)).forEach(cm -> {
ChatButton e = cm.getMapping();
String value = cm.getUniqueName();
String text = e.buttonText();
text = StringUtils.hasText(text) ? text : formatFieldName(cm.getHandlerMethod().getMethod().getName());
bl.add(new Button(value, Type.ACTION, text));
});
Collections.sort((List<Button>) bl.getContents());
}
}
Aggregations