Project

General

Profile

« Previous | Next » 

Revision 786696e3

Added by Andreas Müller over 10 years ago

merge trunk into cdm3.3 branch

View differences:

cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/dwca/in/GbifDescriptionCsv2CdmConverter.java
27 27
import eu.etaxonomy.cdm.model.description.Feature;
28 28
import eu.etaxonomy.cdm.model.description.TaxonDescription;
29 29
import eu.etaxonomy.cdm.model.description.TextData;
30
import eu.etaxonomy.cdm.model.media.Rights;
30 31
import eu.etaxonomy.cdm.model.reference.Reference;
31 32
import eu.etaxonomy.cdm.model.taxon.Taxon;
32 33

  
......
62 63
		if (taxon != null){
63 64
			
64 65
			String description = item.get(TermUri.DC_DESCRIPTION);
66
			//String license = item.get(TermUri.DC_LICENSE);//lorna check - often empty in SP dwca
67
					
68
			//TODO: Create the Language from the TermUri.DC_LANGUAGE in the dwca
69
			Language language = getLanguage(item); 
70
									
71
			
65 72
			if (StringUtils.isNotBlank(description)){
66 73
				Feature feature = getFeatureByDcType(item, resultList);
67 74

  
68 75
				TaxonDescription taxonDescription = getTaxonDescription(taxon, false);
76
								
77
				//deduplicate - if this taxonDescription already got these Rights attached
78
				boolean addRights = true;
79
				String rights = item.get(TermUri.DC_RIGHTS);
80
				Set<Rights> allRights = taxonDescription.getRights();				
81
				for (Rights r : allRights) {					
82
					if (r.getText() == rights) {
83
						addRights = false;
84
					}
85
				}
86
				
87
				if (addRights && (rights != null || rights != "")) {
88
					Rights copyright = Rights.NewInstance(rights, language);
89
					taxonDescription.addRights(copyright);
90
				}
91
				
69 92
				TextData descElement = TextData.NewInstance(feature);
70 93
				
71
				Language language = getLanguage(item);  //TODO
94
				//Language language = getLanguage(item);  //TODO
72 95
				descElement.putText(language,description);
73 96
				taxonDescription.addElement(descElement);
74 97
			}else{
......
92 115
		//TODO
93 116
		
94 117
		Language language = Language.DEFAULT();
118
		String langString = item.get(TermUri.DC_LANGUAGE);	
119
		
120
		/*if (langString != null) {
121
			if (!langString.equals("")) {
122
				language = getTermService().getLanguageByIso(langString.substring(0, 2));
123
				//can getTermService from StreamImportBase which calls GbifDescriptionCsv2CdmConverter.map
124
			}
125
		}*/
95 126
		return language;
96 127
	}
97 128

  

Also available in: Unified diff