ImportJob.java 1.66 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
package eu.simstadt.nf;

/**
 * Import jobs are requests to store, change or delete CityGML models. Every valid import job has an id and a status.
 * 
 * @author Marcel Bruse
 */
public class ImportJob extends Job {
	
	/**
	 * Initializes a new import job instance with unknown state. This is a convenient method.
	 * 
	 * @return Returns a new import job instance with unknown state.
	 */
	public static ImportJob getUnkownInstance() {
		return new ImportJob(JobStatus.UNKOWN);
	}
	
	/**
	 * This constructor forces the job to have a defined state.
	 * 
	 * @param status
	 */
	public ImportJob(JobStatus status) {
		super(status);
	}

	/**
	 * Sets the status of this job depending on the given nF status code. nF status codes will be sent
	 * to you in http responses.
	 *  
	 * @param statusCode The nF status code for this job.
	 */
	@Override
	public void setStatusForCode(int statusCode) {
		switch (statusCode) {
		case 0:
			setStatus(JobStatus.READY_TO_RUN); break;
		case 10:
			setStatus(JobStatus.RUNNING); break;
		case 20:
			setStatus(JobStatus.ERROR); break;
		case 25:
			setStatus(JobStatus.WARNING); break;
		case 30:
			setStatus(JobStatus.FINISHED); break;
		case 40:
			setStatus(JobStatus.APPROVE); break;
		case 45:
			setStatus(JobStatus.REJECT); break;
		case 50:
			setStatus(JobStatus.APPROVE_RUNNING); break;
		case 55:
			setStatus(JobStatus.REJECT_RUNNING); break;
		case 60:
			setStatus(JobStatus.APPROVE_REJECT_ERROR); break;
		case 70:
			setStatus(JobStatus.APPROVE_REJECT_OK); break;
		case 80:
			setStatus(JobStatus.IMPORTED_WARNING); break;
		default:
			setStatus(JobStatus.UNKOWN);
		}
	}
	
}