Logging in serialization

This commit is contained in:
Fabio Sinibaldi 2021-12-01 12:25:51 +01:00
parent add1754dcc
commit 820ea7203f
3 changed files with 7 additions and 4 deletions

View File

@ -54,10 +54,9 @@ public class StatelessClientTests extends BasicVreTests{
@Test
public void query() throws Exception {
QueryRequest req=new QueryRequest();
req.setFilter(Document.parse("{ \"nome\" : { \"$eq\" : \"mock\" } }"));
System.out.println("FRA "+ count(client.query(req)));
System.out.println("FRA "+ count(client.query(
Queries.parse(TestConcessioniQueries.queries.get("emptyresult.json")))));
// No Transformation
System.out.print("First Registered \t");

View File

@ -5,6 +5,7 @@ import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import lombok.extern.slf4j.Slf4j;
import org.bson.Document;
import org.gcube.application.geoportal.common.model.rest.QueryRequest;
@ -12,6 +13,7 @@ import java.io.IOException;
import java.time.format.DateTimeFormatter;
import java.util.Iterator;
@Slf4j
public class Serialization {
@ -43,7 +45,9 @@ public class Serialization {
public static QueryRequest parseQuery(String queryString) throws IOException {
log.debug("Parsing query Request {} ",queryString);
Document queryDocument = Document.parse(queryString);
log.debug("Document is ",queryDocument.toJson());
QueryRequest req = new QueryRequest();
if (queryDocument.containsKey("ordering"))
req.setOrdering(Serialization.read(((Document) queryDocument.get("ordering")).toJson(), QueryRequest.OrderedRequest.class));