diff --git a/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/actions/tables/GetAction.java b/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/actions/tables/GetAction.java index bd110c32..e2524591 100644 --- a/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/actions/tables/GetAction.java +++ b/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/actions/tables/GetAction.java @@ -65,16 +65,6 @@ public class GetAction - /******************************************************************************* - ** - *******************************************************************************/ - public QRecord executeForRecord(GetInput getInput) throws QException - { - return (execute(getInput).getRecord()); - } - - - /******************************************************************************* ** *******************************************************************************/ @@ -108,7 +98,7 @@ public class GetAction } GetOutput getOutput; - boolean usingDefaultGetInterface = false; + boolean usingDefaultGetInterface = false; if(getInterface == null) { getInterface = new DefaultGetInterface(); @@ -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 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 ** from the pkey/ukey, and returning the single record if found). diff --git a/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/actions/tables/QueryAction.java b/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/actions/tables/QueryAction.java index 29cd9f82..58cc53a3 100644 --- a/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/actions/tables/QueryAction.java +++ b/qqq-backend-core/src/main/java/com/kingsrook/qqq/backend/core/actions/tables/QueryAction.java @@ -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 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()); + } + + + /******************************************************************************* ** *******************************************************************************/