<commit_before>/*
 * Copyright (c) 2011 Haulmont Technology Ltd. All Rights Reserved.
 * Haulmont Technology proprietary and confidential.
 * Use is subject to license terms.
 */

package com.haulmont.cuba.gui.app.security.session.browse;

import com.haulmont.cuba.gui.UserSessionClient;
import com.haulmont.cuba.gui.components.*;
import com.haulmont.cuba.gui.ServiceLocator;
import com.haulmont.cuba.security.entity.UserSessionEntity;
import com.haulmont.cuba.security.app.UserSessionService;

import java.util.Map;
import java.util.Set;

public class SessionBrowser extends AbstractLookup {
    public SessionBrowser(IFrame frame) {
        super(frame);
    }

    public void init(Map<String, Object> params) {
        super.init(params);

        final Table table = getComponent("sessions_table");
        table.addAction(new AbstractAction("refresh") {
            public void actionPerform(Component component) {
                table.getDatasource().refresh();
            }
        });
        table.addAction(new AbstractAction("kill") {
            public void actionPerform(Component component) {
                Set<UserSessionEntity> set = table.getSelected();
                for (UserSessionEntity session : set){
                    if (!session.getId().equals(UserSessionClient.getUserSession().getId())) {
                        UserSessionService uss = ServiceLocator.lookup(UserSessionService.NAME);
                        uss.killSession(session.getId());
                    }
                }
                table.getDatasource().refresh();
            }
        });
        table.setAllowMultiStringCells(true);
    }
}
<commit_msg>- get rid of warnings in user session browser<commit_after>/*
 * Copyright (c) 2011 Haulmont Technology Ltd. All Rights Reserved.
 * Haulmont Technology proprietary and confidential.
 * Use is subject to license terms.
 */

package com.haulmont.cuba.gui.app.security.session.browse;

import com.haulmont.cuba.core.global.UserSessionSource;
import com.haulmont.cuba.gui.components.*;
import com.haulmont.cuba.security.app.UserSessionService;
import com.haulmont.cuba.security.entity.UserSessionEntity;

import javax.annotation.Resource;
import javax.inject.Inject;
import java.util.Map;
import java.util.Set;

public class SessionBrowser extends AbstractLookup {

    @Inject
    private UserSessionSource userSessionSource;

    @Inject
    private UserSessionService uss;

    @Resource(name = "sessions_table")
    private Table table;

    public SessionBrowser(IFrame frame) {
        super(frame);
    }

    public void init(Map<String, Object> params) {
        super.init(params);

        table.addAction(new AbstractAction("refresh") {
            public void actionPerform(Component component) {
                table.getDatasource().refresh();
            }
        });
        table.addAction(new AbstractAction("kill") {
            public void actionPerform(Component component) {
                Set<UserSessionEntity> set = table.getSelected();
                for (UserSessionEntity session : set) {
                    if (!session.getId().equals(userSessionSource.getUserSession().getId())) {
                        uss.killSession(session.getId());
                    }
                }
                table.getDatasource().refresh();
            }
        });
        table.setAllowMultiStringCells(true);
    }
}

{'fraction_non_alphanumeric': 0.0993434199257779, 'fraction_numerical': 0.0022837567799029405, 'mean_word_length': 2.3119092627599245, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5399977', 'n_tokens_mistral': 946, 'n_tokens_neox': 893, 'n_words': 184}