Interface IPromptManagementService
- All Superinterfaces:
Serializable
- Since:
- 8.5.0
-
Method Summary
Modifier and TypeMethodDescriptionanalyzePromptConnectionExportData(IPromptConnectionExportAnalysisSpec spec, InputStream inputStream) Analyzes the given prompt connection export data and returns the analysis result.analyzePromptExportData(InputStream inputStream) Analyzes the given prompt export data and returns the analysis result.analyzePromptQueryExport(IPromptQueryExportAnalysisSpec spec, InputStream inputStream) Analyzes the given prompt query export data and returns the analysis result.voiddeleteConnection(IUser user, PromptObjectIdentifier connection) Deletes the prompt connection with the given ID.voiddeleteConnection(IUser user, PromptObjectIdentifier connection, IPromptLock lock) Deletes the prompt connection with the given ID.voiddeleteQuery(IUser user, PromptObjectIdentifier query) Deletes the prompt query with the given ID.voiddeleteQuery(IUser user, PromptObjectIdentifier query, IPromptLock lock) Deletes the prompt query with the given ID.voidexportConnectionData(IPromptConnectionExportSpec exportSpec, OutputStream outputStream, IUser user) Exports prompt connection data according to the given export specification and writes it to the given output stream.voidexportQueryData(IPromptQueryExportSpec exportSpec, OutputStream outputStream, IUser user) Exports prompt query data according to the given export specification and writes it to the given output stream.findConnectionByName(IUser user, PromptScope scope, String name) Searches for a prompt connection by itsname.findConnectionByQuery(IUser user, PromptObjectIdentifier query) Searches for the prompt connectionconfigured forthe given query.findConnectionsByType(IUser user, PromptScope scope, String type, PromptScopeResolutionMode mode) Searches for all prompt connections that use a prompt service of the given type.findQueryByName(IUser user, PromptScope scope, String name) Searches for a prompt query by itsname.importPromptQuery(IPromptQueryImportSpec spec, InputStream inputStream, IUser user) Imports prompt query data from the given input stream according to the given import specification.lockConnection(IUser user, PromptObjectIdentifier connection) Locks the given connection for editing.lockQuery(IUser user, PromptObjectIdentifier query) Locks the given query for editing.readConnection(IUser user, PromptObjectIdentifier connection) Reads the prompt connection with the given UUID.readConnectionConfig(IUser user, PromptObjectIdentifier connection) Reads the raw, non-deserialized configuration of the prompt connection with the given ID.readConnections(IUser user, PromptScope scope, PromptScopeResolutionMode mode) Reads all prompt connections assigned to the given scope.readQueries(IUser user, PromptScope scope, PromptScopeResolutionMode mode) Reads all prompt queries assigned to the given scope.readQuery(IUser user, PromptObjectIdentifier query) Reads the prompt query with the given ID.readQueryConfig(IUser user, PromptObjectIdentifier query) Reads the raw, non-deserialized configuration of the prompt query with the given UUID.voidsaveConnection(IUser user, PromptConnectionData connection, Object config) Persists (create or update) the given prompt connection in the persistence layer.saveConnection(IUser user, PromptConnectionData connection, Object config, IPromptLock lock) Persists (create or update) the given prompt connection in the persistence layer.voidsaveQuery(IUser user, PromptQueryData query, Object config) Persists (create or update) the given prompt query in the persistence layer.saveQuery(IUser user, PromptQueryData query, Object config, IPromptLock lock) Persists (create or update) the given prompt query in the persistence layer.
-
Method Details
-
analyzePromptConnectionExportData
IPromptConnectionExportAnalysisResult analyzePromptConnectionExportData(IPromptConnectionExportAnalysisSpec spec, InputStream inputStream) throws FcPromptException Analyzes the given prompt connection export data and returns the analysis result. The input stream is expected to contain a prompt connection export.- Parameters:
spec- The specification for analyzing the prompt connection export (e.g., decryption password).inputStream- The input stream containing the prompt connection export data.- Returns:
- The analysis result.
- Throws:
IllegalArgumentException- If the input stream or spec is null.FcPromptException- If an error occurs during the analysis, such as invalid or corrupted data, decryption failure, or unsupported export format.
-
analyzePromptExportData
IPromptExportDataAnalysisResult analyzePromptExportData(InputStream inputStream) throws FcPromptException Analyzes the given prompt export data and returns the analysis result.- Parameters:
inputStream- The input stream containing the prompt export data.- Returns:
- The analysis result.
- Throws:
IllegalArgumentException- If the input stream is null.FcPromptException- If an error occurs during the analysis, such as invalid or corrupted data.
-
analyzePromptQueryExport
IPromptQueryExportAnalysisResult analyzePromptQueryExport(IPromptQueryExportAnalysisSpec spec, InputStream inputStream) throws FcPromptException Analyzes the given prompt query export data and returns the analysis result. The input stream is expected to contain a prompt query export.- Parameters:
spec- The specification for analyzing the prompt query export (e.g., decryption password).inputStream- The input stream containing the prompt query export data.- Returns:
- The analysis result.
- Throws:
IllegalArgumentException- If the input stream or spec is null.FcPromptException- If an error occurs during the analysis, such as invalid or corrupted data, decryption failure, or unsupported export format.
-
deleteConnection
Deletes the prompt connection with the given ID. If a lock is provided, this operation will fail in case the connection was modified in the meantime.- Parameters:
user- The user who requested the operation.connection- The ID of the prompt connection to delete, seePromptQueryData.scope()andPromptQueryData.uuid().- Throws:
FcPromptException- If an error occurs during the deletion.
-
deleteConnection
void deleteConnection(IUser user, PromptObjectIdentifier connection, IPromptLock lock) throws FcPromptException Deletes the prompt connection with the given ID. If a lock is provided, this operation will fail in case the connection was modified in the meantime.- Parameters:
user- The user who requested the operation. Used for permission checks and audit logging. Pass null in case you are performing system-internal operations that should bypass permission checks.connection- The ID of the prompt connection to delete, seePromptQueryData.scope()andPromptQueryData.uuid().lock- The lock instance returned bylockConnection(IUser, PromptObjectIdentifier). If the connection was modified in the meantime, this operation will fail with aFcPromptExceptionwhose cause is aOptimisticLockException.- Throws:
FcPromptException- If an error occurs during the deletion.
-
deleteQuery
Deletes the prompt query with the given ID. If a lock is provided, this operation will fail in case the query was modified in the meantime.- Parameters:
user- The user who requested the operation. Used for permission checks and audit logging. Pass null in case you are performing system-internal operations that should bypass permission checks.query- The ID of the prompt query to delete, seePromptQueryData.scope()andPromptQueryData.uuid().- Throws:
FcPromptException- If an error occurs during the deletion.
-
deleteQuery
void deleteQuery(IUser user, PromptObjectIdentifier query, IPromptLock lock) throws FcPromptException Deletes the prompt query with the given ID. If a lock is provided, this operation will fail in case the query was modified in the meantime.- Parameters:
user- The user who requested the operation. Used for permission checks and audit logging. Pass null in case you are performing system-internal operations that should bypass permission checks.query- The ID of the prompt query to delete, seePromptQueryData.scope()andPromptQueryData.uuid().lock- The lock instance returned bylockQuery(IUser, PromptObjectIdentifier). If the query was modified in the meantime, this operation will fail with aFcPromptExceptionwhose cause is aOptimisticLockException.- Throws:
FcPromptException- If an error occurs during the deletion.
-
exportConnectionData
void exportConnectionData(IPromptConnectionExportSpec exportSpec, OutputStream outputStream, IUser user) throws FcPromptException Exports prompt connection data according to the given export specification and writes it to the given output stream.- Parameters:
exportSpec- The specification of what to export and how.outputStream- The output stream to write the exported data to.user- The user who requested the operation. Used for permission checks and audit logging. Pass null in case you are performing system-internal operations that should bypass permission checks.- Throws:
FcPromptException- If an error occurs during the export or the user lacks necessary permissions.IllegalArgumentException- If the export specification is invalid or no output stream is provided.
-
exportQueryData
void exportQueryData(IPromptQueryExportSpec exportSpec, OutputStream outputStream, IUser user) throws FcPromptException Exports prompt query data according to the given export specification and writes it to the given output stream.- Parameters:
exportSpec- The specification of what to export and how.outputStream- The output stream to write the exported data to.user- The user who requested the operation. Used for permission checks and audit logging. Pass null in case you are performing system-internal operations that should bypass permission checks.- Throws:
FcPromptException- If an error occurs during the export or the user lacks necessary permissions.IllegalArgumentException- If the export specification is invalid or no output stream is provided.
-
findConnectionByName
PromptConnectionData findConnectionByName(IUser user, PromptScope scope, String name) throws FcPromptException Searches for a prompt connection by itsname.- Parameters:
user- The user who requested the operation. Used for permission checks and audit logging. Pass null in case you are performing system-internal operations that should bypass permission checks.scope- The scope of the connection, seePromptConnectionData.scope().name- The name of the connection to search for, seePromptConnectionData.name().- Returns:
- The prompt connection, or null if not found.
- Throws:
FcPromptException- If an error occurs during the search.
-
findConnectionByQuery
PromptConnectionData findConnectionByQuery(IUser user, PromptObjectIdentifier query) throws FcPromptException Searches for the prompt connectionconfigured forthe given query.- Parameters:
user- The user who requested the operation. Used for permission checks and audit logging. Pass null in case you are performing system-internal operations that should bypass permission checks.query- The ID of the query whose connection to search for, seePromptQueryData.scope()andPromptQueryData.uuid().- Returns:
- The prompt connection, or null if not found.
- Throws:
FcPromptException- If an error occurs during the search.
-
findConnectionsByType
List<PromptConnectionData> findConnectionsByType(IUser user, PromptScope scope, String type, PromptScopeResolutionMode mode) throws FcPromptException Searches for all prompt connections that use a prompt service of the given type.The mode parameter controls which connections to include based on their assigned scope. When set to
PromptScopeResolutionMode.SELF, only connections assigned to that exact scope are returned. When set toPromptScopeResolutionMode.PARENTS_AND_SELF, connections assigned to the given scope and connections assigned to higher-level scopes are returned. For example, when the scope is a tenant, connections assigned to either that tenant scope or to the global (system) scope are returned.- Parameters:
user- The user who requested the operation. Used for permission checks and audit logging. Pass null in case you are performing system-internal operations that should bypass permission checks.scope- The scope to which to limit the search, or null to search everywhere.type- The type of the connections to search for.- Returns:
- A list of prompt connections of the given type owned by the given tenant.
- Throws:
FcPromptException- If an error occurs during the search.
-
findQueryByName
PromptQueryData findQueryByName(IUser user, PromptScope scope, String name) throws FcPromptException Searches for a prompt query by itsname.- Parameters:
user- The user who requested the operation. Used for permission checks and audit logging. Pass null in case you are performing system-internal operations that should bypass permission checks.scope- The scope of the query, seePromptQueryData.scope().name- The name of the query to search for, seePromptQueryData.name().- Returns:
- The identified prompt query, or null if not found.
- Throws:
FcPromptException- If an error occurs during the search.
-
importPromptQuery
IPromptQueryImportResult importPromptQuery(IPromptQueryImportSpec spec, InputStream inputStream, IUser user) throws FcPromptException Imports prompt query data from the given input stream according to the given import specification.- Parameters:
spec- The specification for importing the prompt query (e.g., decryption password, target scope).inputStream- The input stream containing a prompt query export.user- The user who requested the operation.- Returns:
- The result of the import operation.
- Throws:
IllegalArgumentException- If the input stream or spec is null.FcPromptException- If an error occurs during the import, such as invalid or corrupted data, decryption failure, or unsupported import format.
-
lockConnection
Locked<IPromptLock, PromptConnectionData> lockConnection(IUser user, PromptObjectIdentifier connection) throws FcPromptException Locks the given connection for editing. This method returns a lock instance that should be passed to the various save or delete methods. This will cause those methods to fail in case the connection was modified in the meantime.- Parameters:
user- The user who requested the operation. Used for permission checks and audit logging. Pass null in case you are performing system-internal operations that should bypass permission checks.connection- The ID of the connection to lock, seePromptQueryData.scope()andPromptQueryData.uuid().- Returns:
- A lock instance for the given connection.
- Throws:
FcPromptException- If an error occurs during locking.
-
lockQuery
Locked<IPromptLock, PromptQueryData> lockQuery(IUser user, PromptObjectIdentifier query) throws FcPromptException Locks the given query for editing. This method returns a lock instance that should be passed to the various save or delete methods. This will cause those methods to fail in case the query was modified in the meantime.- Parameters:
user- The user who requested the operation. Used for permission checks and audit logging. Pass null in case you are performing system-internal operations that should bypass permission checks.query- The ID of the query to lock, seePromptQueryData.scope()andPromptQueryData.uuid().- Returns:
- A lock instance for the given query.
- Throws:
FcPromptException- If an error occurs during locking.
-
readConnection
PromptConnectionData readConnection(IUser user, PromptObjectIdentifier connection) throws FcPromptException Reads the prompt connection with the given UUID.- Parameters:
user- The user who requested the operation. Used for permission checks and audit logging. Pass null in case you are performing system-internal operations that should bypass permission checks.connection- The ID of the prompt connection to read, seePromptQueryData.scope()andPromptQueryData.uuid().- Returns:
- The prompt connection, or null if not found.
- Throws:
FcPromptException- If an error occurs during reading.
-
readConnectionConfig
SerializedPromptConfig readConnectionConfig(IUser user, PromptObjectIdentifier connection) throws FcPromptException Reads the raw, non-deserialized configuration of the prompt connection with the given ID. To deserialize the configuration into its appropriate model class, usepromptyTypeService.deserializePromptConnectionConfig.- Parameters:
user- The user who requested the operation. Used for permission checks and audit logging. Pass null in case you are performing system-internal operations that should bypass permission checks.connection- The UUID of a prompt connection, seePromptQueryData.scope()andPromptQueryData.uuid().- Returns:
- The raw, serialized prompt connection configuration.
- Throws:
FcPromptException- If an error occurs during reading.
-
readConnections
List<PromptConnectionData> readConnections(IUser user, PromptScope scope, PromptScopeResolutionMode mode) throws FcPromptException Reads all prompt connections assigned to the given scope.The mode parameter controls which connections to include based on their assigned scope. When set to
PromptScopeResolutionMode.SELF, only connections assigned to that exact scope are returned. When set toPromptScopeResolutionMode.PARENTS_AND_SELF, connections assigned to the given scope and connections assigned to higher-level scopes are returned. For example, when the scope is a tenant, connections assigned to either that tenant scope or to the global (system) scope are returned.- Parameters:
user- The user who requested the operation. Used for permission checks and audit logging. Pass null in case you are performing system-internal operations that should bypass permission checks.scope- The scope whose connections to read, seePromptConnectionData.scope().- Returns:
- A list of prompt connections owned by the given tenant.
- Throws:
FcPromptException- If an error occurs during reading.
-
readQueries
List<PromptQueryData> readQueries(IUser user, PromptScope scope, PromptScopeResolutionMode mode) throws FcPromptException Reads all prompt queries assigned to the given scope.The mode parameter controls which queries to include based on their assigned scope. When set to
PromptScopeResolutionMode.SELF, only queries assigned to that exact scope are returned. When set toPromptScopeResolutionMode.PARENTS_AND_SELF, queries assigned to the given scope and queries assigned to higher-level scopes are returned. For example, when the scope is a tenant, queries assigned to either that tenant scope or to the global (system) scope are returned.- Parameters:
user- The user who requested the operation. Used for permission checks and audit logging. Pass null in case you are performing system-internal operations that should bypass permission checks.scope- The scope whose queries to read, seePromptQueryData.scope().mode- Mode that controls which queries to include.- Returns:
- A list of prompt queries owned by the given tenant.
- Throws:
FcPromptException- If an error occurs during reading.
-
readQuery
Reads the prompt query with the given ID.- Parameters:
user- The user who requested the operation. Used for permission checks and audit logging. Pass null in case you are performing system-internal operations that should bypass permission checks.query- The ID of the prompt query to read.- Returns:
- The prompt query, or null if not found.
- Throws:
FcPromptException- If an error occurs during reading.
-
readQueryConfig
SerializedPromptConfig readQueryConfig(IUser user, PromptObjectIdentifier query) throws FcPromptException Reads the raw, non-deserialized configuration of the prompt query with the given UUID. To deserialize the configuration into its appropriate model class, usepromptyTypeService.deserializePromptQueryConfig.- Parameters:
user- The user who requested the operation. Used for permission checks and audit logging. Pass null in case you are performing system-internal operations that should bypass permission checks.query- The ID of a prompt query, seePromptQueryData.scope()andPromptQueryData.uuid().- Returns:
- The raw, serialized prompt query configuration.
- Throws:
FcPromptException- If an error occurs during reading.
-
saveConnection
void saveConnection(IUser user, PromptConnectionData connection, Object config) throws FcPromptException Persists (create or update) the given prompt connection in the persistence layer. If a connection with the same ID already exists, it will be updated. Otherwise, a new connection will be created.- Parameters:
user- The user who requested the operation.connection- The data of the prompt connection to save.config- The configuration object for the prompt connection, which will getserializedand persisted. Can also be an instance ofSerializedPromptConfigwhen the data was already serialized.- Throws:
FcPromptException- If an error occurs during saving.
-
saveConnection
IPromptLock saveConnection(IUser user, PromptConnectionData connection, Object config, IPromptLock lock) throws FcPromptException Persists (create or update) the given prompt connection in the persistence layer. If a connection with the same ID already exists, it will be updated. Otherwise, a new connection will be created. When a lock is provided, this operation will fail in case the connection was modified in the meantime.- Parameters:
user- The user who requested the operation.connection- The data of the prompt connection to save.config- The configuration object for the prompt connection, which will getserializedand persisted. Can also be an instance ofSerializedPromptConfigwhen the data was already serialized.lock- The lock instance returned bylockConnection(IUser, PromptObjectIdentifier). If the connection was modified in the meantime, this operation will fail with aFcPromptExceptionwhose cause is aOptimisticLockException.- Returns:
- A new lock for the updated connection.
- Throws:
FcPromptException- If an error occurs during saving.
-
saveQuery
Persists (create or update) the given prompt query in the persistence layer. If a query with the same ID already exists, it will be updated. Otherwise, a new query will be created.- Parameters:
user- The user who requested the operation.query- The data of the prompt query to save.config- The configuration object for the prompt query, which will getserializedand persisted. Can also be an instance ofSerializedPromptConfigwhen the data was already serialized.- Throws:
FcPromptException- If an error occurs during saving.
-
saveQuery
IPromptLock saveQuery(IUser user, PromptQueryData query, Object config, IPromptLock lock) throws FcPromptException Persists (create or update) the given prompt query in the persistence layer. If a query with the same ID already exists, it will be updated. Otherwise, a new query will be created. When a lock is provided, this operation will fail in case the query was modified in the meantime.- Parameters:
user- The user who requested the operation.query- The data of the prompt query to save.config- The configuration object for the prompt query, which will getserializedand persisted. Can also be an instance ofSerializedPromptConfigwhen the data was already serialized.lock- The lock instance returned bylockConnection(IUser, PromptObjectIdentifier). If the connection was modified in the meantime, this operation will fail with aFcPromptExceptionwhose cause is aOptimisticLockException.- Returns:
- A new lock for the updated query.
- Throws:
FcPromptException- If an error occurs during saving.
-