Search in sources :

Example 1 with ViewRiksdagenPartySummary

use of com.hack23.cia.model.internal.application.data.party.impl.ViewRiksdagenPartySummary in project cia by Hack23.

the class CommitteeDataSeriesFactoryImpl method createChartTimeSeriesTotalDaysServedCommitteeByParty.

@Override
public DataSeries createChartTimeSeriesTotalDaysServedCommitteeByParty() {
    DataSeries dataSeries = new DataSeries();
    final DataContainer<ViewRiksdagenParty, String> dataContainer = applicationManager.getDataContainer(ViewRiksdagenParty.class);
    final DataContainer<ViewRiksdagenPartySummary, String> partySummarydataContainer = applicationManager.getDataContainer(ViewRiksdagenPartySummary.class);
    partySummarydataContainer.getAll();
    for (final ViewRiksdagenParty data : dataContainer.getAll()) {
        final ViewRiksdagenPartySummary summary = partySummarydataContainer.load(data.getPartyId());
        if (summary != null && summary.isActive()) {
            dataSeries = dataSeries.newSeries().add(data.getPartyName(), summary.getTotalDaysServedCommittee());
        }
    }
    return dataSeries;
}
Also used : ViewRiksdagenParty(com.hack23.cia.model.internal.application.data.party.impl.ViewRiksdagenParty) ViewRiksdagenPartySummary(com.hack23.cia.model.internal.application.data.party.impl.ViewRiksdagenPartySummary) DataSeries(org.dussan.vaadin.dcharts.data.DataSeries)

Example 2 with ViewRiksdagenPartySummary

use of com.hack23.cia.model.internal.application.data.party.impl.ViewRiksdagenPartySummary in project cia by Hack23.

the class PartyDataSeriesFactoryImpl method createChartTimeSeriesCurrentGovernmentByParty.

@Override
public DataSeries createChartTimeSeriesCurrentGovernmentByParty() {
    DataSeries dataSeries = new DataSeries();
    final DataContainer<ViewRiksdagenParty, String> dataContainer = applicationManager.getDataContainer(ViewRiksdagenParty.class);
    final DataContainer<ViewRiksdagenPartySummary, String> partySummarydataContainer = applicationManager.getDataContainer(ViewRiksdagenPartySummary.class);
    partySummarydataContainer.getAll();
    for (final ViewRiksdagenParty data : dataContainer.getAll()) {
        final ViewRiksdagenPartySummary summary = partySummarydataContainer.load(data.getPartyId());
        if (summary != null && summary.isActive()) {
            dataSeries = dataSeries.newSeries().add(data.getPartyName(), summary.getTotalActiveGovernment());
        }
    }
    return dataSeries;
}
Also used : ViewRiksdagenParty(com.hack23.cia.model.internal.application.data.party.impl.ViewRiksdagenParty) ViewRiksdagenPartySummary(com.hack23.cia.model.internal.application.data.party.impl.ViewRiksdagenPartySummary) DataSeries(org.dussan.vaadin.dcharts.data.DataSeries)

Example 3 with ViewRiksdagenPartySummary

use of com.hack23.cia.model.internal.application.data.party.impl.ViewRiksdagenPartySummary in project cia by Hack23.

the class PartyDataSeriesFactoryImpl method createPartyChartTimeSeriesCurrent.

@Override
public DataSeries createPartyChartTimeSeriesCurrent() {
    DataSeries dataSeries = new DataSeries();
    final DataContainer<ViewRiksdagenPartySummary, String> dataContainer = applicationManager.getDataContainer(ViewRiksdagenPartySummary.class);
    for (final ViewRiksdagenPartySummary data : dataContainer.getAllOrderBy(ViewRiksdagenPartySummary_.currentAssignments)) {
        if (data != null && data.isActiveParliament()) {
            dataSeries = dataSeries.newSeries().add(getPartyName(data.getParty()), data.getTotalActiveParliament());
        }
    }
    return dataSeries;
}
Also used : ViewRiksdagenPartySummary(com.hack23.cia.model.internal.application.data.party.impl.ViewRiksdagenPartySummary) DataSeries(org.dussan.vaadin.dcharts.data.DataSeries)

Example 4 with ViewRiksdagenPartySummary

use of com.hack23.cia.model.internal.application.data.party.impl.ViewRiksdagenPartySummary in project cia by Hack23.

the class PartyOverviewPageModContentFactoryImpl method createContent.

@Secured({ "ROLE_ANONYMOUS", "ROLE_USER", "ROLE_ADMIN" })
@Override
public Layout createContent(final String parameters, final MenuBar menuBar, final Panel panel) {
    final VerticalLayout panelContent = createPanelContent();
    final String pageId = getPageId(parameters);
    final DataContainer<ViewRiksdagenParty, String> dataContainer = getApplicationManager().getDataContainer(ViewRiksdagenParty.class);
    final DataContainer<ViewRiksdagenPartySummary, String> partySummarydataContainer = getApplicationManager().getDataContainer(ViewRiksdagenPartySummary.class);
    final ViewRiksdagenParty viewRiksdagenParty = dataContainer.load(pageId);
    if (viewRiksdagenParty != null) {
        getPartyMenuItemFactory().createPartyMenuBar(menuBar, pageId);
        LabelFactory.createHeader2Label(panelContent, OVERVIEW);
        final Link addPartyPageLink = getPageLinkFactory().addPartyPageLink(viewRiksdagenParty);
        panelContent.addComponent(addPartyPageLink);
        panelContent.setExpandRatio(addPartyPageLink, ContentRatio.SMALL);
        getFormFactory().addFormPanelTextFields(panelContent, viewRiksdagenParty, ViewRiksdagenParty.class, AS_LIST);
        final ViewRiksdagenPartySummary viewRiksdagenPartySummary = partySummarydataContainer.load(pageId);
        if (viewRiksdagenPartySummary != null) {
            getFormFactory().addFormPanelTextFields(panelContent, viewRiksdagenPartySummary, ViewRiksdagenPartySummary.class, AS_LIST2);
        }
        final VerticalLayout overviewLayout = new VerticalLayout();
        overviewLayout.setSizeFull();
        panelContent.addComponent(overviewLayout);
        panelContent.setExpandRatio(overviewLayout, ContentRatio.LARGE_FORM);
        getPartyMenuItemFactory().createOverviewPage(overviewLayout, pageId);
        pageCompleted(parameters, panel, pageId, viewRiksdagenParty);
    }
    return panelContent;
}
Also used : ViewRiksdagenParty(com.hack23.cia.model.internal.application.data.party.impl.ViewRiksdagenParty) ViewRiksdagenPartySummary(com.hack23.cia.model.internal.application.data.party.impl.ViewRiksdagenPartySummary) VerticalLayout(com.vaadin.ui.VerticalLayout) Link(com.vaadin.ui.Link) Secured(org.springframework.security.access.annotation.Secured)

Example 5 with ViewRiksdagenPartySummary

use of com.hack23.cia.model.internal.application.data.party.impl.ViewRiksdagenPartySummary in project cia by Hack23.

the class MinistryDataSeriesFactoryImpl method createChartTimeSeriesTotalDaysServedGovernmentByParty.

@Override
public DataSeries createChartTimeSeriesTotalDaysServedGovernmentByParty() {
    DataSeries dataSeries = new DataSeries();
    final DataContainer<ViewRiksdagenParty, String> dataContainer = applicationManager.getDataContainer(ViewRiksdagenParty.class);
    final DataContainer<ViewRiksdagenPartySummary, String> partySummarydataContainer = applicationManager.getDataContainer(ViewRiksdagenPartySummary.class);
    partySummarydataContainer.getAll();
    for (final ViewRiksdagenParty data : dataContainer.getAll()) {
        final ViewRiksdagenPartySummary summary = partySummarydataContainer.load(data.getPartyId());
        if (summary != null && summary.isActive()) {
            dataSeries = dataSeries.newSeries().add(data.getPartyName(), summary.getTotalDaysServedGovernment());
        }
    }
    return dataSeries;
}
Also used : ViewRiksdagenParty(com.hack23.cia.model.internal.application.data.party.impl.ViewRiksdagenParty) ViewRiksdagenPartySummary(com.hack23.cia.model.internal.application.data.party.impl.ViewRiksdagenPartySummary) DataSeries(org.dussan.vaadin.dcharts.data.DataSeries)

Aggregations

ViewRiksdagenPartySummary (com.hack23.cia.model.internal.application.data.party.impl.ViewRiksdagenPartySummary)9 ViewRiksdagenParty (com.hack23.cia.model.internal.application.data.party.impl.ViewRiksdagenParty)5 DataSeries (org.dussan.vaadin.dcharts.data.DataSeries)5 ViewRiksdagenPolitician (com.hack23.cia.model.internal.application.data.politician.impl.ViewRiksdagenPolitician)2 VerticalLayout (com.vaadin.ui.VerticalLayout)2 Secured (org.springframework.security.access.annotation.Secured)2 Iterables (com.google.common.collect.Iterables)1 ViewRiksdagenVoteDataBallotPartySummaryAnnual (com.hack23.cia.model.internal.application.data.committee.impl.ViewRiksdagenVoteDataBallotPartySummaryAnnual)1 ViewRiksdagenVoteDataBallotPartySummaryDaily (com.hack23.cia.model.internal.application.data.committee.impl.ViewRiksdagenVoteDataBallotPartySummaryDaily)1 ViewRiksdagenVoteDataBallotPartySummaryMonthly (com.hack23.cia.model.internal.application.data.committee.impl.ViewRiksdagenVoteDataBallotPartySummaryMonthly)1 ViewRiksdagenVoteDataBallotPoliticianSummaryAnnual (com.hack23.cia.model.internal.application.data.committee.impl.ViewRiksdagenVoteDataBallotPoliticianSummaryAnnual)1 ViewRiksdagenVoteDataBallotPoliticianSummaryDaily (com.hack23.cia.model.internal.application.data.committee.impl.ViewRiksdagenVoteDataBallotPoliticianSummaryDaily)1 ViewRiksdagenVoteDataBallotPoliticianSummaryMonthly (com.hack23.cia.model.internal.application.data.committee.impl.ViewRiksdagenVoteDataBallotPoliticianSummaryMonthly)1 ComplianceCheck (com.hack23.cia.service.api.action.kpi.ComplianceCheck)1 DataViewer (com.hack23.cia.service.data.api.DataViewer)1 Link (com.vaadin.ui.Link)1 ArrayList (java.util.ArrayList)1 Collections (java.util.Collections)1 HashMap (java.util.HashMap)1 List (java.util.List)1