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;
}
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;
}
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);
}
}
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;
}
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;
}
Aggregations