Search in sources :

Example 1 with UserSessionView

use of org.olat.admin.sysinfo.model.UserSessionView in project OpenOLAT by OpenOLAT.

the class UserSessionController method reset.

/**
 * Re-initialize this controller. Fetches sessions again.
 */
public void reset() {
    Collection<UserSession> authUserSessions = sessionManager.getAuthenticatedUserSessions();
    List<UserSessionView> authUserSessionViews = new ArrayList<UserSessionView>(authUserSessions.size());
    for (UserSession authUserSession : authUserSessions) {
        authUserSessionViews.add(new UserSessionView(authUserSession));
    }
    usessTableModel = new UserSessionTableModel(authUserSessionViews, getIdentity().getKey());
    tableCtr.setTableDataModel(usessTableModel);
}
Also used : UserSession(org.olat.core.util.UserSession) ArrayList(java.util.ArrayList) UserSessionView(org.olat.admin.sysinfo.model.UserSessionView)

Example 2 with UserSessionView

use of org.olat.admin.sysinfo.model.UserSessionView in project OpenOLAT by OpenOLAT.

the class UserSessionController method event.

/**
 * @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest,
 *      org.olat.core.gui.control.Controller, org.olat.core.gui.control.Event)
 */
public void event(UserRequest ureq, Controller source, Event event) {
    if (source == tableCtr) {
        if (event.getCommand().equals(Table.COMMANDLINK_ROWACTION_CLICKED)) {
            TableEvent te = (TableEvent) event;
            int selRow = te.getRowId();
            // session info (we only have authenticated sessions here
            UserSessionView usessw = (UserSessionView) tableCtr.getTableDataModel().getObject(selRow);
            if ("sess.chat".equals(te.getActionId())) {
                Buddy buddy = imService.getBuddyById(usessw.getIdentityKey());
                OpenInstantMessageEvent e = new OpenInstantMessageEvent(ureq, buddy);
                ureq.getUserSession().getSingleUserEventCenter().fireEventToListenersOf(e, InstantMessagingService.TOWER_EVENT_ORES);
            } else if ("sess.details".equals(te.getActionId())) {
                UserSession usess = usessw.getUserSession();
                UserSessionDetailsController detailsCtrl = new UserSessionDetailsController(ureq, getWindowControl(), usess);
                listenTo(detailsCtrl);
                String username = usess.getIdentity() == null ? "-" : UserManager.getInstance().getUserDisplayName(usess.getIdentity());
                stackController.pushController(username, detailsCtrl);
            }
        }
    }
}
Also used : TableEvent(org.olat.core.gui.components.table.TableEvent) UserSession(org.olat.core.util.UserSession) OpenInstantMessageEvent(org.olat.instantMessaging.OpenInstantMessageEvent) UserSessionView(org.olat.admin.sysinfo.model.UserSessionView) Buddy(org.olat.instantMessaging.model.Buddy)

Example 3 with UserSessionView

use of org.olat.admin.sysinfo.model.UserSessionView in project openolat by klemens.

the class UserSessionController method reset.

/**
 * Re-initialize this controller. Fetches sessions again.
 */
public void reset() {
    Collection<UserSession> authUserSessions = sessionManager.getAuthenticatedUserSessions();
    List<UserSessionView> authUserSessionViews = new ArrayList<UserSessionView>(authUserSessions.size());
    for (UserSession authUserSession : authUserSessions) {
        authUserSessionViews.add(new UserSessionView(authUserSession));
    }
    usessTableModel = new UserSessionTableModel(authUserSessionViews, getIdentity().getKey());
    tableCtr.setTableDataModel(usessTableModel);
}
Also used : UserSession(org.olat.core.util.UserSession) ArrayList(java.util.ArrayList) UserSessionView(org.olat.admin.sysinfo.model.UserSessionView)

Example 4 with UserSessionView

use of org.olat.admin.sysinfo.model.UserSessionView in project openolat by klemens.

the class UserSessionController method event.

/**
 * @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest,
 *      org.olat.core.gui.control.Controller, org.olat.core.gui.control.Event)
 */
public void event(UserRequest ureq, Controller source, Event event) {
    if (source == tableCtr) {
        if (event.getCommand().equals(Table.COMMANDLINK_ROWACTION_CLICKED)) {
            TableEvent te = (TableEvent) event;
            int selRow = te.getRowId();
            // session info (we only have authenticated sessions here
            UserSessionView usessw = (UserSessionView) tableCtr.getTableDataModel().getObject(selRow);
            if ("sess.chat".equals(te.getActionId())) {
                Buddy buddy = imService.getBuddyById(usessw.getIdentityKey());
                OpenInstantMessageEvent e = new OpenInstantMessageEvent(ureq, buddy);
                ureq.getUserSession().getSingleUserEventCenter().fireEventToListenersOf(e, InstantMessagingService.TOWER_EVENT_ORES);
            } else if ("sess.details".equals(te.getActionId())) {
                UserSession usess = usessw.getUserSession();
                UserSessionDetailsController detailsCtrl = new UserSessionDetailsController(ureq, getWindowControl(), usess);
                listenTo(detailsCtrl);
                String username = usess.getIdentity() == null ? "-" : UserManager.getInstance().getUserDisplayName(usess.getIdentity());
                stackController.pushController(username, detailsCtrl);
            }
        }
    }
}
Also used : TableEvent(org.olat.core.gui.components.table.TableEvent) UserSession(org.olat.core.util.UserSession) OpenInstantMessageEvent(org.olat.instantMessaging.OpenInstantMessageEvent) UserSessionView(org.olat.admin.sysinfo.model.UserSessionView) Buddy(org.olat.instantMessaging.model.Buddy)

Aggregations

UserSessionView (org.olat.admin.sysinfo.model.UserSessionView)4 UserSession (org.olat.core.util.UserSession)4 ArrayList (java.util.ArrayList)2 TableEvent (org.olat.core.gui.components.table.TableEvent)2 OpenInstantMessageEvent (org.olat.instantMessaging.OpenInstantMessageEvent)2 Buddy (org.olat.instantMessaging.model.Buddy)2