Search in sources :

Example 6 with RecordContext

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

the class ParosTableContext method getDataForContext.

/* (non-Javadoc)
	 * @see org.parosproxy.paros.db.paros.TableContext#getDataForContext(int)
	 */
@Override
public synchronized List<RecordContext> getDataForContext(int contextId) throws DatabaseException {
    try {
        List<RecordContext> result = new ArrayList<>();
        psGetAllDataForContext.setInt(1, contextId);
        try (ResultSet rs = psGetAllDataForContext.executeQuery()) {
            while (rs.next()) {
                result.add(new RecordContext(rs.getLong(DATAID), rs.getInt(CONTEXTID), rs.getInt(TYPE), rs.getString(DATA)));
            }
        }
        return result;
    } catch (SQLException e) {
        throw new DatabaseException(e);
    }
}
Also used : SQLException(java.sql.SQLException) ArrayList(java.util.ArrayList) RecordContext(org.parosproxy.paros.db.RecordContext) ResultSet(java.sql.ResultSet) DatabaseException(org.parosproxy.paros.db.DatabaseException)

Example 7 with RecordContext

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

the class SqlTableContext method getDataForContext.

/* (non-Javadoc)
	 * @see org.parosproxy.paros.db.paros.TableContext#getDataForContext(int)
	 */
@Override
public List<RecordContext> getDataForContext(int contextId) throws DatabaseException {
    SqlPreparedStatementWrapper psGetAllDataForContext = null;
    try {
        psGetAllDataForContext = DbSQL.getSingleton().getPreparedStatement("context.ps.alldataforcontext");
        List<RecordContext> result = new ArrayList<>();
        psGetAllDataForContext.getPs().setInt(1, contextId);
        try (ResultSet rs = psGetAllDataForContext.getPs().executeQuery()) {
            while (rs.next()) {
                result.add(new RecordContext(rs.getLong(DATAID), rs.getInt(CONTEXTID), rs.getInt(TYPE), rs.getString(DATA)));
            }
        }
        return result;
    } catch (SQLException e) {
        throw new DatabaseException(e);
    } finally {
        DbSQL.getSingleton().releasePreparedStatement(psGetAllDataForContext);
    }
}
Also used : SQLException(java.sql.SQLException) ArrayList(java.util.ArrayList) RecordContext(org.parosproxy.paros.db.RecordContext) ResultSet(java.sql.ResultSet) DatabaseException(org.parosproxy.paros.db.DatabaseException)

Example 8 with RecordContext

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

the class Session method getContextDataStrings.

public List<String> getContextDataStrings(int contextId, int type) throws DatabaseException {
    List<RecordContext> dataList = model.getDb().getTableContext().getDataForContextAndType(contextId, type);
    List<String> list = new ArrayList<>();
    for (RecordContext data : dataList) {
        list.add(data.getData());
    }
    return list;
}
Also used : RecordContext(org.parosproxy.paros.db.RecordContext) ArrayList(java.util.ArrayList)

Aggregations

RecordContext (org.parosproxy.paros.db.RecordContext)8 DatabaseException (org.parosproxy.paros.db.DatabaseException)7 ResultSet (java.sql.ResultSet)6 SQLException (java.sql.SQLException)6 ArrayList (java.util.ArrayList)6 File (java.io.File)1 IOException (java.io.IOException)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 InvalidParameterException (java.security.InvalidParameterException)1 ConfigurationException (org.apache.commons.configuration.ConfigurationException)1 URIException (org.apache.commons.httpclient.URIException)1 HttpMessage (org.parosproxy.paros.network.HttpMessage)1 Context (org.zaproxy.zap.model.Context)1 IllegalContextNameException (org.zaproxy.zap.model.IllegalContextNameException)1 ParameterParser (org.zaproxy.zap.model.ParameterParser)1 StandardParameterParser (org.zaproxy.zap.model.StandardParameterParser)1 StructuralNodeModifier (org.zaproxy.zap.model.StructuralNodeModifier)1 Tech (org.zaproxy.zap.model.Tech)1 ZapXmlConfiguration (org.zaproxy.zap.utils.ZapXmlConfiguration)1