Search in sources :

Example 11 with ViewRiksdagenCommittee

use of com.hack23.cia.model.internal.application.data.committee.impl.ViewRiksdagenCommittee in project cia by Hack23.

the class DecisionFlowChartManagerImpl method createCommitteeDecisionFlow.

@Override
public SankeyChart createCommitteeDecisionFlow(final ViewRiksdagenCommittee viewRiksdagenCommittee, final Map<String, List<ViewRiksdagenCommittee>> committeeMap, final String rm) {
    final List<ProposalCommitteeeSummary> createCommitteeSummary = decisionDataFactory.createCommitteeSummary(rm);
    final SankeyChart chart = new SankeyChart();
    final Map<String, List<ProposalCommitteeeSummary>> orgProposalMap = createCommitteeSummary.stream().collect(Collectors.groupingBy(ProposalCommitteeeSummary::getOrg));
    for (final Entry<String, List<ProposalCommitteeeSummary>> entry : orgProposalMap.entrySet()) {
        if (committeeMap.containsKey(entry.getKey()) && viewRiksdagenCommittee.getEmbeddedId().getOrgCode().equals(entry.getKey())) {
            addDocTypeDecisionDataRows(chart, entry);
        }
    }
    chart.drawChart();
    return chart;
}
Also used : SankeyChart(com.hack23.cia.web.widgets.charts.SankeyChart) ProposalCommitteeeSummary(com.hack23.cia.web.impl.ui.application.views.common.dataseriesfactory.api.ProposalCommitteeeSummary) List(java.util.List)

Example 12 with ViewRiksdagenCommittee

use of com.hack23.cia.model.internal.application.data.committee.impl.ViewRiksdagenCommittee in project cia by Hack23.

the class DecisionFlowChartManagerImpl method createAllDecisionFlow.

@Override
public SankeyChart createAllDecisionFlow(final Map<String, List<ViewRiksdagenCommittee>> committeeMap, final String rm) {
    final List<ProposalCommitteeeSummary> createCommitteeSummary = decisionDataFactory.createCommitteeSummary(rm);
    final SankeyChart chart = new SankeyChart();
    final Map<String, List<ProposalCommitteeeSummary>> orgProposalMap = createCommitteeSummary.stream().collect(Collectors.groupingBy(ProposalCommitteeeSummary::getOrg));
    for (final Entry<String, List<ProposalCommitteeeSummary>> entry : orgProposalMap.entrySet()) {
        if (committeeMap.containsKey(entry.getKey())) {
            final Optional<ViewRiksdagenCommittee> vewRiksdagenCommittee = committeeMap.get(entry.getKey()).stream().findFirst();
            if (vewRiksdagenCommittee.isPresent()) {
                addDocTypeDataRows(chart, entry, vewRiksdagenCommittee.get());
                addDecisionDataRows(chart, entry, vewRiksdagenCommittee.get());
            }
        }
    }
    chart.drawChart();
    return chart;
}
Also used : SankeyChart(com.hack23.cia.web.widgets.charts.SankeyChart) ProposalCommitteeeSummary(com.hack23.cia.web.impl.ui.application.views.common.dataseriesfactory.api.ProposalCommitteeeSummary) List(java.util.List) ViewRiksdagenCommittee(com.hack23.cia.model.internal.application.data.committee.impl.ViewRiksdagenCommittee)

Example 13 with ViewRiksdagenCommittee

use of com.hack23.cia.model.internal.application.data.committee.impl.ViewRiksdagenCommittee in project cia by Hack23.

the class CommitteeDataSeriesFactoryImpl method createCommitteeChartTimeSeriesAll.

@Override
public DataSeries createCommitteeChartTimeSeriesAll() {
    DataSeries dataSeries = new DataSeries();
    final DataContainer<ViewRiksdagenCommittee, String> dataContainer = applicationManager.getDataContainer(ViewRiksdagenCommittee.class);
    for (final ViewRiksdagenCommittee data : dataContainer.getAll()) {
        dataSeries = dataSeries.newSeries().add(data.getEmbeddedId().getDetail(), data.getTotalAssignments());
    }
    return dataSeries;
}
Also used : DataSeries(org.dussan.vaadin.dcharts.data.DataSeries) ViewRiksdagenCommittee(com.hack23.cia.model.internal.application.data.committee.impl.ViewRiksdagenCommittee)

Example 14 with ViewRiksdagenCommittee

use of com.hack23.cia.model.internal.application.data.committee.impl.ViewRiksdagenCommittee in project cia by Hack23.

the class DataViewerITest method viewRiksdagenCommittee.

/**
 * View riksdagen committee.
 *
 * @throws Exception
 *             the exception
 */
@Test
public void viewRiksdagenCommittee() throws Exception {
    final List<ViewRiksdagenCommittee> committees = dataViewer.getAll(ViewRiksdagenCommittee.class);
    assertNotNull(EXPECT_VALUE_IN_DATABASE, committees);
    if (committees.size() > 0) {
        final ViewRiksdagenCommittee viewRiksdagenCommittee = committees.get(0);
        final ViewRiksdagenCommittee viewRiksdagenCommitteeLoaded = dataViewer.load(ViewRiksdagenCommittee.class, viewRiksdagenCommittee.getEmbeddedId());
        assertNotNull(EXPECT_VALUE_IN_DATABASE, viewRiksdagenCommitteeLoaded);
        final ViewRiksdagenCommittee viewRiksdagenCommitteeFound = dataViewer.findFirstByProperty(ViewRiksdagenCommittee.class, ViewRiksdagenCommittee_.embeddedId, viewRiksdagenCommitteeLoaded.getEmbeddedId());
        assertEquals(EXPECT_SAME_OBJECT_LOADED, viewRiksdagenCommitteeLoaded, viewRiksdagenCommitteeFound);
    }
}
Also used : ViewRiksdagenCommittee(com.hack23.cia.model.internal.application.data.committee.impl.ViewRiksdagenCommittee) Test(org.junit.Test)

Example 15 with ViewRiksdagenCommittee

use of com.hack23.cia.model.internal.application.data.committee.impl.ViewRiksdagenCommittee in project cia by Hack23.

the class CommitteeCurrentMembersHistoryPageModContentFactoryImpl 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<ViewRiksdagenCommittee, String> dataContainer = getApplicationManager().getDataContainer(ViewRiksdagenCommittee.class);
    final ViewRiksdagenCommittee viewRiksdagenCommittee = dataContainer.load(pageId);
    if (viewRiksdagenCommittee != null) {
        getCommitteeMenuItemFactory().createCommitteeeMenuBar(menuBar, pageId);
        LabelFactory.createHeader2Label(panelContent, CURRENT_MEMBERS);
        final DataContainer<ViewRiksdagenCommitteeRoleMember, String> committeeRoleMemberDataContainer = getApplicationManager().getDataContainer(ViewRiksdagenCommitteeRoleMember.class);
        getGridFactory().createBasicBeanItemGrid(panelContent, ViewRiksdagenCommitteeRoleMember.class, committeeRoleMemberDataContainer.findListByProperty(new Object[] { viewRiksdagenCommittee.getEmbeddedId().getDetail(), Boolean.TRUE }, ViewRiksdagenCommitteeRoleMember_.detail, ViewRiksdagenCommitteeRoleMember_.active), CURRENT_MEMBERS, COLUMN_ORDER, HIDE_COLUMNS, LISTENER, null, null);
        panel.setCaption(NAME + "::" + COMMITTEE + viewRiksdagenCommittee.getEmbeddedId().getDetail());
        getPageActionEventHelper().createPageEvent(ViewAction.VISIT_COMMITTEE_VIEW, ApplicationEventGroup.USER, NAME, parameters, pageId);
    }
    return panelContent;
}
Also used : ViewRiksdagenCommitteeRoleMember(com.hack23.cia.model.internal.application.data.committee.impl.ViewRiksdagenCommitteeRoleMember) VerticalLayout(com.vaadin.ui.VerticalLayout) ViewRiksdagenCommittee(com.hack23.cia.model.internal.application.data.committee.impl.ViewRiksdagenCommittee) Secured(org.springframework.security.access.annotation.Secured)

Aggregations

ViewRiksdagenCommittee (com.hack23.cia.model.internal.application.data.committee.impl.ViewRiksdagenCommittee)17 VerticalLayout (com.vaadin.ui.VerticalLayout)13 Secured (org.springframework.security.access.annotation.Secured)13 SankeyChart (com.hack23.cia.web.widgets.charts.SankeyChart)4 List (java.util.List)4 ViewRiksdagenCommitteeRoleMember (com.hack23.cia.model.internal.application.data.committee.impl.ViewRiksdagenCommitteeRoleMember)3 ApplicationEventGroup (com.hack23.cia.model.internal.application.system.impl.ApplicationEventGroup)2 DataContainer (com.hack23.cia.service.api.DataContainer)2 ViewAction (com.hack23.cia.web.impl.ui.application.action.ViewAction)2 DecisionFlowChartManager (com.hack23.cia.web.impl.ui.application.views.common.chartfactory.api.DecisionFlowChartManager)2 ProposalCommitteeeSummary (com.hack23.cia.web.impl.ui.application.views.common.dataseriesfactory.api.ProposalCommitteeeSummary)2 ContentRatio (com.hack23.cia.web.impl.ui.application.views.common.sizing.ContentRatio)2 ChartIndicators (com.hack23.cia.web.impl.ui.application.views.common.viewnames.ChartIndicators)2 PageMode (com.hack23.cia.web.impl.ui.application.views.common.viewnames.PageMode)2 ComboBox (com.vaadin.ui.ComboBox)2 Layout (com.vaadin.ui.Layout)2 MenuBar (com.vaadin.ui.MenuBar)2 Panel (com.vaadin.ui.Panel)2 UI (com.vaadin.ui.UI)2 Arrays (java.util.Arrays)2