Project

General

Profile

« Previous | Next » 

Revision 20fed6a1

Added by Alexander Oppermann about 10 years ago

redlist WS export added .json and .xml functionality

View differences:

.gitattributes
1869 1869
cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/controller/TermListController.java -text
1870 1870
cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/controller/VocabularyController.java -text
1871 1871
cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/controller/VocabularyListController.java -text
1872
cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/controller/csv/CsvDemoController.java -text
1873
cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/controller/csv/CsvExportController.java -text
1872
cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/controller/checklist/ChecklistDemoController.java -text
1873
cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/controller/checklist/CsvExportController.java -text
1874 1874
cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/controller/dto/NameCatalogueController.java -text
1875 1875
cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/controller/dto/PolytomousKeyNodeDtoController.java -text
1876 1876
cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/controller/ext/ExternalBhleController.java -text
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/csv/redlist/demo/CsvDemoExport.java
1 1
/**
2 2
* Copyright (C) 2007 EDIT
3
* European Distributed Institute of Taxonomy 
3
* European Distributed Institute of Taxonomy
4 4
* http://www.e-taxonomy.eu
5
* 
5
*
6 6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7 7
* See LICENSE.TXT at the top of this package for the full license terms.
8 8
*/
......
64 64
		super();
65 65
		this.ioName = this.getClass().getSimpleName();
66 66
	}
67
	
67

  
68 68

  
69 69
	/** Retrieves data from a CDM DB and serializes them CDM to CSV.
70
	 * Starts with root taxa and traverses the classification to retrieve 
71
	 * children taxa, synonyms, relationships, descriptive data, red list 
72
	 * status (features). 
70
	 * Starts with root taxa and traverses the classification to retrieve
71
	 * children taxa, synonyms, relationships, descriptive data, red list
72
	 * status (features).
73 73
	 * Taxa that are not part of the classification are not found.
74
	 * 
74
	 *
75 75
	 * @param exImpConfig
76 76
	 * @param dbname
77 77
	 * @param filename
......
82 82
		TransactionStatus txStatus = startTransaction(true);
83 83
		List<NamedArea> selectedAreas = config.getNamedAreas();
84 84
		Set<Classification> classificationSet = assembleClassificationSet(config);
85
		
85

  
86 86
		PrintWriter writer = null;
87 87
		ByteArrayOutputStream byteArrayOutputStream;
88 88
		try {
89
			byteArrayOutputStream = config.getByteArrayOutputStream();
90
			writer = new PrintWriter(byteArrayOutputStream); 
91
		
89
		    if(config.getByteArrayOutputStream() != null){
90
    			byteArrayOutputStream = config.getByteArrayOutputStream();
91
    			writer = new PrintWriter(byteArrayOutputStream);
92
		    }
92 93
			//geographical Filter
93 94
			List<TaxonNode> taxonNodes = handleGeographicalFilter(state, classificationSet);
94
			
95

  
95 96
			//sorting List
96 97
			sortTaxonNodes(taxonNodes);
97
			
98
			List<CsvDemoRecord> recordList = null;
99
			if(config.getRecordList() != null){
100
			    recordList = config.getRecordList();
101
			}
102

  
98 103
			for (TaxonNode node : taxonNodes){
99 104
				Taxon taxon = CdmBase.deproxy(node.getTaxon(), Taxon.class);
100 105
				CsvDemoRecord record = assembleRecord(state);
101 106
				NonViralName<?> name = CdmBase.deproxy(taxon.getName(), NonViralName.class);
102 107
				Classification classification = node.getClassification();
103
				config.setClassificationTitleCache(classification.getTitleCache());	
108
				config.setClassificationTitleCache(classification.getTitleCache());
104 109
				if (! this.recordExists(taxon)){
105 110
					handleTaxonBase(record, taxon, name, taxon, classification, null, false, false, config, node);
106
					record.write(writer);
111
					if(config.getByteArrayOutputStream() != null){
112
					    record.write(writer);
113
					}
114
					if(recordList != null){
115
					    recordList.add(record);
116
					}
117

  
107 118
					this.addExistingRecord(taxon);
108 119
				}
109 120
				//misapplied names
110 121
				handleMisapplication(taxon, writer, classification, record, config, node);
111
				writer.flush();
122
				if(writer != null){
123
				    writer.flush();
124
				}
112 125
			}
113 126
		} catch (ClassCastException e) {
114 127
			e.printStackTrace();
115 128
		}
116 129
		finally{
117
			writer.close();
118
			this.clearExistingRecordIds();
130
		    if(writer != null){
131
		        writer.close();
132
		    }
133
		    this.clearExistingRecordIds();
119 134
		}
120 135
		commitTransaction(txStatus);
121 136
		return;
122 137

  
123 138
	}
124 139

  
125
	
126
	
140

  
141

  
142

  
127 143
	//TODO: Exception handling
128 144
	/**
129
	 * 
145
	 *
130 146
	 * @param config
131 147
	 * @return
132 148
	 */
......
143 159

  
144 160
	//TODO: Exception handling
145 161
	/**
146
	 * 
162
	 *
147 163
	 * @param state
148 164
	 * @return
149 165
	 */
......
159 175
	}
160 176

  
161 177
	/**
162
	 * Takes positive List of areas and iterates over a given classification 
163
	 * and their {@link Taxon} to return all {@link Taxon} with the desired 
178
	 * Takes positive List of areas and iterates over a given classification
179
	 * and their {@link Taxon} to return all {@link Taxon} with the desired
164 180
	 * geographical attribute.
165
	 * 
181
	 *
166 182
	 * <p><p>
167 183
	 *
168 184
	 * If selectedAreas is null all {@link TaxonNode}s of the given {@link Classification} will be returned.
169
	 * 
170
	 * @param selectedAreas 
185
	 *
186
	 * @param selectedAreas
171 187
	 * @param classificationSet
172 188
	 * @return
173 189
	 */
......
223 239
//			CsvTaxRecordRedlist record = new CsvTaxRecordRedlist(metaRecord, config);
224 240
			TaxonRelationshipType relType = TaxonRelationshipType.MISAPPLIED_NAME_FOR();
225 241
			NonViralName<?> name = CdmBase.deproxy(misappliedName.getName(), NonViralName.class);
226
		
242

  
227 243
			if (! this.recordExists(misappliedName)){
228 244
				handleTaxonBase(record, misappliedName, name, taxon, classification, relType, false, false, config, node);
229 245
				record.write(writer);
230 246
				this.addExistingRecord(misappliedName);
231 247
			}
232
		}	
248
		}
233 249
	}
234 250

  
235 251
	/**
236 252
	 * handles the information record for the actual {@link Taxon} including {@link Classification classification}, Taxon Name, Taxon ID,
237
	 * Taxon Status, Synonyms, {@link Feature features} data 
253
	 * Taxon Status, Synonyms, {@link Feature features} data
238 254
	 * @param record the concrete information record
239 255
	 * @param taxonBase {@link Taxon}
240 256
	 * @param name
241 257
	 * @param acceptedTaxon
242 258
	 * @param parent
243 259
	 * @param basionym
244
	 * @param isPartial 
245
	 * @param isProParte 
246
	 * @param config 
247
	 * @param node 
260
	 * @param isPartial
261
	 * @param isProParte
262
	 * @param config
263
	 * @param node
248 264
	 * @param type
249 265
	 */
250 266
	private void handleTaxonBase(CsvDemoRecord record,TaxonBase<?> taxonBase,
251
			NonViralName<?> name, Taxon acceptedTaxon, Classification classification, 
252
			RelationshipTermBase<?> relType, boolean isProParte, boolean isPartial, 
267
			NonViralName<?> name, Taxon acceptedTaxon, Classification classification,
268
			RelationshipTermBase<?> relType, boolean isProParte, boolean isPartial,
253 269
			CsvDemoExportConfigurator config, TaxonNode node) {
254 270

  
255 271
		Taxon taxon = (Taxon) taxonBase;
256 272
		List<Feature> features = config.getFeatures();
257
		record.setHeadLinePrinted(config.isHasHeaderLines());
258
		if(config.isRedlistFeatures()){
259
			if(features != null){
260
				record.setPrintFeatures(features);
261
			}
273
		if(config.getByteArrayOutputStream() != null){
274
		    record.setHeadLinePrinted(config.isHasHeaderLines());
275
		    if(config.isRedlistFeatures()){
276
		        if(features != null){
277
		            record.setPrintFeatures(features);
278
		        }
279
		    }
280
		    config.setHasHeaderLines(false);
262 281
		}
263
		config.setHasHeaderLines(false);
264

  
265 282
		if(config.isClassification()){
266 283
			record.setDatasetName(classification.getTitleCache());
267 284
		}
268 285
		if(config.isTaxonName()){
269
			record.setScientificName(name.getNameCache());				
286
			record.setScientificName(name.getNameCache());
270 287
		}
271 288
		if(config.isTaxonNameID()){
272 289
			record.setScientificNameId(name.getUuid().toString());
......
326 343
		}
327 344
		if(config.isRedlistFeatures()){
328 345
			if(features!= null) {
329
				
346

  
330 347
				List<List<String>> featureCells = new ArrayList<List<String>>(features.size());
331 348
				for(int i = 0; i < features.size(); i++) {
332 349
					featureCells.add(new ArrayList<String>());
333 350
				}
334 351
				handleRelatedRedlistStatus(record, taxon, false, featureCells, features);
335 352
				handleRelatedRedlistStatus(record, taxon, true, featureCells, features);
336
				
353

  
337 354
			}
338 355
		}
339
		
356

  
340 357
		if(config.isExternalID()){
341 358
			Set<IdentifiableSource> sources = taxonBase.getSources();
342 359
			for(IdentifiableSource source:sources){
......
344 361
				/*
345 362
				 * TODO: handle this more generic.
346 363
				 * see ticket #4040
347
				 *  
364
				 *
348 365
				 */
349 366
				if(citation.getId() == 22){
350 367
					String idInSource = source.getIdInSource();
......
352 369
						idInSource = "";
353 370
					}
354 371
					record.setExternalID(idInSource);
355
					
372

  
356 373
				}
357 374
			}
358 375
		}
......
362 379
	 * @param record
363 380
	 * @param name
364 381
	 * @param type
365
	 * @param isPartial 
366
	 * @param isProParte 
382
	 * @param isPartial
383
	 * @param isProParte
367 384
	 */
368 385
	private void handleTaxonomicStatus(
369 386
			CsvDemoRecord record,
370
			NonViralName<?> name, 
387
			NonViralName<?> name,
371 388
			RelationshipTermBase<?> type,
372 389
			boolean isProParte,
373 390
			boolean isPartial) {
......
389 406
				logger.warn(message);
390 407
				status = "partialSynonym";
391 408
			}
392
			
409

  
393 410
			record.setTaxonomicStatus(status);
394 411
		}
395 412
	}
396 413

  
397 414
	/**
398
	 * 
415
	 *
399 416
	 * This method concatenates several synonyms in a list.
400
	 * 
417
	 *
401 418
	 * @param record
402 419
	 * @param taxon
403 420
	 */
404 421
	private void handleSynonyms(CsvDemoRecord record, Taxon taxon) {
405
		
422

  
406 423
		Set<SynonymRelationship> synRels = taxon.getSynonymRelations();
407
		ArrayList<String> synonyms = new ArrayList<String>(); 
424
		ArrayList<String> synonyms = new ArrayList<String>();
408 425
		for (SynonymRelationship synRel :synRels ){
409 426
			Synonym synonym = synRel.getSynonym();
410 427
			SynonymRelationshipType type = synRel.getType();
......
418 435
	}
419 436

  
420 437
	/**
421
	 * 
438
	 *
422 439
	 * @param record
423 440
	 * @param taxon
424 441
	 */
425 442
	private void handleDiscriptionData(CsvDemoRecord record, Taxon taxon) {
426
		
443

  
427 444
		Set<TaxonDescription> descriptions = taxon.getDescriptions();
428 445
		ArrayList<String> distributions = new ArrayList<String>();
429 446
		for (TaxonDescription description : descriptions){
......
439 456
		record.setCountryCode(distributions);
440 457
	}
441 458
	/**
442
	 * 
459
	 *
443 460
	 * @param record
444 461
	 * @param taxon
445 462
	 * @param featureCells
446
	 * @param features 
463
	 * @param features
447 464
	 */
448 465
	private void handleRedlistStatus(CsvDemoRecord record, Taxon taxon, List<List<String>> featureCells, List<Feature> features){
449 466
		Set<TaxonDescription> descriptions = taxon.getDescriptions();
......
473 490
							text = text.replaceAll(System.getProperty("line.separator"), "");
474 491
							text = text.replaceAll("                            ", " ");
475 492
							cell.add(text);
476
							
493

  
477 494
						}
478 495
					}
479 496
				}
......
483 500
	}
484 501

  
485 502
	/**
486
	 * 
503
	 *
487 504
	 * @param record
488 505
	 * @param taxon
489 506
	 * @param relationFrom
490 507
	 * @param featureCells
491
	 * @param features 
508
	 * @param features
492 509
	 */
493 510
	private void handleRelatedRedlistStatus(CsvDemoRecord record, Taxon taxon, boolean relationFrom, List<List<String>> featureCells, List<Feature> features) {
494 511

  
495
		if (relationFrom)handleRedlistStatus(record, taxon, featureCells, features);
496
		
497
		
512
		if (relationFrom) {
513
            handleRedlistStatus(record, taxon, featureCells, features);
514
        }
515

  
516

  
498 517
		Set<TaxonRelationship> taxRels;
499 518
		if(relationFrom){
500 519
			taxRels = taxon.getRelationsFromThisTaxon();
......
513 532
			}
514 533
		}
515 534
	}
516
	
535

  
517 536

  
518 537

  
519 538
	/**
520
	 * 
539
	 *
521 540
	 * @param taxonNodes
522 541
	 */
523 542
	private void sortTaxonNodes(List<TaxonNode> taxonNodes) {
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/csv/redlist/demo/CsvDemoExportConfigurator.java
1 1
/**
2 2
 * Copyright (C) 2007 EDIT
3
 * European Distributed Institute of Taxonomy 
3
 * European Distributed Institute of Taxonomy
4 4
 * http://www.e-taxonomy.eu
5
 * 
5
 *
6 6
 * The contents of this file are subject to the Mozilla Public License Version 1.1
7 7
 * See LICENSE.TXT at the top of this package for the full license terms.
8 8
 */
......
48 48
	private String defaultBibliographicCitation = null;
49 49
	private List<UUID> featureExclusions = new ArrayList<UUID>();
50 50
	//filter on the classifications to be exported
51
	private Set<UUID> classificationUuids = new HashSet<UUID>();   
51
	private Set<UUID> classificationUuids = new HashSet<UUID>();
52 52
	private boolean withHigherClassification = false;
53 53
	private String setSeparator = ";";
54 54

  
55 55
	private boolean doGeographicalFilter = true;
56 56
	private boolean doDemoExport = false;
57 57
	private boolean doTaxonConceptExport = false;
58
	
58

  
59 59
	//attributes for export
60 60
	private boolean classification;
61 61
	private boolean taxonName;
......
71 71
	private boolean parentID;
72 72
	private boolean externalID;
73 73
	private boolean lastChange;
74
	
74

  
75
	private List<CsvDemoRecord> recordList;
76

  
75 77

  
76 78

  
77
	
78
	private List<Feature> features;
79

  
80
    private List<Feature> features;
79 81
	private String classificationTitleCache;
80 82
	private List<NamedArea> areas;
81 83

  
82 84
	//TODO
83 85
	private static IExportTransformer defaultTransformer = null;
84 86

  
85
	public static CsvDemoExportConfigurator NewInstance(ICdmDataSource source, File destinationFolder) { 
87
	public static CsvDemoExportConfigurator NewInstance(ICdmDataSource source, File destinationFolder) {
86 88
		return new CsvDemoExportConfigurator(source, destinationFolder);
87 89
	}
88 90

  
......
94 96
		};
95 97
	}
96 98

  
97
	
99

  
98 100
	/**
99
	 * This is function is only to have a shortcut for 
101
	 * This is function is only to have a shortcut for
100 102
	 * a preselection for available fields. One can still
101 103
	 * select fields manually.
102 104
	 * <p><p>
103 105
	 * Only one of the parameter should be true, otherwise you
104
	 * all fields are set to true and will be exported. 
106
	 * all fields are set to true and will be exported.
105 107
	 * <p><p>
106
	 * In future this function might be removed. 
107
	 * 
108
	 * 
108
	 * In future this function might be removed.
109
	 *
110
	 *
109 111
	 * @param doDemoExport
110 112
	 * @param doTaxonConceptExport
111 113
	 */
......
130 132
			setLastChange(true);
131 133
		}
132 134
	}
133
	
134
	
135
	
135

  
136

  
137

  
136 138
	/**
137 139
	 * @param url
138 140
	 * @param destination
......
172 174
	/* (non-Javadoc)
173 175
	 * @see eu.etaxonomy.cdm.io.common.IExportConfigurator#getNewState()
174 176
	 */
175
	public CsvDemoExportState getNewState() {
177
	@Override
178
    public CsvDemoExportState getNewState() {
176 179
		return new CsvDemoExportState(this);
177 180
	}
178 181

  
......
271 274
	}
272 275

  
273 276
	/**
274
	 * The default value for the taxon.source column. This may be a column linking to a url that provides 
275
	 * data about the given taxon. The id is replaced by a placeholder, 
277
	 * The default value for the taxon.source column. This may be a column linking to a url that provides
278
	 * data about the given taxon. The id is replaced by a placeholder,
276 279
	 * e.g. http://wp6-cichorieae.e-taxonomy.eu/portal/?q=cdm_dataportal/taxon/{id}.
277 280
	 * NOTE: This may be replaced in future versions by concrete CDM server implementations.
278
	 * 
281
	 *
279 282
	 * @return the taxonSourceDefault
280 283
	 */
281 284

  
......
327 330

  
328 331
	public void setFeatures(List<Feature> features) {
329 332
		this.features = features;
330
		
333

  
331 334
	}
332
	
335

  
333 336
	public List<Feature>  getFeatures() {
334 337
		return features;
335
		
338

  
336 339
	}
337 340

  
338 341
	public void setClassificationTitleCache(String classificationTitleCache) {
339 342
		this.classificationTitleCache = classificationTitleCache;
340 343
	}
341
	
344

  
342 345
	public String getClassificationTitleCache() {
343 346
		return classificationTitleCache;
344 347
	}
......
349 352
	public void setNamedAreas(List<NamedArea> areas) {
350 353
		// TODO Auto-generated method stub
351 354
		this.areas = areas;
352
		
355

  
353 356
	}
354 357
	public List<NamedArea> getNamedAreas(){
355 358
		return areas;
356 359
	}
357
	
360

  
358 361
	public boolean isDoGeographicalFilter() {
359 362
		return doGeographicalFilter;
360 363
	}
......
370 373
	public void setDoDemoExport(boolean doDemoHeadlines) {
371 374
		this.doDemoExport = doDemoHeadlines;
372 375
	}
373
	
376

  
374 377

  
375 378
	public boolean isDoTaxonConceptExport() {
376 379
		return doTaxonConceptExport;
......
379 382
	public void setDoTaxonConceptExport(boolean doTaxonConceptExport) {
380 383
		this.doTaxonConceptExport = doTaxonConceptExport;
381 384
	}
382
	
385

  
383 386
	public boolean isAuthor() {
384 387
		return author;
385 388
	}
......
490 493
	public void setExternalID(boolean externalID) {
491 494
		this.externalID = externalID;
492 495
	}
496
    public List<CsvDemoRecord> getRecordList() {
497
        return recordList;
498
    }
499
    public void setRecordList(List<CsvDemoRecord> recordList) {
500
        this.recordList = recordList;
501
    }
493 502
}
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/csv/redlist/demo/CsvDemoRecord.java
1 1
// $Id$
2 2
/**
3 3
 * Copyright (C) 2009 EDIT
4
 * European Distributed Institute of Taxonomy 
4
 * European Distributed Institute of Taxonomy
5 5
 * http://www.e-taxonomy.eu
6
 * 
6
 *
7 7
 * The contents of this file are subject to the Mozilla Public License Version 1.1
8 8
 * See LICENSE.TXT at the top of this package for the full license terms.
9 9
 */
......
15 15
import java.util.List;
16 16

  
17 17
import org.apache.log4j.Logger;
18
import org.codehaus.jackson.annotate.JsonIgnore;
18 19

  
19 20
import eu.etaxonomy.cdm.io.dwca.TermUri;
20 21
import eu.etaxonomy.cdm.model.description.Feature;
......
27 28
 */
28 29
public class CsvDemoRecord extends CsvDemoRecordBase{
29 30

  
30
	@SuppressWarnings("unused")
31
	private static final Logger logger = Logger.getLogger(CsvDemoRecord.class);
32

  
33
	private String scientificNameId;
34
	private String scientificName;
35
	private String taxonomicStatus;
36
	private CsvDemoId datasetId;
37
	private String taxonConceptID;
38
	private String datasetName;
39
	private ArrayList<String> synonyms;
40
	private String threadStatus;
41
	private ArrayList<String> countryCodes;
42
	private ArrayList<String> headlines;
43
	private boolean isHeadLinePrinted;
44
	private List<Feature> features;
45
	private List<List<String>> featuresCells;
46
	private CsvDemoExportConfigurator config;
47

  
48
	private String authorshipCache;
49

  
50
	private String rank;
51

  
52
	private String parentUuid;
53

  
54
	private String lastUpdated;
55

  
56
	private String externalID;
57

  
58
	/**
59
	 * 
60
	 * @param metaDataRecord
61
	 * @param config
62
	 */
63
	public CsvDemoRecord(CsvDemoMetaDataRecord metaDataRecord, CsvDemoExportConfigurator config){
64
		super(metaDataRecord, config);
65
		this.config = config;
66
		datasetId = new CsvDemoId(config);
67
	}
68

  
69
	/* (non-Javadoc)
70
	 * @see eu.etaxonomy.cdm.io.dwca.out.DwcaRecordBase#registerKnownFields()
71
	 */
72
	protected void registerKnownFields(){
73
		try {
74
			addKnownField(TermUri.DWC_SCIENTIFIC_NAME);
75
			addKnownField(TermUri.DWC_TAXONOMIC_STATUS);
76
			addKnownField(TermUri.DWC_DATASET_NAME);
77
			addKnownField("countryCode", "http://rs.tdwg.org/dwc/terms/countryCode");
78
		} catch (URISyntaxException e) {
79
			throw new RuntimeException(e);
80
		}
81
	}
82

  
83
	public void write(PrintWriter writer) {
84
		if(isHeadLinePrinted()){
85
			printHeadline(writer, setHeadlines(), TermUri.DWC_DATASET_NAME);
86
			isHeadLinePrinted=false;
87
		}
88
		if(config.isClassification()){
89
			print(datasetName, writer, IS_FIRST, TermUri.DWC_DATASET_NAME);
90
		}
91
		if(config.isDoTaxonConceptExport()){
92
			if(config.isTaxonName()){
93
				print(scientificName, writer, IS_FIRST, TermUri.DWC_SCIENTIFIC_NAME);
94
			}
95
		}else{
96
			if(config.isTaxonName()){
97
				print(scientificName, writer, IS_NOT_FIRST, TermUri.DWC_SCIENTIFIC_NAME);
98
			}
99
		}
100
		if(config.isTaxonNameID()){
101
			print(scientificNameId, writer, IS_NOT_FIRST, TermUri.DWC_DATASET_ID);
102
		}
103
		if(config.isAuthor()){
104
			print(authorshipCache, writer, IS_NOT_FIRST, TermUri.DC_CREATOR);
105
		}
106
		if(config.isRank()){
107
			print(rank, writer, IS_NOT_FIRST, TermUri.DWC_TAXON_RANK);
108
		}
109
		if(config.isTaxonConceptID()){
110
			print(taxonConceptID, writer, IS_NOT_FIRST, TermUri.DWC_TAXON_CONCEPT_ID);
111
		}
112
		if(config.isTaxonStatus()){
113
			print(taxonomicStatus, writer, IS_NOT_FIRST, TermUri.DWC_TAXONOMIC_STATUS);
114
		}
115
		if(config.isAcceptedName()){
116
			//TODO print accepted Name
117
		}
118
		if(config.isParentID()){
119
			print(parentUuid, writer, IS_NOT_FIRST, TermUri.DWC_PARENT_NAME_USAGE_ID);
120
		}
121
		if(config.isSynonyms()){
122
			print(synonyms, TermUri.DWC_SCIENTIFIC_NAME, writer);
123
		}
124
		if(config.isDistributions()){
125
			print(countryCodes, TermUri.DWC_COUNTRY_CODE, writer);
126
		}
127
		if(config.isRedlistFeatures()){
128
			if(features != null ||featuresCells != null || !featuresCells.isEmpty()){
129
				for(List<String> featureList : featuresCells) {
130
					print((ArrayList<String>)featureList, TermUri.DWC_LIFESTAGE, writer);
131
				}
132
			}
133
		}
134
		if(config.isExternalID()){
135
			print(externalID, writer, IS_NOT_FIRST,TermUri.DWC_ORIGINAL_NAME_USAGE_ID);
136
		}
137
		if(config.isLastChange()){
138
			print(lastUpdated, writer, IS_NOT_FIRST,TermUri.DC_MODIFIED);
139
		}
140
		writer.println();
141
	}
142

  
143
	
144
	//--------------Getter-Setter-Methods------------------//
145

  
146
	public String getDatasetName() {
147
		return datasetName;
148
	}
149
	public void setDatasetName(String datasetName) {
150
		this.datasetName = datasetName;
151
	}
152
	public String getScientificName() {
153
		return scientificName;
154
	}
155
	public void setScientificName(String scientificName) {
156
		this.scientificName = scientificName;
157
	}
158
	public String getTaxonomicStatus() {
159
		return taxonomicStatus;
160
	}
161
	public void setTaxonomicStatus(String taxonomicStatus) {
162
		this.taxonomicStatus = taxonomicStatus;
163
	}
164
	public String getDatasetId() {
165
		return datasetId.getId();
166
	}
167
	public void setDatasetId(Classification classification) {
168
		this.datasetId.setId(classification);
169
	}
170
	public void setSynonyms(ArrayList<String> synonyms){
171
		this.synonyms = synonyms;
172
	}
173
	public ArrayList<String> getSynonyms(){
174
		return synonyms;
175
	}
176
	public String getThreadStatus() {
177
		return threadStatus;
178
	}
179
	public void setThreadStatus(String threadStatus) {
180
		this.threadStatus = threadStatus;
181
	}
182

  
183
	public void setCountryCode(ArrayList<String> countryCodes) {
184
		this.countryCodes = countryCodes;
185
	}
186

  
187
	//FIXME: hard coded header lines
188
	private ArrayList<String> setHeadlines(){
189
//		if(config.isDoDemoExport()){
190
			headlines = new ArrayList<String>(); 
191
			
192
			if(config.isClassification()){
193
				headlines.add("Classification");
194
			}
195
			if(config.isTaxonName()){
196
				headlines.add("Wissenschaftlicher Name");
197
			}
198
			if(config.isTaxonNameID()){
199
				headlines.add("Taxon ID");
200
			}
201
			if(config.isAuthor()){
202
				headlines.add("Autor");
203
			}
204
			if(config.isRank()){
205
				headlines.add("Rang");
206
			}
207
			if(config.isTaxonStatus()){
208
				headlines.add("Taxon Status");
209
			}
210
			if(config.isAcceptedName()){
211
				headlines.add("Akzeptierter Name");
212
			}
213
			if(config.isTaxonConceptID()){
214
				headlines.add("Taxon Konzept ID");
215
			}
216
			if(config.isParentID()){
217
				headlines.add("Parent ID");
218
			}
219
			if(config.isSynonyms()){
220
				headlines.add("Synonym");
221
			}
222
			if(config.isDistributions()){
223
				headlines.add("Distribution");
224
			}
225
			if(features != null){
226
				if(!features.isEmpty()){
227
					for(Feature f : features) {
228
						headlines.add(f.getLabel());
229
					}
230
				}
231
			}
232
			if(config.isExternalID()){
233
				headlines.add("External ID");
234
			}
235
			if(config.isLastChange()){
236
				headlines.add("Letztes Update");
237
			}
238
//		}else if(config.isDoTaxonConceptExport()){
239
//			headlines = new ArrayList<String>(); 
240
//			Collections.addAll(headlines, "Taxon Name UUID","Taxon Name","Author","Rank","Taxon Status","Accepted Name", "Taxon Concept ID", "Parent ID", "Last Change");
241
//		}
242
		return headlines;
243
	}
244

  
245
	public boolean isHeadLinePrinted() {
246
		return isHeadLinePrinted;
247
	}
248

  
249
	public void setHeadLinePrinted(boolean isHeadLinePrinted) {
250
		this.isHeadLinePrinted = isHeadLinePrinted;
251
	}
252

  
253
	public void setScientificNameId(String scientificNameId) {
254
		this.scientificNameId = scientificNameId;
255
	}
256

  
257
	public void setPrintFeatures(List<Feature> features) {
258
		this.features = features;
259
		
260
	}
261

  
262
	public void setFeatures(List<List<String>> featureCells) {
263
		this.featuresCells = featureCells;
264
		
265
	}
266

  
267
	public void setAuthorName(String authorshipCache) {
268
		this.authorshipCache = authorshipCache;
269
		
270
	}
271

  
272
	public void setRank(String rank) {
273
		this.rank = rank;
274
	}
275

  
276
	public void setParentUUID(String parentUuid) {
277
		this.parentUuid = parentUuid;
278
		
279
	}
280

  
281
	public void setLastChange(String lastUpdated) {
282
		this.lastUpdated = lastUpdated;
283
	}
284

  
285
	public void setTaxonConceptID(String taxonConceptID) {
286
		this.taxonConceptID = taxonConceptID;
287
	}
288

  
289
	public void setExternalID(String externalID) {
290
		this.externalID = externalID;
291
	}
31
    @SuppressWarnings("unused")
32
    private static final Logger logger = Logger.getLogger(CsvDemoRecord.class);
33

  
34
    private String scientificNameId;
35
    private String scientificName;
36
    private String taxonomicStatus;
37
    private final CsvDemoId datasetId;
38
    private String taxonConceptID;
39
    private String datasetName;
40
    private ArrayList<String> synonyms;
41
    private String threadStatus;
42
    private ArrayList<String> countryCodes;
43
    private ArrayList<String> headlines;
44
    private Boolean isHeadLinePrinted;
45
    private List<Feature> features;
46
    private List<List<String>> featuresCells;
47
    private final CsvDemoExportConfigurator config;
48
    private String authorshipCache;
49
    private String rank;
50
    private String parentUuid;
51
    private String lastUpdated;
52
    private String externalID;
53

  
54
    /**
55
     *
56
     * @param metaDataRecord
57
     * @param config
58
     */
59
    public CsvDemoRecord(CsvDemoMetaDataRecord metaDataRecord, CsvDemoExportConfigurator config){
60
        super(metaDataRecord, config);
61
        this.config = config;
62
        datasetId = new CsvDemoId(config);
63
    }
64

  
65
    /* (non-Javadoc)
66
     * @see eu.etaxonomy.cdm.io.dwca.out.DwcaRecordBase#registerKnownFields()
67
     */
68
    @Override
69
    protected void registerKnownFields(){
70
        try {
71
            addKnownField(TermUri.DWC_SCIENTIFIC_NAME);
72
            addKnownField(TermUri.DWC_TAXONOMIC_STATUS);
73
            addKnownField(TermUri.DWC_DATASET_NAME);
74
            addKnownField("countryCode", "http://rs.tdwg.org/dwc/terms/countryCode");
75
        } catch (URISyntaxException e) {
76
            throw new RuntimeException(e);
77
        }
78
    }
79

  
80
    @Override
81
    public void write(PrintWriter writer) {
82
        if(isHeadLinePrinted() != null && isHeadLinePrinted() == true){
83
            printHeadline(writer, setHeadlines(), TermUri.DWC_DATASET_NAME);
84
            isHeadLinePrinted=false;
85
        }
86
        if(config.isClassification()){
87
            print(datasetName, writer, IS_FIRST, TermUri.DWC_DATASET_NAME);
88
        }
89
        if(config.isDoTaxonConceptExport()){
90
            if(config.isTaxonName()){
91
                print(scientificName, writer, IS_FIRST, TermUri.DWC_SCIENTIFIC_NAME);
92
            }
93
        }else{
94
            if(config.isTaxonName()){
95
                print(scientificName, writer, IS_NOT_FIRST, TermUri.DWC_SCIENTIFIC_NAME);
96
            }
97
        }
98
        if(config.isTaxonNameID()){
99
            print(scientificNameId, writer, IS_NOT_FIRST, TermUri.DWC_DATASET_ID);
100
        }
101
        if(config.isAuthor()){
102
            print(authorshipCache, writer, IS_NOT_FIRST, TermUri.DC_CREATOR);
103
        }
104
        if(config.isRank()){
105
            print(rank, writer, IS_NOT_FIRST, TermUri.DWC_TAXON_RANK);
106
        }
107
        if(config.isTaxonConceptID()){
108
            print(taxonConceptID, writer, IS_NOT_FIRST, TermUri.DWC_TAXON_CONCEPT_ID);
109
        }
110
        if(config.isTaxonStatus()){
111
            print(taxonomicStatus, writer, IS_NOT_FIRST, TermUri.DWC_TAXONOMIC_STATUS);
112
        }
113
        if(config.isAcceptedName()){
114
            //TODO print accepted Name
115
        }
116
        if(config.isParentID()){
117
            print(parentUuid, writer, IS_NOT_FIRST, TermUri.DWC_PARENT_NAME_USAGE_ID);
118
        }
119
        if(config.isSynonyms()){
120
            print(synonyms, TermUri.DWC_SCIENTIFIC_NAME, writer);
121
        }
122
        if(config.isDistributions()){
123
            print(countryCodes, TermUri.DWC_COUNTRY_CODE, writer);
124
        }
125
        if(config.isRedlistFeatures()){
126
            if(features != null ||featuresCells != null || !featuresCells.isEmpty()){
127
                for(List<String> featureList : featuresCells) {
128
                    print((ArrayList<String>)featureList, TermUri.DWC_LIFESTAGE, writer);
129
                }
130
            }
131
        }
132
        if(config.isExternalID()){
133
            print(externalID, writer, IS_NOT_FIRST,TermUri.DWC_ORIGINAL_NAME_USAGE_ID);
134
        }
135
        if(config.isLastChange()){
136
            print(lastUpdated, writer, IS_NOT_FIRST,TermUri.DC_MODIFIED);
137
        }
138
        writer.println();
139
    }
140

  
141

  
142
    //--------------Getter-Setter-Methods------------------//
143

  
144
/*    public String getDatasetName() {
145
        return datasetName;
146
    }*/
147
    public void setDatasetName(String datasetName) {
148
        this.datasetName = datasetName;
149
    }
150
    public String getScientificName() {
151
        return scientificName;
152
    }
153
    public void setScientificName(String scientificName) {
154
        this.scientificName = scientificName;
155
    }
156
/*    public String getTaxonomicStatus() {
157
        return taxonomicStatus;
158
    }*/
159
    public void setTaxonomicStatus(String taxonomicStatus) {
160
        this.taxonomicStatus = taxonomicStatus;
161
    }
162
/*    public String getDatasetId() {
163
        return datasetId.getId();
164
    }*/
165
    public void setDatasetId(Classification classification) {
166
        this.datasetId.setId(classification);
167
    }
168
    public void setSynonyms(ArrayList<String> synonyms){
169
        this.synonyms = synonyms;
170
    }
171
/*    public ArrayList<String> getSynonyms(){
172
        return synonyms;
173
    }*/
174
/*    public String getThreadStatus() {
175
        return threadStatus;
176
    }*/
177
    public void setThreadStatus(String threadStatus) {
178
        this.threadStatus = threadStatus;
179
    }
180

  
181
    public void setCountryCode(ArrayList<String> countryCodes) {
182
        this.countryCodes = countryCodes;
183
    }
184

  
185
    //FIXME: hard coded header lines
186
    private ArrayList<String> setHeadlines(){
187
//      if(config.isDoDemoExport()){
188
            headlines = new ArrayList<String>();
189

  
190
            if(config.isClassification()){
191
                headlines.add("Classification");
192
            }
193
            if(config.isTaxonName()){
194
                headlines.add("Wissenschaftlicher Name");
195
            }
196
            if(config.isTaxonNameID()){
197
                headlines.add("Taxon ID");
198
            }
199
            if(config.isAuthor()){
200
                headlines.add("Autor");
201
            }
202
            if(config.isRank()){
203
                headlines.add("Rang");
204
            }
205
            if(config.isTaxonStatus()){
206
                headlines.add("Taxon Status");
207
            }
208
            if(config.isAcceptedName()){
209
                headlines.add("Akzeptierter Name");
210
            }
211
            if(config.isTaxonConceptID()){
212
                headlines.add("Taxon Konzept ID");
213
            }
214
            if(config.isParentID()){
215
                headlines.add("Parent ID");
216
            }
217
            if(config.isSynonyms()){
218
                headlines.add("Synonym");
219
            }
220
            if(config.isDistributions()){
221
                headlines.add("Distribution");
222
            }
223
            if(features != null){
224
                if(!features.isEmpty()){
225
                    for(Feature f : features) {
226
                        headlines.add(f.getLabel());
227
                    }
228
                }
229
            }
230
            if(config.isExternalID()){
231
                headlines.add("External ID");
232
            }
233
            if(config.isLastChange()){
234
                headlines.add("Letztes Update");
235
            }
236
//      }else if(config.isDoTaxonConceptExport()){
237
//          headlines = new ArrayList<String>();
238
//          Collections.addAll(headlines, "Taxon Name UUID","Taxon Name","Author","Rank","Taxon Status","Accepted Name", "Taxon Concept ID", "Parent ID", "Last Change");
239
//      }
240
        return headlines;
241
    }
242
    @JsonIgnore
243
    public Boolean isHeadLinePrinted() {
244
        return isHeadLinePrinted;
245
    }
246

  
247
    public void setHeadLinePrinted(Boolean isHeadLinePrinted) {
248
        this.isHeadLinePrinted = isHeadLinePrinted;
249
    }
250

  
251
    public void setScientificNameId(String scientificNameId) {
252
        this.scientificNameId = scientificNameId;
253
    }
254

  
255
    public void setPrintFeatures(List<Feature> features) {
256
        this.features = features;
257

  
258
    }
259

  
260
    public void setFeatures(List<List<String>> featureCells) {
261
        this.featuresCells = featureCells;
262

  
263
    }
264

  
265
    public void setAuthorName(String authorshipCache) {
266
        this.authorshipCache = authorshipCache;
267
    }
268

  
269
    public void setRank(String rank) {
270
        this.rank = rank;
271
    }
272

  
273
    public void setParentUUID(String parentUuid) {
274
        this.parentUuid = parentUuid;
275

  
276
    }
277

  
278
    public void setLastChange(String lastUpdated) {
279
        this.lastUpdated = lastUpdated;
280
    }
281

  
282
    public void setTaxonConceptID(String taxonConceptID) {
283
        this.taxonConceptID = taxonConceptID;
284
    }
285

  
286
    public void setExternalID(String externalID) {
287
        this.externalID = externalID;
288
    }
289
       /**
290
     * @return the scientificNameId
291
     */
292
/*    public String getScientificNameId() {
293
        return scientificNameId;
294
    }*/
295

  
296
    /**
297
     * @return the taxonConceptID
298
     */
299
    public String getTaxonConceptID() {
300
        return taxonConceptID;
301
    }
302
/*
303
    public ArrayList<String> getCountryCodes() {
304
        return countryCodes;
305
    }
306
*/
307
    /**
308
     * @return the authorshipCache
309
     */
310
    public String getAuthor() {
311
        return authorshipCache;
312
    }
313

  
314
    /**
315
     * @return the rank
316
     */
317
    public String getRank() {
318
        return rank;
319
    }
320

  
321
    /**
322
     * @return the parentUuid
323
     */
324
    public String getParentUuid() {
325
        return parentUuid;
326
    }
327

  
328
    /**
329
     * @return the lastUpdated
330
     */
331
    public String getLastUpdated() {
332
        return lastUpdated;
333
    }
334

  
335
    /**
336
     * @return the externalID
337
     */
338
    public String getExternalID() {
339
        return externalID;
340
    }
341

  
292 342
}
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/csv/redlist/demo/CsvDemoRecordBase.java
1 1
// $Id$
2 2
/**
3 3
* Copyright (C) 2009 EDIT
4
* European Distributed Institute of Taxonomy 
4
* European Distributed Institute of Taxonomy
5 5
* http://www.e-taxonomy.eu
6
* 
6
*
7 7
* The contents of this file are subject to the Mozilla Public License Version 1.1
8 8
* See LICENSE.TXT at the top of this package for the full license terms.
9 9
*/
......
59 59
	protected static final boolean IS_FIRST = false;
60 60
	protected static final boolean IS_NOT_FIRST = true;
61 61
//	protected static final String SEP = ",";
62
	
62

  
63 63
	protected Map<String, URI> knownFields = new HashMap<String, URI>();
64 64
	protected Set<TermUri> knownTermFields = new HashSet<TermUri>();
65
	
65

  
66 66
	public abstract void write(PrintWriter writer);
67 67
	protected abstract void registerKnownFields();
68
	
68

  
69 69
	protected int count;
70
	private CsvDemoMetaDataRecord metaDataRecord;
70
	private final CsvDemoMetaDataRecord metaDataRecord;
71 71
	protected CsvDemoExportConfigurator config;
72 72

  
73 73
	private Integer id;
74 74
	private UUID uuid;
75 75

  
76
	
76

  
77 77
	protected CsvDemoRecordBase(CsvDemoMetaDataRecord metaDataRecord, CsvDemoExportConfigurator config){
78 78
		this.metaDataRecord = metaDataRecord;
79 79
		this.count = metaDataRecord.inc();
80 80
		this.config = config;
81 81
	}
82
	
83
	
82

  
83

  
84 84
	public void setId(Integer id) {
85 85
		this.id = id;
86 86
	}
......
93 93
		this.uuid = uuid;
94 94
	}
95 95

  
96
	public UUID getUuid() {
96
/*	public UUID getUuid() {
97 97
		return uuid;
98
	}
98
	}*/
99 99

  
100 100
	protected void printNotes(Set<Annotation> notes, PrintWriter writer, boolean addSeparator, TermUri fieldKey) {
101 101
		printNotes(notes, writer, addSeparator, fieldKey.getUriString());
......
105 105
		String value = null;
106 106
		print(value, writer, addSeparator, fieldKey);
107 107
	}
108
	
108

  
109 109
//	protected void print(Object object, PrintWriter writer, boolean addSeparator, TermUri fieldKey) {
110 110
//		print(object == null ? null : object.toString(), writer, addSeparator, fieldKey);
111 111
//	}
......
122 122
		print(agent == null ? null : getAgent(agent), writer, addSeparator, fieldKey);
123 123
	}
124 124

  
125
	
125

  
126 126
	protected void print(Language language, PrintWriter writer, boolean addSeparator, TermUri fieldKey) {
127 127
		print(language, writer, addSeparator, fieldKey.getUriString());
128 128
	}
......
135 135
	protected void print(LSID lsid, PrintWriter writer, boolean addSeparator, String fieldKey) {
136 136
		print(lsid == null ? null : String.valueOf(lsid.toString()), writer, addSeparator, fieldKey);
137 137
	}
138
	
138

  
139 139
	protected void print(Set<Rights> rights, PrintWriter writer, boolean addSeparator, TermUri fieldKey) {
140 140
		print(rights, writer, addSeparator, fieldKey.getUriString());
141 141
	}
......
149 149
	protected void print(URI uri, PrintWriter writer, boolean addSeparator, String fieldKey) {
150 150
		print(uri == null ? null : String.valueOf(uri), writer, addSeparator, fieldKey);
151 151
	}
152
	
152

  
153 153
	protected void print(Point point, PrintWriter writer, boolean addSeparator, TermUri latitudeKey, TermUri longitudeKey) {
154 154
		print(point, writer, addSeparator, latitudeKey.getUriString(), longitudeKey.getUriString());
155 155
	}
156
	
156

  
157 157
	protected void print(Point point, PrintWriter writer, boolean addSeparator, String latitudeKey, String longitudeKey) {
158 158
		if (point == null){
159 159
			String toPrint = null;
......
168 168
	}
169 169
	protected void print(Boolean boolValue, PrintWriter writer, boolean addSeparator, TermUri fieldKey) {
170 170
		print(boolValue, writer, addSeparator, fieldKey.getUriString());
171
	}	
171
	}
172 172
	protected void print(Boolean boolValue, PrintWriter writer, boolean addSeparator, String fieldKey) {
173 173
		print(boolValue == null ? null : String.valueOf(boolValue), writer, addSeparator, fieldKey);
174 174
	}
......
179 179
	protected void print(Integer intValue, PrintWriter writer, boolean addSeparator, String fieldKey) {
180 180
		print(intValue == null ? null : String.valueOf(intValue), writer, addSeparator, fieldKey);
181 181
	}
182
	
182

  
183 183
	protected void printId(Integer intValue, PrintWriter writer, boolean addSeparator, String fieldKey) {
184 184
		print(intValue == null ? null : String.valueOf(intValue), writer, addSeparator, fieldKey);
185 185
	}
......
194 194
	protected void print(String value, PrintWriter writer, boolean addSeparator, TermUri fieldKey, String defaultValue) {
195 195
		print(value, writer, addSeparator, fieldKey.getUriString(), defaultValue);
196 196
	}
197
	
197

  
198 198
	protected void print(String value, PrintWriter writer, boolean addSeparator, String fieldKey) {
199 199
		print(value, writer, addSeparator, fieldKey, null);
200 200
	}
201
	
201

  
202 202
	protected void print(String value, PrintWriter writer, boolean addSeparator, String fieldKey, String defaultValue) {
203 203
		if (count == 1 && addSeparator == IS_NOT_FIRST){
204 204
			registerFieldKey(URI.create(fieldKey), defaultValue);
......
208 208
			if (StringUtils.isNotBlank(value)){
209 209
				//Replace quotes by double quotes
210 210
				value = value.replace("\"", "\"\"");
211
				
211

  
212 212
				value = value.replace(config.getLinesTerminatedBy(), "\\r");
213
				
213

  
214 214
				//replace all line brakes according to best practices: http://code.google.com/p/gbif-ecat/wiki/BestPractices
215 215
				value = value.replace("\r\n", "\\r");
216 216
				value = value.replace("\r", "\\r");
217 217
				value = value.replace("\n", "\\r");
218
				
218

  
219 219
				strToPrint += config.getFieldsEnclosedBy() + value + config.getFieldsEnclosedBy();
220 220
			}
221 221
			writer.print(strToPrint);
222 222
		}
223 223
	}
224
	
224

  
225 225
	/**
226 226
	 * @param writer
227 227
	 * @param list
......
243 243
	 * @param list
244 244
	 * @param termUri
245 245
	 * @param writer
246
	 * 
246
	 *
247 247
	 * Method for concatenating strings, especially for the red list use case
248 248
	 */
249 249
	protected void print(ArrayList<String> list, TermUri termUri, PrintWriter writer){
......
264 264
					print(element, writer, IS_FIRST, termUri);
265 265
					writer.write(",");
266 266
					logger.info(element);
267
					
267

  
268 268
				}
269 269
			}
270 270
		}
271 271
	}
272
	
273
	
272

  
273

  
274 274
	private void registerFieldKey(URI key, String defaultValue) {
275 275
		this.metaDataRecord.addFieldEntry(key, defaultValue);
276 276
	}
277 277

  
278
	
278

  
279 279
	protected String getRights(Rights rights) {
280 280
		if (rights == null){
281 281
			return "";
......
337 337
			return result;
338 338
		}
339 339
	}
340
	
340

  
341 341
	protected String getSex(DefinedTerm sex) {
342 342
		String result = CsvDemoExportTransformer.transformToGbifSex(sex);
343 343
		if (result == null){
......
350 350
			return result;
351 351
		}
352 352
	}
353
	
353

  
354 354
	protected String getLifeStage(DefinedTerm stage) {
355 355
		String result = CsvDemoExportTransformer.transformToGbifLifeStage(stage);
356 356
		if (result == null){
......
376 376
			return result;
377 377
		}
378 378
	}
379
	
379

  
380 380
	protected String getEstablishmentMeans(PresenceAbsenceTermBase<?> status) {
381 381
		String result = CsvDemoExportTransformer.transformToGbifEstablishmentMeans(status);
382 382
		if (result == null){
......
390 390
		}
391 391
	}
392 392

  
393
	
394
	
393

  
394

  
395 395
	protected String getAgent(AgentBase<?> agent) {
396 396
		if (agent == null){
397 397
			return "";
......
400 400
			return agent.getTitleCache();
401 401
		}
402 402
	}
403
	
403

  
404 404

  
405 405
	protected String getFeature(Feature feature) {
406 406
		if (feature == null){
......
411 411
		}
412 412
	}
413 413

  
414
	
414

  
415 415
	protected String getTimePeriod(TimePeriod period) {
416 416
		if (period == null){
417 417
			return "";
......
420 420
			return period.toString();
421 421
		}
422 422
	}
423
	
423

  
424 424
	protected String getTimePeriodPart(TimePeriod period, boolean useEnd) {
425 425
		if (period == null){
426 426
			return "";
......
449 449
			return result;
450 450
		}
451 451
	}
452
	
452

  
453 453

  
454 454
	protected String getDesignationType(TypeDesignationStatusBase<?> status) {
455 455
		if (status == null){
......
469 469
			return result;
470 470
		}
471 471
	}
472
	
473
	
472

  
473

  
474 474
	protected void addKnownField(String string, String uri) throws URISyntaxException {
475 475
		this.knownFields.put(string, new URI(uri));
476 476
	}
477
	
477

  
478 478
	protected void addKnownField(TermUri term) throws URISyntaxException {
479 479
		this.knownTermFields.add(term);
480 480
	}
cdmlib-remote-webapp/src/main/webapp/WEB-INF/json-views.xml
29 29
      <property name="jsonConfig" ref="nameCatalogueJsonConfig" />
30 30
    </bean>
31 31

  
32
    <bean name="**/csv/* **/export" class="eu.etaxonomy.cdm.remote.view.JsonView">
33
      <property name="jsonConfig" ref="nameCatalogueJsonConfig" />
34
    </bean>
35

  
32 36
    <!-- portal service -->
33 37
    <bean name="**/portal/* **/portal/**/*" class="eu.etaxonomy.cdm.remote.view.JsonView">
34 38
        <property name="jsonConfig" ref="jsonConfigPortal" />
cdmlib-remote-webapp/src/main/webapp/WEB-INF/xml-views.xml
51 51
      <property name="jsonConfig" ref="nameCatalogueJsonConfig" />
52 52
      <property name="dataSourceProperties" ref="dataSourceProperties" />
53 53
    </bean>
54
    
55
     <bean name="**/csv/* **/export" class="eu.etaxonomy.cdm.remote.view.JsonView">
56
      <property name="type" value="XML" />
57
      <property name="jsonConfig" ref="nameCatalogueJsonConfig" />
58
      <property name="dataSourceProperties" ref="dataSourceProperties" />
59
    </bean>
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff