use of com.hack23.cia.model.internal.application.data.document.impl.ViewRiksdagenPartyDocumentDailySummary in project cia by Hack23.
the class PartyDocumentChartDataManagerImpl method createDocumentHistoryPartyChart.
@Override
public void createDocumentHistoryPartyChart(final AbstractOrderedLayout content, final String org) {
final DataSeries dataSeries = new DataSeries();
final Series series = new Series();
final Map<String, List<ViewRiksdagenPartyDocumentDailySummary>> allMap = getViewRiksdagenPartyDocumentDailySummaryMap();
final List<ViewRiksdagenPartyDocumentDailySummary> itemList = allMap.get(org.toUpperCase(Locale.ENGLISH).replace(UNDER_SCORE, EMPTY_STRING).trim());
if (itemList != null) {
final Map<String, List<ViewRiksdagenPartyDocumentDailySummary>> map = itemList.parallelStream().filter(Objects::nonNull).collect(Collectors.groupingBy(t -> StringUtils.defaultIfBlank(t.getEmbeddedId().getDocumentType(), NO_INFO)));
addDocumentHistoryByPartyData(dataSeries, series, map);
}
addChart(content, DOCUMENT_HISTORY_PARTY, new DCharts().setDataSeries(dataSeries).setOptions(getChartOptions().createOptionsXYDateFloatLegendInsideOneColumn(series)).show(), true);
}
use of com.hack23.cia.model.internal.application.data.document.impl.ViewRiksdagenPartyDocumentDailySummary in project cia by Hack23.
the class PartyDocumentChartDataManagerImpl method addDocumentHistoryByPartyData.
/**
* Adds the document history by party data.
*
* @param dataSeries
* the data series
* @param series
* the series
* @param map
* the map
*/
private static void addDocumentHistoryByPartyData(final DataSeries dataSeries, final Series series, final Map<String, List<ViewRiksdagenPartyDocumentDailySummary>> map) {
final SimpleDateFormat simpleDateFormat = new SimpleDateFormat(DD_MMM_YYYY, Locale.ENGLISH);
for (final Entry<String, List<ViewRiksdagenPartyDocumentDailySummary>> entry : map.entrySet()) {
series.addSeries(new XYseries().setLabel(entry.getKey()));
dataSeries.newSeries();
if (entry.getValue() != null) {
for (final ViewRiksdagenPartyDocumentDailySummary 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);
}
}
}
Aggregations