Interface Task
A task is a database-side resource managed by the
DBMS_CLOUD_AI_AGENT PL/SQL package. Tasks define work that can be
assigned to or coordinated by an agent team.
A Task instance can represent an existing database task or be
configured for creation. The name-only SelectAIAgent.task(String)
factory verifies that the task exists and loads its metadata and attributes
before returning. SelectAIAgent.listTasks() also returns handles with
loaded metadata and attributes. A handle configured for creation is obtained with
SelectAIAgent.task(String, TaskAttributes, String, TaskStatus).
A creation-configured handle retains its supplied attributes, description,
and status without querying the database. Only such a handle can call
create(); after creation succeeds, it becomes database-backed.
enable(), disable(), and drop(boolean) require an
existing task and operate on the database-side resource.
Existing tasks can update individual attributes with setAttribute(String, String)
or multiple attributes with setAttributes(TaskAttributes); both
operations reload the typed attributes after the database update succeeds.
Before creation, getStatus() and getTaskAttributes() return
the configured values. For a database-backed handle, each call to either
method queries the database. getStatus() does not change the
description returned by getDescription(). The description is
supplied or loaded when the handle is initialized; getDescription()
does not query the database.
Names and required Java arguments are checked locally. Loading metadata and executing lifecycle operations require database access; the database checks privileges and validates task attributes when they are submitted.
For a complete runnable example, see CreateTaskSample source.
- Since:
- 1.1.0
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionbooleancreate()Creates this creation-configured task in the database.booleandisable()Disables this database-backed task.booleandrop(boolean force) Drops this database-backed task.booleanenable()Enables this database-backed task.Returns the description supplied or loaded when this handle was initialized.Returns the configured status before creation or the current database status for an existing task.Returns task attributes for this handle.Returns the configured or database-reported task name without database access.booleansetAttribute(String attributeName, boolean attributeValue) Updates one boolean task attribute in the database.booleansetAttribute(String attributeName, Float attributeValue) Updates one floating-point task attribute in the database.booleansetAttribute(String attributeName, Integer attributeValue) Updates one integer task attribute in the database.booleansetAttribute(String attributeName, String attributeValue) Updates one task attribute in the database.booleansetAttributes(TaskAttributes taskAttributes) Updates multiple task attributes in one database operation.
-
Method Details
-
create
Creates this creation-configured task in the database. For a runnable example, see CreateTaskSample source.- Returns:
truewhen the database creates the task- Throws:
IllegalStateException- when this handle was loaded from an existing taskSelectAIException- when the database rejects or cannot complete the operation
-
enable
Enables this database-backed task. For a runnable example, see EnableTaskSample source.- Returns:
truewhen the database enables the task- Throws:
IllegalStateException- when this task has not been createdSelectAIException- when the database operation fails
-
disable
Disables this database-backed task. For a runnable example, see DisableTaskSample source.- Returns:
truewhen the database disables the task- Throws:
IllegalStateException- when this task has not been createdSelectAIException- when the database operation fails
-
drop
Drops this database-backed task. Whenforceistrue, the operation may be retried after the handle has already been dropped; the database force-drop semantics determine the result. For a runnable example, see DropTaskSample source.- Parameters:
force- database force-drop option- Returns:
truewhen the drop completes- Throws:
IllegalStateException- whenforceisfalseand this task has not been createdSelectAIException- when the database operation fails
-
setAttribute
Updates one task attribute in the database. For a runnable example, see SetTaskAttributeSample source.- Parameters:
attributeName- database task attribute nameattributeValue- string value, ornullwhere supported- Returns:
truewhen the update succeeds- Throws:
IllegalArgumentException- whenattributeNameis null or blankIllegalStateException- when this task has not been createdSelectAIException- when the database update fails
-
setAttribute
Updates one boolean task attribute in the database. For a runnable example, see SetTaskAttributeSample source.- Parameters:
attributeName- database task attribute nameattributeValue- boolean value- Returns:
truewhen the update succeeds- Throws:
IllegalArgumentException- whenattributeNameis null or blankIllegalStateException- when this task has not been createdSelectAIException- when the database update fails
-
setAttribute
Updates one integer task attribute in the database. For a runnable example, see SetTaskAttributeSample source.- Parameters:
attributeName- database task attribute nameattributeValue- integer value- Returns:
truewhen the update succeeds- Throws:
IllegalArgumentException- whenattributeNameis null or blank, orattributeValueis nullIllegalStateException- when this task has not been createdSelectAIException- when the database update fails
-
setAttribute
Updates one floating-point task attribute in the database. For a runnable example, see SetTaskAttributeSample source.- Parameters:
attributeName- database task attribute nameattributeValue- floating-point value- Returns:
truewhen the update succeeds- Throws:
IllegalArgumentException- whenattributeNameis null or blank, orattributeValueis nullIllegalStateException- when this task has not been createdSelectAIException- when the database update fails
-
setAttributes
Updates multiple task attributes in one database operation. For a runnable example, see SetTaskAttributesSample source.- Parameters:
taskAttributes- task attributes to update- Returns:
truewhen the update succeeds- Throws:
IllegalArgumentException- whentaskAttributesis nullIllegalStateException- when this task has not been createdSelectAIException- when the database update fails
-
getTaskName
Returns the configured or database-reported task name without database access. For a runnable example, see LoadTaskSample source.- Returns:
- configured or database-reported task name
-
getDescription
Returns the description supplied or loaded when this handle was initialized. This method does not access the database and the value is not changed bygetStatus(). For a runnable example, see LoadTaskSample source.- Returns:
- supplied or loaded task description, or
nullwhen absent
-
getStatus
Returns the configured status before creation or the current database status for an existing task. A pending task with no configured status returnsnull. This method does not change the description. For a runnable example, see LoadTaskSample source.- Returns:
- configured or current task status
- Throws:
SelectAIException- when current task metadata cannot be fetched
-
getTaskAttributes
Returns task attributes for this handle.For a database-backed task, this method reloads the attributes from the database on each call and therefore can fail if the resource was deleted. For a creation-configured task, it returns the configured attributes without querying the database. For a runnable example, see LoadTaskSample source.
- Returns:
- current task attributes for an existing task, or configured attributes for a task pending creation
- Throws:
SelectAIException- when the task no longer exists or current attributes cannot be fetched
-