use of com.hack23.cia.service.api.DataContainer in project cia by Hack23.
the class MinistryRoleGhantPageModContentFactoryImpl 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<ViewRiksdagenMinistry, String> dataContainer = getApplicationManager().getDataContainer(ViewRiksdagenMinistry.class);
final ViewRiksdagenMinistry viewRiksdagenMinistry = dataContainer.load(pageId);
if (viewRiksdagenMinistry != null) {
getMinistryMenuItemFactory().createMinistryMenuBar(menuBar, pageId);
LabelFactory.createHeader2Label(panelContent, ROLE_GHANT);
final DataContainer<ViewRiksdagenGovermentRoleMember, String> govermentRoleMemberDataContainer = getApplicationManager().getDataContainer(ViewRiksdagenGovermentRoleMember.class);
final List<ViewRiksdagenGovermentRoleMember> allMembers = govermentRoleMemberDataContainer.getAllBy(ViewRiksdagenGovermentRoleMember_.detail, viewRiksdagenMinistry.getNameId());
ministryGhantChartManager.createRoleGhant(panelContent, allMembers);
panel.setCaption(NAME + "::" + MINISTRY + viewRiksdagenMinistry.getNameId());
getPageActionEventHelper().createPageEvent(ViewAction.VISIT_MINISTRY_VIEW, ApplicationEventGroup.USER, NAME, parameters, pageId);
}
return panelContent;
}
use of com.hack23.cia.service.api.DataContainer in project cia by Hack23.
the class UserHomeApplicationEventsPageModContentFactoryImpl method createContent.
@Secured({ "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);
userHomeMenuItemFactory.createUserHomeMenuBar(menuBar, pageId);
LabelFactory.createHeader2Label(panelContent, USER_EVENTS);
final Long userIdFromSecurityContext = UserContextUtil.getUserInternalIdFromSecurityContext();
if (userIdFromSecurityContext == null) {
UI.getCurrent().getNavigator().navigateTo(CommonsViews.MAIN_VIEW_NAME);
} else {
final DataContainer<UserAccount, Long> dataContainer = getApplicationManager().getDataContainer(UserAccount.class);
final UserAccount userAccount = dataContainer.load(userIdFromSecurityContext);
final DataContainer<ApplicationActionEvent, Long> eventDataContainer = getApplicationManager().getDataContainer(ApplicationActionEvent.class);
getGridFactory().createBasicBeanItemGrid(panelContent, ApplicationActionEvent.class, eventDataContainer.findOrderedListByProperty(ApplicationActionEvent_.userId, userAccount.getUserId(), ApplicationActionEvent_.createdDate), APPLICATION_ACTION_EVENT, COLUMN_ORDER, HIDE_COLUMNS, LISTENER, null, null);
}
panel.setCaption(NAME + "::" + USERHOME + USER_EVENTS);
getPageActionEventHelper().createPageEvent(ViewAction.VISIT_USER_HOME_VIEW, ApplicationEventGroup.USER, NAME, parameters, pageId);
return panelContent;
}
use of com.hack23.cia.service.api.DataContainer in project cia by Hack23.
the class UserHomeApplicationSessionsPageModContentFactoryImpl method createContent.
@Secured({ "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);
userHomeMenuItemFactory.createUserHomeMenuBar(menuBar, pageId);
LabelFactory.createHeader2Label(panelContent, USER_VISITS);
final Long userIdFromSecurityContext = UserContextUtil.getUserInternalIdFromSecurityContext();
if (userIdFromSecurityContext == null) {
UI.getCurrent().getNavigator().navigateTo(CommonsViews.MAIN_VIEW_NAME);
} else {
final DataContainer<UserAccount, Long> dataContainer = getApplicationManager().getDataContainer(UserAccount.class);
final UserAccount userAccount = dataContainer.load(userIdFromSecurityContext);
final DataContainer<ApplicationSession, Long> sessionDataContainer = getApplicationManager().getDataContainer(ApplicationSession.class);
getGridFactory().createBasicBeanItemGrid(panelContent, ApplicationSession.class, sessionDataContainer.findOrderedListByProperty(ApplicationSession_.userId, userAccount.getUserId(), ApplicationSession_.createdDate), APPLICATION_SESSION, COLUMN_ORDER, HIDE_COLUMNS, LISTENER, null, COLLECTION_PROPERTY_CONVERTERS);
}
panel.setCaption(NAME + "::" + USERHOME + USER_VISITS);
getPageActionEventHelper().createPageEvent(ViewAction.VISIT_USER_HOME_VIEW, ApplicationEventGroup.USER, NAME, parameters, pageId);
return panelContent;
}
use of com.hack23.cia.service.api.DataContainer in project cia by Hack23.
the class UserHomeOverviewPageModContentFactoryImpl method createContent.
@Secured({ "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);
userHomeMenuItemFactory.createUserHomeMenuBar(menuBar, pageId);
LabelFactory.createHeader2Label(panelContent, OVERVIEW);
final Button logoutButton = new Button(LOGOUT, VaadinIcons.SIGN_OUT);
final LogoutRequest logoutRequest = new LogoutRequest();
logoutRequest.setSessionId(RequestContextHolder.currentRequestAttributes().getSessionId());
logoutButton.addClickListener(new LogoutClickListener(logoutRequest));
panelContent.addComponent(logoutButton);
final DataContainer<UserAccount, Long> dataContainer = getApplicationManager().getDataContainer(UserAccount.class);
final Long userIdFromSecurityContext = UserContextUtil.getUserInternalIdFromSecurityContext();
if (userIdFromSecurityContext == null) {
UI.getCurrent().getNavigator().navigateTo(CommonsViews.MAIN_VIEW_NAME);
} else {
final UserAccount userAccount = dataContainer.load(userIdFromSecurityContext);
getFormFactory().addFormPanelTextFields(panelContent, userAccount, UserAccount.class, AS_LIST);
panelContent.setExpandRatio(logoutButton, ContentRatio.SMALL);
final VerticalLayout overviewLayout = new VerticalLayout();
overviewLayout.setSizeFull();
panelContent.addComponent(overviewLayout);
panelContent.setExpandRatio(overviewLayout, ContentRatio.LARGE_FORM);
userHomeMenuItemFactory.createOverviewPage(overviewLayout);
}
panel.setCaption(NAME + "::" + USERHOME);
getPageActionEventHelper().createPageEvent(ViewAction.VISIT_USER_HOME_VIEW, ApplicationEventGroup.USER, NAME, parameters, pageId);
return panelContent;
}
use of com.hack23.cia.service.api.DataContainer in project cia by Hack23.
the class PartyCommitteeBallotDecisionSummaryPageModContentFactoryImpl 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, COMMITTEE_BALLOT_DECISION_SUMMARY);
final DataContainer<ViewRiksdagenCommitteeBallotDecisionPartySummary, ViewRiksdagenCommitteeBallotDecisionPartyEmbeddedId> committeeBallotDecisionPartyDataContainer = getApplicationManager().getDataContainer(ViewRiksdagenCommitteeBallotDecisionPartySummary.class);
final List<ViewRiksdagenCommitteeBallotDecisionPartySummary> decisionPartySummaryList = committeeBallotDecisionPartyDataContainer.findOrderedListByEmbeddedProperty(ViewRiksdagenCommitteeBallotDecisionPartySummary.class, ViewRiksdagenCommitteeBallotDecisionPartySummary_.embeddedId, ViewRiksdagenCommitteeBallotDecisionPartyEmbeddedId.class, ViewRiksdagenCommitteeBallotDecisionPartyEmbeddedId_.party, pageId, ViewRiksdagenCommitteeBallotDecisionPartyEmbeddedId_.issue);
getGridFactory().createBasicBeanItemNestedPropertiesGrid(panelContent, ViewRiksdagenCommitteeBallotDecisionPartySummary.class, decisionPartySummaryList, COMMITTEE_BALLOT_DECISION_PARTY_SUMMARY, NESTED_PROPERTIES, COLUMN_ORDER, HIDE_COLUMNS, LISTENER, BALLOT_ID, null);
pageCompleted(parameters, panel, pageId, viewRiksdagenParty);
}
return panelContent;
}
Aggregations