client: Add client backward compatibility with old "QueryResponse" and "QueryResult"
package org.opencb.cellbase.client.rest;
+import com.fasterxml.jackson.annotation.JsonAlias;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
@@ -25,11 +26,11 @@ import org.opencb.biodata.models.variant.avro.DrugResponseClassification;
import org.opencb.cellbase.client.config.ClientConfiguration;
import org.opencb.cellbase.client.rest.models.mixin.DrugResponseClassificationMixIn;
import org.opencb.cellbase.core.CellBaseDataResponse;
+import org.opencb.cellbase.core.result.CellBaseDataResult;
import org.opencb.commons.datastore.core.Event;
import org.opencb.commons.datastore.core.ObjectMap;
import org.opencb.commons.datastore.core.Query;
import org.opencb.commons.datastore.core.QueryOptions;
-import org.opencb.cellbase.core.result.CellBaseDataResult;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -95,6 +96,18 @@ public class ParentRestClient<T> {
jsonObjectMapper = new ObjectMapper();
jsonObjectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
jsonObjectMapper.addMixIn(DrugResponseClassification.class, DrugResponseClassificationMixIn.class);
+ jsonObjectMapper.addMixIn(CellBaseDataResponse.class, CellBaseDataResponseMixIn.class);
+ jsonObjectMapper.addMixIn(CellBaseDataResult.class, CellBaseDataResultMixIn.class);
+ }
+
+ public interface CellBaseDataResponseMixIn<T> {
+ @JsonAlias("response")
+ List<CellBaseDataResult<T>> getResponses();
+ }
+
+ public interface CellBaseDataResultMixIn<T> {
+ @JsonAlias("result")
+ List<T> getResults();
}
// end points have been removed
