Class RecordDeveloperModeUtils
java.lang.Object
com.kingsrook.qqq.middleware.javalin.executors.utils.RecordDeveloperModeUtils
Record "developer mode" logic - a record's associated scripts with their
revisions and test fields, a script revision's logs, and storing a new
revision - shared by the legacy script routes (QJavalinScriptsHandler) and
the v1 developer-mode specs, so that both apply the same permission checks
and return the same data.
Methods that read more than one table take a sessionSetup, which (when not
null) is run on each action input before it is used: the legacy routes
establish their session per input; v1 has one session per request.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classEverything developer mode shows about one of a table's associated scripts, for one record. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidcheckRecordIsReadable(String tableName, String primaryKey, UnsafeConsumer<AbstractActionInput, QException> sessionSetup) Make sure the user can get the record that they're trying to do a related (script) action for: requires READ permission on its table, and throws not-found if there is no such record.getAssociatedScripts(QTableMetaData table, QRecord record, UnsafeConsumer<AbstractActionInput, QException> sessionSetup) Load the details of each of a table's associated scripts, for a record of that table: the script type, the script the record references (if any) with its revisions (newest first), and the script tester's input and output fields (if the associated script has a tester).static QRecordGet the record that developer mode is for: requires READ permission on its table, generates display values and translates possible values, and throws not-found if there is no such record.getScriptLogRecords(QueryInput queryInput, String scriptRevisionId) Get the (newest, up to 100) logs of a script revision, each with its log lines as a list of records in its scriptLogLine value.static StoreAssociatedScriptOutputStore a new revision of a record's associated script: requires EDIT permission on the record's table (checked before anything is stored).
-
Field Details
-
SCRIPT_LOG_LIMIT
public static final int SCRIPT_LOG_LIMIT- See Also:
-
-
Constructor Details
-
RecordDeveloperModeUtils
public RecordDeveloperModeUtils()
-
-
Method Details
-
getRecord
public static QRecord getRecord(GetInput getInput, String tableName, String primaryKey) throws QException Get the record that developer mode is for: requires READ permission on its table, generates display values and translates possible values, and throws not-found if there is no such record.- Parameters:
getInput- a new GetInput (which the caller may already have used to set up its session)- Throws:
QException
-
checkRecordIsReadable
public static void checkRecordIsReadable(String tableName, String primaryKey, UnsafeConsumer<AbstractActionInput, QException> sessionSetup) throws QExceptionMake sure the user can get the record that they're trying to do a related (script) action for: requires READ permission on its table, and throws not-found if there is no such record.- Throws:
QException
-
getAssociatedScripts
public static List<RecordDeveloperModeUtils.AssociatedScriptDetails> getAssociatedScripts(QTableMetaData table, QRecord record, UnsafeConsumer<AbstractActionInput, QException> sessionSetup) throws QExceptionLoad the details of each of a table's associated scripts, for a record of that table: the script type, the script the record references (if any) with its revisions (newest first), and the script tester's input and output fields (if the associated script has a tester). Empty if the instance does not have the script tables.- Throws:
QException
-
getScriptLogRecords
public static List<QRecord> getScriptLogRecords(QueryInput queryInput, String scriptRevisionId) throws QException Get the (newest, up to 100) logs of a script revision, each with its log lines as a list of records in its scriptLogLine value.- Parameters:
queryInput- a new QueryInput (which the caller may already have used to set up its session)- Throws:
QException
-
storeAssociatedScript
public static StoreAssociatedScriptOutput storeAssociatedScript(StoreAssociatedScriptInput input) throws QException Store a new revision of a record's associated script: requires EDIT permission on the record's table (checked before anything is stored).- Throws:
QException
-