use of com.hack23.cia.model.internal.application.system.impl.ApplicationSession 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;
}
Aggregations