Loading DataAccessAPI/src/main/java/cz/muni/fi/lasaris/sbms/data/api/DataPointsEndpoint.java +14 −14 Original line number Diff line number Diff line Loading @@ -19,8 +19,8 @@ import com.fasterxml.jackson.databind.ObjectMapper; import cz.muni.fi.lasaris.sbms.data.api.request.GroupedAddressRequest; import cz.muni.fi.lasaris.sbms.data.api.request.AddressRequest; import cz.muni.fi.lasaris.sbms.data.api.response.AggregationResponse; import cz.muni.fi.lasaris.sbms.data.api.response.SnapshotResponse; import cz.muni.fi.lasaris.sbms.data.api.response.AggregateResponse; import cz.muni.fi.lasaris.sbms.data.api.response.SliceResponse; import cz.muni.fi.lasaris.sbms.data.entities.Address; import cz.muni.fi.lasaris.sbms.data.entities.AggregationFunction; import cz.muni.fi.lasaris.sbms.data.entities.values.RawValue; Loading @@ -39,7 +39,7 @@ public class DataPointsEndpoint { @RolesAllowed({"user","admin"}) @GET @Produces(MediaType.APPLICATION_JSON) public SnapshotResponse getDataPoints( public SliceResponse getDataPoints( @QueryParam("ids") String json, @QueryParam("cache") String cache ) { Loading @@ -51,11 +51,11 @@ public class DataPointsEndpoint { logger.debug(json); AddressRequest readSpecs = m.readValue(json, AddressRequest.class); logger.debug(readSpecs); SnapshotResponse result = dc.getDataPointValues(readSpecs, allowCache(cache)); SliceResponse result = dc.getDataPointValues(readSpecs, allowCache(cache)); logger.debug(result); return result; } catch (IOException e) { return SnapshotResponse.getErrorResponse("Unable to parse query:" + e); return SliceResponse.getErrorResponse("Unable to parse query:" + e); } Loading @@ -66,7 +66,7 @@ public class DataPointsEndpoint { @GET @Path("/aggregated") @Produces(MediaType.APPLICATION_JSON) public AggregationResponse getAggregatedDataPoints( public AggregateResponse getAggregatedDataPoints( @QueryParam("ids") String json, @DefaultValue("NONE") @QueryParam("aggregation") AggregationFunction agg, @QueryParam("cache") String cache Loading @@ -79,7 +79,7 @@ public class DataPointsEndpoint { logger.debug(readSpecs); return dc.getDataPointsAggregation(readSpecs, agg, allowCache(cache)); } catch (IOException e) { return AggregationResponse.getErrorResponse("Unable to parse query:" + e); return AggregateResponse.getErrorResponse("Unable to parse query:" + e); } } Loading @@ -88,7 +88,7 @@ public class DataPointsEndpoint { @GET @Path("/grouped") @Produces(MediaType.APPLICATION_JSON) public SnapshotResponse getGroupedDataPoints( public SliceResponse getGroupedDataPoints( @QueryParam("ids") String json, @QueryParam("cache") String cache ) { Loading @@ -100,7 +100,7 @@ public class DataPointsEndpoint { logger.debug(readSpecs); return dc.getDataPointGroupedValues(readSpecs, allowCache(cache)); } catch (IOException e) { return SnapshotResponse.getErrorResponse("Unable to parse query:" + e); return SliceResponse.getErrorResponse("Unable to parse query:" + e); } } Loading @@ -108,7 +108,7 @@ public class DataPointsEndpoint { @GET @Path("/group-aggregated") @Produces(MediaType.APPLICATION_JSON) public AggregationResponse getGroupedAggregatedDataPoints( public AggregateResponse getGroupedAggregatedDataPoints( @QueryParam("ids") String json, @DefaultValue("NONE") @QueryParam("aggregation") AggregationFunction agg, @QueryParam("cache") String cache Loading @@ -119,11 +119,11 @@ public class DataPointsEndpoint { logger.debug(json); GroupedAddressRequest readSpecs = m.readValue(json, GroupedAddressRequest.class); logger.debug(readSpecs); AggregationResponse result = dc.getDataPointGroupAggregations(readSpecs, agg, allowCache(cache)); AggregateResponse result = dc.getDataPointGroupAggregations(readSpecs, agg, allowCache(cache)); logger.debug(result); return result; } catch (IOException e) { return AggregationResponse.getErrorResponse("Unable to parse query:" + e); return AggregateResponse.getErrorResponse("Unable to parse query:" + e); } } Loading @@ -131,12 +131,12 @@ public class DataPointsEndpoint { @GET @Path("/{id}") @Produces(MediaType.APPLICATION_JSON) public SnapshotResponse getDataPoint( public SliceResponse getDataPoint( @PathParam("id") String idP, @QueryParam("cache") String cache) { Address a = new Address(idP); RawValue v = ProviderManager.getDataPointsProvider(a.getProtocol()).getDataPointValue(a, allowCache(cache)); return new SnapshotResponse(a, v); return new SliceResponse(a, v); } private boolean allowCache(String cache) { Loading DataAccessAPI/src/main/java/cz/muni/fi/lasaris/sbms/data/api/TrendsEndpoint.java +16 −16 Original line number Diff line number Diff line Loading @@ -22,9 +22,9 @@ import com.fasterxml.jackson.databind.ObjectMapper; import cz.muni.fi.lasaris.sbms.data.api.request.GroupedAddressRequest; import cz.muni.fi.lasaris.sbms.data.api.request.AddressRequest; import cz.muni.fi.lasaris.sbms.data.api.response.AggregationResponse; import cz.muni.fi.lasaris.sbms.data.api.response.SnapshotResponse; import cz.muni.fi.lasaris.sbms.data.api.response.SnapshotResponse; import cz.muni.fi.lasaris.sbms.data.api.response.AggregateResponse; import cz.muni.fi.lasaris.sbms.data.api.response.SliceResponse; import cz.muni.fi.lasaris.sbms.data.api.response.SliceResponse; import cz.muni.fi.lasaris.sbms.data.entities.Address; import cz.muni.fi.lasaris.sbms.data.entities.AggregationFunction; import cz.muni.fi.lasaris.sbms.data.entities.Interpolation; Loading Loading @@ -55,7 +55,7 @@ public class TrendsEndpoint { @RolesAllowed({"user","admin"}) @GET @Produces(MediaType.APPLICATION_JSON) public SnapshotResponse getTrends( public SliceResponse getTrends( @QueryParam("ids") String json, @QueryParam("start") String start, @QueryParam("end") String end, Loading @@ -68,11 +68,11 @@ public class TrendsEndpoint { logger.debug(json); TrendsRequest readSpecs = getReadSpecs(json, start, end, samplingCron, samplingDur, interpolation, null); logger.debug(readSpecs); SnapshotResponse result = dc.getTrends(readSpecs); SliceResponse result = dc.getTrends(readSpecs); logger.debug(result); return result; } catch (IOException e) { return SnapshotResponse.getErrorResponse("Unable to parse query:" + e); return SliceResponse.getErrorResponse("Unable to parse query:" + e); } Loading @@ -83,8 +83,8 @@ public class TrendsEndpoint { @GET @Path("/aggregated") @Produces(MediaType.APPLICATION_JSON) public AggregationResponse getAggregatedDataPoints( @QueryParam("json") String json, public AggregateResponse getAggregatedTrends( @QueryParam("ids") String json, @DefaultValue("NONE") @QueryParam("aggregation") AggregationFunction agg ) { ObjectMapper m = new ObjectMapper(); Loading @@ -95,7 +95,7 @@ public class TrendsEndpoint { logger.debug(readSpecs); return dc.getDataPointsAggregation(readSpecs, agg); } catch (IOException e) { return AggregationResponse.getErrorResponse("Unable to parse query:" + e); return AggregateResponse.getErrorResponse("Unable to parse query:" + e); } } Loading @@ -104,7 +104,7 @@ public class TrendsEndpoint { @GET @Path("/grouped") @Produces(MediaType.APPLICATION_JSON) public SnapshotResponse getGroupedDataPoints( public SliceResponse getGroupedDataPoints( @QueryParam("json") String json ) { ObjectMapper m = new ObjectMapper(); Loading @@ -115,7 +115,7 @@ public class TrendsEndpoint { logger.debug(readSpecs); return dc.getDataPointGroupedValues(readSpecs); } catch (IOException e) { return SnapshotResponse.getErrorResponse("Unable to parse query:" + e); return SliceResponse.getErrorResponse("Unable to parse query:" + e); } } Loading @@ -123,7 +123,7 @@ public class TrendsEndpoint { @GET @Path("/group-aggregated") @Produces(MediaType.APPLICATION_JSON) public AggregationResponse getGroupedAggregatedDataPoints( public AggregateResponse getGroupedAggregatedDataPoints( @QueryParam("json") String json, @DefaultValue("NONE") @QueryParam("aggregation") AggregationFunction agg ) { Loading @@ -133,11 +133,11 @@ public class TrendsEndpoint { logger.debug(json); GroupedAddressRequest readSpecs = m.readValue(json, GroupedAddressRequest.class); logger.debug(readSpecs); AggregationResponse result = dc.getDataPointGroupAggregations(readSpecs, agg); AggregateResponse result = dc.getDataPointGroupAggregations(readSpecs, agg); logger.debug(result); return result; } catch (IOException e) { return AggregationResponse.getErrorResponse("Unable to parse query:" + e); return AggregateResponse.getErrorResponse("Unable to parse query:" + e); } } Loading @@ -145,7 +145,7 @@ public class TrendsEndpoint { @GET @Path("/{id}") @Produces(MediaType.APPLICATION_JSON) public SnapshotResponse getTrend( public SliceResponse getTrend( @QueryParam("id") String id, @QueryParam("start") String start, @QueryParam("end") String end, Loading @@ -155,7 +155,7 @@ public class TrendsEndpoint { ) { Address a = new Address(id); Trend v = ProviderManager.getTrendsProvider(a.getProtocol()).getTrend(a, getSeriesSpecs(start, end, samplingCron, samplingDur, interpolation)); return new SnapshotResponse(a, v); return new SliceResponse(a, v); } private TrendsRequest getReadSpecs(String json, String start, String end, String samplingCron, Loading DataAccessAPI/src/main/java/cz/muni/fi/lasaris/sbms/data/api/response/AggregationResponse.java→DataAccessAPI/src/main/java/cz/muni/fi/lasaris/sbms/data/api/response/AggregateResponse.java +7 −7 Original line number Diff line number Diff line Loading @@ -7,7 +7,7 @@ import cz.muni.fi.lasaris.sbms.data.entities.AddressGroup; import cz.muni.fi.lasaris.sbms.data.entities.containers.Aggregation; import cz.muni.fi.lasaris.sbms.data.entities.values.AggregatedValue; public class AggregationResponse { public class AggregateResponse { private String error; private Map<String, AggregatedValue> results; Loading @@ -15,26 +15,26 @@ public class AggregationResponse { return this.results; } public static AggregationResponse getErrorResponse(String error) { AggregationResponse r = new AggregationResponse(); public static AggregateResponse getErrorResponse(String error) { AggregateResponse r = new AggregateResponse(); r.setError(error); return r; } private AggregationResponse() { private AggregateResponse() { this.results = null; } public AggregationResponse(Map<String, AggregatedValue> data) { public AggregateResponse(Map<String, AggregatedValue> data) { this.results = data; } public AggregationResponse(AggregatedValue v) { public AggregateResponse(AggregatedValue v) { this.results = new LinkedHashMap<String, AggregatedValue>(); this.results.put("value", v); } public AggregationResponse(Aggregation<AddressGroup> a) { public AggregateResponse(Aggregation<AddressGroup> a) { this.results = new LinkedHashMap<String, AggregatedValue>(); a.forEach((k,v) -> this.results.put(k.getName(), v)); } Loading DataAccessAPI/src/main/java/cz/muni/fi/lasaris/sbms/data/api/response/SeriesOfValuesResponse.java 0 → 100644 +53 −0 Original line number Diff line number Diff line package cz.muni.fi.lasaris.sbms.data.api.response; import java.util.LinkedHashMap; import java.util.Map; import cz.muni.fi.lasaris.sbms.data.entities.Address; import cz.muni.fi.lasaris.sbms.data.entities.containers.Series; import cz.muni.fi.lasaris.sbms.data.entities.values.Value; public class SeriesOfValuesResponse { private static final String DEFAULT_GROUPING = "noGrouping"; private String error; private Map<String, Map<Address, Series<? extends Value>>> results; public Map<String, Map<Address, Series<? extends Value>>> getResults() { return this.results; } public static SeriesOfValuesResponse getErrorResponse(String error) { SeriesOfValuesResponse r = new SeriesOfValuesResponse(); r.setError(error); return r; } private SeriesOfValuesResponse() { this.results = null; } public SeriesOfValuesResponse(Map<String, Map<Address, Series<? extends Value>>> data, boolean groups) { this.results = data; } public SeriesOfValuesResponse(Map<Address, Series<? extends Value>> data) { this.results = new LinkedHashMap<String, Map<Address, Series<? extends Value>>>(); this.results.put(DEFAULT_GROUPING, data); } public SeriesOfValuesResponse(Address a, Series<? extends Value> v) { this(new LinkedHashMap<String, Map<Address, Series<? extends Value>>>(), true); this.results.put(DEFAULT_GROUPING, new LinkedHashMap<Address, Series<? extends Value>>()); this.results.get(DEFAULT_GROUPING).put(a, v); } public String getError() { return error; } public void setError(String error) { this.error = error; } } DataAccessAPI/src/main/java/cz/muni/fi/lasaris/sbms/data/api/response/SnapshotResponse.java→DataAccessAPI/src/main/java/cz/muni/fi/lasaris/sbms/data/api/response/SliceResponse.java +7 −7 Original line number Diff line number Diff line Loading @@ -7,7 +7,7 @@ import cz.muni.fi.lasaris.sbms.data.entities.Address; import cz.muni.fi.lasaris.sbms.data.entities.containers.Snapshot; import cz.muni.fi.lasaris.sbms.data.entities.values.RawValue; public class SnapshotResponse { public class SliceResponse { private static final String DEFAULT_GROUPING = "noGrouping"; Loading @@ -18,26 +18,26 @@ public class SnapshotResponse { return this.results; } public static SnapshotResponse getErrorResponse(String error) { SnapshotResponse r = new SnapshotResponse(); public static SliceResponse getErrorResponse(String error) { SliceResponse r = new SliceResponse(); r.setError(error); return r; } private SnapshotResponse() { private SliceResponse() { this.results = null; } public SnapshotResponse(Map<String, Snapshot> data) { public SliceResponse(Map<String, Snapshot> data) { this.results = data; } public SnapshotResponse(Snapshot data) { public SliceResponse(Snapshot data) { this.results = new LinkedHashMap<String, Snapshot>(); this.results.put(DEFAULT_GROUPING, data); } public SnapshotResponse(Address a, RawValue v) { public SliceResponse(Address a, RawValue v) { this(new Snapshot()); this.results.get(DEFAULT_GROUPING).add(a, v); Loading Loading
DataAccessAPI/src/main/java/cz/muni/fi/lasaris/sbms/data/api/DataPointsEndpoint.java +14 −14 Original line number Diff line number Diff line Loading @@ -19,8 +19,8 @@ import com.fasterxml.jackson.databind.ObjectMapper; import cz.muni.fi.lasaris.sbms.data.api.request.GroupedAddressRequest; import cz.muni.fi.lasaris.sbms.data.api.request.AddressRequest; import cz.muni.fi.lasaris.sbms.data.api.response.AggregationResponse; import cz.muni.fi.lasaris.sbms.data.api.response.SnapshotResponse; import cz.muni.fi.lasaris.sbms.data.api.response.AggregateResponse; import cz.muni.fi.lasaris.sbms.data.api.response.SliceResponse; import cz.muni.fi.lasaris.sbms.data.entities.Address; import cz.muni.fi.lasaris.sbms.data.entities.AggregationFunction; import cz.muni.fi.lasaris.sbms.data.entities.values.RawValue; Loading @@ -39,7 +39,7 @@ public class DataPointsEndpoint { @RolesAllowed({"user","admin"}) @GET @Produces(MediaType.APPLICATION_JSON) public SnapshotResponse getDataPoints( public SliceResponse getDataPoints( @QueryParam("ids") String json, @QueryParam("cache") String cache ) { Loading @@ -51,11 +51,11 @@ public class DataPointsEndpoint { logger.debug(json); AddressRequest readSpecs = m.readValue(json, AddressRequest.class); logger.debug(readSpecs); SnapshotResponse result = dc.getDataPointValues(readSpecs, allowCache(cache)); SliceResponse result = dc.getDataPointValues(readSpecs, allowCache(cache)); logger.debug(result); return result; } catch (IOException e) { return SnapshotResponse.getErrorResponse("Unable to parse query:" + e); return SliceResponse.getErrorResponse("Unable to parse query:" + e); } Loading @@ -66,7 +66,7 @@ public class DataPointsEndpoint { @GET @Path("/aggregated") @Produces(MediaType.APPLICATION_JSON) public AggregationResponse getAggregatedDataPoints( public AggregateResponse getAggregatedDataPoints( @QueryParam("ids") String json, @DefaultValue("NONE") @QueryParam("aggregation") AggregationFunction agg, @QueryParam("cache") String cache Loading @@ -79,7 +79,7 @@ public class DataPointsEndpoint { logger.debug(readSpecs); return dc.getDataPointsAggregation(readSpecs, agg, allowCache(cache)); } catch (IOException e) { return AggregationResponse.getErrorResponse("Unable to parse query:" + e); return AggregateResponse.getErrorResponse("Unable to parse query:" + e); } } Loading @@ -88,7 +88,7 @@ public class DataPointsEndpoint { @GET @Path("/grouped") @Produces(MediaType.APPLICATION_JSON) public SnapshotResponse getGroupedDataPoints( public SliceResponse getGroupedDataPoints( @QueryParam("ids") String json, @QueryParam("cache") String cache ) { Loading @@ -100,7 +100,7 @@ public class DataPointsEndpoint { logger.debug(readSpecs); return dc.getDataPointGroupedValues(readSpecs, allowCache(cache)); } catch (IOException e) { return SnapshotResponse.getErrorResponse("Unable to parse query:" + e); return SliceResponse.getErrorResponse("Unable to parse query:" + e); } } Loading @@ -108,7 +108,7 @@ public class DataPointsEndpoint { @GET @Path("/group-aggregated") @Produces(MediaType.APPLICATION_JSON) public AggregationResponse getGroupedAggregatedDataPoints( public AggregateResponse getGroupedAggregatedDataPoints( @QueryParam("ids") String json, @DefaultValue("NONE") @QueryParam("aggregation") AggregationFunction agg, @QueryParam("cache") String cache Loading @@ -119,11 +119,11 @@ public class DataPointsEndpoint { logger.debug(json); GroupedAddressRequest readSpecs = m.readValue(json, GroupedAddressRequest.class); logger.debug(readSpecs); AggregationResponse result = dc.getDataPointGroupAggregations(readSpecs, agg, allowCache(cache)); AggregateResponse result = dc.getDataPointGroupAggregations(readSpecs, agg, allowCache(cache)); logger.debug(result); return result; } catch (IOException e) { return AggregationResponse.getErrorResponse("Unable to parse query:" + e); return AggregateResponse.getErrorResponse("Unable to parse query:" + e); } } Loading @@ -131,12 +131,12 @@ public class DataPointsEndpoint { @GET @Path("/{id}") @Produces(MediaType.APPLICATION_JSON) public SnapshotResponse getDataPoint( public SliceResponse getDataPoint( @PathParam("id") String idP, @QueryParam("cache") String cache) { Address a = new Address(idP); RawValue v = ProviderManager.getDataPointsProvider(a.getProtocol()).getDataPointValue(a, allowCache(cache)); return new SnapshotResponse(a, v); return new SliceResponse(a, v); } private boolean allowCache(String cache) { Loading
DataAccessAPI/src/main/java/cz/muni/fi/lasaris/sbms/data/api/TrendsEndpoint.java +16 −16 Original line number Diff line number Diff line Loading @@ -22,9 +22,9 @@ import com.fasterxml.jackson.databind.ObjectMapper; import cz.muni.fi.lasaris.sbms.data.api.request.GroupedAddressRequest; import cz.muni.fi.lasaris.sbms.data.api.request.AddressRequest; import cz.muni.fi.lasaris.sbms.data.api.response.AggregationResponse; import cz.muni.fi.lasaris.sbms.data.api.response.SnapshotResponse; import cz.muni.fi.lasaris.sbms.data.api.response.SnapshotResponse; import cz.muni.fi.lasaris.sbms.data.api.response.AggregateResponse; import cz.muni.fi.lasaris.sbms.data.api.response.SliceResponse; import cz.muni.fi.lasaris.sbms.data.api.response.SliceResponse; import cz.muni.fi.lasaris.sbms.data.entities.Address; import cz.muni.fi.lasaris.sbms.data.entities.AggregationFunction; import cz.muni.fi.lasaris.sbms.data.entities.Interpolation; Loading Loading @@ -55,7 +55,7 @@ public class TrendsEndpoint { @RolesAllowed({"user","admin"}) @GET @Produces(MediaType.APPLICATION_JSON) public SnapshotResponse getTrends( public SliceResponse getTrends( @QueryParam("ids") String json, @QueryParam("start") String start, @QueryParam("end") String end, Loading @@ -68,11 +68,11 @@ public class TrendsEndpoint { logger.debug(json); TrendsRequest readSpecs = getReadSpecs(json, start, end, samplingCron, samplingDur, interpolation, null); logger.debug(readSpecs); SnapshotResponse result = dc.getTrends(readSpecs); SliceResponse result = dc.getTrends(readSpecs); logger.debug(result); return result; } catch (IOException e) { return SnapshotResponse.getErrorResponse("Unable to parse query:" + e); return SliceResponse.getErrorResponse("Unable to parse query:" + e); } Loading @@ -83,8 +83,8 @@ public class TrendsEndpoint { @GET @Path("/aggregated") @Produces(MediaType.APPLICATION_JSON) public AggregationResponse getAggregatedDataPoints( @QueryParam("json") String json, public AggregateResponse getAggregatedTrends( @QueryParam("ids") String json, @DefaultValue("NONE") @QueryParam("aggregation") AggregationFunction agg ) { ObjectMapper m = new ObjectMapper(); Loading @@ -95,7 +95,7 @@ public class TrendsEndpoint { logger.debug(readSpecs); return dc.getDataPointsAggregation(readSpecs, agg); } catch (IOException e) { return AggregationResponse.getErrorResponse("Unable to parse query:" + e); return AggregateResponse.getErrorResponse("Unable to parse query:" + e); } } Loading @@ -104,7 +104,7 @@ public class TrendsEndpoint { @GET @Path("/grouped") @Produces(MediaType.APPLICATION_JSON) public SnapshotResponse getGroupedDataPoints( public SliceResponse getGroupedDataPoints( @QueryParam("json") String json ) { ObjectMapper m = new ObjectMapper(); Loading @@ -115,7 +115,7 @@ public class TrendsEndpoint { logger.debug(readSpecs); return dc.getDataPointGroupedValues(readSpecs); } catch (IOException e) { return SnapshotResponse.getErrorResponse("Unable to parse query:" + e); return SliceResponse.getErrorResponse("Unable to parse query:" + e); } } Loading @@ -123,7 +123,7 @@ public class TrendsEndpoint { @GET @Path("/group-aggregated") @Produces(MediaType.APPLICATION_JSON) public AggregationResponse getGroupedAggregatedDataPoints( public AggregateResponse getGroupedAggregatedDataPoints( @QueryParam("json") String json, @DefaultValue("NONE") @QueryParam("aggregation") AggregationFunction agg ) { Loading @@ -133,11 +133,11 @@ public class TrendsEndpoint { logger.debug(json); GroupedAddressRequest readSpecs = m.readValue(json, GroupedAddressRequest.class); logger.debug(readSpecs); AggregationResponse result = dc.getDataPointGroupAggregations(readSpecs, agg); AggregateResponse result = dc.getDataPointGroupAggregations(readSpecs, agg); logger.debug(result); return result; } catch (IOException e) { return AggregationResponse.getErrorResponse("Unable to parse query:" + e); return AggregateResponse.getErrorResponse("Unable to parse query:" + e); } } Loading @@ -145,7 +145,7 @@ public class TrendsEndpoint { @GET @Path("/{id}") @Produces(MediaType.APPLICATION_JSON) public SnapshotResponse getTrend( public SliceResponse getTrend( @QueryParam("id") String id, @QueryParam("start") String start, @QueryParam("end") String end, Loading @@ -155,7 +155,7 @@ public class TrendsEndpoint { ) { Address a = new Address(id); Trend v = ProviderManager.getTrendsProvider(a.getProtocol()).getTrend(a, getSeriesSpecs(start, end, samplingCron, samplingDur, interpolation)); return new SnapshotResponse(a, v); return new SliceResponse(a, v); } private TrendsRequest getReadSpecs(String json, String start, String end, String samplingCron, Loading
DataAccessAPI/src/main/java/cz/muni/fi/lasaris/sbms/data/api/response/AggregationResponse.java→DataAccessAPI/src/main/java/cz/muni/fi/lasaris/sbms/data/api/response/AggregateResponse.java +7 −7 Original line number Diff line number Diff line Loading @@ -7,7 +7,7 @@ import cz.muni.fi.lasaris.sbms.data.entities.AddressGroup; import cz.muni.fi.lasaris.sbms.data.entities.containers.Aggregation; import cz.muni.fi.lasaris.sbms.data.entities.values.AggregatedValue; public class AggregationResponse { public class AggregateResponse { private String error; private Map<String, AggregatedValue> results; Loading @@ -15,26 +15,26 @@ public class AggregationResponse { return this.results; } public static AggregationResponse getErrorResponse(String error) { AggregationResponse r = new AggregationResponse(); public static AggregateResponse getErrorResponse(String error) { AggregateResponse r = new AggregateResponse(); r.setError(error); return r; } private AggregationResponse() { private AggregateResponse() { this.results = null; } public AggregationResponse(Map<String, AggregatedValue> data) { public AggregateResponse(Map<String, AggregatedValue> data) { this.results = data; } public AggregationResponse(AggregatedValue v) { public AggregateResponse(AggregatedValue v) { this.results = new LinkedHashMap<String, AggregatedValue>(); this.results.put("value", v); } public AggregationResponse(Aggregation<AddressGroup> a) { public AggregateResponse(Aggregation<AddressGroup> a) { this.results = new LinkedHashMap<String, AggregatedValue>(); a.forEach((k,v) -> this.results.put(k.getName(), v)); } Loading
DataAccessAPI/src/main/java/cz/muni/fi/lasaris/sbms/data/api/response/SeriesOfValuesResponse.java 0 → 100644 +53 −0 Original line number Diff line number Diff line package cz.muni.fi.lasaris.sbms.data.api.response; import java.util.LinkedHashMap; import java.util.Map; import cz.muni.fi.lasaris.sbms.data.entities.Address; import cz.muni.fi.lasaris.sbms.data.entities.containers.Series; import cz.muni.fi.lasaris.sbms.data.entities.values.Value; public class SeriesOfValuesResponse { private static final String DEFAULT_GROUPING = "noGrouping"; private String error; private Map<String, Map<Address, Series<? extends Value>>> results; public Map<String, Map<Address, Series<? extends Value>>> getResults() { return this.results; } public static SeriesOfValuesResponse getErrorResponse(String error) { SeriesOfValuesResponse r = new SeriesOfValuesResponse(); r.setError(error); return r; } private SeriesOfValuesResponse() { this.results = null; } public SeriesOfValuesResponse(Map<String, Map<Address, Series<? extends Value>>> data, boolean groups) { this.results = data; } public SeriesOfValuesResponse(Map<Address, Series<? extends Value>> data) { this.results = new LinkedHashMap<String, Map<Address, Series<? extends Value>>>(); this.results.put(DEFAULT_GROUPING, data); } public SeriesOfValuesResponse(Address a, Series<? extends Value> v) { this(new LinkedHashMap<String, Map<Address, Series<? extends Value>>>(), true); this.results.put(DEFAULT_GROUPING, new LinkedHashMap<Address, Series<? extends Value>>()); this.results.get(DEFAULT_GROUPING).put(a, v); } public String getError() { return error; } public void setError(String error) { this.error = error; } }
DataAccessAPI/src/main/java/cz/muni/fi/lasaris/sbms/data/api/response/SnapshotResponse.java→DataAccessAPI/src/main/java/cz/muni/fi/lasaris/sbms/data/api/response/SliceResponse.java +7 −7 Original line number Diff line number Diff line Loading @@ -7,7 +7,7 @@ import cz.muni.fi.lasaris.sbms.data.entities.Address; import cz.muni.fi.lasaris.sbms.data.entities.containers.Snapshot; import cz.muni.fi.lasaris.sbms.data.entities.values.RawValue; public class SnapshotResponse { public class SliceResponse { private static final String DEFAULT_GROUPING = "noGrouping"; Loading @@ -18,26 +18,26 @@ public class SnapshotResponse { return this.results; } public static SnapshotResponse getErrorResponse(String error) { SnapshotResponse r = new SnapshotResponse(); public static SliceResponse getErrorResponse(String error) { SliceResponse r = new SliceResponse(); r.setError(error); return r; } private SnapshotResponse() { private SliceResponse() { this.results = null; } public SnapshotResponse(Map<String, Snapshot> data) { public SliceResponse(Map<String, Snapshot> data) { this.results = data; } public SnapshotResponse(Snapshot data) { public SliceResponse(Snapshot data) { this.results = new LinkedHashMap<String, Snapshot>(); this.results.put(DEFAULT_GROUPING, data); } public SnapshotResponse(Address a, RawValue v) { public SliceResponse(Address a, RawValue v) { this(new Snapshot()); this.results.get(DEFAULT_GROUPING).add(a, v); Loading