JobDescriptorImpl.java 10.1 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
package eu.simstadt.nf;

import java.util.ArrayList;
import java.util.List;

/**
 * Every instance of this class describes an export or import job for the novaFACTORY. Instances of JobBuilder
 * take JobDescriptions and build XML export and import job files out of it.
 * 
 * @author Marcel Bruse
 */
public class JobDescriptorImpl implements JobDescriptor {
	
	private static final String DEFAULT_ACCOUNT = "Habib";

	private static final String DEFAULT_XMETA_DATA = "0";

	private static final String DEFAULT_CALIBRATION = "0";

	private static final String DEFAULT_PRODUCT = "LBTEST";

	private static final String DEFAULT_ZIP_RESULT = "0";

	private static final String DEFAULT_DHK_RESOLVE_REFERENCES = "1";

	private static final String DEFAULT_USE_PDCT_BORDER_POLY = "0";

	private static final String DEFAULT_USE_NO_DATA_MASK = "0";

	private static final String DEFAULT_ECK = "0";
	
	private static final String DEFAULT_COL = "0";

	private static final String DEFAULT_EXPORT_META_DATA = "1";

	private static final String DEFAULT_FORMAT = "CityGML";

	private static final String DEFAULT_SCALE = "10000.0";

	private static final String DEFAULT_RESOLUTION = "100.0";

	private static final String DEFAULT_MERGE_MAP_SHEETS = "off";

	private static final String DEFAULT_SRS = "31467";

	private static final String DEFAULT_SINGLE = "1";

	private static final String DEFAULT_PLOTFRAME = "0";

	private static final String DEFAULT_PLOT_LABEL_SRS = "-1";

	private static final String DEFAULT_MONO = "0";

	private static final String DEFAULT_COLOR = "0";

	private static final String DEFAULT_JOBNUMBER = "GR_EXPORT_CITYGML_LOD1";

	private static final String DEFAULT_INITIATOR = "2758";

	/** The version of the novaFACTORY XML export job format. */
	public static final String EXPORT_JOB_VERSION = "1.0.0";
	
	/** TODO: Who or what is this initiator? */
	private String initiator;
	
	/** The number of the job which can actually be a string. */
	private String jobnumber;
	
	/** The account or user for which a job should be executed. */
	private String account;
	
	/** The product for which a job should be executed. */
	private String product;
	
	/** Color attribute of the layers tag. */
	private String color;
	
	/** The mono attribute of the layers tag. */
	private String mono;
	
	/** The plotLabelSrs flag of the layers tag. */
	private String plotLabelSrs;
	
	/** The plotframe flag of the layers tag. */
	private String plotframe;
	
	/** The single flag of the layers tag. */
	private String single;
	
	/** The layers which will be involved in a job. */
	private ArrayList<Layer> layerList = new ArrayList<>();
	
	/** The SRS for the job. */
	private String srs;
	
	/** The merge_mapsheets attribute of the extend tag. */
	private String mergeMapsheets;
		
	/** The polygon of the selected region which should be exported. */
	ArrayList<Coord> regionPolygon = new ArrayList<>();
	
	/** The resolution for the job. */
	private String resolution; 
	
	/** The scale for the job. */
	private String scale;
	
	/** The format for the job. E.g. CityGML. */
	private String format;
	
	/** The exportmetadata flag for the job. */
	private String exportmetadata;
	
	/** The col attribute of the addfile tag. */
	private String col;
	
	/** The eck attribute of the addfile tag. */
	private String eck;
	
	/** The usenodatamask flag for the job. */
	private String usenodatamask;
	
	/** The usepdctborderpoly flag for the job. */
	private String usepdctborderpoly;
	
	/** The dhkresolvereferences flag for the job. */
	private String dhkresolvereferences;
	
	/** Flag for zipped results. */
	private String zipresult;
	
	/** The calibration attribute of the exportmetadata tag. */
	private String calibration;
	
	/** The xmetadata attribute of the exportmetadata tag. */
	private String xmetadata;

	public String getInitiator() {
		return initiator;
	}

	public void setInitiator(String initiator) {
		this.initiator = initiator;
	}

	public String getJobnumber() {
		return jobnumber;
	}

	public void setJobnumber(String jobnumber) {
		this.jobnumber = jobnumber;
	}

	public String getAccount() {
		return account;
	}

	public void setAccount(String account) {
		this.account = account;
	}

	public String getProduct() {
		return product;
	}

	public void setProduct(String product) {
		this.product = product;
	}

	public String getColor() {
		return color;
	}

	public void setColor(String color) {
		this.color = color;
	}

	public String getMono() {
		return mono;
	}

	public void setMono(String mono) {
		this.mono = mono;
	}

	public String getPlotLabelSrs() {
		return plotLabelSrs;
	}

	public void setPlotLabelSrs(String plotLabelSrs) {
		this.plotLabelSrs = plotLabelSrs;
	}

	public String getPlotframe() {
		return plotframe;
	}

	public void setPlotframe(String plotframe) {
		this.plotframe = plotframe;
	}

	public String getSingle() {
		return single;
	}

	public void setSingle(String single) {
		this.single = single;
	}

	public ArrayList<Layer> getLayerList() {
		return layerList;
	}

	public void setLayerList(ArrayList<Layer> layerList) {
		this.layerList = layerList;
	}
	
	public void addLayer(Layer layer) {
		layerList.add(layer);
	}

	public String getSrs() {
		return srs;
	}

	public void setSrs(String srs) {
		this.srs = srs;
	}

	public String getMergeMapsheets() {
		return mergeMapsheets;
	}

	public void setMergeMapsheets(String mergeMapsheets) {
		this.mergeMapsheets = mergeMapsheets;
	}

	public String getResolution() {
		return resolution;
	}

	public void setResolution(String resolution) {
		this.resolution = resolution;
	}

	public String getScale() {
		return scale;
	}

	public void setScale(String scale) {
		this.scale = scale;
	}

	public String getFormat() {
		return format;
	}

	public void setFormat(String format) {
		this.format = format;
	}

	public String getExportmetadata() {
		return exportmetadata;
	}

	public void setExportmetadata(String exportmetadata) {
		this.exportmetadata = exportmetadata;
	}

	public String getCol() {
		return col;
	}

	public void setCol(String col) {
		this.col = col;
	}
	
	public String getEck() {
		return eck;
	}

	public void setEck(String eck) {
		this.eck = eck;
	}

	public String getUsenodatamask() {
		return usenodatamask;
	}

	public void setUsenodatamask(String usenodatamask) {
		this.usenodatamask = usenodatamask;
	}

	public String getUsepdctborderpoly() {
		return usepdctborderpoly;
	}

	public void setUsepdctborderpoly(String usepdctborderpoly) {
		this.usepdctborderpoly = usepdctborderpoly;
	}

	public String getDhkresolvereferences() {
		return dhkresolvereferences;
	}

	public void setDhkresolvereferences(String dhkresolvereferences) {
		this.dhkresolvereferences = dhkresolvereferences;
	}

	public String getZipresult() {
		return zipresult;
	}

	public void setZipresult(String zipresult) {
		this.zipresult = zipresult;
	}

	public String getCalibration() {
		return calibration;
	}

	public void setCalibration(String calibration) {
		this.calibration = calibration;
	}

	public String getXmetadata() {
		return xmetadata;
	}

	public void setXmetadata(String xmetadata) {
		this.xmetadata = xmetadata;
	}

	@Override
	public String supportsExportJobVersion() {
		return EXPORT_JOB_VERSION;
	}

	@Override
	public String supportsImportJobVersion() {
		// TODO Auto-generated method stub
		return null;
	}
	
	/**
	 * Adds a new coordinate to the region polygon. A region polygon is only used for export jobs.
	 * 
	 * @param coordinate The new coordiante of the region polygon of a export job.
	 */
	public void addCoordinateToRegionPolygon(Coord coordinate) {
		regionPolygon.add(coordinate);
	}
	
	/**
	 * Sets the whole region polygon for an export job.
	 * 
	 * @param regionPolygon The region polygon to be used for an export job.
	 */
	public void setRegionPolygon(List<Coord> regionPolygon) {
		this.regionPolygon.clear();
		this.regionPolygon.addAll(regionPolygon);
	}
	
	/**
	 * @return Returns the region polygon.
	 */
	public ArrayList<Coord> getRegionPolygon() {
		return regionPolygon;
	}
	
	/**
	 * @return Returns true, if all mandatory elements and attributes are set. Otherwise, false.
	 */
	public boolean isValid() {
		if (regionPolygon.isEmpty()
				|| layerList.isEmpty()
				|| initiator.isEmpty()
				|| account.isEmpty()
				|| jobnumber.isEmpty()
				|| product.isEmpty() 
				|| color.isEmpty() 
				|| mono.isEmpty()
				|| plotLabelSrs.isEmpty()
				|| plotframe.isEmpty()
				|| single.isEmpty()
				|| srs.isEmpty()
				|| resolution.isEmpty()
				|| scale.isEmpty()
				|| format.isEmpty()
				|| exportmetadata.isEmpty()
				|| col.isEmpty()
				|| eck.isEmpty()){
			return false;
		} else {
			return true;
		}
	}
	
	public static JobDescriptorImpl getDefaultDescriptor() {
		JobDescriptorImpl descriptor = new JobDescriptorImpl();
		descriptor.setInitiator(DEFAULT_INITIATOR);
		descriptor.setJobnumber(DEFAULT_JOBNUMBER);
		descriptor.setAccount(DEFAULT_ACCOUNT);
		descriptor.setProduct(DEFAULT_PRODUCT);
		descriptor.setColor(DEFAULT_COLOR);
		descriptor.setMono(DEFAULT_MONO);
		descriptor.setPlotLabelSrs(DEFAULT_PLOT_LABEL_SRS);
		descriptor.setPlotframe(DEFAULT_PLOTFRAME);
		descriptor.setSingle(DEFAULT_SINGLE);
		descriptor.setSrs(DEFAULT_SRS);
		descriptor.setMergeMapsheets(DEFAULT_MERGE_MAP_SHEETS);
		descriptor.setResolution(DEFAULT_RESOLUTION);
		descriptor.setScale(DEFAULT_SCALE);
		descriptor.setFormat(DEFAULT_FORMAT);
		descriptor.setExportmetadata(DEFAULT_EXPORT_META_DATA);
		descriptor.setCol(DEFAULT_COL);
		descriptor.setEck(DEFAULT_ECK);
		descriptor.setUsenodatamask(DEFAULT_USE_NO_DATA_MASK);
		descriptor.setUsepdctborderpoly(DEFAULT_USE_PDCT_BORDER_POLY);
		descriptor.setDhkresolvereferences(DEFAULT_DHK_RESOLVE_REFERENCES);
		descriptor.setZipresult(DEFAULT_ZIP_RESULT);
		descriptor.setCalibration(DEFAULT_CALIBRATION);
		descriptor.setXmetadata(DEFAULT_XMETA_DATA);
		return descriptor;
	}
	
}