@Test public void testConvertGroupBy() { TopHitsAnalytics topHitsAnalytics = new TopHitsAnalytics(); Map<String, Map<String, String>> metadata = new HashMap<>(); Map<String, String> analyticMetadata = new HashMap<>(); analyticMetadata.put("key", "value"); metadata.put("topHits", analyticMetadata); topHitsAnalytics.setMetadata(metadata); Map<String, Long> values = new HashMap<>(); values.put("valuesKey", 1L); topHitsAnalytics.setValues(values); GroupByAnalytics analytics = analyticsMapper.convert(topHitsAnalytics); assertNotNull(analytics); assertEquals(metadata, analytics.getMetadata()); assertEquals(values, analytics.getValues()); }
public DateHistoAnalytics convert(HistogramAnalytics analytics) { DateHistoAnalytics analyticsItem = new DateHistoAnalytics(); if (analytics != null && analytics.getTimestamp() != null) { analyticsItem.setTimestamp(new Timerange() .from(analytics.getTimestamp().getFrom()) .to(analytics.getTimestamp().getTo()) .interval(analytics.getTimestamp().getInterval()) ); List<Bucket> buckets = convertBucketList(analytics.getValues()); analyticsItem.setValues(buckets); } return analyticsItem; }
AnalyticsMapper { public DateHistoAnalytics convert(HistogramAnalytics analytics) { DateHistoAnalytics analyticsItem = new DateHistoAnalytics(); if (analytics != null && analytics.getTimestamp() != null) { analyticsItem.setTimestamp(new Timerange() .from(analytics.getTimestamp().getFrom()) .to(analytics.getTimestamp().getTo()) .interval(analytics.getTimestamp().getInterval()) ); List<Bucket> buckets = convertBucketList(analytics.getValues()); analyticsItem.setValues(buckets); } return analyticsItem; } }
AnalyticsMapper { public DateHistoAnalytics convert(HistogramAnalytics analytics) { DateHistoAnalytics analyticsItem = new DateHistoAnalytics(); if (analytics != null && analytics.getTimestamp() != null) { analyticsItem.setTimestamp(new Timerange() .from(analytics.getTimestamp().getFrom()) .to(analytics.getTimestamp().getTo()) .interval(analytics.getTimestamp().getInterval()) ); List<Bucket> buckets = convertBucketList(analytics.getValues()); analyticsItem.setValues(buckets); } return analyticsItem; }  }
AnalyticsMapper { public DateHistoAnalytics convert(HistogramAnalytics analytics) { DateHistoAnalytics analyticsItem = new DateHistoAnalytics(); if (analytics != null && analytics.getTimestamp() != null) { analyticsItem.setTimestamp(new Timerange() .from(analytics.getTimestamp().getFrom()) .to(analytics.getTimestamp().getTo()) .interval(analytics.getTimestamp().getInterval()) ); List<Bucket> buckets = convertBucketList(analytics.getValues()); analyticsItem.setValues(buckets); } return analyticsItem; }  DateHistoAnalytics convert(HistogramAnalytics analytics); CountAnalytics convert(HitsAnalytics analytics); GroupByAnalytics convert(TopHitsAnalytics analytics); }
AnalyticsMapper { public DateHistoAnalytics convert(HistogramAnalytics analytics) { DateHistoAnalytics analyticsItem = new DateHistoAnalytics(); if (analytics != null && analytics.getTimestamp() != null) { analyticsItem.setTimestamp(new Timerange() .from(analytics.getTimestamp().getFrom()) .to(analytics.getTimestamp().getTo()) .interval(analytics.getTimestamp().getInterval()) ); List<Bucket> buckets = convertBucketList(analytics.getValues()); analyticsItem.setValues(buckets); } return analyticsItem; }  DateHistoAnalytics convert(HistogramAnalytics analytics); CountAnalytics convert(HitsAnalytics analytics); GroupByAnalytics convert(TopHitsAnalytics analytics);  }