Search in sources :

Example 1 with UserSession

use of org.ovirt.engine.core.common.businessentities.UserSession in project ovirt-engine by oVirt.

the class TerminateSessionsModel method setSessionsDetails.

private void setSessionsDetails() {
    final List<String> sessionStrings = new ArrayList<>();
    for (UserSession session : sessions) {
        final long sessionId = session.getId();
        final String sessionUserName = session.getUserName();
        final String userSessionRow = ConstantsManager.getInstance().getMessages().userSessionRow(sessionId, sessionUserName);
        sessionStrings.add(userSessionRow);
    }
    setItems(sessionStrings);
}
Also used : UserSession(org.ovirt.engine.core.common.businessentities.UserSession) ArrayList(java.util.ArrayList)

Example 2 with UserSession

use of org.ovirt.engine.core.common.businessentities.UserSession in project ovirt-engine by oVirt.

the class TerminateSessionsModel method onTerminate.

private void onTerminate() {
    final List<ActionParametersBase> parameterList = new ArrayList<>(sessions.size());
    for (UserSession session : sessions) {
        final long sessionId = session.getId();
        final TerminateSessionParameters terminateSessionParameters = new TerminateSessionParameters(sessionId);
        parameterList.add(terminateSessionParameters);
    }
    Frontend.getInstance().runMultipleActions(ActionType.TerminateSession, parameterList, result -> sourceListModel.getSearchCommand().execute());
    cancel();
}
Also used : TerminateSessionParameters(org.ovirt.engine.core.common.action.TerminateSessionParameters) UserSession(org.ovirt.engine.core.common.businessentities.UserSession) ArrayList(java.util.ArrayList) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase)

Example 3 with UserSession

use of org.ovirt.engine.core.common.businessentities.UserSession in project ovirt-engine by oVirt.

the class MainSessionView method initTable.

void initTable() {
    getTable().enableColumnResizing();
    AbstractTextColumn<UserSession> sessionDbIdColumn = new AbstractTextColumn<UserSession>() {

        @Override
        public String getValue(UserSession session) {
            return Long.toString(session.getId());
        }
    };
    sessionDbIdColumn.makeSortable(SessionConditionFieldAutoCompleter.SESSION_DB_ID);
    // $NON-NLS-1$
    getTable().addColumn(sessionDbIdColumn, constants.sessionDbId(), "100px");
    AbstractTextColumn<UserSession> userNameColumn = new AbstractTextColumn<UserSession>() {

        @Override
        public String getValue(UserSession session) {
            return session.getUserName();
        }
    };
    userNameColumn.makeSortable(SessionConditionFieldAutoCompleter.USER_NAME);
    // $NON-NLS-1$
    getTable().addColumn(userNameColumn, constants.userNameUser(), "200px");
    AbstractTextColumn<UserSession> authzNameColumn = new AbstractTextColumn<UserSession>() {

        @Override
        public String getValue(UserSession session) {
            return session.getAuthzName();
        }
    };
    authzNameColumn.makeSortable(SessionConditionFieldAutoCompleter.AUTHZ_NAME);
    // $NON-NLS-1$
    getTable().addColumn(authzNameColumn, constants.authorizationProvider(), "300px");
    AbstractTextColumn<UserSession> userIdColumn = new AbstractTextColumn<UserSession>() {

        @Override
        public String getValue(UserSession session) {
            return session.getUserId().toString();
        }
    };
    userIdColumn.makeSortable(SessionConditionFieldAutoCompleter.USER_ID);
    // $NON-NLS-1$
    getTable().addColumn(userIdColumn, constants.userId(), "200px");
    AbstractTextColumn<UserSession> sourceIpColumn = new AbstractTextColumn<UserSession>() {

        @Override
        public String getValue(UserSession session) {
            return session.getSourceIp();
        }
    };
    sourceIpColumn.makeSortable(SessionConditionFieldAutoCompleter.SOURCE_IP);
    // $NON-NLS-1$
    getTable().addColumn(sourceIpColumn, constants.sourceIp(), "200px");
    final DateTimeFormat dateFormat = DateTimeFormat.getFormat(DateTimeFormat.PredefinedFormat.DATE_TIME_MEDIUM);
    AbstractTextColumn<UserSession> sessionStartColumn = new AbstractTextColumn<UserSession>() {

        @Override
        public String getValue(UserSession session) {
            return session.getSessionStartTime() == null ? // $NON-NLS-1$
            "" : dateFormat.format(session.getSessionStartTime());
        }
    };
    sessionStartColumn.makeSortable(Comparator.comparing(UserSession::getSessionStartTime));
    // $NON-NLS-1$
    getTable().addColumn(sessionStartColumn, constants.sessionStartTime(), "200px");
    AbstractTextColumn<UserSession> sessionLastActiveColumn = new AbstractTextColumn<UserSession>() {

        @Override
        public String getValue(UserSession session) {
            return session.getSessionLastActiveTime() == null ? // $NON-NLS-1$
            "" : dateFormat.format(session.getSessionLastActiveTime());
        }
    };
    sessionLastActiveColumn.makeSortable(Comparator.comparing(UserSession::getSessionLastActiveTime));
    // $NON-NLS-1$
    getTable().addColumn(sessionLastActiveColumn, constants.sessionLastActiveTime(), "200px");
}
Also used : UserSession(org.ovirt.engine.core.common.businessentities.UserSession) AbstractTextColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn) DateTimeFormat(com.google.gwt.i18n.client.DateTimeFormat)

Aggregations

UserSession (org.ovirt.engine.core.common.businessentities.UserSession)3 ArrayList (java.util.ArrayList)2 DateTimeFormat (com.google.gwt.i18n.client.DateTimeFormat)1 ActionParametersBase (org.ovirt.engine.core.common.action.ActionParametersBase)1 TerminateSessionParameters (org.ovirt.engine.core.common.action.TerminateSessionParameters)1 AbstractTextColumn (org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn)1