Beispiel #1
0
 public void createFile(Persistent p, File file, String filename) throws IOException {
   File target = createTargetFile(p.getClass(), p.getId(), filename);
   FileUtils.deleteQuietly(target);
   FileUtils.copyFile(file, target);
 }
Beispiel #2
0
 public void createFile(Persistent p, MultipartFile file, String filename) throws IOException {
   createFile(p.getClass(), p.getId(), file, filename);
 }
Beispiel #3
0
 /**
  * Get all of the files that are associated with the given Persistent instance.
  *
  * @param p <code>Persistent</code>.
  * @return <code>List</code> of <code>javax.activation.FileDataSource</code> .
  */
 public List<FileDataSource> getFiles(Persistent p) {
   return getFiles(p.getClass(), p.getId());
 }
Beispiel #4
0
 /**
  * Get a single file that is owned by a given <code>Persistent</code>.
  *
  * @param p <code>Persistent</code>.
  * @param fileName The name of the file.
  * @return <code>FileDataSource</code>.
  */
 public FileDataSource getFile(Persistent p, String fileName) {
   return getFile(p.getClass(), p.getId(), fileName);
 }
Beispiel #5
0
 public File getTargetDirectory(Persistent p, String name, boolean createIfMissing)
     throws IOException {
   return this.getTargetDirectory(p.getClass(), p.getId(), name, createIfMissing);
 }