use of com.hack23.cia.model.internal.application.data.document.impl.ViewRiksdagenOrgDocumentDailySummary in project cia by Hack23.
the class OrgDocumentChartDataManagerImpl method addNewDataSerie.
private static void addNewDataSerie(final DataSeries dataSeries, final Series series, final SimpleDateFormat simpleDateFormat, final SimpleDateFormat parseIncomingDateFormat, final Entry<String, List<ViewRiksdagenOrgDocumentDailySummary>> entry) {
series.addSeries(new XYseries().setLabel(entry.getKey()));
dataSeries.newSeries();
if (entry.getValue() != null) {
for (final ViewRiksdagenOrgDocumentDailySummary item : entry.getValue()) {
if (item != null && item.getEmbeddedId().getPublicDate().length() > 0) {
try {
dataSeries.add(simpleDateFormat.format(parseIncomingDateFormat.parse(item.getEmbeddedId().getPublicDate())), item.getTotal());
} catch (final ParseException e) {
LOGGER.warn("Problem parsing date:{}", item.getEmbeddedId().getPublicDate());
}
}
}
} else {
LOGGER.info(LOG_MSG_MISSING_DATA_FOR_KEY, entry);
}
}
use of com.hack23.cia.model.internal.application.data.document.impl.ViewRiksdagenOrgDocumentDailySummary in project cia by Hack23.
the class OrgDocumentChartDataManagerImpl method createDocumentHistoryChartByOrg.
@Override
public void createDocumentHistoryChartByOrg(final AbstractOrderedLayout content, final String org) {
final String searchOrg = org.toUpperCase(Locale.ENGLISH).replace(UNDER_SCORE, EMPTY_STRING).replace(MINUS_SIGN, EMPTY_STRING).trim();
final DataSeries dataSeries = new DataSeries();
final Series series = new Series();
final Map<String, List<ViewRiksdagenOrgDocumentDailySummary>> allMap = getViewRiksdagenOrgDocumentDailySummaryMap();
final List<ViewRiksdagenOrgDocumentDailySummary> itemList = allMap.get(searchOrg);
if (itemList != null) {
addDocumentHistoryByOrgData(dataSeries, series, itemList);
}
addChart(content, DOCUMENT_HISTORY_BY_ORG, new DCharts().setDataSeries(dataSeries).setOptions(getChartOptions().createOptionsXYDateFloatLegendInsideOneColumn(series)).show(), true);
}
use of com.hack23.cia.model.internal.application.data.document.impl.ViewRiksdagenOrgDocumentDailySummary in project cia by Hack23.
the class OrgDocumentChartDataManagerImpl method addDocumentHistoryByOrgData.
/**
* Adds the document history by org data.
*
* @param dataSeries
* the data series
* @param series
* the series
* @param itemList
* the item list
*/
private static void addDocumentHistoryByOrgData(final DataSeries dataSeries, final Series series, final List<ViewRiksdagenOrgDocumentDailySummary> itemList) {
final Map<String, List<ViewRiksdagenOrgDocumentDailySummary>> map = itemList.parallelStream().filter(Objects::nonNull).collect(Collectors.groupingBy(t -> StringUtils.defaultIfBlank(t.getDocumentType(), NO_INFO)));
final SimpleDateFormat simpleDateFormat = new SimpleDateFormat(DD_MMM_YYYY, Locale.ENGLISH);
final SimpleDateFormat parseIncomingDateFormat = new SimpleDateFormat("yyyy-MM-dd", Locale.ENGLISH);
for (final Entry<String, List<ViewRiksdagenOrgDocumentDailySummary>> entry : map.entrySet()) {
addNewDataSerie(dataSeries, series, simpleDateFormat, parseIncomingDateFormat, entry);
}
}
Aggregations