mirror of
https://github.com/Kingsrook/qqq.git
synced 2025-07-18 13:10:44 +00:00
Add "convenience wrappers"
This commit is contained in:
@ -65,16 +65,6 @@ public class GetAction
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
|
||||||
**
|
|
||||||
*******************************************************************************/
|
|
||||||
public QRecord executeForRecord(GetInput getInput) throws QException
|
|
||||||
{
|
|
||||||
return (execute(getInput).getRecord());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
**
|
**
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
@ -140,6 +130,43 @@ public class GetAction
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
** shorthand way to call for the most common use-case, when you just want the
|
||||||
|
** output record to be returned.
|
||||||
|
*******************************************************************************/
|
||||||
|
public QRecord executeForRecord(GetInput getInput) throws QException
|
||||||
|
{
|
||||||
|
return (execute(getInput).getRecord());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
** more shorthand way to call for the most common use-case, when you just want the
|
||||||
|
** output record to be returned, and you just want to pass in a table name and primary key.
|
||||||
|
*******************************************************************************/
|
||||||
|
public static QRecord execute(String tableName, Serializable primaryKey) throws QException
|
||||||
|
{
|
||||||
|
GetAction getAction = new GetAction();
|
||||||
|
GetInput getInput = new GetInput(tableName).withPrimaryKey(primaryKey);
|
||||||
|
return getAction.executeForRecord(getInput);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
** more shorthand way to call for the most common use-case, when you just want the
|
||||||
|
** output record to be returned, and you just want to pass in a table name and unique key
|
||||||
|
*******************************************************************************/
|
||||||
|
public static QRecord execute(String tableName, Map<String, Serializable> uniqueKey) throws QException
|
||||||
|
{
|
||||||
|
GetAction getAction = new GetAction();
|
||||||
|
GetInput getInput = new GetInput(tableName).withUniqueKey(uniqueKey);
|
||||||
|
return getAction.executeForRecord(getInput);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
** Run a GetAction by using the QueryAction instead (e.g., with a filter made
|
** Run a GetAction by using the QueryAction instead (e.g., with a filter made
|
||||||
** from the pkey/ukey, and returning the single record if found).
|
** from the pkey/ukey, and returning the single record if found).
|
||||||
|
@ -151,6 +151,22 @@ public class QueryAction
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
** shorthand way to call for the most common use-case, when you just want the
|
||||||
|
** records to be returned, and you just want to pass in a table name and filter.
|
||||||
|
*******************************************************************************/
|
||||||
|
public static List<QRecord> execute(String tableName, QQueryFilter filter) throws QException
|
||||||
|
{
|
||||||
|
QueryAction queryAction = new QueryAction();
|
||||||
|
QueryInput queryInput = new QueryInput();
|
||||||
|
queryInput.setTableName(tableName);
|
||||||
|
queryInput.setFilter(filter);
|
||||||
|
QueryOutput queryOutput = queryAction.execute(queryInput);
|
||||||
|
return (queryOutput.getRecords());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
**
|
**
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
Reference in New Issue
Block a user