{
final Object[] rowData = rows[row];
for (int column = 0; column < selectedFields.size(); column++)
{
final OpenERPFieldInfo fld = selectedFields.get(column);
// Base64 Decode Binary
if (fld.getFieldType() == FieldType.BINARY
&& rowData[column] != null)
{
try
{
rowData[column] = Base64.decode(rowData[column].toString());
}
catch (DecodingException e)
{
rowData[column] = "Unable to decode string";
}
catch (Exception e)
{
logger.debug("Failed to decode string on query-result: Row=" + row + " Col=" + column, e);
}
}
// Only return integer part (exclude name) from many2one field
if (fld.getFieldType() == FieldType.MANY2ONE
&& rowData[column] instanceof Object[])
{
final Object[] value = (Object[]) rowData[column];
rowData[column] = Integer.parseInt(String.valueOf(value[0]));
}
// make many2many and one2many a comma separated list of values
if ((fld.getFieldType() == FieldType.MANY2MANY || fld.getFieldType() == FieldType.ONE2MANY)
&& rowData[column] instanceof Object[])
{
final StringBuilder stringValue = new StringBuilder();
final Object[] mcolumn = (Object[]) rowData[column];