Revision 5559e194
Added by Andreas Müller over 12 years ago
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/sdd/out/SDDDocumentBuilder.java | ||
---|---|---|
15 | 15 |
import java.io.OutputStreamWriter; |
16 | 16 |
import java.io.Writer; |
17 | 17 |
import java.util.HashMap; |
18 |
import java.util.HashSet; |
|
18 | 19 |
import java.util.Iterator; |
19 | 20 |
import java.util.List; |
20 | 21 |
import java.util.Map; |
... | ... | |
98 | 99 |
private SDDDataSet cdmSource; |
99 | 100 |
|
100 | 101 |
private final Map<Person, String> agents = new HashMap<Person, String>(); |
101 |
private final Map<TaxonNameBase, String> taxonNames = new HashMap<TaxonNameBase, String>();
|
|
102 |
private final Map<TaxonNameBase<?,?>, String> taxonNames = new HashMap<TaxonNameBase<?,?>, String>();
|
|
102 | 103 |
private final Map<Feature, String> characters = new HashMap<Feature, String>(); |
103 | 104 |
private final Map<FeatureNode, String> featureNodes = new HashMap<FeatureNode, String>(); |
104 | 105 |
private final Map<Feature, String> descriptiveConcepts = new HashMap<Feature, String>(); |
105 | 106 |
private final Map<TaxonDescription, String> codedDescriptions = new HashMap<TaxonDescription, String>(); |
106 | 107 |
private final Map<Media, String> medias = new HashMap<Media, String>(); |
107 | 108 |
private final Map<State, String> states = new HashMap<State, String>(); |
108 |
private final Map<Reference, String> articles = new HashMap<Reference, String>();
|
|
109 |
private final Map<Reference<?>, String> articles = new HashMap<Reference<?>, String>();
|
|
109 | 110 |
private final Map<VersionableEntity, String> featuretrees = new HashMap<VersionableEntity, String>(); |
110 | 111 |
private final Map<Modifier, String> modifiers = new HashMap<Modifier, String>(); |
111 | 112 |
private final Map<TaxonNode, String> taxonNodes = new HashMap<TaxonNode, String>(); |
112 | 113 |
private final Map<NamedArea, String> namedAreas = new HashMap<NamedArea, String>(); |
113 | 114 |
private final Map<Specimen, String> specimens = new HashMap<Specimen, String>(); |
114 |
private final ReferenceFactory refFactory = ReferenceFactory.newInstance(); |
|
115 |
|
|
115 |
|
|
116 | 116 |
private final Map<VersionableEntity, String> features = new HashMap<VersionableEntity, String>(); |
117 | 117 |
private int agentsCount = 0; |
118 | 118 |
private int articlesCount = 0; |
... | ... | |
269 | 269 |
|
270 | 270 |
List<Reference> references = cdmSource.getReferences(); |
271 | 271 |
Iterator<Reference> iterator = references.iterator(); |
272 |
IDatabase d = refFactory.newDatabase();
|
|
272 |
IDatabase d = ReferenceFactory.newDatabase();
|
|
273 | 273 |
while (iterator.hasNext()) { |
274 | 274 |
Reference reference = iterator.next(); |
275 | 275 |
if (reference.getType().equals(ReferenceType.Database)) { |
... | ... | |
295 | 295 |
List<Reference> references = cdmSource.getReferences(); |
296 | 296 |
Iterator<Reference> iterator = references.iterator(); |
297 | 297 |
boolean database = false; |
298 |
IDatabase d = refFactory.newDatabase();
|
|
298 |
IDatabase d = ReferenceFactory.newDatabase();
|
|
299 | 299 |
while ((iterator.hasNext()) && (!database)) { |
300 |
Reference reference = iterator.next(); |
|
300 |
Reference<?> reference = iterator.next();
|
|
301 | 301 |
if (reference.getType().equals(ReferenceType.Database)) { |
302 | 302 |
d = reference; |
303 | 303 |
} |
... | ... | |
354 | 354 |
buildLabel(representation, reference.getTitleCache()); |
355 | 355 |
|
356 | 356 |
Set<Annotation> annotations = ((Reference) reference).getAnnotations(); |
357 |
Iterator iterator = annotations.iterator(); |
|
357 |
Iterator<Annotation> iterator = annotations.iterator();
|
|
358 | 358 |
String detailText = null; |
359 | 359 |
if (iterator.hasNext()) { |
360 | 360 |
Annotation annotation = (Annotation) iterator.next(); |
... | ... | |
830 | 830 |
} |
831 | 831 |
} |
832 | 832 |
|
833 |
Set<Reference> descriptionSources = taxonDescription |
|
834 |
.getDescriptionSources(); |
|
835 |
for (Iterator<Reference> rb = descriptionSources.iterator(); rb |
|
836 |
.hasNext();) { |
|
833 |
Set<Reference> descriptionSources = new HashSet<Reference>(); |
|
834 |
for (IdentifiableSource source : taxonDescription.getSources()){ |
|
835 |
descriptionSources.add(source.getCitation()); |
|
836 |
} |
|
837 |
for (Iterator<Reference> rb = descriptionSources.iterator(); rb.hasNext();) { |
|
837 | 838 |
Reference descriptionSource = rb.next(); |
838 | 839 |
if (descriptionSource.getType().equals(ReferenceType.Article)) { |
839 | 840 |
|
... | ... | |
841 | 842 |
articlesCount = buildReference(descriptionSource, articles, |
842 | 843 |
REF, citation, "p", articlesCount); |
843 | 844 |
|
844 |
Set<Annotation> annotations = descriptionSource |
|
845 |
.getAnnotations(); |
|
846 |
for (Iterator<Annotation> a = annotations.iterator(); a |
|
847 |
.hasNext();) { |
|
845 |
Set<Annotation> annotations = descriptionSource.getAnnotations(); |
|
846 |
for (Iterator<Annotation> a = annotations.iterator(); a.hasNext();) { |
|
848 | 847 |
Annotation annotation = a.next(); |
849 |
AnnotationType annotationType = annotation |
|
850 |
.getAnnotationType(); |
|
848 |
AnnotationType annotationType = annotation.getAnnotationType(); |
|
851 | 849 |
if (annotationType != null) { |
852 | 850 |
String type = annotationType.getLabel(); |
853 | 851 |
if (type.equals("location")) { |
854 |
citation.setAttribute("location", |
|
855 |
annotation.getText()); |
|
852 |
citation.setAttribute("location",annotation.getText()); |
|
856 | 853 |
} |
857 | 854 |
} |
858 | 855 |
} |
... | ... | |
1369 | 1366 |
for (int i = 0; i < cdmSource.getReferences().size(); i++) { |
1370 | 1367 |
ElementImpl elPublication = new ElementImpl(document, |
1371 | 1368 |
"Publication"); |
1372 |
Reference publication = cdmSource.getReferences().get(i); |
|
1369 |
Reference<?> publication = cdmSource.getReferences().get(i);
|
|
1373 | 1370 |
Set<Annotation> annotations = publication.getAnnotations(); |
1374 | 1371 |
for (Iterator<Annotation> a = annotations.iterator(); a |
1375 | 1372 |
.hasNext();) { |
Also available in: Unified diff
remove deprecated call for description.setAddSource