class ResponseBuilder implements java.io.Serializable {

    public Object buildWorkflowResponse(DelegateExecution execution) {

        String method = getClass().getSimpleName() + ".buildWorkflowResponse(" + "execution=" + execution.getId() + ")";
        logger.debug("Entered " + method);

        String prefix = (String) execution.getVariable("prefix");
        String processKey = getProcessKey(execution);

        Object theResponse = null;

        WorkflowException theException = (WorkflowException) execution.getVariable(WORKFLOWEXCEPTION);
        String errorResponse = trimString(execution.getVariable(prefix + "ErrorResponse"), null);
        String responseCode = trimString(execution.getVariable(prefix + "ResponseCode"), null);

        if (theException == null && errorResponse == null
                && isOneOf(responseCode, null, "0", "200", "201", "202", "204")) {

            theResponse = execution.getVariable("WorkflowResponse");

            if (theResponse == null) {
                theResponse = execution.getVariable(processKey + "Response");
            }
        }

        logger.debug("Exited " + method);
        return theResponse;
    }

}