mirror of
https://github.com/sismics/docs.git
synced 2025-12-13 17:56:20 +00:00
Ability to upload files without document (no OCR, no Lucene)
+ New resource to attach a document to a file and OCR/Lucene it
This commit is contained in:
@@ -93,12 +93,32 @@ public class FileDao {
|
||||
q.setParameter("id", file.getId());
|
||||
File fileFromDb = (File) q.getSingleResult();
|
||||
|
||||
// Update the user
|
||||
// Update the file
|
||||
fileFromDb.setContent(file.getContent());
|
||||
|
||||
return file;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the document of a file.
|
||||
*
|
||||
* @param file File to update
|
||||
* @return Updated file
|
||||
*/
|
||||
public File updateDocument(File file) {
|
||||
EntityManager em = ThreadLocalContext.get().getEntityManager();
|
||||
|
||||
// Get the file
|
||||
Query q = em.createQuery("select f from File f where f.id = :id and f.deleteDate is null");
|
||||
q.setParameter("id", file.getId());
|
||||
File fileFromDb = (File) q.getSingleResult();
|
||||
|
||||
// Update the file
|
||||
fileFromDb.setDocumentId(file.getDocumentId());
|
||||
|
||||
return file;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a file by its ID.
|
||||
*
|
||||
|
||||
@@ -1 +1 @@
|
||||
db.version=6
|
||||
db.version=7
|
||||
Reference in New Issue
Block a user