Search in sources :

Example 1 with DocumentStatusContainer

use of com.hack23.cia.model.external.riksdagen.dokumentstatus.impl.DocumentStatusContainer in project cia by Hack23.

the class DocumentDetailsPageModContentFactoryImpl 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<DocumentElement, String> documentElementDataContainer = getApplicationManager().getDataContainer(DocumentElement.class);
    final DataContainer<DocumentStatusContainer, String> documentStatusContainerDataContainer = getApplicationManager().getDataContainer(DocumentStatusContainer.class);
    getApplicationManager().getDataContainer(CommitteeProposalComponentData.class);
    final DocumentElement documentElement = documentElementDataContainer.load(pageId);
    if (documentElement != null) {
        getDocumentMenuItemFactory().createDocumentMenuBar(menuBar, pageId);
        final DocumentStatusContainer documentStatusContainer = documentStatusContainerDataContainer.findByQueryProperty(DocumentStatusContainer.class, DocumentStatusContainer_.document, DocumentData.class, DocumentData_.id, pageId);
        LabelFactory.createHeader2Label(panelContent, DOCUMENT_DETAILS);
        if (documentStatusContainer != null && documentStatusContainer.getDocumentDetailContainer() != null && documentStatusContainer.getDocumentDetailContainer().getDocumentDetailList() != null) {
            getGridFactory().createBasicBeanItemGrid(panelContent, DocumentDetailData.class, documentStatusContainer.getDocumentDetailContainer().getDocumentDetailList(), DOCUMENT_DETAILS2, COLUMN_ORDER, HIDE_COLUMNS, null, null, null);
        }
        panel.setContent(panelContent);
        getPageActionEventHelper().createPageEvent(ViewAction.VISIT_DOCUMENT_VIEW, ApplicationEventGroup.USER, NAME, parameters, pageId);
    }
    return panelContent;
}
Also used : DocumentStatusContainer(com.hack23.cia.model.external.riksdagen.dokumentstatus.impl.DocumentStatusContainer) DocumentElement(com.hack23.cia.model.external.riksdagen.dokumentlista.impl.DocumentElement) VerticalLayout(com.vaadin.ui.VerticalLayout) Secured(org.springframework.security.access.annotation.Secured)

Example 2 with DocumentStatusContainer

use of com.hack23.cia.model.external.riksdagen.dokumentstatus.impl.DocumentStatusContainer in project cia by Hack23.

the class DocumentOverviewPageModContentFactoryImpl 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<DocumentElement, String> documentElementDataContainer = getApplicationManager().getDataContainer(DocumentElement.class);
    final DataContainer<DocumentStatusContainer, String> documentStatusContainerDataContainer = getApplicationManager().getDataContainer(DocumentStatusContainer.class);
    final DocumentElement documentElement = documentElementDataContainer.load(pageId);
    if (documentElement != null) {
        getDocumentMenuItemFactory().createDocumentMenuBar(menuBar, pageId);
        final DocumentStatusContainer documentStatusContainer = documentStatusContainerDataContainer.findByQueryProperty(DocumentStatusContainer.class, DocumentStatusContainer_.document, DocumentData.class, DocumentData_.id, pageId);
        LabelFactory.createHeader2Label(panelContent, OVERVIEW);
        getFormFactory().addFormPanelTextFields(panelContent, documentElement, DocumentElement.class, AS_LIST);
        if (documentStatusContainer != null) {
            getFormFactory().addFormPanelTextFields(panelContent, documentStatusContainer, DocumentStatusContainer.class, AS_LIST3);
            getFormFactory().addFormPanelTextFields(panelContent, documentStatusContainer.getDocument(), DocumentData.class, AS_LIST2);
        }
        final VerticalLayout overviewLayout = new VerticalLayout();
        overviewLayout.setSizeFull();
        panelContent.addComponent(overviewLayout);
        panelContent.setExpandRatio(overviewLayout, ContentRatio.LARGE_FORM);
        getDocumentMenuItemFactory().createOverviewPage(overviewLayout, pageId);
        panel.setContent(panelContent);
        getPageActionEventHelper().createPageEvent(ViewAction.VISIT_DOCUMENT_VIEW, ApplicationEventGroup.USER, NAME, parameters, pageId);
    }
    return panelContent;
}
Also used : DocumentStatusContainer(com.hack23.cia.model.external.riksdagen.dokumentstatus.impl.DocumentStatusContainer) DocumentElement(com.hack23.cia.model.external.riksdagen.dokumentlista.impl.DocumentElement) VerticalLayout(com.vaadin.ui.VerticalLayout) Secured(org.springframework.security.access.annotation.Secured)

Example 3 with DocumentStatusContainer

use of com.hack23.cia.model.external.riksdagen.dokumentstatus.impl.DocumentStatusContainer in project cia by Hack23.

the class DocumentReferencesPageModContentFactoryImpl 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<DocumentElement, String> documentElementDataContainer = getApplicationManager().getDataContainer(DocumentElement.class);
    final DataContainer<DocumentStatusContainer, String> documentStatusContainerDataContainer = getApplicationManager().getDataContainer(DocumentStatusContainer.class);
    getApplicationManager().getDataContainer(CommitteeProposalComponentData.class);
    final DocumentElement documentElement = documentElementDataContainer.load(pageId);
    if (documentElement != null) {
        getDocumentMenuItemFactory().createDocumentMenuBar(menuBar, pageId);
        final DocumentStatusContainer documentStatusContainer = documentStatusContainerDataContainer.findByQueryProperty(DocumentStatusContainer.class, DocumentStatusContainer_.document, DocumentData.class, DocumentData_.id, pageId);
        LabelFactory.createHeader2Label(panelContent, DOCUMENT_REFERENCES);
        if (documentStatusContainer != null && documentStatusContainer.getDocumentReferenceContainer() != null && documentStatusContainer.getDocumentReferenceContainer().getDocumentReferenceList() != null) {
            getGridFactory().createBasicBeanItemGrid(panelContent, DocumentReferenceData.class, documentStatusContainer.getDocumentReferenceContainer().getDocumentReferenceList(), DOCUMENT_REFERENCES2, COLUMN_ORDER, HIDE_COLUMNS, null, null, null);
        }
        panel.setContent(panelContent);
        getPageActionEventHelper().createPageEvent(ViewAction.VISIT_DOCUMENT_VIEW, ApplicationEventGroup.USER, NAME, parameters, pageId);
    }
    return panelContent;
}
Also used : DocumentStatusContainer(com.hack23.cia.model.external.riksdagen.dokumentstatus.impl.DocumentStatusContainer) DocumentElement(com.hack23.cia.model.external.riksdagen.dokumentlista.impl.DocumentElement) VerticalLayout(com.vaadin.ui.VerticalLayout) Secured(org.springframework.security.access.annotation.Secured)

Example 4 with DocumentStatusContainer

use of com.hack23.cia.model.external.riksdagen.dokumentstatus.impl.DocumentStatusContainer in project cia by Hack23.

the class DocumentActivityPageModContentFactoryImpl 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<DocumentElement, String> documentElementDataContainer = getApplicationManager().getDataContainer(DocumentElement.class);
    final DataContainer<DocumentStatusContainer, String> documentStatusContainerDataContainer = getApplicationManager().getDataContainer(DocumentStatusContainer.class);
    getApplicationManager().getDataContainer(CommitteeProposalComponentData.class);
    final DocumentElement documentElement = documentElementDataContainer.load(pageId);
    if (documentElement != null) {
        getDocumentMenuItemFactory().createDocumentMenuBar(menuBar, pageId);
        final DocumentStatusContainer documentStatusContainer = documentStatusContainerDataContainer.findByQueryProperty(DocumentStatusContainer.class, DocumentStatusContainer_.document, DocumentData.class, DocumentData_.id, pageId);
        LabelFactory.createHeader2Label(panelContent, DOCUMENT_ACTIVITY);
        if (documentStatusContainer != null && documentStatusContainer.getDocumentActivityContainer() != null && documentStatusContainer.getDocumentActivityContainer().getDocumentActivities() != null) {
            getGridFactory().createBasicBeanItemGrid(panelContent, DocumentActivityData.class, documentStatusContainer.getDocumentActivityContainer().getDocumentActivities(), DOCUMENT_ACTIVITIES, COLUMN_ORDER, HIDE_COLUMNS, null, null, null);
        }
        panel.setContent(panelContent);
        getPageActionEventHelper().createPageEvent(ViewAction.VISIT_DOCUMENT_VIEW, ApplicationEventGroup.USER, NAME, parameters, pageId);
    }
    return panelContent;
}
Also used : DocumentStatusContainer(com.hack23.cia.model.external.riksdagen.dokumentstatus.impl.DocumentStatusContainer) DocumentElement(com.hack23.cia.model.external.riksdagen.dokumentlista.impl.DocumentElement) VerticalLayout(com.vaadin.ui.VerticalLayout) Secured(org.springframework.security.access.annotation.Secured)

Example 5 with DocumentStatusContainer

use of com.hack23.cia.model.external.riksdagen.dokumentstatus.impl.DocumentStatusContainer in project cia by Hack23.

the class RiksdagenDocumentApiImplITest method getDocumentStatusTest.

/**
 * Gets the document status test.
 *
 * @return the document status test
 * @throws Exception
 *             the exception
 */
@Test
public void getDocumentStatusTest() throws Exception {
    DocumentStatusContainer dokumentstatus = riksdagenApi.getDocumentStatus("GU01JuU11");
    assertNotNull(dokumentstatus);
    assertNotNull(dokumentstatus.getDocument().getMadePublicDate());
    assertNotNull(dokumentstatus.getDocument().getHangarId());
    assertEquals(DocumentType.BET.value(), dokumentstatus.getDocument().getDocumentType());
    assertTrue(dokumentstatus.getDocumentReferenceContainer().getDocumentReferenceList().size() > 0);
    assertTrue(dokumentstatus.getDocumentDetailContainer().getDocumentDetailList().size() > 0);
    dokumentstatus = riksdagenApi.getDocumentStatus("GQ02So321");
    assertNotNull(dokumentstatus);
    assertNotNull(dokumentstatus.getDocument().getMadePublicDate());
    assertNotNull(dokumentstatus.getDocument().getHangarId());
    assertEquals(DocumentType.MOT.value(), dokumentstatus.getDocument().getDocumentType());
    assertEquals("Avslag", dokumentstatus.getDocumentProposal().getProposal().getChamber());
    assertEquals(" Avslag", dokumentstatus.getDocumentProposal().getProposal().getCommittee());
    assertEquals("2003/04:SoU7", dokumentstatus.getDocumentProposal().getProposal().getProcessedIn());
    assertEquals("Röstning", dokumentstatus.getDocumentProposal().getProposal().getDecisionType());
    assertEquals("0540190357911", dokumentstatus.getDocumentPersonReferenceContainer().getDocumentPersonReferenceList().get(0).getPersonReferenceId());
    assertTrue(dokumentstatus.getDocumentDetailContainer().getDocumentDetailList().size() > 0);
    dokumentstatus = riksdagenApi.getDocumentStatus("GX02Ub453");
    assertNotNull(dokumentstatus);
    assertNotNull(dokumentstatus.getDocument().getMadePublicDate());
    assertNotNull(dokumentstatus.getDocument().getHangarId());
    assertEquals(DocumentType.MOT.value(), dokumentstatus.getDocument().getDocumentType());
    assertTrue(dokumentstatus.getDocumentDetailContainer().getDocumentDetailList().size() > 0);
    assertEquals(1, dokumentstatus.getDocumentPersonReferenceContainer().getDocumentPersonReferenceList().size());
    final DocumentPersonReferenceData documentPersonReferenceData = dokumentstatus.getDocumentPersonReferenceContainer().getDocumentPersonReferenceList().iterator().next();
    assertEquals("Thomas Bodström", documentPersonReferenceData.getReferenceName());
}
Also used : DocumentStatusContainer(com.hack23.cia.model.external.riksdagen.dokumentstatus.impl.DocumentStatusContainer) DocumentPersonReferenceData(com.hack23.cia.model.external.riksdagen.dokumentstatus.impl.DocumentPersonReferenceData) Test(org.junit.Test)

Aggregations

DocumentStatusContainer (com.hack23.cia.model.external.riksdagen.dokumentstatus.impl.DocumentStatusContainer)10 DocumentElement (com.hack23.cia.model.external.riksdagen.dokumentlista.impl.DocumentElement)7 VerticalLayout (com.vaadin.ui.VerticalLayout)7 Secured (org.springframework.security.access.annotation.Secured)7 Test (org.junit.Test)2 DocumentPersonReferenceData (com.hack23.cia.model.external.riksdagen.dokumentstatus.impl.DocumentPersonReferenceData)1 ProposalCommitteeeSummary (com.hack23.cia.web.impl.ui.application.views.common.dataseriesfactory.api.ProposalCommitteeeSummary)1 ArrayList (java.util.ArrayList)1