use of com.hack23.cia.model.internal.application.data.committee.impl.ViewRiksdagenCommitteeDecisionTypeDailySummary in project cia by Hack23.
the class DecisionChartDataManagerImpl method createDecisionTypeChart.
@Override
public void createDecisionTypeChart(final AbstractOrderedLayout content) {
final Map<String, List<ViewRiksdagenCommitteeDecisionTypeDailySummary>> map = getCommitteeDecisionTypeMap();
final SimpleDateFormat simpleDateFormat = new SimpleDateFormat(DD_MMM_YYYY, Locale.ENGLISH);
final DataSeries dataSeries = new DataSeries();
final Series series = new Series();
for (final Entry<String, List<ViewRiksdagenCommitteeDecisionTypeDailySummary>> entry : map.entrySet()) {
if (entry.getKey() != null) {
series.addSeries(new XYseries().setLabel(entry.getKey()));
dataSeries.newSeries();
final List<ViewRiksdagenCommitteeDecisionTypeDailySummary> list = entry.getValue();
for (final ViewRiksdagenCommitteeDecisionTypeDailySummary item : list) {
if (item != null) {
dataSeries.add(simpleDateFormat.format(item.getEmbeddedId().getDecisionDate()), item.getTotal());
}
}
}
}
addChart(content, "Decision type daily summary", new DCharts().setDataSeries(dataSeries).setOptions(getChartOptions().createOptionsXYDateFloatLegendInsideOneColumn(series)).show(), true);
}
use of com.hack23.cia.model.internal.application.data.committee.impl.ViewRiksdagenCommitteeDecisionTypeDailySummary in project cia by Hack23.
the class DecisionChartDataManagerImpl method getCommitteeDecisionTypeMap.
/**
* Gets the committee decision type map.
*
* @return the committee decision type map
*/
private Map<String, List<ViewRiksdagenCommitteeDecisionTypeDailySummary>> getCommitteeDecisionTypeMap() {
final DataContainer<ViewRiksdagenCommitteeDecisionTypeDailySummary, RiksdagenCommitteeDecisionTypeSummaryEmbeddedId> committeeBallotDecisionPartyDataContainer = getApplicationManager().getDataContainer(ViewRiksdagenCommitteeDecisionTypeDailySummary.class);
final Date now = new Date();
final Date notBefore = new GregorianCalendar(2000, Calendar.JANUARY, 1).getTime();
return committeeBallotDecisionPartyDataContainer.getAll().parallelStream().filter(t -> t != null && !t.getEmbeddedId().getDecisionDate().after(now) && !notBefore.after(t.getEmbeddedId().getDecisionDate())).collect(Collectors.groupingBy(t -> t.getEmbeddedId().getDecisionType()));
}
Aggregations