Revision 531fc7bc
Added by Andreas Müller almost 8 years ago
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/dwca/out/DwcaReferenceExport.java | ||
---|---|---|
1 | 1 |
/** |
2 | 2 |
d* 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 |
/** Retrieves data from a CDM DB and serializes them CDM to XML. |
49 | 49 |
* Starts with root taxa and traverses the classification to retrieve children taxa, synonyms and relationships. |
50 | 50 |
* Taxa that are not part of the classification are not found. |
51 |
*
|
|
51 |
* |
|
52 | 52 |
* @param exImpConfig |
53 | 53 |
* @param dbname |
54 | 54 |
* @param filename |
... | ... | |
69 | 69 |
//sec |
70 | 70 |
DwcaReferenceRecord record = new DwcaReferenceRecord(metaRecord, config); |
71 | 71 |
Taxon taxon = CdmBase.deproxy(node.getTaxon(), Taxon.class); |
72 |
Reference<?> sec = taxon.getSec();
|
|
72 |
Reference sec = taxon.getSec(); |
|
73 | 73 |
if (sec != null && ! recordExists(sec)){ |
74 | 74 |
handleReference(record, sec, taxon); |
75 | 75 |
record.write(writer); |
76 | 76 |
addExistingRecord(sec); |
77 | 77 |
} |
78 |
|
|
78 |
|
|
79 | 79 |
//nomRef |
80 | 80 |
record = new DwcaReferenceRecord(metaRecord, config); |
81 | 81 |
INomenclaturalReference nomRef = taxon.getName().getNomenclaturalReference(); |
82 | 82 |
if (nomRef != null && ! existingRecordIds.contains(nomRef.getId())){ |
83 |
handleReference(record, (Reference<?>)nomRef, taxon);
|
|
83 |
handleReference(record, (Reference)nomRef, taxon); |
|
84 | 84 |
record.write(writer); |
85 |
addExistingRecord((Reference<?>)nomRef);
|
|
85 |
addExistingRecord((Reference)nomRef); |
|
86 | 86 |
} |
87 |
|
|
87 |
|
|
88 | 88 |
writer.flush(); |
89 |
|
|
89 |
|
|
90 | 90 |
} |
91 | 91 |
} catch (FileNotFoundException e) { |
92 | 92 |
e.printStackTrace(); |
... | ... | |
103 | 103 |
return; |
104 | 104 |
} |
105 | 105 |
|
106 |
private void handleReference(DwcaReferenceRecord record, Reference<?> reference, Taxon taxon) {
|
|
106 |
private void handleReference(DwcaReferenceRecord record, Reference reference, Taxon taxon) { |
|
107 | 107 |
record.setId(taxon.getId()); |
108 | 108 |
record.setUuid(taxon.getUuid()); |
109 |
|
|
109 |
|
|
110 | 110 |
record.setISBN_ISSN(StringUtils.isNotBlank(reference.getIsbn())? reference.getIsbn(): reference.getIssn()); |
111 | 111 |
record.setUri(reference.getUri()); |
112 | 112 |
//TODO implementation, DOI is extension type |
... | ... | |
118 | 118 |
record.setCreator(reference.getAuthorship()); |
119 | 119 |
record.setDate(reference.getDatePublished()); |
120 | 120 |
record.setSource(reference.getInReference()==null?null:reference.getInReference().getTitleCache()); |
121 |
|
|
121 |
|
|
122 | 122 |
//FIXME abstracts, remarks, notes |
123 | 123 |
record.setDescription(reference.getReferenceAbstract()); |
124 | 124 |
//FIXME |
125 | 125 |
record.setSubject(null); |
126 |
|
|
126 |
|
|
127 | 127 |
//TODO missing, why ISO639-1 better 639-3 |
128 | 128 |
record.setLanguage(null); |
129 | 129 |
record.setRights(reference.getRights()); |
... | ... | |
132 | 132 |
//TODO |
133 | 133 |
record.setType(null); |
134 | 134 |
} |
135 |
|
|
135 |
|
|
136 | 136 |
@Override |
137 | 137 |
protected boolean doCheck(DwcaTaxExportState state) { |
138 | 138 |
boolean result = true; |
... | ... | |
145 | 145 |
protected boolean isIgnore(DwcaTaxExportState state) { |
146 | 146 |
return ! state.getConfig().isDoReferences(); |
147 | 147 |
} |
148 |
|
|
148 |
|
|
149 | 149 |
} |
Also available in: Unified diff
Remove generics from Reference in cdmlib (except for cdmlib-model) #5830