use of com.hack23.cia.model.internal.application.data.document.impl.ViewRiksdagenPoliticianDocumentDailySummary in project cia by Hack23.
the class PersonDocumentChartDataManagerImpl method addDocumentHistoryByPersonData.
/**
* Adds the document history by person data.
*
* @param simpleDateFormat
* the simple date format
* @param dataSeries
* the data series
* @param series
* the series
* @param map
* the map
*/
private static void addDocumentHistoryByPersonData(final SimpleDateFormat simpleDateFormat, final DataSeries dataSeries, final Series series, final Map<String, List<ViewRiksdagenPoliticianDocumentDailySummary>> map) {
for (final Entry<String, List<ViewRiksdagenPoliticianDocumentDailySummary>> entry : map.entrySet()) {
series.addSeries(new XYseries().setLabel(entry.getKey()));
dataSeries.newSeries();
if (entry.getValue() != null) {
for (final ViewRiksdagenPoliticianDocumentDailySummary item : entry.getValue()) {
if (item != null) {
dataSeries.add(simpleDateFormat.format(item.getEmbeddedId().getPublicDate()), item.getTotal());
}
}
} else {
LOGGER.info(LOG_MSG_MISSING_DATA_FOR_KEY, entry);
}
}
}
use of com.hack23.cia.model.internal.application.data.document.impl.ViewRiksdagenPoliticianDocumentDailySummary in project cia by Hack23.
the class PersonDocumentChartDataManagerImpl method createPersonDocumentHistoryChart.
@Override
public void createPersonDocumentHistoryChart(final AbstractOrderedLayout content, final String personId) {
final SimpleDateFormat simpleDateFormat = new SimpleDateFormat(DD_MMM_YYYY, Locale.ENGLISH);
final DataSeries dataSeries = new DataSeries();
final Series series = new Series();
final Map<String, List<ViewRiksdagenPoliticianDocumentDailySummary>> allMap = getViewRiksdagenPoliticianDocumentDailySummaryMap();
final List<ViewRiksdagenPoliticianDocumentDailySummary> itemList = allMap.get(personId.toUpperCase(Locale.ENGLISH).replace(UNDER_SCORE, EMPTY_STRING).trim());
if (itemList != null) {
final Map<String, List<ViewRiksdagenPoliticianDocumentDailySummary>> map = itemList.parallelStream().filter(Objects::nonNull).collect(Collectors.groupingBy(t -> StringUtils.defaultIfBlank(t.getEmbeddedId().getDocumentType(), NO_INFO)));
addDocumentHistoryByPersonData(simpleDateFormat, dataSeries, series, map);
}
addChart(content, DOCUMENT_HISTORY, new DCharts().setDataSeries(dataSeries).setOptions(getChartOptions().createOptionsXYDateFloatLegendInsideOneColumn(series)).show(), true);
}
Aggregations