added utility method for loading a table that takes in a filter

This commit is contained in:
Tim Chamberlain
2024-03-06 13:01:22 -06:00
parent 7b9f659afa
commit 7edcb61b4d

View File

@ -292,9 +292,26 @@ public class GeneralProcessUtils
** too many rows... Caveat emptor.
*******************************************************************************/
public static <T extends QRecordEntity> List<T> loadTable(String tableName, Class<T> entityClass) throws QException
{
return (loadTable(tableName, entityClass, null));
}
/*******************************************************************************
** Load all rows from a table as a RecordEntity, takes in a filter as well
**
** Note, this is inherently unsafe, if you were to call it on a table with
** too many rows... Caveat emptor.
*******************************************************************************/
public static <T extends QRecordEntity> List<T> loadTable(String tableName, Class<T> entityClass, QQueryFilter filter) throws QException
{
QueryInput queryInput = new QueryInput();
queryInput.setTableName(tableName);
if(filter != null)
{
queryInput.setFilter(filter);
}
QueryOutput queryOutput = new QueryAction().execute(queryInput);
List<T> rs = new ArrayList<>();