mirror of
https://github.com/Kingsrook/qqq.git
synced 2025-07-18 13:10:44 +00:00
Add overload of loadTableToMap that takes Consumer<QueryInput> (e.g., to request heavy fields)
This commit is contained in:
@ -28,6 +28,7 @@ import java.util.HashMap;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
import java.util.function.Consumer;
|
||||||
import com.kingsrook.qqq.backend.core.actions.tables.CountAction;
|
import com.kingsrook.qqq.backend.core.actions.tables.CountAction;
|
||||||
import com.kingsrook.qqq.backend.core.actions.tables.GetAction;
|
import com.kingsrook.qqq.backend.core.actions.tables.GetAction;
|
||||||
import com.kingsrook.qqq.backend.core.actions.tables.QueryAction;
|
import com.kingsrook.qqq.backend.core.actions.tables.QueryAction;
|
||||||
@ -394,9 +395,25 @@ public class GeneralProcessUtils
|
|||||||
** Note - null values from the key field are NOT put in the map.
|
** Note - null values from the key field are NOT put in the map.
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
public static <T extends QRecordEntity> Map<Serializable, T> loadTableToMap(AbstractActionInput parentActionInput, String tableName, String keyFieldName, Class<T> entityClass) throws QException
|
public static <T extends QRecordEntity> Map<Serializable, T> loadTableToMap(AbstractActionInput parentActionInput, String tableName, String keyFieldName, Class<T> entityClass) throws QException
|
||||||
|
{
|
||||||
|
return (loadTableToMap(tableName, keyFieldName, entityClass, null));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
** Note - null values from the key field are NOT put in the map.
|
||||||
|
*******************************************************************************/
|
||||||
|
public static <T extends QRecordEntity> Map<Serializable, T> loadTableToMap(String tableName, String keyFieldName, Class<T> entityClass, Consumer<QueryInput> queryInputCustomizer) throws QException
|
||||||
{
|
{
|
||||||
QueryInput queryInput = new QueryInput();
|
QueryInput queryInput = new QueryInput();
|
||||||
queryInput.setTableName(tableName);
|
queryInput.setTableName(tableName);
|
||||||
|
|
||||||
|
if(queryInputCustomizer != null)
|
||||||
|
{
|
||||||
|
queryInputCustomizer.accept(queryInput);
|
||||||
|
}
|
||||||
|
|
||||||
QueryOutput queryOutput = new QueryAction().execute(queryInput);
|
QueryOutput queryOutput = new QueryAction().execute(queryInput);
|
||||||
List<QRecord> records = queryOutput.getRecords();
|
List<QRecord> records = queryOutput.getRecords();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user