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);
}
}
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);
}
}
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;
}
Aggregations