use of flexjson.JSONDeserializer in project pentaho-metaverse by pentaho.
the class MetaverseUtil method convertOperationsStringToMap.
public static Operations convertOperationsStringToMap(String operations) {
Operations resultOps = null;
if (!Const.isEmpty(operations)) {
try {
Map<String, List<IOperation>> rawOpsMap = new JSONDeserializer<Map<String, List<IOperation>>>().use("values.values", Operation.class).deserialize(operations);
resultOps = new Operations();
for (String key : rawOpsMap.keySet()) {
resultOps.put(ChangeType.forValue(key), rawOpsMap.get(key));
}
} catch (Exception e) {
resultOps = null;
}
// return new JSONDeserializer<Operations>().use(null, Operations.class).deserialize( operations );
}
return resultOps;
}
use of flexjson.JSONDeserializer in project data-access by pentaho.
the class DatabaseConnectionListReaderWriter method readFrom.
@Override
public IDatabaseConnectionList readFrom(Class<IDatabaseConnectionList> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, String> httpHeaders, InputStream entityStream) throws IOException, WebApplicationException {
JSONDeserializer<DefaultDatabaseConnectionList> jsonD = new JSONDeserializer<DefaultDatabaseConnectionList>();
jsonD.use("databaseType", DatabaseType.class);
return jsonD.deserialize(new InputStreamReader(entityStream), DefaultDatabaseConnectionList.class);
}
use of flexjson.JSONDeserializer in project data-access by pentaho.
the class DatabaseConnectionReaderWriter method readFrom.
@Override
public DatabaseConnection readFrom(Class<DatabaseConnection> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, String> httpHeaders, InputStream entityStream) throws IOException, WebApplicationException {
JSONDeserializer<DatabaseConnection> jsonD = new JSONDeserializer<DatabaseConnection>();
jsonD.use("databaseType", DatabaseType.class);
return jsonD.deserialize(new InputStreamReader(entityStream), DatabaseConnection.class);
}
Aggregations