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.Table;
13  import javax.persistence.Temporal;
14  import javax.persistence.TemporalType;
15  
16  import ch.busyboxes.agoo.model.enumeration.TaskState;
17  import ch.busyboxes.agoo.model.enumeration.TaskType;
18  
19  /**
20   * A file watched by the Agoo system
21   * 
22   * @author julien@busyboxes.ch
23   */
24  @Entity
25  @Table(name = "agoo_watcher_task")
26  public class WatcherTask {
27  	
28  	/** The id of the file */
29  	@Id
30  	@GeneratedValue
31  	private Long id;
32  	
33  	/** The task type */
34  	@Column(nullable = false)
35  	@Enumerated(EnumType.STRING)
36  	private TaskType taskType;
37  	
38  	/** The task status */
39  	@Column(nullable = false)
40  	@Enumerated(EnumType.STRING)
41  	private TaskState taskState;
42  
43  	/** The id of the target object */
44  	@Basic(optional = false)
45  	private Long targetId;
46  	
47  	/** The last modified value */
48  	@Temporal(TemporalType.TIMESTAMP)
49  	private Date created;
50  	
51  	/**
52  	 * Returns the id of the watched file
53  	 * 
54  	 * @return the id of the watched file
55  	 */
56  	public Long getId() {
57  		return id;
58  	}
59  
60  	/**
61  	 * Gets the task type
62  	 * 
63  	 * @return the taskType
64  	 */
65  	public TaskType getTaskType() {
66  		return taskType;
67  	}
68  
69  	/**
70  	 * Sets the task type
71  	 * 
72  	 * @param taskType the taskType to set
73  	 */
74  	public void setTaskType(TaskType taskType) {
75  		this.taskType = taskType;
76  	}
77  
78  	/**
79  	 * Gets the task state
80  	 * 
81  	 * @return the taskState
82  	 */
83  	public TaskState getTaskState() {
84  		return taskState;
85  	}
86  
87  	/**
88  	 * Sets the task state
89  	 * 
90  	 * @param taskState the taskState to set
91  	 */
92  	public void setTaskState(TaskState taskState) {
93  		this.taskState = taskState;
94  	}
95  
96  	/**
97  	 * Gets the target id
98  	 * 
99  	 * @return the target id
100 	 */
101 	public Long getTargetId() {
102 		return targetId;
103 	}
104 
105 	/**
106 	 * Sets the target id
107 	 * 
108 	 * @param targetId the targetId to set
109 	 */
110 	public void setTargetId(Long targetId) {
111 		this.targetId = targetId;
112 	}
113 
114 	/**
115 	 * Get the date when the task was created
116 	 * 
117 	 * @return the created
118 	 */
119 	public Date getCreated() {
120 		return created;
121 	}
122 
123 	/**
124 	 * Sets the task's creation date
125 	 * 
126 	 * @param created the created to set
127 	 */
128 	public void setCreated(Date created) {
129 		this.created = created;
130 	}
131 	
132 	/**
133 	 * String representation of the task
134 	 */
135 	public String toString() {
136 		return "WatcherTask {" + id + ", " + taskType + ", " + targetId + "}";
137 	}
138 
139 }