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übersichtKonstruktoren
- 
MethodenübersichtModifizierer 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- 
DUUIProcessControllerpublic DUUIProcessController()
 
- 
- 
Methodendetails- 
getLanguageCodeGet the language code for a given language.- Parameter:
- language- The language to get the code for.
- Gibt zurück:
- the language code.
 
- 
mergeSettingspublic 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.
 
- 
findOneByIdFind one process given its id.- Parameter:
- id- The id of the process.
- Gibt zurück:
- the process or null.
 
- 
findManyRetrieve one or more processes from the database given a userId andMongoDBFiltersto sort and filter the results.- Parameter:
- filters- A- MongoDBFiltersobject that contains filter options.
- Gibt zurück:
- A Document containing a list of matched processes.
 
- 
updateOneUpdate a process by setting the key value pair.- Parameter:
- id- The id of the process
- key- The field name
- value- The updated value of the field
- Gibt zurück:
- The result of the update.
 
- 
deleteOneDelete 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.
 
- 
startpublic 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. See- getDefaultSettings()
- Gibt zurück:
- if the process has been found and stopped.
- Löst aus:
- URISyntaxException
- IOException
- InsufficientWorkersException
- InvalidIOException
 
- 
stopStop 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.
 
- 
updatePipelineStatusUpdate 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.
 
- 
removeProcessRemove a process from the active processes map.- Parameter:
- id- The process' id
 
- 
setStatusUpdate the status of a process.- Parameter:
- id- The id of the process.
- status- The new status- DUUIStatus
 
- 
setProgressSet the progress of a process to a new value.- Parameter:
- id- The id of the process to update.
- progress- The new progress value.
 
- 
setFinishedAtSets the finished_at field of a process to the current time.- Parameter:
- id- The id of the process.
 
- 
setFinishedAtSets 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.
 
- 
setFinishedMark a process as finished.- Parameter:
- id- The id of the process.
- finished- A flag that indicates if the process is finished.
 
- 
setErrorSet an error for a process.- Parameter:
- id- The id of the process.
- error- The error that occurred.
 
- 
setDocumentPaths
- 
setInstantiationDurationUpdate 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.
 
- 
deleteManypublic 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- A- Bsonfilter to delete only selected processes
 
- 
insertAnnotationspublic 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.
 
- 
getActiveProcessesGet a list of all active processes- Gibt zurück:
- a list of IDUUIProcessHandlers
 
- 
getActiveProcessesGet all active processes for a given pipeline.- Parameter:
- pipelineId- The id of the pipeline.
- Gibt zurück:
- A List of IDUUIProcessHandlers.
 
- 
getHandlerpublic 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.
- GeneralSecurityException
- IOException
 
- 
deleteTempOutputDirectoryA 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.
 
- 
downloadFilepublic 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 an- IDUUIDocumentHandler
- path- 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.
 
- 
getProcessSummaryForEmailGet 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.
 
 
-