Search in sources :

Example 1 with ViewRiksdagenPolitician

use of com.hack23.cia.model.internal.application.data.politician.impl.ViewRiksdagenPolitician in project cia by Hack23.

the class DataViewerITest method viewRiksdagenPolitician.

/**
 * View riksdagen politician.
 *
 * @throws Exception
 *             the exception
 */
@Test
public void viewRiksdagenPolitician() throws Exception {
    final List<ViewRiksdagenPolitician> politicians = dataViewer.getAll(ViewRiksdagenPolitician.class);
    assertNotNull(EXPECT_VALUE_IN_DATABASE, politicians);
    if (politicians.size() > 0) {
        final ViewRiksdagenPolitician viewRiksdagenPolitician = politicians.get(4);
        final ViewRiksdagenPolitician viewRiksdagenPoliticianLoaded = dataViewer.load(ViewRiksdagenPolitician.class, viewRiksdagenPolitician.getPersonId());
        assertNotNull(EXPECT_VALUE_IN_DATABASE, viewRiksdagenPoliticianLoaded);
        final ViewRiksdagenPolitician viewRiksdagenPoliticianFound = dataViewer.findFirstByProperty(ViewRiksdagenPolitician.class, ViewRiksdagenPolitician_.personId, viewRiksdagenPoliticianLoaded.getPersonId());
        assertEquals(EXPECT_SAME_OBJECT_LOADED, viewRiksdagenPoliticianLoaded, viewRiksdagenPoliticianFound);
        assertEquals(SHOULD_ALWAYS_BE_349_IN_PARLIAMENT, 349, dataViewer.findListByProperty(ViewRiksdagenPolitician.class, ViewRiksdagenPolitician_.activeParliament, true).size());
    }
}
Also used : ViewRiksdagenPolitician(com.hack23.cia.model.internal.application.data.politician.impl.ViewRiksdagenPolitician) Test(org.junit.Test)

Example 2 with ViewRiksdagenPolitician

use of com.hack23.cia.model.internal.application.data.politician.impl.ViewRiksdagenPolitician in project cia by Hack23.

the class PageItemPropertyClickListenerTest method checkCorrectPageIdSuccessTest.

/**
 * Check correct page id success test.
 */
@Test
public void checkCorrectPageIdSuccessTest() {
    final PageItemPropertyClickListener pageItemPropertyClickListener = new PageItemPropertyClickListener(UserViews.POLITICIAN_VIEW_NAME, "wrongProperty");
    final String pageId = pageItemPropertyClickListener.getPageId(new ViewRiksdagenPolitician());
    assertEquals("ErrorGettingPageId", pageId);
}
Also used : ViewRiksdagenPolitician(com.hack23.cia.model.internal.application.data.politician.impl.ViewRiksdagenPolitician) AbstractUnitTest(com.hack23.cia.testfoundation.AbstractUnitTest) Test(org.junit.Test)

Example 3 with ViewRiksdagenPolitician

use of com.hack23.cia.model.internal.application.data.politician.impl.ViewRiksdagenPolitician in project cia by Hack23.

the class PoliticianRankingDataGridPageModContentFactoryImpl 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();
    getPoliticianRankingMenuItemFactory().createPoliticianRankingMenuBar(menuBar);
    final String pageId = getPageId(parameters);
    final DataContainer<ViewRiksdagenPolitician, String> politicianDataContainer = getApplicationManager().getDataContainer(ViewRiksdagenPolitician.class);
    getGridFactory().createBasicBeanItemGrid(panelContent, ViewRiksdagenPolitician.class, politicianDataContainer.getAllOrderBy(ViewRiksdagenPolitician_.currentAssignments), POLITICIANS, COLUMN_ORDER, HIDE_COLUMNS, LISTENER, null, null);
    panel.setCaption(NAME + "::" + DATAGRID);
    getPageActionEventHelper().createPageEvent(ViewAction.VISIT_POLITICIAN_RANKING_VIEW, ApplicationEventGroup.USER, NAME, parameters, pageId);
    return panelContent;
}
Also used : VerticalLayout(com.vaadin.ui.VerticalLayout) ViewRiksdagenPolitician(com.hack23.cia.model.internal.application.data.politician.impl.ViewRiksdagenPolitician) Secured(org.springframework.security.access.annotation.Secured)

Example 4 with ViewRiksdagenPolitician

use of com.hack23.cia.model.internal.application.data.politician.impl.ViewRiksdagenPolitician in project cia by Hack23.

the class PoliticianRoleGhantPageModContentFactoryImpl 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<PersonData, String> dataContainer = getApplicationManager().getDataContainer(PersonData.class);
    final PersonData personData = dataContainer.load(pageId);
    if (personData != null) {
        final DataContainer<ViewRiksdagenPolitician, String> politicianDataContainer = getApplicationManager().getDataContainer(ViewRiksdagenPolitician.class);
        final ViewRiksdagenPolitician viewRiksdagenPolitician = politicianDataContainer.load(personData.getId());
        getPoliticianMenuItemFactory().createPoliticianMenuBar(menuBar, pageId);
        LabelFactory.createHeader2Label(panelContent, PoliticianPageMode.ROLEGHANT.toString());
        final List<AssignmentData> assignmentList = personData.getPersonAssignmentData().getAssignmentList();
        politicianGhantChartManager.createRoleGhant(panelContent, assignmentList);
        pageCompleted(parameters, panel, pageId, viewRiksdagenPolitician);
    }
    return panelContent;
}
Also used : PersonData(com.hack23.cia.model.external.riksdagen.person.impl.PersonData) VerticalLayout(com.vaadin.ui.VerticalLayout) ViewRiksdagenPolitician(com.hack23.cia.model.internal.application.data.politician.impl.ViewRiksdagenPolitician) AssignmentData(com.hack23.cia.model.external.riksdagen.person.impl.AssignmentData) Secured(org.springframework.security.access.annotation.Secured)

Example 5 with ViewRiksdagenPolitician

use of com.hack23.cia.model.internal.application.data.politician.impl.ViewRiksdagenPolitician in project cia by Hack23.

the class PoliticianVotesHistoryPageModContentFactoryImpl 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<PersonData, String> dataContainer = getApplicationManager().getDataContainer(PersonData.class);
    final PersonData personData = dataContainer.load(pageId);
    if (personData != null) {
        final DataContainer<ViewRiksdagenPolitician, String> politicianDataContainer = getApplicationManager().getDataContainer(ViewRiksdagenPolitician.class);
        final ViewRiksdagenPolitician viewRiksdagenPolitician = politicianDataContainer.load(personData.getId());
        getPoliticianMenuItemFactory().createPoliticianMenuBar(menuBar, pageId);
        LabelFactory.createHeader2Label(panelContent, PoliticianPageMode.VOTEHISTORY.toString());
        getGridFactory().createBasicBeanItemNestedPropertiesGrid(panelContent, ViewRiksdagenVoteDataBallotPoliticianSummary.class, viewRiksdagenVoteDataBallotPoliticianSummaryChartDataManager.findByValue(personData.getId()), BALLOTS, NESTED_PROPERTIES, COLUMN_ORDER, HIDE_COLUMNS, LISTENER, EMBEDDED_ID_BALLOT_ID, null);
        pageCompleted(parameters, panel, pageId, viewRiksdagenPolitician);
    }
    return panelContent;
}
Also used : PersonData(com.hack23.cia.model.external.riksdagen.person.impl.PersonData) VerticalLayout(com.vaadin.ui.VerticalLayout) ViewRiksdagenPolitician(com.hack23.cia.model.internal.application.data.politician.impl.ViewRiksdagenPolitician) Secured(org.springframework.security.access.annotation.Secured)

Aggregations

ViewRiksdagenPolitician (com.hack23.cia.model.internal.application.data.politician.impl.ViewRiksdagenPolitician)17 VerticalLayout (com.vaadin.ui.VerticalLayout)13 Secured (org.springframework.security.access.annotation.Secured)13 PersonData (com.hack23.cia.model.external.riksdagen.person.impl.PersonData)10 AssignmentData (com.hack23.cia.model.external.riksdagen.person.impl.AssignmentData)3 Test (org.junit.Test)3 ViewRiksdagenParty (com.hack23.cia.model.internal.application.data.party.impl.ViewRiksdagenParty)2 ViewRiksdagenPartySummary (com.hack23.cia.model.internal.application.data.party.impl.ViewRiksdagenPartySummary)2 Iterables (com.google.common.collect.Iterables)1 ViewRiksdagenCommitteeBallotDecisionPoliticianEmbeddedId (com.hack23.cia.model.internal.application.data.committee.impl.ViewRiksdagenCommitteeBallotDecisionPoliticianEmbeddedId)1 ViewRiksdagenCommitteeBallotDecisionPoliticianSummary (com.hack23.cia.model.internal.application.data.committee.impl.ViewRiksdagenCommitteeBallotDecisionPoliticianSummary)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 ViewRiksdagenPoliticianDocument (com.hack23.cia.model.internal.application.data.document.impl.ViewRiksdagenPoliticianDocument)1 ComplianceCheck (com.hack23.cia.service.api.action.kpi.ComplianceCheck)1 DataViewer (com.hack23.cia.service.data.api.DataViewer)1