use of com.servoy.j2db.util.serialize.JSONSerializerWrapper in project servoy-client by Servoy.
the class FoundSetManager method replaceValuesWithSerializedString.
private static void replaceValuesWithSerializedString(IDataSet dataSet, boolean[] rowsToStringserialize) {
// run stringserializer over the rows
JSONSerializerWrapper stringserializer = new JSONSerializerWrapper(false);
for (int r = 0; r < dataSet.getRowCount(); r++) {
Object[] row = dataSet.getRow(r).clone();
for (int i = 0; i < rowsToStringserialize.length; i++) {
if (rowsToStringserialize[i] && row[i] != null && !(row[i] instanceof String)) {
// the data was not a string (so not pre-serialized from js), run it through the stringserializer.
try {
row[i] = stringserializer.toJSON(row[i]).toString();
} catch (MarshallException e) {
Debug.warn(e);
}
}
}
dataSet.setRow(r, row);
}
}
use of com.servoy.j2db.util.serialize.JSONSerializerWrapper in project servoy-client by Servoy.
the class FoundSetManager method replaceValuesWithSerializedString.
private static void replaceValuesWithSerializedString(IDataSet dataSet, Set<Integer> columnsThatNeedToStringSerialize) {
Integer[] colIndexesThatNeedToStringSerialize = columnsThatNeedToStringSerialize.toArray(new Integer[columnsThatNeedToStringSerialize.size()]);
// run stringserializer over the rows
JSONSerializerWrapper stringserializer = new JSONSerializerWrapper(false);
for (int r = 0; r < dataSet.getRowCount(); r++) {
Object[] row = dataSet.getRow(r).clone();
for (Integer colIdxAsInteger : colIndexesThatNeedToStringSerialize) {
int colIdx = colIdxAsInteger.intValue();
if (row[colIdx] != null && !(row[colIdx] instanceof String)) {
// the data was not a string (so not pre-serialized from js), run it through the stringserializer.
try {
row[colIdx] = stringserializer.toJSON(row[colIdx]).toString();
} catch (MarshallException e) {
Debug.warn(e);
}
}
}
dataSet.setRow(r, row);
}
}
Aggregations