Project

General

Profile

« Previous | Next » 

Revision ad3ad9e0

Added by Andreas Kohlbecker over 12 years ago

  • ID ad3ad9e0f0560d0bb782836297c4ffe39b2625c8
  • Parent 55d84577

Merging r13295 through r13325 from trunk

View differences:

cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/sdd/in/SDDImport.java
109 109
	private Map<String,String> locations = new HashMap<String,String>();
110 110
	private Map<String,List<CdmBase>> mediaObject_ListCdmBase = new HashMap<String,List<CdmBase>>();
111 111
	private Map<String,String> mediaObject_Role = new HashMap<String,String>();
112
	private Map<String,Reference> publications = new HashMap<String,Reference>();
112
	private Map<String,Reference<?>> publications = new HashMap<String,Reference<?>>();
113 113
	private Map<String,State> states = new HashMap<String,State>();
114 114
	private Map<String,TaxonDescription> taxonDescriptions = new HashMap<String,TaxonDescription>();
115
	private Map<String,NonViralName> taxonNameBases = new HashMap<String,NonViralName>();
115
	private Map<String,NonViralName<?>> taxonNameBases = new HashMap<String,NonViralName<?>>();
116 116
	private Map<String,MeasurementUnit> units = new HashMap<String,MeasurementUnit>();
117 117
	private Map<String,TaxonNode> taxonNodes = new HashMap<String,TaxonNode>();
118 118
	private Map<String,NamedArea> namedAreas = new HashMap<String,NamedArea>();
......
120 120
	private Map<String,Modifier> modifiers = new HashMap<String,Modifier>();
121 121
	
122 122
	private Set<MarkerType> markerTypes = new HashSet<MarkerType>();
123
	private Set<TermVocabulary> vocabularies = new HashSet<TermVocabulary>();
123
	private Set<TermVocabulary<?>> vocabularies = new HashSet<TermVocabulary<?>>();
124 124

  
125 125
	private Set<Feature> descriptiveConcepts = new HashSet<Feature>();
126 126
	private Set<AnnotationType> annotationTypes = new HashSet<AnnotationType>();
127 127
//	private Set<Feature> featureSet = new HashSet<Feature>();
128
	private Set<Reference> sources = new HashSet<Reference>();
129
	private Reference sec = ReferenceFactory.newDatabase();
130
	private Reference sourceReference = null;
128
	private Set<Reference<?>> sources = new HashSet<Reference<?>>();
129
	private Reference<?> sec = ReferenceFactory.newDatabase();
130
	private Reference<?> sourceReference = null;
131 131

  
132 132
	private Language datasetLanguage = null;
133 133
	private WorkingSet workingSet = null;
......
177 177
		// <TechnicalMetadata created="2006-04-20T10:00:00">
178 178
		importTechnicalMetadata(root, sddNamespace, sddConfig);
179 179
		List<Element> elDatasets = root.getChildren("Dataset",sddNamespace);
180
		int i = 0;
180
//		int i = 0;
181 181

  
182 182
		//for each Dataset
183 183
		logger.info("start Dataset ...");
......
389 389
			if (StringUtils.isNotBlank(ref)) {
390 390
				if (ve instanceof TaxonDescription) {
391 391
					TaxonDescription td = (TaxonDescription) ve;
392
					if (td.getDescriptionSources().size() > 0) {
393
						this.associateImageWithCdmBase(ref,(Reference) td.getDescriptionSources().toArray()[0]);
392
					if (td.getSources().size() > 0) {
393
						this.associateImageWithCdmBase(ref, td.getSources().iterator().next().getCitation());
394 394
					} else {
395
						Reference descriptionSource = ReferenceFactory.newGeneric();
395
						Reference<?> descriptionSource = ReferenceFactory.newGeneric();
396 396
						sources.add(descriptionSource);
397
						td.addDescriptionSource(descriptionSource);
397
						td.addSource(null, null, descriptionSource, null);
398 398
						this.associateImageWithCdmBase(ref,descriptionSource);
399 399
					}
400 400
				} else {
......
618 618
					location.setAnnotationType(annotationType);
619 619
					(publication).addAnnotation(location);
620 620
				}
621
				td.addDescriptionSource(publication);
621
				td.addSource(null, null,publication, null);
622 622
			}
623 623
		}
624 624
		logger.info("end makeTaxonDescriptions ...");
......
632 632
		}
633 633
		saveFeatures();
634 634
		
635
		for (Reference publication : publications.values()){
635
		for (Reference<?> publication : publications.values()){
636 636
			getReferenceService().save(publication); 
637 637
		}
638 638
		
639
		for (Reference source : sources){
639
		for (Reference<?> source : sources){
640 640
			getReferenceService().save(source); 
641 641
		}
642 642

  
......
659 659
	 * 
660 660
	 */
661 661
	private void saveVocabularies() {
662
		for (TermVocabulary vocabulary : vocabularies ){
662
		for (TermVocabulary<?> vocabulary : vocabularies ){
663 663
			getVocabularyService().save(vocabulary);
664 664
		}
665 665
		
......
749 749
		Element elSpecimens = elDataset.getChild("Specimens",sddNamespace);
750 750
		if (elSpecimens != null){
751 751
			List<Element> listSpecimens = elSpecimens.getChildren("Specimen", sddNamespace);
752
			int j = 0;
753 752
			for (Element elSpecimen : listSpecimens) {
754 753
				String id = elSpecimen.getAttributeValue("id");
755 754
				Specimen specimen = null;
......
881 880
				String id = elTaxonName.getAttributeValue("id");
882 881
				String uri = elTaxonName.getAttributeValue("uri");
883 882

  
884
				NonViralName tnb = null;
883
				NonViralName<?> tnb = null;
885 884
				if (!id.equals("")) {
886 885
					tnb = NonViralName.NewInstance(null);
887 886
					IdentifiableSource source = null;
......
1188 1187
	 */
1189 1188
	private Taxon handleCDNoScope(Namespace sddNamespace, SDDImportState cdmState, Element elCodedDescription	) {
1190 1189
		Taxon taxon = null;
1191
		NonViralName nonViralName = NonViralName.NewInstance(null);
1190
		NonViralName<?> nonViralName = NonViralName.NewInstance(null);
1192 1191
		String id = new String("" + taxonNamesCount);
1193 1192
		IdentifiableSource source = IdentifiableSource.NewInstance(id, "TaxonName");
1194 1193
		importRepresentation(elCodedDescription, sddNamespace, nonViralName, id, cdmState);
......
1225 1224
		Taxon taxon = null;
1226 1225
		Element elTaxonName = elScope.getChild("TaxonName", sddNamespace);
1227 1226
		String ref = elTaxonName.getAttributeValue("ref");
1228
		NonViralName nonViralName = taxonNameBases.get(ref);
1227
		NonViralName<?> nonViralName = taxonNameBases.get(ref);
1229 1228
		
1230 1229
		if(cdmState.getConfig().isDoMatchTaxa()){
1231 1230
			taxon = getTaxonService().findBestMatchingTaxon(nonViralName.getTitleCache());
......
1508 1507
				try {
1509 1508

  
1510 1509
					String idP = elPublication.getAttributeValue("id");
1511
					Reference publication = ReferenceFactory.newArticle();
1510
					Reference<?> publication = ReferenceFactory.newArticle();
1512 1511
					importRepresentation(elPublication, sddNamespace, publication, idP, cdmState);
1513 1512

  
1514 1513
					publications.put(idP,publication);
......
1585 1584
						if (lcb != null) {
1586 1585
							for (int k = 0; k < lcb.size(); k++) {
1587 1586
								if (lcb.get(k) instanceof DefinedTermBase) {
1588
									DefinedTermBase dtb = (DefinedTermBase) lcb.get(k);
1587
									DefinedTermBase<?> dtb = (DefinedTermBase<?>) lcb.get(k);
1589 1588
									// if (lcb.get(0) instanceof DefinedTermBase) {
1590 1589
									// DefinedTermBase dtb = (DefinedTermBase) lcb.get(0);
1591 1590
									//									if (dtb!=null) {
......
1598 1597
									//										}
1599 1598
									//									}
1600 1599
								} else if (lcb.get(k) instanceof Reference) {
1601
									Reference rb = (Reference) lcb.get(k);
1600
									Reference<?> rb = (Reference<?>) lcb.get(k);
1602 1601
									//} else if (lcb.get(0) instanceof Reference) {
1603 1602
									//Reference rb = (Reference) lcb.get(0);
1604 1603
									// rb.setTitleCache(label);
......
1859 1858
						Classification classification =  Classification.NewInstance(label);
1860 1859
						importRepresentation(elTaxonHierarchy, sddNamespace, classification, "", cdmState);
1861 1860
					
1862
						Set<TaxonNode> root = classification.getChildNodes();
1863 1861
						Element elNodes = elTaxonHierarchy.getChild("Nodes", sddNamespace); // There can be only one <Nodes> block for TaxonHierarchies
1864 1862
						List<Element> listNodes = elNodes.getChildren("Node", sddNamespace);
1865 1863
						
1866 1864
						for (Element elNode : listNodes){
1867 1865
							String idN = elNode.getAttributeValue("id");
1868
							TaxonNameBase tnb = null;
1866
							TaxonNameBase<?,?> tnb = null;
1869 1867
							if (!idN.equals("")) {
1870 1868
								Element elTaxonName = elNode.getChild("TaxonName", sddNamespace);
1871 1869
								String refTN = elTaxonName.getAttributeValue("ref");

Also available in: Unified diff