use of com.hack23.cia.service.external.esv.api.GovernmentBodyAnnualSummary in project cia by Hack23.
the class GovernmentBodyChartDataManagerImpl method createMinistryGovernmentBodyHeadcountSummaryChart.
@Override
public void createMinistryGovernmentBodyHeadcountSummaryChart(final AbstractOrderedLayout content) {
final Map<Integer, List<GovernmentBodyAnnualSummary>> map = esvApi.getData();
final List<String> ministryNames = esvApi.getMinistryNames();
final DataSeries dataSeries = new DataSeries();
final Series series = new Series();
for (final String ministryName : ministryNames) {
series.addSeries(new XYseries().setLabel(ministryName));
dataSeries.newSeries();
for (final Entry<Integer, List<GovernmentBodyAnnualSummary>> entry : map.entrySet()) {
final List<GovernmentBodyAnnualSummary> item = entry.getValue();
final Integer totalHeadcount = item.stream().filter((final GovernmentBodyAnnualSummary p) -> p.getMinistry().equalsIgnoreCase(ministryName)).mapToInt(GovernmentBodyAnnualSummary::getHeadCount).sum();
if (entry.getKey() != null && totalHeadcount > 0) {
dataSeries.add(FIRST_OF_JAN + entry.getKey(), totalHeadcount);
}
}
}
addChart(content, ANNUAL_HEADCOUNT_ALL_MINISTRIES, new DCharts().setDataSeries(dataSeries).setOptions(getChartOptions().createOptionsXYDateFloatLogYAxisLegendOutside(series)).show(), true);
}
use of com.hack23.cia.service.external.esv.api.GovernmentBodyAnnualSummary in project cia by Hack23.
the class EsvApiTest method getDataFinanceMinistry2016SuccessTest.
/**
* Gets the data finance ministry 2016 success test.
*
* @return the data finance ministry 2016 success test
*/
@Test
public void getDataFinanceMinistry2016SuccessTest() {
final List<GovernmentBodyAnnualSummary> list = esvApi.getDataPerMinistryAndYear("Finansdepartementet", 2016);
assertNotNull(list);
assertEquals(45, list.size());
for (final GovernmentBodyAnnualSummary governmentBodyAnnualSummary : list) {
assertNotNull(governmentBodyAnnualSummary);
}
}
use of com.hack23.cia.service.external.esv.api.GovernmentBodyAnnualSummary in project cia by Hack23.
the class EsvApiTest method getDataPerGovernmentBodySuccessTest.
/**
* Gets the data per government body success test.
*
* @return the data per government body success test
*/
@Test
public void getDataPerGovernmentBodySuccessTest() {
final Map<Integer, GovernmentBodyAnnualSummary> governmentBodyAnnualSummaryData = esvApi.getDataPerGovernmentBody("Exportkreditnämnden");
assertNotNull(governmentBodyAnnualSummaryData);
assertEquals(20, governmentBodyAnnualSummaryData.size());
for (final GovernmentBodyAnnualSummary governmentBodyAnnualSummary : governmentBodyAnnualSummaryData.values()) {
assertNotNull(governmentBodyAnnualSummary);
}
}
use of com.hack23.cia.service.external.esv.api.GovernmentBodyAnnualSummary in project cia by Hack23.
the class EsvApiTest method getDataSuccessTest.
/**
* Gets the data success test.
*
* @return the data success test
*/
@Test
public void getDataSuccessTest() {
final Map<Integer, List<GovernmentBodyAnnualSummary>> governmentBodyAnnualSummaryData = esvApi.getData();
assertNotNull(governmentBodyAnnualSummaryData);
assertEquals(20, governmentBodyAnnualSummaryData.size());
for (final List<GovernmentBodyAnnualSummary> list : governmentBodyAnnualSummaryData.values()) {
// assertTrue(list.size() > 200);
for (final GovernmentBodyAnnualSummary governmentBodyAnnualSummary : list) {
assertNotNull(governmentBodyAnnualSummary);
}
}
}
use of com.hack23.cia.service.external.esv.api.GovernmentBodyAnnualSummary in project cia by Hack23.
the class EsvApiTest method getDataFinanceMinistrySuccessTest.
/**
* Gets the data finance ministry success test.
*
* @return the data finance ministry success test
*/
@Test
public void getDataFinanceMinistrySuccessTest() {
final Map<Integer, List<GovernmentBodyAnnualSummary>> governmentBodyAnnualSummaryData = esvApi.getDataPerMinistry("Finansdepartementet");
assertNotNull(governmentBodyAnnualSummaryData);
assertEquals(20, governmentBodyAnnualSummaryData.size());
for (final List<GovernmentBodyAnnualSummary> list : governmentBodyAnnualSummaryData.values()) {
for (final GovernmentBodyAnnualSummary governmentBodyAnnualSummary : list) {
assertNotNull(governmentBodyAnnualSummary);
}
}
}
Aggregations