Search in sources :

Example 1 with RecordSession

use of org.parosproxy.paros.db.RecordSession in project zaproxy by zaproxy.

the class SqlTableSession method listSessions.

@Override
public List<RecordSession> listSessions() throws DatabaseException {
    SqlPreparedStatementWrapper psList = null;
    try {
        psList = DbSQL.getSingleton().getPreparedStatement("session.ps.list");
        List<RecordSession> result = new ArrayList<RecordSession>();
        try (ResultSet rs = psList.getPs().executeQuery()) {
            RecordSession ra = build(rs);
            while (ra != null) {
                result.add(ra);
                ra = build(rs);
            }
        }
        return result;
    } catch (SQLException e) {
        throw new DatabaseException(e);
    } finally {
        DbSQL.getSingleton().releasePreparedStatement(psList);
    }
}
Also used : SQLException(java.sql.SQLException) ArrayList(java.util.ArrayList) ResultSet(java.sql.ResultSet) RecordSession(org.parosproxy.paros.db.RecordSession) DatabaseException(org.parosproxy.paros.db.DatabaseException)

Example 2 with RecordSession

use of org.parosproxy.paros.db.RecordSession in project zaproxy by zaproxy.

the class MenuFileControl method openDbBasedSession.

private void openDbBasedSession() {
    try {
        List<String> sessionList = new ArrayList<String>();
        for (RecordSession rs : model.getDb().getTableSession().listSessions()) {
            sessionList.add("" + rs.getSessionId());
        }
        SessionTableSelectDialog ssd = new SessionTableSelectDialog(View.getSingleton().getMainFrame(), sessionList);
        ssd.setVisible(true);
        if (ssd.getSelectedSession() != null) {
            waitMessageDialog = view.getWaitMessageDialog(Constant.messages.getString("menu.file.loadSession"));
            control.openSession(ssd.getSelectedSession(), this);
            waitMessageDialog.setVisible(true);
        }
    } catch (DatabaseException e) {
        log.error(e.getMessage(), e);
    }
}
Also used : ArrayList(java.util.ArrayList) SessionTableSelectDialog(org.zaproxy.zap.view.SessionTableSelectDialog) RecordSession(org.parosproxy.paros.db.RecordSession) DatabaseException(org.parosproxy.paros.db.DatabaseException)

Aggregations

ArrayList (java.util.ArrayList)2 DatabaseException (org.parosproxy.paros.db.DatabaseException)2 RecordSession (org.parosproxy.paros.db.RecordSession)2 ResultSet (java.sql.ResultSet)1 SQLException (java.sql.SQLException)1 SessionTableSelectDialog (org.zaproxy.zap.view.SessionTableSelectDialog)1