Search in sources :

Example 21 with ApplicationSession

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;
}
Also used : ApplicationSession(com.hack23.cia.model.internal.application.system.impl.ApplicationSession) VerticalLayout(com.vaadin.ui.VerticalLayout) UserAccount(com.hack23.cia.model.internal.application.user.impl.UserAccount) Secured(org.springframework.security.access.annotation.Secured)

Aggregations

ApplicationSession (com.hack23.cia.model.internal.application.system.impl.ApplicationSession)21 Test (org.junit.Test)14 Date (java.util.Date)5 CreateApplicationSessionRequest (com.hack23.cia.service.api.action.application.CreateApplicationSessionRequest)4 AbstractServiceFunctionalIntegrationTest (com.hack23.cia.service.impl.AbstractServiceFunctionalIntegrationTest)4 Secured (org.springframework.security.access.annotation.Secured)4 ApplicationActionEvent (com.hack23.cia.model.internal.application.system.impl.ApplicationActionEvent)3 UserAccount (com.hack23.cia.model.internal.application.user.impl.UserAccount)2 CreateApplicationEventResponse (com.hack23.cia.service.api.action.application.CreateApplicationEventResponse)2 CreateApplicationSessionResponse (com.hack23.cia.service.api.action.application.CreateApplicationSessionResponse)2 VerticalLayout (com.vaadin.ui.VerticalLayout)2 PerfTest (org.databene.contiperf.PerfTest)2 Required (org.databene.contiperf.Required)2 ApplicationConfiguration (com.hack23.cia.model.internal.application.system.impl.ApplicationConfiguration)1 ManageUserAccountRequest (com.hack23.cia.service.api.action.admin.ManageUserAccountRequest)1 ManageUserAccountResponse (com.hack23.cia.service.api.action.admin.ManageUserAccountResponse)1 CreateApplicationEventRequest (com.hack23.cia.service.api.action.application.CreateApplicationEventRequest)1 DestroyApplicationSessionRequest (com.hack23.cia.service.api.action.application.DestroyApplicationSessionRequest)1 DestroyApplicationSessionResponse (com.hack23.cia.service.api.action.application.DestroyApplicationSessionResponse)1 RegisterUserRequest (com.hack23.cia.service.api.action.application.RegisterUserRequest)1