Klasse DUUIProcessController
java.lang.Object
org.texttechnologylab.duui.api.controllers.processes.DUUIProcessController
A Controller for database operations related to the processes collection.
- Autor:
- Cedric Borkowski
-
Konstruktorübersicht
Konstruktoren -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungstatic voiddeleteMany(org.bson.conversions.Bson filter) Delete all processes matching a given filter.static booleanDelete a process and all documents and events referencing this process.static booleandeleteTempOutputDirectory(File directory) A utility function that recursively deletes the content of a folder and the folder itself.static InputStreamdownloadFile(org.texttechnologylab.DockerUnifiedUIMAInterface.document_handler.IDUUIDocumentHandler handler, String path) Download a file from a cloud storage given the handler and path to the file.static org.bson.DocumentfindMany(MongoDBFilters filters) Retrieve one or more processes from the database given a userId andMongoDBFiltersto sort and filter the results.static org.bson.DocumentfindOneById(String id) Find one process given its id.static List<IDUUIProcessHandler> Get a list of all active processesstatic List<IDUUIProcessHandler> getActiveProcesses(String pipelineId) Get all active processes for a given pipeline.static org.texttechnologylab.DockerUnifiedUIMAInterface.document_handler.IDUUIDocumentHandlergetHandler(String provider, String providerId, String userId) Constructs a IDUUIDocumentHandler given aProvideras a String.static StringgetLanguageCode(String language) Get the language code for a given language.getProcessSummaryForEmail(String processId) Get the summary of a process for an email.static voidinsertAnnotations(String processId, Set<org.texttechnologylab.DockerUnifiedUIMAInterface.document_handler.DUUIDocument> documents) Store the annotations in the document in the database.static org.bson.DocumentmergeSettings(org.bson.Document settings) Given aDocumentof settings for a process, compare to the default settings by filling out missing values and checking invalid entries.static voidremoveProcess(String id) Remove a process from the active processes map.static voidsetDocumentPaths(String id, Set<String> documentPaths) static voidSet an error for a process.static voidsetFinished(String id, boolean finished) Mark a process as finished.static voidsetFinishedAt(String id) Sets the finished_at field of a process to the current time.static voidsetFinishedAt(String id, long endTime) Sets the finished_at field of a process to the specified time.static voidsetInstantiationDuration(String id, long instantiationDuration) Update the instantiation duration for a process.static voidsetProgress(String id, int progress) Set the progress of a process to a new value.static voidUpdate the status of a process.static org.bson.Documentstart(org.bson.Document pipeline, org.bson.Document settings, DUUIDocumentProvider input, DUUIDocumentProvider output) Start and insert a new process.static StringStop an active process.static com.mongodb.client.result.UpdateResultUpdate a process by setting the key value pair.static voidupdatePipelineStatus(String id, Map<String, String> pipelineStatus) Update the status of a pipeline from the pipeline_status property of a process.
-
Konstruktordetails
-
DUUIProcessController
public DUUIProcessController()
-
-
Methodendetails
-
getLanguageCode
Get the language code for a given language.- Parameter:
language- The language to get the code for.- Gibt zurück:
- the language code.
-
mergeSettings
public static org.bson.Document mergeSettings(org.bson.Document settings) Given aDocumentof settings for a process, compare to the default settings by filling out missing values and checking invalid entries.- Parameter:
settings- the user defined settings for a process.- Gibt zurück:
- the settings with added missing entries.
-
findOneById
Find one process given its id.- Parameter:
id- The id of the process.- Gibt zurück:
- the process or null.
-
findMany
Retrieve one or more processes from the database given a userId andMongoDBFiltersto sort and filter the results.- Parameter:
filters- AMongoDBFiltersobject that contains filter options.- Gibt zurück:
- A Document containing a list of matched processes.
-
updateOne
Update a process by setting the key value pair.- Parameter:
id- The id of the processkey- The field namevalue- The updated value of the field- Gibt zurück:
- The result of the update.
-
deleteOne
Delete a process and all documents and events referencing this process.- Parameter:
id- The id of the process.- Gibt zurück:
- if the process has been deleted successfully.
-
start
public static org.bson.Document start(org.bson.Document pipeline, org.bson.Document settings, DUUIDocumentProvider input, DUUIDocumentProvider output) throws URISyntaxException, IOException, InsufficientWorkersException, InvalidIOException Start and insert a new process.- Parameter:
pipeline- The pipeline to execute.settings- The settings for the process. SeegetDefaultSettings()- Gibt zurück:
- if the process has been found and stopped.
- Löst aus:
URISyntaxExceptionIOExceptionInsufficientWorkersExceptionInvalidIOException
-
stop
Stop an active process.- Parameter:
id- The id of the process to stop.- Gibt zurück:
- null if the process or pipeline was not found else a confirmation message.
-
updatePipelineStatus
Update the status of a pipeline from the pipeline_status property of a process.- Parameter:
id- The process' id that holds the property.pipelineStatus- the new pipeline status.
-
removeProcess
Remove a process from the active processes map.- Parameter:
id- The process' id
-
setStatus
Update the status of a process.- Parameter:
id- The id of the process.status- The new statusDUUIStatus
-
setProgress
Set the progress of a process to a new value.- Parameter:
id- The id of the process to update.progress- The new progress value.
-
setFinishedAt
Sets the finished_at field of a process to the current time.- Parameter:
id- The id of the process.
-
setFinishedAt
Sets the finished_at field of a process to the specified time.- Parameter:
id- The id of the process.endTime- The timestamp the process has finished at.
-
setFinished
Mark a process as finished.- Parameter:
id- The id of the process.finished- A flag that indicates if the process is finished.
-
setError
Set an error for a process.- Parameter:
id- The id of the process.error- The error that occurred.
-
setDocumentPaths
-
setInstantiationDuration
Update the instantiation duration for a process.- Parameter:
id- The id of the process.instantiationDuration- The duration it took for the pipeline executed by the process to be instantiated.
-
deleteMany
public static void deleteMany(org.bson.conversions.Bson filter) Delete all processes matching a given filter. Also deletes all documents and events that reference this process.- Parameter:
filter- ABsonfilter to delete only selected processes
-
insertAnnotations
public static void insertAnnotations(String processId, Set<org.texttechnologylab.DockerUnifiedUIMAInterface.document_handler.DUUIDocument> documents) Store the annotations in the document in the database.- Parameter:
processId- The id of the process the documents are analyzed in.documents- The documents containing annotation.
-
getActiveProcesses
Get a list of all active processes- Gibt zurück:
- a list of
IDUUIProcessHandlers
-
getActiveProcesses
Get all active processes for a given pipeline.- Parameter:
pipelineId- The id of the pipeline.- Gibt zurück:
- A List of
IDUUIProcessHandlers.
-
getHandler
public static org.texttechnologylab.DockerUnifiedUIMAInterface.document_handler.IDUUIDocumentHandler getHandler(String provider, String providerId, String userId) throws com.dropbox.core.DbxException, GeneralSecurityException, IOException Constructs a IDUUIDocumentHandler given aProvideras a String.- Parameter:
provider- The type of provider to construct.userId- The id of the user that requested the handler.- Gibt zurück:
- the created DocumentHandler.
- Löst aus:
com.dropbox.core.DbxException- if incorrect credentials for Dropbox are provided.GeneralSecurityExceptionIOException
-
deleteTempOutputDirectory
A utility function that recursively deletes the content of a folder and the folder itself.- Parameter:
directory- The folder to delete.- Gibt zurück:
- if the deletion was successful.
-
downloadFile
public static InputStream downloadFile(org.texttechnologylab.DockerUnifiedUIMAInterface.document_handler.IDUUIDocumentHandler handler, String path) throws IOException Download a file from a cloud storage given the handler and path to the file.- Parameter:
handler- an instance of anIDUUIDocumentHandlerpath- the absolute path to the file in the cloud storage.- Gibt zurück:
- an
InputStreamwith the file contents. - Löst aus:
IOException- when the file is not found or an error occurs while reading.
-
getProcessSummaryForEmail
Get the summary of a process for an email.- Parameter:
processId- The id of the process.- Gibt zurück:
- an
Optionalof the summary. - Löst aus:
IOException- when the template file is not found.
-