Search in sources :

Example 1 with RestVariableConverter

use of com.plumdo.flow.rest.variable.RestVariableConverter in project plumdo-work by wengwh.

the class RestResponseFactory method getVariableValue.

public Object getVariableValue(RestVariable restVariable) {
    Object value = null;
    if (restVariable.getType() != null) {
        RestVariableConverter converter = null;
        for (RestVariableConverter conv : variableConverters) {
            if (conv.getRestTypeName().equals(restVariable.getType())) {
                converter = conv;
                break;
            }
        }
        if (converter == null) {
            throw new FlowableIllegalArgumentException("Variable '" + restVariable.getName() + "' has unsupported type: '" + restVariable.getType() + "'.");
        }
        value = converter.getVariableValue(restVariable);
    } else {
        value = restVariable.getValue();
    }
    return value;
}
Also used : StringRestVariableConverter(com.plumdo.flow.rest.variable.StringRestVariableConverter) BooleanRestVariableConverter(com.plumdo.flow.rest.variable.BooleanRestVariableConverter) IntegerRestVariableConverter(com.plumdo.flow.rest.variable.IntegerRestVariableConverter) DoubleRestVariableConverter(com.plumdo.flow.rest.variable.DoubleRestVariableConverter) LongRestVariableConverter(com.plumdo.flow.rest.variable.LongRestVariableConverter) ShortRestVariableConverter(com.plumdo.flow.rest.variable.ShortRestVariableConverter) RestVariableConverter(com.plumdo.flow.rest.variable.RestVariableConverter) ListRestVariableConverter(com.plumdo.flow.rest.variable.ListRestVariableConverter) DateRestVariableConverter(com.plumdo.flow.rest.variable.DateRestVariableConverter) FlowableIllegalArgumentException(org.flowable.engine.common.api.FlowableIllegalArgumentException)

Aggregations

BooleanRestVariableConverter (com.plumdo.flow.rest.variable.BooleanRestVariableConverter)1 DateRestVariableConverter (com.plumdo.flow.rest.variable.DateRestVariableConverter)1 DoubleRestVariableConverter (com.plumdo.flow.rest.variable.DoubleRestVariableConverter)1 IntegerRestVariableConverter (com.plumdo.flow.rest.variable.IntegerRestVariableConverter)1 ListRestVariableConverter (com.plumdo.flow.rest.variable.ListRestVariableConverter)1 LongRestVariableConverter (com.plumdo.flow.rest.variable.LongRestVariableConverter)1 RestVariableConverter (com.plumdo.flow.rest.variable.RestVariableConverter)1 ShortRestVariableConverter (com.plumdo.flow.rest.variable.ShortRestVariableConverter)1 StringRestVariableConverter (com.plumdo.flow.rest.variable.StringRestVariableConverter)1 FlowableIllegalArgumentException (org.flowable.engine.common.api.FlowableIllegalArgumentException)1