View Javadoc

1   package ch.busyboxes.agoo.model;
2   
3   import java.util.Date;
4   
5   import javax.persistence.Basic;
6   import javax.persistence.Column;
7   import javax.persistence.Entity;
8   import javax.persistence.EnumType;
9   import javax.persistence.Enumerated;
10  import javax.persistence.GeneratedValue;
11  import javax.persistence.Id;
12  import javax.persistence.ManyToOne;
13  import javax.persistence.Table;
14  import javax.persistence.Temporal;
15  import javax.persistence.TemporalType;
16  
17  import ch.busyboxes.agoo.model.enumeration.WatchedFileState;
18  
19  /**
20   * A file watched by the Agoo system
21   * 
22   * @author julien@busyboxes.ch
23   */
24  @Entity
25  @Table(name = "agoo_watched_files")
26  public class WatchedFile {
27  
28  	/** The id of the file */
29  	@Id
30  	@GeneratedValue
31  	private Long id;
32  
33  	/** The file name of the file relative to the watched folder */
34  	@Basic(optional = false)
35  	private String filename;
36  	
37  	/** The md5 hash for this file */
38  	@Basic
39  	private String md5Hash;
40  	
41  	/** The last check value */
42  	@Temporal(TemporalType.TIMESTAMP)
43  	private Date lastCheck;
44  	
45  	/** The state of this file */
46  	@Column(nullable = false)
47  	@Enumerated(EnumType.STRING)
48  	private WatchedFileState watchedFileState;
49  	
50  	/** The folder associated with this file */
51  	@ManyToOne
52  	private WatchedFolder watchedFolder;
53  	
54  	/**
55  	 * Returns the id of the watched file
56  	 * 
57  	 * @return the id of the watched file
58  	 */
59  	public Long getId() {
60  		return id;
61  	}
62  
63  	/**
64  	 * Returns the file name relative to the folder
65  	 * 
66  	 * @return the filename
67  	 */
68  	public String getFilename() {
69  		return filename;
70  	}
71  
72  	/**
73  	 * Sets the file name for this file
74  	 * 
75  	 * @param filename the file name to set
76  	 */
77  	public void setFilename(String filename) {
78  		this.filename = filename;
79  	}
80  
81  	/**
82  	 * Returns the md5 hash for this file
83  	 * 
84  	 * @return the md5Hash for this file
85  	 */
86  	public String getMd5Hash() {
87  		return md5Hash;
88  	}
89  
90  	/**
91  	 * Sets the md5 hash for this files
92  	 * 
93  	 * @param md5Hash the md5 hash to set
94  	 */
95  	public void setMd5Hash(String md5Hash) {
96  		this.md5Hash = md5Hash;
97  	}
98  
99  	/**
100 	 * Returns the last check date for this file
101 	 * 
102 	 * @return the lastCheck the last date
103 	 */
104 	public Date getLastCheck() {
105 		return lastCheck;
106 	}
107 
108 	/**
109 	 * Sets the last check date for this file
110 	 * 
111 	 * @param lastCheck the last check date to set
112 	 */
113 	public void setLastCheck(Date lastCheck) {
114 		this.lastCheck = lastCheck;
115 	}
116 
117 	/**
118 	 * Rerurns he folder containing this file
119 	 * 
120 	 * @return the watchedFolder the associated folder
121 	 */
122 	public WatchedFolder getWatchedFolder() {
123 		return watchedFolder;
124 	}
125 
126 	/**
127 	 * Sets the associated folder to this file
128 	 * 
129 	 * @param watchedFolder the watchedFolder to set
130 	 */
131 	public void setWatchedFolder(WatchedFolder watchedFolder) {
132 		this.watchedFolder = watchedFolder;
133 	}
134 
135 	/**
136 	 * Gets the watched file state
137 	 * 
138 	 * @return the watchedFileState
139 	 */
140 	public WatchedFileState getWatchedFileState() {
141 		return watchedFileState;
142 	}
143 
144 	/**
145 	 * Sets the watched file state
146 	 * 
147 	 * @param watchedFileState the watchedFileState to set
148 	 */
149 	public void setWatchedFileState(WatchedFileState watchedFileState) {
150 		this.watchedFileState = watchedFileState;
151 	}
152 }