use of org.finos.symphony.toolkit.workflow.annotations.ChatResponseBody in project spring-bot by finos.
the class WorkResponseConverter method convert.
@Override
public Response convert(Object source, ChatHandlerExecutor creator) {
Addressable a = creator.action().getAddressable();
ChatResponseBody wr = creator.getOriginatingMapping().getHandlerMethod().getMethodAnnotation(ChatResponseBody.class);
WorkMode wm = WorkMode.VIEW;
if (wr != null) {
String template = wr.template();
WorkMode wmAnnotation = wr.workMode();
if (wmAnnotation == WorkMode.EDIT) {
wm = wmAnnotation;
}
if (StringUtils.hasText(template)) {
Map<String, Object> entityMap = WorkResponse.createEntityMap(source, null, null);
return new WorkResponse(a, entityMap, template, wm, source.getClass());
}
}
return new WorkResponse(a, source, wm, null, null);
}
Aggregations