View Javadoc

1   package net.sf.appstatus.core.batch;
2   
3   import java.io.Serializable;
4   import java.util.Date;
5   
6   /**
7    * Object representation of a batch execution's configuration.
8    *
9    * @author Idriss Neumann
10   *
11   */
12  public class BatchConfiguration implements Serializable, IBatchConfiguration {
13  	private static final long serialVersionUID = 1L;
14  
15  	private String group;
16  
17  	private Date lastExecution;
18  
19  	private final IBatchScheduleManager manager;
20  
21  	private String name;
22  
23  	private String schedule;
24  
25  	public BatchConfiguration(IBatchScheduleManager manager) {
26  		this.manager = manager;
27  	}
28  
29  	/**
30  	 * @return the group
31  	 */
32  	public String getGroup() {
33  		return group;
34  	}
35  
36  	/**
37  	 * @return the lastExecution
38  	 */
39  	public Date getLastExecution() {
40  		return lastExecution;
41  	}
42  
43  	/**
44  	 * @return the name
45  	 */
46  	public String getName() {
47  		return name;
48  	}
49  
50  	/**
51  	 * @return the nextExecution
52  	 */
53  	public Date getNextExecution() {
54  		return manager.getNextDate(schedule, new Date());
55  	}
56  
57  	/**
58  	 * @return the schedule
59  	 */
60  	public String getSchedule() {
61  		return schedule;
62  	}
63  
64  	/**
65  	 * @param group
66  	 *            the group to set
67  	 */
68  	public void setGroup(String group) {
69  		this.group = group;
70  	}
71  
72  	/**
73  	 * @param lastExecution
74  	 *            the lastExecution to set
75  	 */
76  	public void setLastExecution(Date lastExecution) {
77  		this.lastExecution = lastExecution;
78  	}
79  
80  	/**
81  	 * @param name
82  	 *            the name to set
83  	 */
84  	public void setName(String name) {
85  		this.name = name;
86  	}
87  
88  	/**
89  	 * @param schedule
90  	 *            the schedule to set
91  	 */
92  	public void setSchedule(String executionExpr) {
93  		this.schedule = executionExpr;
94  	}
95  }