mirror of
https://github.com/sismics/docs.git
synced 2025-12-14 10:16:21 +00:00
File sharing (server done)
This commit is contained in:
@@ -64,6 +64,12 @@ public class FileDao {
|
||||
// Delete the file
|
||||
Date dateNow = new Date();
|
||||
fileDb.setDeleteDate(dateNow);
|
||||
|
||||
// Delete linked data
|
||||
q = em.createQuery("update FileShare fs set fs.deleteDate = :dateNow where fs.fileId = :fileId and fs.deleteDate is null");
|
||||
q.setParameter("fileId", id);
|
||||
q.setParameter("dateNow", dateNow);
|
||||
q.executeUpdate();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -46,7 +46,11 @@ public class FileShareDao {
|
||||
EntityManager em = ThreadLocalContext.get().getEntityManager();
|
||||
Query q = em.createQuery("select fs from FileShare fs where fs.id = :id and fs.deleteDate is null");
|
||||
q.setParameter("id", id);
|
||||
return (FileShare) q.getSingleResult();
|
||||
try {
|
||||
return (FileShare) q.getSingleResult();
|
||||
} catch (NoResultException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user