Add getFormParam and getQueryParam methods, for common use-case of single-value

This commit is contained in:
2025-05-27 11:24:02 -05:00
parent 13189f5855
commit 6ae30f4d65

View File

@ -26,6 +26,7 @@ import java.util.List;
import java.util.Map;
import com.kingsrook.qqq.backend.core.model.actions.processes.ProcessState;
import com.kingsrook.qqq.backend.core.model.actions.processes.QProcessPayload;
import com.kingsrook.qqq.backend.core.utils.CollectionUtils;
/*******************************************************************************
@ -71,6 +72,46 @@ public class ProcessBasedRouterPayload extends QProcessPayload
/***************************************************************************
** for the common use-case, get a single formParam by name (vs the list that the
** actual proper formal interface would give).
***************************************************************************/
public String getFormParam(String name)
{
if(formParams != null)
{
List<String> values = formParams.get(name);
if(CollectionUtils.nullSafeHasContents(values))
{
return values.get(0);
}
}
return (null);
}
/***************************************************************************
** for the common use-case, get a single queryParam by name (vs the list that the
** actual proper formal interface would give).
***************************************************************************/
public String getQueryParam(String name)
{
if(queryParams != null)
{
List<String> values = queryParams.get(name);
if(CollectionUtils.nullSafeHasContents(values))
{
return values.get(0);
}
}
return (null);
}
/*******************************************************************************
** Getter for path
*******************************************************************************/