String serializedValue = null;
if (valueFields.getTextValue() != null) {
serializedValue = valueFields.getTextValue();
} else if (valueFields.getByteArrayValue() != null){
try {
ByteArrayEntity byteArray = valueFields.getByteArrayValue();
serializedValue = new String(byteArray.getBytes(), "UTF-8");
} catch (UnsupportedEncodingException e) {
throw new ProcessEngineException("UTF-8 is not a supported encoding", e);
}
}