Job.java 1.58 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
package eu.simstadt.nf;

/**
 * This job class bundles the three attributes of every nF job: Id, status and last job related nF (error) message.  
 * 
 * @author Marcel Bruse
 */
public abstract class Job {
	
	/** The status of the job. There are different states for export and import jobs. */
	private JobStatus status;
	
	/** The id of the job. */
	private int jobId;
	
	/**
	 * This constructor forces the job to have a defined state.
	 * 
	 * @param status The initial status of this job.
	 */
	public Job(JobStatus status) {
		this.status = status;
	}
	
	/**
	 * Every job has it's status. Look up the different possible values in the JobStatus enumeration.
	 * 
	 * @return Returns the status of this job.
	 */
	public JobStatus getStatus() {
		return status;
	}
	
	/**
	 * Lets you set the status of this job.
	 * 
	 * @param status The status of this job.
	 */
	protected void setStatus(JobStatus status) {
		this.status = status;
	}
	
	/**
	 * @return Returns the id of this job.
	 */
	public int getJobId() {
		return jobId;
	}
	
	/**
	 * Sets the id of this job.
	 * 
	 * @param jobId The job id about to be set.
	 */
	public void setJobId(int jobId) {
		this.jobId = jobId;
	}
	
	/**
	 * Sets the status of this job depending on the given nF status code. nF status codes will be sent
	 * to you in http responses. Export jobs and import jobs have different states. Consider this fact
	 * in your implementation.
	 *  
	 * @param statusCode The nF status code for this job.
	 */
	public abstract void setStatusForCode(int statusCode);
	
}