com.scaleset.search.Results Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of scaleset-search Show documentation
Show all versions of scaleset-search Show documentation
Java object model for representing query requests in REST protocols.
package com.scaleset.search;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.vividsolutions.jts.geom.Envelope;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@JsonPropertyOrder({"headers", "query", "totalItems", "aggs", "bbox", "items"})
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public class Results {
private Map aggs = new HashMap<>();
private List items = new ArrayList<>();
private Query query;
private Integer totalItems = 0;
private Envelope bbox;
private Map headers = new HashMap();
/* For Jackson */
protected Results() {
}
public Results(Query query, Map aggs, List items, Integer totalItems) {
this(query, aggs, items, totalItems, null, null);
}
public Results(Query query, Map aggs, List items, Integer totalItems, Envelope bbox, Map headers) {
this.query = query;
if (aggs != null) {
this.aggs.putAll(aggs);
}
this.items.addAll(items);
this.totalItems = totalItems;
this.bbox = bbox;
if (headers != null) {
this.headers.putAll(headers);
}
}
public Results(Query query, List items) {
this.query = query;
this.items.addAll(items);
}
public Envelope getBbox() {
return bbox;
}
public AggregationResults getAgg(String name) {
return aggs.get(name);
}
public Map getAggs() {
return aggs;
}
public Map getHeaders() {
return headers;
}
public List getItems() {
return items;
}
public Query getQuery() {
return query;
}
public Integer getTotalItems() {
return totalItems;
}
}