Search in sources :

Example 1 with ViewRiksdagenParty

use of com.hack23.cia.model.internal.application.data.party.impl.ViewRiksdagenParty 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 ViewRiksdagenParty

use of com.hack23.cia.model.internal.application.data.party.impl.ViewRiksdagenParty 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 ViewRiksdagenParty

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

the class DataViewerITest method viewRiksdagenParty.

/**
 * View riksdagen party.
 *
 * @throws Exception
 *             the exception
 */
@Test
public void viewRiksdagenParty() throws Exception {
    final List<ViewRiksdagenParty> parties = dataViewer.getAll(ViewRiksdagenParty.class);
    assertNotNull(EXPECT_VALUE_IN_DATABASE, parties);
    if (parties.size() > 0) {
        final ViewRiksdagenParty viewRiksdagenParty = parties.get(0);
        final ViewRiksdagenParty viewRiksdagenPartyLoaded = dataViewer.load(ViewRiksdagenParty.class, viewRiksdagenParty.getPartyId());
        assertNotNull(EXPECT_VALUE_IN_DATABASE, viewRiksdagenPartyLoaded);
        final ViewRiksdagenParty viewRiksdagenPartyFound = dataViewer.findFirstByProperty(ViewRiksdagenParty.class, ViewRiksdagenParty_.partyName, viewRiksdagenPartyLoaded.getPartyName());
        assertEquals(EXPECT_SAME_OBJECT_LOADED, viewRiksdagenPartyLoaded, viewRiksdagenPartyFound);
    }
}
Also used : ViewRiksdagenParty(com.hack23.cia.model.internal.application.data.party.impl.ViewRiksdagenParty) Test(org.junit.Test)

Example 4 with ViewRiksdagenParty

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

the class PartyCurrentMembersPageModContentFactoryImpl 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 ViewRiksdagenParty viewRiksdagenParty = dataContainer.load(pageId);
    if (viewRiksdagenParty != null) {
        getPartyMenuItemFactory().createPartyMenuBar(menuBar, pageId);
        LabelFactory.createHeader2Label(panelContent, CURRENT_MEMBERS);
        final DataContainer<ViewRiksdagenPolitician, String> politicianDataContainer = getApplicationManager().getDataContainer(ViewRiksdagenPolitician.class);
        getGridFactory().createBasicBeanItemGrid(panelContent, ViewRiksdagenPolitician.class, politicianDataContainer.findListByProperty(new Object[] { viewRiksdagenParty.getPartyId(), Boolean.TRUE }, ViewRiksdagenPolitician_.party, ViewRiksdagenPolitician_.active), POLITICIANS, COLUMN_ORDER, HIDE_COLUMNS, LISTENER, null, null);
        pageCompleted(parameters, panel, pageId, viewRiksdagenParty);
    }
    return panelContent;
}
Also used : ViewRiksdagenParty(com.hack23.cia.model.internal.application.data.party.impl.ViewRiksdagenParty) VerticalLayout(com.vaadin.ui.VerticalLayout) ViewRiksdagenPolitician(com.hack23.cia.model.internal.application.data.politician.impl.ViewRiksdagenPolitician) Secured(org.springframework.security.access.annotation.Secured)

Example 5 with ViewRiksdagenParty

use of com.hack23.cia.model.internal.application.data.party.impl.ViewRiksdagenParty 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)

Aggregations

ViewRiksdagenParty (com.hack23.cia.model.internal.application.data.party.impl.ViewRiksdagenParty)20 VerticalLayout (com.vaadin.ui.VerticalLayout)14 Secured (org.springframework.security.access.annotation.Secured)14 ViewRiksdagenPartySummary (com.hack23.cia.model.internal.application.data.party.impl.ViewRiksdagenPartySummary)5 DataSeries (org.dussan.vaadin.dcharts.data.DataSeries)5 ViewRiksdagenPartyRoleMember (com.hack23.cia.model.internal.application.data.party.impl.ViewRiksdagenPartyRoleMember)3 ViewRiksdagenPolitician (com.hack23.cia.model.internal.application.data.politician.impl.ViewRiksdagenPolitician)2 ViewRiksdagenCommitteeBallotDecisionPartyEmbeddedId (com.hack23.cia.model.internal.application.data.committee.impl.ViewRiksdagenCommitteeBallotDecisionPartyEmbeddedId)1 ViewRiksdagenCommitteeBallotDecisionPartySummary (com.hack23.cia.model.internal.application.data.committee.impl.ViewRiksdagenCommitteeBallotDecisionPartySummary)1 ViewRiksdagenCommitteeRoleMember (com.hack23.cia.model.internal.application.data.committee.impl.ViewRiksdagenCommitteeRoleMember)1 ViewRiksdagenPoliticianDocument (com.hack23.cia.model.internal.application.data.document.impl.ViewRiksdagenPoliticianDocument)1 ViewRiksdagenGovermentRoleMember (com.hack23.cia.model.internal.application.data.ministry.impl.ViewRiksdagenGovermentRoleMember)1 PageItemPropertyClickListener (com.hack23.cia.web.impl.ui.application.views.pageclicklistener.PageItemPropertyClickListener)1 Link (com.vaadin.ui.Link)1 Test (org.junit.Test)1