Project

General

Profile

« Previous | Next » 

Revision 51171c9d

Added by Andreas Müller about 13 years ago

last updates for Taxon Excel Import and moving all success variables to state

View differences:

cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/sdd/in/SDDImport.java
34 34
import eu.etaxonomy.cdm.common.IProgressMonitor;
35 35
import eu.etaxonomy.cdm.common.media.ImageInfo;
36 36
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
37
import eu.etaxonomy.cdm.io.common.CdmImportBase;
38 37
import eu.etaxonomy.cdm.io.common.ICdmImport;
39
import eu.etaxonomy.cdm.io.common.IImportConfigurator;
40 38
import eu.etaxonomy.cdm.io.common.ImportHelper;
41 39
import eu.etaxonomy.cdm.io.common.XmlImportBase;
42 40
import eu.etaxonomy.cdm.io.sdd.SDDTransformer;
......
159 157
	//	@Override
160 158
	//	public boolean doInvoke(IImportConfigurator config, Map<String, MapWrapper<? extends CdmBase>> stores){
161 159
	@Override
162
	public boolean doInvoke(SDDImportState state){
163
		boolean success = true;
160
	public void doInvoke(SDDImportState state){
164 161
		
165 162
		TransactionStatus ts = startTransaction();
166 163
		SDDImportConfigurator sddConfig = state.getConfig();
......
182 179
		logger.info("start Dataset ...");
183 180
		progressMonitor.beginTask("Importing SDD data", elDatasets.size());
184 181
		for (Element elDataset : elDatasets){
185
			success &= importDataset(elDataset, sddNamespace, state);			
182
			importDataset(elDataset, sddNamespace, state);			
186 183
//			if ((++i % modCount) == 0){ logger.info("dataset(s) handled: " + i);}
187 184
//			logger.info(i + " dataset(s) handled");
188 185
			progressMonitor.worked(1);
......
190 187
		commitTransaction(ts);
191 188
		progressMonitor.done();
192 189
		logger.info("End of transaction");
193
		return success;
190
		return;
194 191
	}
195 192

  
196 193
	/* (non-Javadoc)
......
268 265
	}
269 266

  
270 267
	// imports the representation (label, detail, lang) of a particular SDD element
271
	protected void importRepresentation(Element parent, Namespace sddNamespace, VersionableEntity ve, String id, IImportConfigurator config){
268
	protected void importRepresentation(Element parent, Namespace sddNamespace, VersionableEntity ve, String id, SDDImportState state){
272 269
		Element elRepresentation = parent.getChild("Representation",sddNamespace);
273 270
		
274 271
		Map<Language,List<String>> langLabDet = new HashMap<Language,List<String>>();
......
532 529
	}
533 530

  
534 531
	// imports the complete dataset information
535
	protected boolean importDataset(Element elDataset, Namespace sddNamespace, SDDImportState state){			// <Dataset xml:lang="en-us">
536
		boolean success = true;
537
		SDDImportConfigurator sddConfig = state.getConfig();
538

  
532
	protected void importDataset(Element elDataset, Namespace sddNamespace, SDDImportState state){			// <Dataset xml:lang="en-us">
533
		
539 534
		workingSet = WorkingSet.NewInstance();
540
		importDatasetLanguage(elDataset,sddConfig);
535
		importDatasetLanguage(elDataset,state);
541 536
		importDatasetRepresentation(elDataset, sddNamespace);
542 537
		importRevisionData(elDataset, sddNamespace);
543
		importIPRStatements(elDataset, sddNamespace, sddConfig);
544
		importTaxonNames(elDataset, sddNamespace, sddConfig);
538
		importIPRStatements(elDataset, sddNamespace, state);
539
		importTaxonNames(elDataset, sddNamespace, state);
545 540

  
546
		importDescriptiveConcepts(elDataset, sddNamespace, sddConfig);
547
		success &= importCharacters(elDataset, sddNamespace, sddConfig);
548
		importCharacterTrees(elDataset, sddNamespace, sddConfig, success);
541
		importDescriptiveConcepts(elDataset, sddNamespace, state);
542
		importCharacters(elDataset, sddNamespace, state);
543
		importCharacterTrees(elDataset, sddNamespace, state);
549 544
		
550 545
		MarkerType editorMarkerType = getMarkerType(state, SDDTransformer.uuidMarkerEditor, "editor", "Editor", "edt");
551 546
		MarkerType geographicAreaMarkerType = getMarkerType(state, SDDTransformer.uuidMarkerSDDGeographicArea, "SDDGeographicArea", "SDDGeographicArea", "ga"); 
......
565 560
		saveStatisticalMeasure();		
566 561
		saveAnnotationType();
567 562

  
568
		success &= importCodedDescriptions(elDataset, sddNamespace, sddConfig);
569
		importAgents(elDataset, sddNamespace, sddConfig, success);
570
		importPublications(elDataset, sddNamespace, sddConfig, success);
571
		importMediaObjects(elDataset, sddNamespace, sddConfig, success);
572
		importTaxonHierarchies(elDataset, sddNamespace, sddConfig, success);
573
		importGeographicAreas(elDataset, sddNamespace, sddConfig);
574
		importSpecimens(elDataset,sddNamespace, sddConfig);
563
		importCodedDescriptions(elDataset, sddNamespace, state);
564
		importAgents(elDataset, sddNamespace, state);
565
		importPublications(elDataset, sddNamespace, state);
566
		importMediaObjects(elDataset, sddNamespace, state);
567
		importTaxonHierarchies(elDataset, sddNamespace, state);
568
		importGeographicAreas(elDataset, sddNamespace, state);
569
		importSpecimens(elDataset,sddNamespace, state);
575 570
		
576 571
		
577 572
		if ((authors != null)||(editors != null)) {
......
652 647
		}
653 648
		logger.info("end of persistence ...");
654 649
		
655
		return success;
650
		return;
656 651
	}
657 652

  
658 653
	/**
......
721 716
	}
722 717

  
723 718
	// imports the default language of the dataset
724
	protected void importDatasetLanguage(Element elDataset, SDDImportConfigurator sddConfig){
719
	protected void importDatasetLanguage(Element elDataset, SDDImportState state){
725 720
		String nameLang = elDataset.getAttributeValue("lang",xmlNamespace);
726 721

  
727 722
		if (StringUtils.isNotBlank(nameLang)) {
......
736 731
	}
737 732
	
738 733
	// imports the specimens
739
	protected void importSpecimens(Element elDataset, Namespace sddNamespace, SDDImportConfigurator sddConfig) {
734
	protected void importSpecimens(Element elDataset, Namespace sddNamespace, SDDImportState cdmState) {
740 735
		logger.info("start Specimens ...");
741 736
		/*	<Specimens>
742 737
        		<Specimen id="sp1">
......
756 751
				if (!id.equals("")) {
757 752
					specimen = Specimen.NewInstance();
758 753
					specimens.put(id,specimen);
759
					importRepresentation(elSpecimen, sddNamespace, specimen, id, sddConfig);
754
					importRepresentation(elSpecimen, sddNamespace, specimen, id, cdmState);
760 755
				}
761 756
			}
762 757

  
......
819 814
	}
820 815

  
821 816
	// imports ipr statements associated with a dataset
822
	protected void importIPRStatements(Element elDataset, Namespace sddNamespace, SDDImportConfigurator sddConfig){
817
	protected void importIPRStatements(Element elDataset, Namespace sddNamespace, SDDImportState state){
823 818
		// <IPRStatements>
824 819
		logger.info("start IPRStatements ...");
825 820
		Element elIPRStatements = elDataset.getChild("IPRStatements",sddNamespace);
......
867 862
	}
868 863

  
869 864
	// imports the taxon names
870
	protected void importTaxonNames(Element elDataset, Namespace sddNamespace, SDDImportConfigurator sddConfig){
865
	protected void importTaxonNames(Element elDataset, Namespace sddNamespace, SDDImportState state){
871 866
		// <TaxonNames>
872 867
		logger.info("start TaxonNames ...");
873 868
		Element elTaxonNames = elDataset.getChild("TaxonNames",sddNamespace);
......
898 893

  
899 894
				// <Representation>
900 895
				// <Label xml:lang="la">Viola hederacea Labill.</Label>
901
				importRepresentation(elTaxonName, sddNamespace, tnb, id, sddConfig);
896
				importRepresentation(elTaxonName, sddNamespace, tnb, id, state);
902 897

  
903 898
				if ((++j % modCount) == 0){ logger.info("TaxonNames handled: " + j);}
904 899

  
......
907 902
	}
908 903

  
909 904
	// imports the characters (categorical, quantitative and text ; sequence characters not supported) which correspond to CDM Features
910
	protected boolean importCharacters(Element elDataset, Namespace sddNamespace, SDDImportConfigurator sddConfig){
911
		boolean success = true;
905
	protected void importCharacters(Element elDataset, Namespace sddNamespace, SDDImportState cdmState){
912 906
		// <Characters>
913 907
		logger.info("start Characters ...");
914 908
		Element elCharacters = elDataset.getChild("Characters", sddNamespace);
915 909

  
916 910
		// <CategoricalCharacter id="c1">
917 911
		if (elCharacters != null) {
918
			success &= handleCategoricalData(sddNamespace, sddConfig, elCharacters);
919
			success &= handleQuantitativeData(sddNamespace, sddConfig, elCharacters);
920
			success &= handleTextCharacters(sddNamespace, sddConfig, elCharacters);
912
			handleCategoricalData(sddNamespace, cdmState, elCharacters);
913
			handleQuantitativeData(sddNamespace, cdmState, elCharacters);
914
			handleTextCharacters(sddNamespace, cdmState, elCharacters);
921 915
		}
922 916

  
923 917
		/*for (Iterator<Feature> f = features.values().iterator() ; f.hasNext() ;){
924 918
			featureSet.add(f.next()); //XIM Why this line ?
925 919
		}*/
926 920
		
927
		return success;
921
		return;
928 922

  
929 923
	}
930 924

  
931 925
	/**
932 926
	 * @param sddNamespace
933 927
	 * @param sddConfig
934
	 * @param success
935 928
	 * @param elCharacters
936 929
	 * @return
937 930
	 */
938
	private boolean handleCategoricalData(Namespace sddNamespace, SDDImportConfigurator sddConfig, Element elCharacters) {
939
		boolean success = true;
931
	private void handleCategoricalData(Namespace sddNamespace, SDDImportState cdmState, Element elCharacters) {
940 932
		List<Element> elCategoricalCharacters = elCharacters.getChildren("CategoricalCharacter", sddNamespace);
941 933
		int j = 0;
942 934
		for (Element elCategoricalCharacter : elCategoricalCharacters){
......
945 937
				String idCC = elCategoricalCharacter.getAttributeValue("id");
946 938
				Feature categoricalCharacter = Feature.NewInstance();
947 939
				categoricalCharacter.setKindOf(Feature.DESCRIPTION());
948
				importRepresentation(elCategoricalCharacter, sddNamespace, categoricalCharacter, idCC, sddConfig);
940
				importRepresentation(elCategoricalCharacter, sddNamespace, categoricalCharacter, idCC, cdmState);
949 941
				categoricalCharacter.setSupportsCategoricalData(true);
950 942

  
951 943
				// <States>
......
970 962
					}else{
971 963
						logger.debug("State duplicate found");
972 964
					}
973
					importRepresentation(elStateDefinition, sddNamespace, state, idS, sddConfig);
965
					importRepresentation(elStateDefinition, sddNamespace, state, idS, cdmState);
974 966

  
975 967
					termVocabularyState.addTerm(state);
976 968
					states.put(idS,state);
......
980 972

  
981 973
			} catch (Exception e) {
982 974
				logger.warn("Import of CategoricalCharacter " + j + " failed.");
983
				success = false; 
975
				cdmState.setUnsuccessfull(); 
984 976
			}
985 977

  
986 978
			if ((++j % modCount) == 0){ logger.info("CategoricalCharacters handled: " + j);}
987 979

  
988 980
		}
989
		return success;
981
		return;
990 982
	}
991 983

  
992 984
	/**
......
994 986
	 * @param sddConfig
995 987
	 * @param elCharacters
996 988
	 */
997
	private boolean handleQuantitativeData(Namespace sddNamespace,	SDDImportConfigurator sddConfig, Element elCharacters) {
998
		boolean success = true;
989
	private void handleQuantitativeData(Namespace sddNamespace,	SDDImportState cdmState, Element elCharacters) {
999 990
		int j;
1000 991
		// <QuantitativeCharacter id="c2">
1001 992
		List<Element> elQuantitativeCharacters = elCharacters.getChildren("QuantitativeCharacter", sddNamespace);
......
1012 1003
				// </Representation>
1013 1004
				Feature quantitativeCharacter = Feature.NewInstance();
1014 1005
				quantitativeCharacter.setKindOf(Feature.DESCRIPTION());
1015
				importRepresentation(elQuantitativeCharacter, sddNamespace, quantitativeCharacter, idQC, sddConfig);
1006
				importRepresentation(elQuantitativeCharacter, sddNamespace, quantitativeCharacter, idQC, cdmState);
1016 1007

  
1017 1008
				quantitativeCharacter.setSupportsQuantitativeData(true);
1018 1009

  
......
1059 1050
			} catch (Exception e) {
1060 1051
				//FIXME
1061 1052
				logger.warn("Import of QuantitativeCharacter " + j + " failed.");
1062
				success = false; 
1053
				cdmState.setUnsuccessfull();
1063 1054
			}
1064 1055

  
1065 1056
			if ((++j % modCount) == 0){ logger.info("QuantitativeCharacters handled: " + j);}
1066 1057

  
1067 1058
		}
1068
		return success;
1059
		return;
1069 1060
	}
1070 1061

  
1071
	private boolean handleTextCharacters(Namespace sddNamespace, SDDImportConfigurator sddConfig, Element elCharacters) {
1072
		boolean success = true;
1062
	private void handleTextCharacters(Namespace sddNamespace, SDDImportState cdmState, Element elCharacters) {
1073 1063
		int j;
1074 1064
		// <TextCharacter id="c3">
1075 1065
		List<Element> elTextCharacters = elCharacters.getChildren("TextCharacter", sddNamespace);
......
1086 1076
				// </Representation>
1087 1077
				Feature textCharacter = Feature.NewInstance();
1088 1078
				textCharacter.setKindOf(Feature.DESCRIPTION());
1089
				importRepresentation(elTextCharacter, sddNamespace, textCharacter, idTC, sddConfig);
1079
				importRepresentation(elTextCharacter, sddNamespace, textCharacter, idTC, cdmState);
1090 1080

  
1091 1081
				textCharacter.setSupportsTextData(true);
1092 1082

  
......
1095 1085
			} catch (Exception e) {
1096 1086
				//FIXME
1097 1087
				logger.warn("Import of TextCharacter " + j + " failed.");
1098
				success = false; 
1088
				cdmState.setUnsuccessfull();
1099 1089
			}
1100 1090

  
1101 1091
			if ((++j % modCount) == 0){ logger.info("TextCharacters handled: " + j);}
1102 1092

  
1103 1093
		}
1104
		return success;
1094
		return;
1105 1095
	}
1106 1096

  
1107 1097
	// imports the descriptions of taxa
1108
	protected boolean importCodedDescriptions(Element elDataset, Namespace sddNamespace, SDDImportConfigurator sddConfig){
1109
		boolean success = true;
1110
		
1098
	protected void importCodedDescriptions(Element elDataset, Namespace sddNamespace, SDDImportState cdmState){
1099
				
1111 1100
		// <CodedDescriptions>
1112 1101
		logger.info("start CodedDescriptions ...");
1113 1102
		Element elCodedDescriptions = elDataset.getChild("CodedDescriptions",sddNamespace);
......
1118 1107
			int j = 0;
1119 1108
			//for each CodedDescription
1120 1109
			for (Element elCodedDescription : listCodedDescriptions){
1121
				success &= handleCodedDescription(sddNamespace, sddConfig, elCodedDescription, j);
1110
				handleCodedDescription(sddNamespace, cdmState, elCodedDescription, j);
1122 1111
				if ((++j % modCount) == 0){ logger.info("CodedDescriptions handled: " + j);}
1123 1112
			}
1124 1113
		}
1125
		return success;
1114
		return;
1126 1115
	}
1127 1116

  
1128 1117
	/**
......
1132 1121
	 * @param elCodedDescription
1133 1122
	 * @return
1134 1123
	 */
1135
	private boolean handleCodedDescription(Namespace sddNamespace, SDDImportConfigurator sddConfig, Element elCodedDescription, int j) {
1136
		boolean success = true ;
1124
	private void handleCodedDescription(Namespace sddNamespace, SDDImportState cdmState, Element elCodedDescription, int j) {
1137 1125
		try {
1138 1126

  
1139 1127
			String idCD = elCodedDescription.getAttributeValue("id");
......
1146 1134
				Annotation annotation = Annotation.NewInstance(generatorName, AnnotationType.TECHNICAL(),Language.DEFAULT());
1147 1135
				taxonDescription.addAnnotation(annotation);
1148 1136
			}
1149
			importRepresentation(elCodedDescription, sddNamespace, taxonDescription, idCD, sddConfig);
1137
			importRepresentation(elCodedDescription, sddNamespace, taxonDescription, idCD, cdmState);
1150 1138

  
1151 1139
			// <Scope>
1152 1140
			//  <TaxonName ref="t1"/>
......
1155 1143
			Element elScope = elCodedDescription.getChild("Scope", sddNamespace);
1156 1144
			Taxon taxon;
1157 1145
			if (elScope != null) {
1158
				taxon = handleCDScope(sddNamespace, sddConfig, idCD, elScope);
1146
				taxon = handleCDScope(sddNamespace, cdmState, idCD, elScope);
1159 1147
			} else {//in case no taxon is linked to the description, a new one is created
1160
				taxon = handleCDNoScope(sddNamespace, sddConfig, elCodedDescription);
1148
				taxon = handleCDNoScope(sddNamespace, cdmState, elCodedDescription);
1161 1149
			}
1162 1150

  
1163 1151
			// <SummaryData>
......
1181 1169
		} catch (Exception e) {
1182 1170
			//FIXME
1183 1171
			logger.warn("Import of CodedDescription " + j + " failed.", e);
1184
			success = false;
1172
			cdmState.setUnsuccessfull();
1185 1173
		}
1186
		return success;
1174
		return;
1187 1175
	}
1188 1176

  
1189 1177
	/**
......
1193 1181
	 * @param taxon
1194 1182
	 * @return
1195 1183
	 */
1196
	private Taxon handleCDNoScope(Namespace sddNamespace,
1197
			SDDImportConfigurator sddConfig, Element elCodedDescription	) {
1184
	private Taxon handleCDNoScope(Namespace sddNamespace, SDDImportState cdmState, Element elCodedDescription	) {
1198 1185
		Taxon taxon = null;
1199 1186
		NonViralName nonViralName = NonViralName.NewInstance(null);
1200 1187
		String id = new String("" + taxonNamesCount);
1201 1188
		IdentifiableSource source = IdentifiableSource.NewInstance(id, "TaxonName");
1202
		importRepresentation(elCodedDescription, sddNamespace, nonViralName, id, sddConfig);
1189
		importRepresentation(elCodedDescription, sddNamespace, nonViralName, id, cdmState);
1203 1190
		
1204
		if(sddConfig.isDoMatchTaxa()){
1191
		if(cdmState.getConfig().isDoMatchTaxa()){
1205 1192
			taxon = getTaxonService().findBestMatchingTaxon(nonViralName.getTitleCache());
1206 1193
		}
1207 1194
		
......
1228 1215
	 * @param taxon
1229 1216
	 * @return
1230 1217
	 */
1231
	private Taxon handleCDScope(Namespace sddNamespace, SDDImportConfigurator sddConfig, 
1218
	private Taxon handleCDScope(Namespace sddNamespace, SDDImportState cdmState, 
1232 1219
			String idCD, Element elScope) {
1233 1220
		Taxon taxon = null;
1234 1221
		Element elTaxonName = elScope.getChild("TaxonName", sddNamespace);
1235 1222
		String ref = elTaxonName.getAttributeValue("ref");
1236 1223
		NonViralName nonViralName = taxonNameBases.get(ref);
1237 1224
		
1238
		if(sddConfig.isDoMatchTaxa()){
1225
		if(cdmState.getConfig().isDoMatchTaxa()){
1239 1226
			taxon = getTaxonService().findBestMatchingTaxon(nonViralName.getTitleCache());
1240 1227
		}
1241 1228
		
......
1416 1403
	}
1417 1404

  
1418 1405
	// imports the persons associated with the dataset creation, modification, related publications
1419
	protected void importAgents(Element elDataset, Namespace sddNamespace, SDDImportConfigurator sddConfig, boolean success){
1406
	protected void importAgents(Element elDataset, Namespace sddNamespace, SDDImportState cdmState){
1420 1407
		// <Agents>
1421 1408
		logger.info("start Agents ...");
1422 1409
		Element elAgents = elDataset.getChild("Agents",sddNamespace);
......
1436 1423
					//   <Detail role="Description">Ali Baba is also known as r.a.m.</Detail>
1437 1424
					//  </Representation>
1438 1425
					Person person = Person.NewInstance();
1439
					importRepresentation(elAgent, sddNamespace, person, idA, sddConfig);
1426
					importRepresentation(elAgent, sddNamespace, person, idA, cdmState);
1440 1427
					person.addSource(IdentifiableSource.NewInstance(idA, "Agent"));
1441 1428

  
1442 1429
					/*XIM <Links>
......
1483 1470
				} catch (Exception e) {
1484 1471
					//FIXME
1485 1472
					logger.warn("Import of Agent " + j + " failed.");
1486
					success = false; 
1473
					cdmState.setUnsuccessfull(); 
1487 1474
				}
1488 1475

  
1489 1476
				if ((++j % modCount) == 0){ logger.info("Agents handled: " + j);}
......
1493 1480
	}
1494 1481

  
1495 1482
	// imports publications related with the data set
1496
	protected void importPublications(Element elDataset, Namespace sddNamespace, SDDImportConfigurator sddConfig, boolean success){
1483
	protected void importPublications(Element elDataset, Namespace sddNamespace, SDDImportState cdmState){
1497 1484
		/* <Publications>
1498 1485
			  <Publication id="p112">
1499 1486
			    <Representation>
......
1517 1504

  
1518 1505
					String idP = elPublication.getAttributeValue("id");
1519 1506
					Reference publication = ReferenceFactory.newArticle();
1520
					importRepresentation(elPublication, sddNamespace, publication, idP, sddConfig);
1507
					importRepresentation(elPublication, sddNamespace, publication, idP, cdmState);
1521 1508

  
1522 1509
					publications.put(idP,publication);
1523 1510

  
1524 1511
				} catch (Exception e) {
1525 1512
					logger.warn("Import of Publication " + j + " failed.");
1526
					success = false; 
1513
					cdmState.setUnsuccessfull();
1527 1514
				}
1528 1515

  
1529 1516
				if ((++j % modCount) == 0){ logger.info("Publications handled: " + j);}
......
1533 1520
	}
1534 1521

  
1535 1522
	// imports media objects such as images //FIXME check mediaobj
1536
	protected void importMediaObjects(Element elDataset, Namespace sddNamespace, SDDImportConfigurator sddConfig, boolean success){
1523
	protected void importMediaObjects(Element elDataset, Namespace sddNamespace, SDDImportState cdmState){
1537 1524
		// <MediaObjects>
1538 1525
		logger.info("start MediaObjects ...");
1539 1526
		Element elMediaObjects = elDataset.getChild("MediaObjects",sddNamespace);
......
1554 1541
					//   <Label>Image description, e.g. to be used for alt-attribute in html.</Label>
1555 1542
					//  </Representation>
1556 1543
					Media media = Media.NewInstance();
1557
					importRepresentation(elMO, sddNamespace, media, idMO, sddConfig);
1544
					importRepresentation(elMO, sddNamespace, media, idMO, cdmState);
1558 1545

  
1559 1546
					// <Type>Image</Type>
1560 1547
					// <Source href="http://test.edu/test.jpg"/>
......
1576 1563
								logger.error("Malformed URL", e);
1577 1564
							}
1578 1565
						} else {
1579
							String sns = sddConfig.getSourceNameString();
1566
							String sns = cdmState.getConfig().getSourceNameString();
1580 1567
							File f = new File(sns);
1581 1568
							File parent = f.getParentFile();
1582 1569
							String fi = parent.toString() + File.separator + href;
......
1632 1619
				} catch (Exception e) {
1633 1620
					//FIXME
1634 1621
					logger.warn("Could not attach MediaObject " + j + "(SDD: " + id + ") to several objects.");
1635
					success = false; 
1622
					cdmState.setUnsuccessfull();
1636 1623
				}
1637 1624

  
1638 1625
				if ((++j % modCount) == 0){ logger.info("MediaObjects handled: " + j);
......
1644 1631

  
1645 1632
	// imports the <DescriptiveConcepts> block ; DescriptiveConcepts are used as nodes in CharacterTrees and Characters as leaves
1646 1633
	// but since Modifiers can be linked to DescriptiveConcepts they are stored as features with a particular Marker
1647
	protected void importDescriptiveConcepts(Element elDataset, Namespace sddNamespace, SDDImportConfigurator sddConfig){
1634
	protected void importDescriptiveConcepts(Element elDataset, Namespace sddNamespace, SDDImportState state){
1648 1635
		/* <DescriptiveConcepts>
1649 1636
		      <DescriptiveConcept id="dc0">
1650 1637
			        <Representation>
......
1676 1663
					if (!id.equals("")) {
1677 1664
					//	 <Representation>
1678 1665
					//       <Label>Body</Label>
1679
					importRepresentation(elDescriptiveConcept, sddNamespace, feature, id, sddConfig);
1666
					importRepresentation(elDescriptiveConcept, sddNamespace, feature, id, state);
1680 1667
						features.put(id, feature);
1681 1668
						getTermService().save(feature);//XIM
1682 1669
						descriptiveConcepts.add(feature);
......
1688 1675
						for (Element elModifier : listModifiers) {
1689 1676
								Modifier modif = Modifier.NewInstance();
1690 1677
								String idmod = elModifier.getAttributeValue("id");
1691
								importRepresentation(elModifier, sddNamespace, modif, idmod, sddConfig);
1678
								importRepresentation(elModifier, sddNamespace, modif, idmod, state);
1692 1679
								termVocabularyState.addTerm(modif);
1693 1680
								//termVocabularyStates.add(termVocabularyState);
1694 1681
								getVocabularyService().save(termVocabularyState);//XIM
......
1709 1696
	}
1710 1697

  
1711 1698
	// imports the <CharacterTrees> block
1712
	protected void importCharacterTrees(Element elDataset, Namespace sddNamespace, SDDImportConfigurator sddConfig, boolean success){
1699
	protected void importCharacterTrees(Element elDataset, Namespace sddNamespace, SDDImportState cdmState){
1713 1700
		// <CharacterTrees>
1714 1701
		logger.info("start CharacterTrees ...");
1715 1702
		Element elCharacterTrees = elDataset.getChild("CharacterTrees",sddNamespace);
......
1724 1711
					//Element elDesignedFor = elCharacterTree.getChild("DesignedFor",sddNamespace);//TODO ?
1725 1712

  
1726 1713
					FeatureTree featureTree =  FeatureTree.NewInstance();
1727
					importRepresentation(elCharacterTree, sddNamespace, featureTree, "", sddConfig);
1714
					importRepresentation(elCharacterTree, sddNamespace, featureTree, "", cdmState);
1728 1715
					FeatureNode root = featureTree.getRoot();
1729 1716
					List<Element> listeOfNodes = elCharacterTree.getChildren("Nodes", sddNamespace);
1730 1717

  
......
1743 1730

  
1744 1731
				catch (Exception e) {
1745 1732
					logger.warn("Import of Character tree " + j + " failed.");
1746
					success = false; 
1733
					cdmState.setUnsuccessfull();
1747 1734
				}
1748 1735
				if ((++j % modCount) == 0){ logger.info("CharacterTrees handled: " + j);}
1749 1736

  
......
1852 1839
	}
1853 1840

  
1854 1841
	// imports the <TaxonHierarchies> block
1855
	protected void importTaxonHierarchies(Element elDataset, Namespace sddNamespace, SDDImportConfigurator sddConfig, boolean success){
1842
	protected void importTaxonHierarchies(Element elDataset, Namespace sddNamespace, SDDImportState cdmState){
1856 1843

  
1857 1844
		logger.info("start TaxonHierarchies ...");
1858 1845
		Element elTaxonHierarchies = elDataset.getChild("TaxonHierarchies",sddNamespace);
......
1865 1852
					Element elRepresentation = elTaxonHierarchy.getChild("Representation",sddNamespace);
1866 1853
					String label = (String)ImportHelper.getXmlInputValue(elRepresentation,"Label",sddNamespace);
1867 1854
						Classification classification =  Classification.NewInstance(label);
1868
						importRepresentation(elTaxonHierarchy, sddNamespace, classification, "", sddConfig);
1855
						importRepresentation(elTaxonHierarchy, sddNamespace, classification, "", cdmState);
1869 1856
					
1870 1857
						Set<TaxonNode> root = classification.getChildNodes();
1871 1858
						Element elNodes = elTaxonHierarchy.getChild("Nodes", sddNamespace); // There can be only one <Nodes> block for TaxonHierarchies
......
1901 1888
				catch (Exception e) {
1902 1889
					//FIXME
1903 1890
					logger.warn("Import of Taxon Hierarchy " + j + " failed.");
1904
					success = false; 
1891
					cdmState.setUnsuccessfull();
1905 1892
				}
1906 1893

  
1907 1894
				if ((++j % modCount) == 0){ logger.info("TaxonHierarchies handled: " + j);}
......
1913 1900
	
1914 1901
	
1915 1902
	// imports the <GeographicAreas> block 
1916
	protected void importGeographicAreas(Element elDataset, Namespace sddNamespace, SDDImportConfigurator sddConfig) {
1903
	protected void importGeographicAreas(Element elDataset, Namespace sddNamespace, SDDImportState cdmState) {
1917 1904
		Element elGeographicAreas = elDataset.getChild("GeographicAreas",sddNamespace);
1918 1905
		if (elGeographicAreas != null) {
1919 1906
			List<Element> listGeographicAreas = elGeographicAreas.getChildren("GeographicArea", sddNamespace);
......
1923 1910

  
1924 1911
				String id = elGeographicArea.getAttributeValue("id");
1925 1912
				NamedArea na = new NamedArea();
1926
				importRepresentation(elGeographicArea, sddNamespace, na, id, sddConfig);
1913
				importRepresentation(elGeographicArea, sddNamespace, na, id, cdmState);
1927 1914
				namedAreas.put(id,na);
1928 1915
								}
1929 1916
			if ((++j % modCount) == 0){ logger.info("GeographicAreas handled: " + j);}

Also available in: Unified diff