View Javadoc

1   package org.appfuse.webapp.data;
2   
3   import org.apache.tapestry5.upload.services.UploadedFile;
4   
5   import java.io.File;
6   import java.io.Serializable;
7   
8   /**
9    * Wrapper class around the attributes used by the upload process
10   *
11   * @author Serge Eby
12   * @version $Id: FileData.java 5 2008-08-30 09:59:21Z serge.eby $
13   */
14  public class FileData implements Serializable {
15  
16      private UploadedFile file;
17      private String friendlyName;
18      private String path;
19      private String url;
20  
21      public UploadedFile getFile() {
22          return file;
23      }
24  
25      public void setFile(UploadedFile file) {
26          this.file = file;
27      }
28  
29      public String getFriendlyName() {
30          return friendlyName;
31      }
32  
33      public void setFriendlyName(String friendlyName) {
34          this.friendlyName = friendlyName;
35      }
36  
37      public String getPath() {
38          return path;
39      }
40  
41      public void setPath(String path) {
42          this.path = path;
43      }
44  
45      public String getUrl() {
46          return url;
47      }
48  
49      public void setUrl(String url) {
50          this.url = url;
51      }
52  
53      // Utility methods
54      public String getFileName() {
55          return file != null ? file.getFileName() : null;
56      }
57  
58      public Long getSize() {
59          return file != null ? Long.valueOf(file.getSize()) : null;
60      }
61  
62      public String getContentType() {
63          return file != null ? file.getContentType() : null;
64      }
65  
66      public void write(File another) {
67          file.write(another);
68      }
69  
70  
71  }