Search in sources :

Example 1 with ChatResponseBody

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);
}
Also used : Addressable(org.finos.symphony.toolkit.workflow.content.Addressable) WorkResponse(org.finos.symphony.toolkit.workflow.response.WorkResponse) WorkMode(org.finos.symphony.toolkit.workflow.annotations.WorkMode) ChatResponseBody(org.finos.symphony.toolkit.workflow.annotations.ChatResponseBody)

Aggregations

ChatResponseBody (org.finos.symphony.toolkit.workflow.annotations.ChatResponseBody)1 WorkMode (org.finos.symphony.toolkit.workflow.annotations.WorkMode)1 Addressable (org.finos.symphony.toolkit.workflow.content.Addressable)1 WorkResponse (org.finos.symphony.toolkit.workflow.response.WorkResponse)1