Project

General

Profile

Revision de46e497

IDde46e4977ada2f9461b9a582f44cddae15004117
Parent 3d375614
Child fdf26591

Added by Alexander Oppermann over 8 years ago

View differences:

.gitattributes
377 377
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/dwca/out/DwcaZipExport.java -text
378 378
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/dwca/out/IDwcaAreaRecord.java -text
379 379
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/dwca/out/TermMapping.java -text
380
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/excel/bfn/ExcelMapReader.java -text
381
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/excel/bfn/ExcelRecordStream.java -text
382
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/excel/bfn/ExcelStreamImport.java -text
383
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/excel/bfn/ExcelStreamImportConfigurator.java -text
384
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/excel/bfn/ExcelStreamImportState.java -text
385
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/excel/bfn/ExcelToStreamConverter.java -text
386 380
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/excel/common/ExcelImportConfiguratorBase.java -text
387 381
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/excel/common/ExcelImportState.java -text
388 382
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/excel/common/ExcelImporterBase.java -text
......
550 544
cdmlib-io/src/test/java/eu/etaxonomy/cdm/io/dwca/in/DatabaseMappingTest.java -text
551 545
cdmlib-io/src/test/java/eu/etaxonomy/cdm/io/dwca/in/DwcaImportIntegrationTest.java -text
552 546
cdmlib-io/src/test/java/eu/etaxonomy/cdm/io/dwca/in/DwcaZipToStreamConverterTest.java -text
553
cdmlib-io/src/test/java/eu/etaxonomy/cdm/io/excel/bfn/ExcelStreamImportTest.java -text
554 547
cdmlib-io/src/test/java/eu/etaxonomy/cdm/io/excel/stream/ExcelStreamImportTest.java -text
555 548
cdmlib-io/src/test/java/eu/etaxonomy/cdm/io/excel/taxa/NormalExplicitImportTest.java -text
556 549
cdmlib-io/src/test/java/eu/etaxonomy/cdm/io/jaxb/AgentsTest.java -text
......
595 588
cdmlib-io/src/test/resources/eu/etaxonomy/cdm/io/dwca/in/description.txt -text
596 589
cdmlib-io/src/test/resources/eu/etaxonomy/cdm/io/dwca/in/meta.xml -text
597 590
cdmlib-io/src/test/resources/eu/etaxonomy/cdm/io/dwca/in/vernacular.txt -text
598
cdmlib-io/src/test/resources/eu/etaxonomy/cdm/io/excel/bfn/ExcelStreamImport-TestInput.xls -text
599
cdmlib-io/src/test/resources/eu/etaxonomy/cdm/io/excel/bfn/ExcelStreamImportTest.xml -text
600 591
cdmlib-io/src/test/resources/eu/etaxonomy/cdm/io/excel/stream/ExcelStreamImport-TestInput.xls -text
601 592
cdmlib-io/src/test/resources/eu/etaxonomy/cdm/io/excel/stream/ExcelStreamImportTest.xml -text
602 593
cdmlib-io/src/test/resources/eu/etaxonomy/cdm/io/excel/taxa/DenormalExplicit.xls -text
......
653 644
cdmlib-io/src/test/resources/eu/etaxonomy/cdm/io/sdd/varanusSDD_RatingExample_mod.xml -text
654 645
cdmlib-io/src/test/resources/eu/etaxonomy/cdm/io/sdd/wrongSDD.xml -text
655 646
cdmlib-io/src/test/resources/eu/etaxonomy/cdm/io/specimen/abcd206/in/SpecimenImportConfiguratorTest-input.xml -text
656
cdmlib-io/src/test/resources/eu/etaxonomy/cdm/io/specimen/excel/in/.~lock.ExcelSpecimenImportExampleTest-input.xls# -text
657 647
cdmlib-io/src/test/resources/eu/etaxonomy/cdm/io/specimen/excel/in/ExcelImportConfiguratorTest-input.xls -text
658 648
cdmlib-io/src/test/resources/eu/etaxonomy/cdm/io/specimen/excel/in/ExcelSpecimenImportExampleTest-input.xls -text
659 649
cdmlib-io/src/test/resources/eu/etaxonomy/cdm/io/specimen/excel/in/ExcelSpecimenImportExampleTest.testResultSet-result.xml -text
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/excel/bfn/ExcelMapReader.java
1
// $Id$
2
/**
3
* Copyright (C) 2009 EDIT
4
* European Distributed Institute of Taxonomy 
5
* http://www.e-taxonomy.eu
6
* 
7
* The contents of this file are subject to the Mozilla Public License Version 1.1
8
* See LICENSE.TXT at the top of this package for the full license terms.
9
*/
10
package eu.etaxonomy.cdm.io.excel.bfn;
11

  
12
import java.util.HashMap;
13
import java.util.List;
14
import java.util.Set;
15

  
16
import eu.etaxonomy.cdm.io.common.ObservableBase;
17
import eu.etaxonomy.cdm.io.common.events.IIoObserver;
18
import eu.etaxonomy.cdm.io.dwca.TermUri;
19
import eu.etaxonomy.cdm.io.stream.IItemStream;
20
import eu.etaxonomy.cdm.io.stream.StreamItem;
21

  
22
/**
23
 * @author a.oppermann
24
 * @date 24.05.2013
25
 *
26
 */
27
public class ExcelMapReader extends ObservableBase implements IItemStream {
28

  
29
	private List<HashMap<String, String>> innerStream;
30
	int index = 0;
31
	private TermUri termUri;
32
	private String streamLocation;
33
	
34
	/**
35
	 * @param innerStream
36
	 */
37
	public ExcelMapReader(List<HashMap<String, String>> innerStream, TermUri termUri, String streamLocation) {
38
		super();
39
		this.innerStream = innerStream;
40
		index = 0;
41
		this.termUri = termUri;
42
		this.streamLocation = streamLocation;
43
	}
44

  
45
	/* (non-Javadoc)
46
	 * @see eu.etaxonomy.cdm.io.dwca.in.IReader#read()
47
	 */
48
	@Override
49
	public StreamItem read() {
50
		HashMap<String, String> map = innerStream.get(index++);
51
		StreamItem item = convertMapToItem(map);
52
		return item;
53
	}
54

  
55
	/**
56
	 * @param map
57
	 * @return
58
	 */
59
	private StreamItem convertMapToItem(HashMap<String, String> map) {
60
		StreamItem result = new StreamItem(termUri, map, streamLocation);
61
		return result;
62
	}
63

  
64
	/* (non-Javadoc)
65
	 * @see eu.etaxonomy.cdm.io.dwca.in.IReader#hasNext()
66
	 */
67
	@Override
68
	public boolean hasNext() {
69
		return innerStream.size() > index;
70
	}
71

  
72
	/* (non-Javadoc)
73
	 * @see eu.etaxonomy.cdm.io.stream.IItemStream#getTerm()
74
	 */
75
	@Override
76
	public TermUri getTerm() {
77
		return termUri;
78
	}
79

  
80
	/* (non-Javadoc)
81
	 * @see eu.etaxonomy.cdm.io.stream.IItemStream#getItemLocation()
82
	 */
83
	@Override
84
	public String getItemLocation() {
85
		//FIXME better dont use ExcelUtils !!
86
		return "FIXME";
87
	}
88

  
89
	/* (non-Javadoc)
90
	 * @see eu.etaxonomy.cdm.io.stream.IItemStream#getStreamLocation()
91
	 */
92
	@Override
93
	public String getStreamLocation() {
94
		return streamLocation;
95
	}
96

  
97

  
98
}
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/excel/bfn/ExcelRecordStream.java
1
// $Id$
2
/**
3
* Copyright (C) 2009 EDIT
4
* European Distributed Institute of Taxonomy 
5
* http://www.e-taxonomy.eu
6
* 
7
* The contents of this file are subject to the Mozilla Public License Version 1.1
8
* See LICENSE.TXT at the top of this package for the full license terms.
9
*/
10
package eu.etaxonomy.cdm.io.excel.bfn;
11

  
12
import java.util.HashMap;
13
import java.util.Map;
14
import java.util.Set;
15

  
16
import org.apache.commons.lang.StringUtils;
17
import org.apache.log4j.Logger;
18
import org.apache.poi.hssf.usermodel.HSSFCell;
19
import org.apache.poi.hssf.usermodel.HSSFRow;
20
import org.apache.poi.hssf.usermodel.HSSFSheet;
21

  
22
import eu.etaxonomy.cdm.common.ExcelUtils;
23
import eu.etaxonomy.cdm.io.common.events.IIoObserver;
24
import eu.etaxonomy.cdm.io.dwca.TermUri;
25
import eu.etaxonomy.cdm.io.stream.IItemStream;
26
import eu.etaxonomy.cdm.io.stream.StreamItem;
27

  
28
/**
29
 * @author a.oppermann
30
 * @date 16.05.2013
31
 *
32
 */
33
public class ExcelRecordStream  implements IItemStream{
34
	private static Logger logger = Logger.getLogger(ExcelRecordStream.class);
35
	
36
	private ExcelStreamImportState state;
37
	
38
	private HSSFSheet sheet;
39
//	private ArchiveEntryBase archiveEntry;
40
	private TermUri term;
41
	private int line = 0;
42
	
43
	private Map<Integer,String> mapping;
44
	
45
	private StreamItem next;
46
	
47
	
48
	
49

  
50
	/**
51
	 * Constructor. 
52
	 * @param term 
53
	 */
54
	public ExcelRecordStream(ExcelStreamImportState state, HSSFSheet sheet, TermUri term) {
55
		this.state = state;
56
		this.sheet = sheet;
57
		this.term = term;
58
	}
59
	
60
	/* (non-Javadoc)
61
	 * @see eu.etaxonomy.cdm.io.dwca.in.IReader#read()
62
	 */
63
	@Override
64
	public StreamItem read() {
65
		//FIXME:
66
		return readMe();
67
	}
68

  
69
	/* (non-Javadoc)
70
	 * @see eu.etaxonomy.cdm.io.dwca.in.IReader#hasNext()
71
	 */
72
	@Override
73
	public boolean hasNext() {
74
		if (next != null){
75
			return true;
76
		}else{
77
			next = readMe();
78
			return (next != null);
79
		}
80
	}
81

  
82

  
83
	private StreamItem readMe() {
84
		StreamItem resultItem;
85
		if (next != null){
86
			resultItem = next;
87
			next = null;
88
			return resultItem;
89
		}else{
90
		
91
			if (mapping == null){
92
				mapping = getHeaderMapping(sheet.getRow(line++));
93
			}
94
	//		int rows = sheet.getPhysicalNumberOfRows();
95
			HSSFRow row = sheet.getRow(line++);
96
			int i = 0;
97
			while (row == null && i++ < 10){
98
				row = sheet.getRow(line++);
99
				continue;
100
			}
101
			if (row == null){
102
				return null;
103
			}else{
104
				int cells = row.getPhysicalNumberOfCells();
105
				logger.info("\nROW " + row.getRowNum() + " has " + cells + " cell(s).");
106
				Map<String, String> map = new HashMap<String, String>();
107
				
108
				for (int c :mapping.keySet()){
109
					HSSFCell cell = row.getCell(c);
110
					String value = ExcelUtils.getCellValue(cell);
111
					map.put(mapping.get(c), value);
112
					logger.info("CELL col=" + cell.getColumnIndex() + " VALUE=" + value);
113
				}
114
				
115
				resultItem = new StreamItem(term, map, String.valueOf(line));
116
				
117
				return resultItem;
118
			}
119
		}
120
	}
121
	
122
	/**
123
	 * @param row
124
	 * @return
125
	 */
126
	private Map<Integer,String> getHeaderMapping(HSSFRow row) {
127
		Map<Integer,String> result = new HashMap<Integer, String>();
128
		
129
		int cells = row.getPhysicalNumberOfCells();
130
		logger.info("\nROW " + row.getRowNum() + " has " + cells + " cell(s).");
131
		for (int c = 0; c < cells; c++) {
132
			HSSFCell cell = row.getCell(c);
133
			String value = ExcelUtils.getCellValue(cell);
134
			String termUri = convert2semanticKey(value);
135
			if (termUri != null){
136
				result.put(c, termUri);
137
			}else{
138
				//TODO fire Event
139
				String message = "No mapping defined for column %d '%s'";
140
				logger.warn(String.format(message, c + 1, value));
141
			}
142
		}
143
		
144
		return result;
145
	}
146

  
147
	/**
148
	 * @param value
149
	 * @return
150
	 */
151
	private String convert2semanticKey(String key) {
152
		if (key.equalsIgnoreCase("id")){
153
			return "id";
154
		}else if (key.equalsIgnoreCase("ParentId")){
155
			return TermUri.DWC_PARENT_NAME_USAGE_ID.getUriString();
156
		}else if (key.equalsIgnoreCase("NameStatus")){
157
			return TermUri.DWC_TAXONOMIC_STATUS.getUriString();
158
		}else if (key.equalsIgnoreCase("Rank")){
159
			return TermUri.DWC_TAXON_RANK.getUriString();
160
		}else if (key.equalsIgnoreCase("ScientificName")){
161
			return TermUri.DWC_SCIENTIFIC_NAME.getUriString();
162
		}else if (key.equalsIgnoreCase("Author")){
163
			return TermUri.DWC_SCIENTIFIC_NAME_AUTHORS.getUriString();
164
			//TODO Taxon Remarks
165
		}else if (key.equalsIgnoreCase("Comments")){
166
			return TermUri.DWC_TAXON_REMARKS.getUriString();
167
		}else if (key.equalsIgnoreCase("Language")){
168
			return TermUri.DC_LANGUAGE.getUriString();
169
		}else if (key.equalsIgnoreCase("TDWG_1")){
170
			return TermUri.DWC_COUNTRY_CODE.getUriString();
171
		}else if (key.equalsIgnoreCase("VernacularName")){
172
			return TermUri.DWC_VERNACULAR_NAME.getUriString();
173
		}else if (key.equalsIgnoreCase("ExternalId_sysCode")){
174
			return TermUri.CDM_SOURCE_IDINSOURCE.getUriString();
175
		}else if (key.equalsIgnoreCase("External_source")){
176
			return TermUri.CDM_SOURCE_REFERENCE.getUriString();
177
		}else if (key.equalsIgnoreCase("IdNamespace")){
178
			return TermUri.CDM_SOURCE_IDNAMESPACE.getUriString();
179
		}else{
180
			//TODO fire Event
181
			String message = "Key '%s' does not (yet) exist for import";
182
			logger.warn(String.format(message, key));
183
			return null;
184
		}
185
		
186
	//Language	TDWG_1	TDWG_2	VernacularName	SysCode
187
	
188
	}
189

  
190
	/* (non-Javadoc)
191
	 * @see eu.etaxonomy.cdm.io.stream.IItemStream#getTerm()
192
	 */
193
	@Override
194
	public TermUri getTerm() {
195
		return this.term;
196
	}
197

  
198
	/* (non-Javadoc)
199
	 * @see eu.etaxonomy.cdm.io.stream.IItemStream#getItemLocation()
200
	 */
201
	@Override
202
	public String getItemLocation() {
203
		// TODO Auto-generated method stub
204
		return null;
205
	}
206

  
207
	/* (non-Javadoc)
208
	 * @see eu.etaxonomy.cdm.io.stream.IItemStream#getStreamLocation()
209
	 */
210
	@Override
211
	public String getStreamLocation() {
212
		// TODO Auto-generated method stub
213
		return null;
214
	}
215

  
216
	/* (non-Javadoc)
217
	 * @see eu.etaxonomy.cdm.io.stream.IItemStream#addObservers(java.util.Set)
218
	 */
219
	@Override
220
	public void addObservers(Set<IIoObserver> observers) {
221
		// TODO Auto-generated method stub
222
		logger.warn("addObservers Not yet implemented");
223
	}
224
	
225
//******************** toString *******************************************
226

  
227
	/* (non-Javadoc)
228
	 * @see java.lang.Object#toString()
229
	 */
230
	@Override
231
	public String toString() {
232
		if (sheet != null && StringUtils.isNotBlank(sheet.getSheetName())){
233
			return sheet.getSheetName();
234
		}else{
235
			return super.toString();
236
		}
237
	}
238
	
239
	
240
	
241

  
242
}
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/excel/bfn/ExcelStreamImport.java
1
package eu.etaxonomy.cdm.io.excel.bfn;
2

  
3
import java.io.IOException;
4
import java.net.URI;
5
import java.util.ArrayList;
6
import java.util.HashMap;
7

  
8
import org.apache.http.HttpException;
9
import org.apache.log4j.Logger;
10
import org.springframework.stereotype.Component;
11

  
12
import eu.etaxonomy.cdm.io.dwca.TermUri;
13
import eu.etaxonomy.cdm.io.dwca.in.DwcTaxonCsv2CdmTaxonRelationConverter;
14
import eu.etaxonomy.cdm.io.dwca.in.DwcTaxonStreamItem2CdmTaxonConverter;
15
import eu.etaxonomy.cdm.io.dwca.in.DwcaDataImportBase;
16
import eu.etaxonomy.cdm.io.dwca.in.IPartitionableConverter;
17
import eu.etaxonomy.cdm.io.dwca.in.IReader;
18
import eu.etaxonomy.cdm.io.stream.StreamItem;
19
import eu.etaxonomy.cdm.model.common.CdmBase;
20

  
21
/**
22
 * 
23
 * @author a.oppermann
24
 * @date 08.05.2013
25
 *
26
 */
27
@Component
28
public class ExcelStreamImport extends DwcaDataImportBase<ExcelStreamImportConfigurator, ExcelStreamImportState>{
29
	private static final Logger logger = Logger.getLogger(ExcelStreamImport.class);
30

  
31
	private ArrayList<HashMap<String, String>> recordList = null;
32
	
33
	
34
	/* (non-Javadoc)
35
	 * @see eu.etaxonomy.cdm.io.common.CdmIoBase#doInvoke(eu.etaxonomy.cdm.io.common.IoStateBase)
36
	 */
37
	@Override
38
	protected void doInvoke(ExcelStreamImportState state) {
39
		
40
		makeSourceRef(state);
41
		URI source = state.getConfig().getSource();
42
		ExcelToStreamConverter<ExcelStreamImportState> excelStreamConverter = ExcelToStreamConverter.NewInstance(source);
43

  
44
		try {
45
			IReader<ExcelRecordStream> worksheetStream = excelStreamConverter.getWorksheetStream(state);
46
		
47
			while (worksheetStream.hasNext()){
48
				ExcelRecordStream recordStream = worksheetStream.read();
49
				try {
50
					handleSingleRecord(state, recordStream);
51
				} catch (Exception e) {
52
					String message = "Exception (%s) occurred while handling worksheet stream %s";
53
					message = String.format(message, e.getMessage(), recordStream.toString());
54
					fireWarningEvent (message, recordStream.toString(), 14);
55
				}
56
			}
57
			state.finish();
58
		} catch (IOException e1) {
59
			// TODO Auto-generated catch block
60
			e1.printStackTrace();
61
		} catch (HttpException e1) {
62
			// TODO Auto-generated catch block
63
			e1.printStackTrace();
64
		}
65
		
66
		return;
67
	}
68

  
69

  
70

  
71
	/* (non-Javadoc)
72
	 * @see eu.etaxonomy.cdm.io.dwca.in.StreamImportBase#getConverter(eu.etaxonomy.cdm.io.dwca.TermUri, eu.etaxonomy.cdm.io.dwca.in.StreamImportStateBase)
73
	 */
74
	@Override
75
	protected IPartitionableConverter<StreamItem, IReader<CdmBase>, String> getConverter(
76
			TermUri namespace, ExcelStreamImportState state) {
77
		
78
		
79
		if (namespace.equals(TermUri.DWC_TAXON)){
80
			if (! state.isTaxaCreated()){
81
				return new DwcTaxonStreamItem2CdmTaxonConverter(state);
82
			}else{
83
				return new DwcTaxonCsv2CdmTaxonRelationConverter(state);
84
			}
85
		}else{
86
			String message = "No converter available for %s";
87
			logger.error(String.format(message, namespace));
88
			return null;
89
		}
90
	}
91
	
92
	
93
	/* (non-Javadoc)
94
	 * @see eu.etaxonomy.cdm.io.common.CdmIoBase#doCheck(eu.etaxonomy.cdm.io.common.IoStateBase)
95
	 */
96
	@Override
97
	protected boolean doCheck(ExcelStreamImportState state) {
98
		return state.isCheck();
99
	}
100

  
101
	/* (non-Javadoc)
102
	 * @see eu.etaxonomy.cdm.io.common.CdmIoBase#isIgnore(eu.etaxonomy.cdm.io.common.IoStateBase)
103
	 */
104
	@Override
105
	protected boolean isIgnore(ExcelStreamImportState state) {
106
		return false;  //we only have 1 import class for excel stream import
107
	}
108

  
109
}
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/excel/bfn/ExcelStreamImportConfigurator.java
1
package eu.etaxonomy.cdm.io.excel.bfn;
2

  
3
import java.net.URI;
4

  
5
import org.apache.log4j.Logger;
6

  
7
import eu.etaxonomy.cdm.database.DbSchemaValidation;
8
import eu.etaxonomy.cdm.database.ICdmDataSource;
9
import eu.etaxonomy.cdm.io.common.IImportConfigurator;
10
import eu.etaxonomy.cdm.io.common.mapping.IInputTransformer;
11
import eu.etaxonomy.cdm.io.dwca.in.DwcaDataImportConfiguratorBase;
12
import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
13
/**
14
 * 
15
 * @author a.oppermann
16
 * @date 08.05.2013
17
 *
18
 */
19
public class ExcelStreamImportConfigurator extends DwcaDataImportConfiguratorBase<ExcelStreamImportState> implements IImportConfigurator {
20
	@SuppressWarnings("unused")
21
	private static final Logger logger = Logger.getLogger(ExcelStreamImportConfigurator.class);
22

  
23
	private static final String DEFAULT_REF_TITLE = "Excel Stream Import";
24

  
25
	
26
	private static IInputTransformer defaultTransformer = null;
27

  
28
	
29
	/**
30
	 * Factory method.
31
	 * @param uri
32
	 * @param destination
33
	 * @return
34
	 */
35
	public static ExcelStreamImportConfigurator NewInstance(URI uri, ICdmDataSource destination, NomenclaturalCode nomenclaturalCode, DbSchemaValidation dbSchemaValidation){
36
		return new ExcelStreamImportConfigurator(uri, destination, nomenclaturalCode, dbSchemaValidation);
37
	}
38
	
39
//	/**
40
//	 * @param transformer
41
//	 */
42
//	public ExcelStreamImportConfigurator(IInputTransformer transformer) {
43
//		super(transformer);
44
//	}
45

  
46
	/**
47
	 * Constructor.
48
	 * @param uri
49
	 * @param destination
50
	 */
51
	private ExcelStreamImportConfigurator(URI uri, ICdmDataSource destination, NomenclaturalCode nomenclaturalCode, DbSchemaValidation dbSchemaValidation) {
52
		super(uri, destination, defaultTransformer);
53
		setDbSchemaValidation(dbSchemaValidation);
54
		setNomenclaturalCode(nomenclaturalCode);	
55
	}
56
	
57
	/* (non-Javadoc)
58
	 * @see eu.etaxonomy.cdm.io.common.IImportConfigurator#getNewState()
59
	 */
60
	@Override
61
	public ExcelStreamImportState getNewState() {
62
		return new ExcelStreamImportState(this);
63
	}
64

  
65
	/* (non-Javadoc)
66
	 * @see eu.etaxonomy.cdm.io.common.ImportConfiguratorBase#makeIoClassList()
67
	 */
68
	@SuppressWarnings("unchecked")
69
	@Override
70
	protected void makeIoClassList() {
71
		ioClassList = new Class[]{
72
				ExcelStreamImport.class
73
		};
74
	}
75

  
76
	
77
	/* (non-Javadoc)
78
	 * @see eu.etaxonomy.cdm.io.dwca.in.StreamImportConfiguratorBase#getDefaultSourceReferenceTitle()
79
	 */
80
	@Override
81
	protected String getDefaultSourceReferenceTitle() {
82
		return DEFAULT_REF_TITLE;
83
	}
84

  
85
}
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/excel/bfn/ExcelStreamImportState.java
1
// $Id$
2
/**
3
* Copyright (C) 2007 EDIT
4
* European Distributed Institute of Taxonomy 
5
* http://www.e-taxonomy.eu
6
* 
7
* The contents of this file are subject to the Mozilla Public License Version 1.1
8
* See LICENSE.TXT at the top of this package for the full license terms.
9
*/
10

  
11
package eu.etaxonomy.cdm.io.excel.bfn;
12

  
13
import org.apache.log4j.Logger;
14

  
15
import eu.etaxonomy.cdm.io.dwca.in.DwcaDataImportStateBase;
16
import eu.etaxonomy.cdm.io.dwca.in.DwcaImportState;
17

  
18
/**
19
 * 
20
 * @author a.oppermann
21
 * @date 08.05.2013
22
 *
23
 *
24
 *<ROW extends ExcelRowBase>
25
 */
26
public class ExcelStreamImportState extends DwcaDataImportStateBase<ExcelStreamImportConfigurator>{
27
	@SuppressWarnings("unused")
28
	private static final Logger logger = Logger.getLogger(DwcaImportState.class);
29

  
30
	public ExcelStreamImportState(ExcelStreamImportConfigurator config) {
31
		super(config);
32
	}
33
	
34
}
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/excel/bfn/ExcelToStreamConverter.java
1
// $Id$
2
/**
3
* Copyright (C) 2009 EDIT
4
* European Distributed Institute of Taxonomy 
5
* http://www.e-taxonomy.eu
6
* 
7
* The contents of this file are subject to the Mozilla Public License Version 1.1
8
* See LICENSE.TXT at the top of this package for the full license terms.
9
*/
10
package eu.etaxonomy.cdm.io.excel.bfn;
11

  
12
import java.io.IOException;
13
import java.net.URI;
14
import java.util.ArrayList;
15
import java.util.HashMap;
16
import java.util.List;
17
import java.util.Map;
18

  
19
import org.apache.commons.lang.StringUtils;
20
import org.apache.http.HttpException;
21
import org.apache.log4j.Logger;
22
import org.apache.poi.hssf.usermodel.HSSFSheet;
23
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
24
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
25

  
26
import eu.etaxonomy.cdm.common.UriUtils;
27
import eu.etaxonomy.cdm.common.monitor.IProgressMonitor;
28
import eu.etaxonomy.cdm.io.dwca.TermUri;
29
import eu.etaxonomy.cdm.io.dwca.in.IReader;
30
import eu.etaxonomy.cdm.io.dwca.in.ListReader;
31

  
32
/**
33
 * This class transforms excel archive in to a InputStream.
34
 * 
35
 * @author a.oppermann
36
 * @date 16.05.2013
37
 *
38
 */
39
public class ExcelToStreamConverter<STATE extends ExcelStreamImportState> {
40
	
41
	private static Logger logger = Logger.getLogger(ExcelToStreamConverter.class);
42
	
43
	private URI source;
44
	
45
	/**
46
	 * 
47
	 * Factory
48
	 * @param source
49
	 * @return
50
	 */
51
	public static ExcelToStreamConverter<ExcelStreamImportState> NewInstance(URI source) {
52
		return new ExcelToStreamConverter<ExcelStreamImportState>(source);
53
	}
54

  
55
	/**
56
	 * Constructor
57
	 * @param source
58
	 */
59
	public ExcelToStreamConverter(URI source){
60
		this.source = source;
61
	}
62
	
63
	/**
64
	 * @param state
65
	 * @return
66
	 * @throws HttpException 
67
	 * @throws IOException 
68
	 */
69
	public IReader<ExcelRecordStream> getWorksheetStream(STATE state) throws IOException, HttpException{
70
		POIFSFileSystem fs = new POIFSFileSystem(UriUtils.getInputStream(source));
71
		HSSFWorkbook wb = new HSSFWorkbook(fs);
72
		
73
		Map<TermUri, Integer> map = new HashMap<TermUri, Integer>();
74
		for (int i = 0 ; i < wb.getNumberOfSheets(); i++){
75
			String wsName = wb.getSheetName(i);
76
			TermUri termUri = convertSheetName2TermUri(wsName);
77
			if (map.get(termUri) != null){
78
				String message = "Worksheet type exists more then once: %s";
79
				//TODO fire event
80
				logger.warn(String.format(message, termUri.toString()));
81
			}
82
			map.put(termUri, i);
83
		}
84
		
85
		//core
86
		List<ExcelRecordStream> streamList = new ArrayList<ExcelRecordStream>();
87
		TermUri term= TermUri.DWC_TAXON;
88
		Integer i = map.get(term);
89
		if (i != null){
90
			HSSFSheet ws = wb.getSheetAt(i);
91
			ExcelRecordStream excelRecordStream = new ExcelRecordStream(state, ws, term);
92
			streamList.add(excelRecordStream); //for taxa and names
93
		}else{
94
			String message = "Taxon worksheet not available for %s";
95
			logger.warn(String.format(message, "taxa"));
96
			state.setSuccess(false);
97
		} 
98
		
99
		//core relationships
100
		i = map.get(term);
101
		if (i != null){
102
			HSSFSheet ws = wb.getSheetAt(i);
103
			ExcelRecordStream excelRecordStream = new ExcelRecordStream(state, ws, term);
104
			streamList.add(excelRecordStream); //for relationships
105
		}else{
106
			String message = "Taxon worksheet not available for %s";
107
			logger.warn(String.format(message, "taxon relations"));
108
			state.setSuccess(false);
109
		} 
110
		
111
		return new ListReader<ExcelRecordStream>(streamList);
112
	}
113

  
114

  
115
	/**
116
	 * @param wsName
117
	 * @return
118
	 */
119
	private TermUri convertSheetName2TermUri(String wsName) {
120
		if (StringUtils.isBlank(wsName)){
121
			throw new IllegalArgumentException("Worksheet name must not be null or empty");
122
			//FIXME: Hard coded worksheet name should be avoided  
123
		}else if(wsName.equalsIgnoreCase("Sheet1")){
124
			return TermUri.DWC_TAXON;
125
		}else{
126
			String message = "Worksheet name %s not yet handled by %s";
127
			throw new IllegalArgumentException(String.format(message, wsName, this.getClass().getSimpleName()));
128
		}
129
	}
130

  
131
	public void warnProgress(STATE state, String message, Throwable e) {
132
        if(state.getConfig().getProgressMonitor() != null){
133
            IProgressMonitor monitor = state.getConfig().getProgressMonitor();
134
            if (e == null) {
135
                monitor.warning(message);
136
            }else{
137
                monitor.warning(message, e);
138
            }
139
        }
140
    }
141
	
142

  
143
	
144
}
cdmlib-io/src/test/java/eu/etaxonomy/cdm/io/excel/bfn/ExcelStreamImportTest.java
1
// $Id$
2
/**
3
* Copyright (C) 2007 EDIT
4
* European Distributed Institute of Taxonomy 
5
* http://www.e-taxonomy.eu
6
* 
7
* The contents of this file are subject to the Mozilla Public License Version 1.1
8
* See LICENSE.TXT at the top of this package for the full license terms.
9
*/
10

  
11
package eu.etaxonomy.cdm.io.excel.bfn;
12

  
13
import static org.junit.Assert.assertEquals;
14
import static org.junit.Assert.assertNotNull;
15
import static org.junit.Assert.assertTrue;
16

  
17
import java.net.URISyntaxException;
18
import java.net.URL;
19
import java.util.ArrayList;
20
import java.util.HashSet;
21
import java.util.Iterator;
22
import java.util.List;
23
import java.util.Set;
24
import java.util.UUID;
25

  
26
import junit.framework.Assert;
27

  
28
import org.apache.log4j.Logger;
29
import org.junit.Before;
30
import org.junit.Test;
31
import org.unitils.dbunit.annotation.DataSet;
32
import org.unitils.spring.annotation.SpringBeanByName;
33
import org.unitils.spring.annotation.SpringBeanByType;
34

  
35
import eu.etaxonomy.cdm.api.service.DescriptionServiceImpl;
36
import eu.etaxonomy.cdm.api.service.IClassificationService;
37
import eu.etaxonomy.cdm.api.service.IDescriptionService;
38
import eu.etaxonomy.cdm.api.service.INameService;
39
import eu.etaxonomy.cdm.api.service.ITaxonService;
40
import eu.etaxonomy.cdm.api.service.ITermService;
41
import eu.etaxonomy.cdm.io.common.CdmApplicationAwareDefaultImport;
42
import eu.etaxonomy.cdm.io.common.IImportConfigurator;
43
import eu.etaxonomy.cdm.io.common.events.LoggingIoObserver;
44
import eu.etaxonomy.cdm.model.common.AnnotatableEntity;
45
import eu.etaxonomy.cdm.model.common.Annotation;
46
import eu.etaxonomy.cdm.model.common.CdmBase;
47
import eu.etaxonomy.cdm.model.common.DescriptionElementSource;
48
import eu.etaxonomy.cdm.model.common.IdentifiableSource;
49
import eu.etaxonomy.cdm.model.common.Language;
50
import eu.etaxonomy.cdm.model.common.LanguageString;
51
import eu.etaxonomy.cdm.model.description.CommonTaxonName;
52
import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
53
import eu.etaxonomy.cdm.model.description.Distribution;
54
import eu.etaxonomy.cdm.model.description.Feature;
55
import eu.etaxonomy.cdm.model.description.TaxonDescription;
56
import eu.etaxonomy.cdm.model.description.TextData;
57
import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
58
import eu.etaxonomy.cdm.model.name.NonViralName;
59
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
60
import eu.etaxonomy.cdm.model.reference.Reference;
61
import eu.etaxonomy.cdm.model.taxon.Classification;
62
import eu.etaxonomy.cdm.model.taxon.Synonym;
63
import eu.etaxonomy.cdm.model.taxon.Taxon;
64
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
65
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
66
import eu.etaxonomy.cdm.test.integration.CdmTransactionalIntegrationTest;
67

  
68
/**
69
 * @author a.mueller
70
 * @created 24.05.2013
71
 */
72
public class ExcelStreamImportTest extends CdmTransactionalIntegrationTest{
73
	@SuppressWarnings("unused")
74
	private static final Logger logger = Logger.getLogger(ExcelStreamImportTest.class);
75

  
76
	@SpringBeanByName
77
	CdmApplicationAwareDefaultImport defaultImport;
78

  
79
	@SpringBeanByType
80
	INameService nameService;
81
	
82
	@SpringBeanByType
83
	ITaxonService taxonService;
84
	
85
	@SpringBeanByType
86
	ITermService termService;
87
	
88
	@SpringBeanByType
89
	IClassificationService classificationService;
90
	
91
	@SpringBeanByType
92
	IDescriptionService descriptionService;
93

  
94
	private IImportConfigurator configurator;
95
	private IImportConfigurator uuidConfigurator;
96
	
97
	@Before
98
	public void setUp() throws URISyntaxException {
99
		//TODO create own test file
100
		String inputFile = "/eu/etaxonomy/cdm/io/excel/bfn/ExcelStreamImport-TestInput.xls";
101
		URL url = this.getClass().getResource(inputFile);
102
	 	assertNotNull("URL for the test file '" + inputFile + "' does not exist", url);
103
		configurator = ExcelStreamImportConfigurator.NewInstance(url.toURI(), null, NomenclaturalCode.ICBN, null);
104
		assertNotNull("Configurator could not be created", configurator);
105
		configurator.addObserver(new LoggingIoObserver());
106
		
107
		inputFile = "/eu/etaxonomy/cdm/io/excel/taxa/NormalExplicitImportTest.testUuid-input.xls";
108
		url = this.getClass().getResource(inputFile);
109
	 	assertNotNull("URL for the test file '" + inputFile + "' does not exist", url);
110
		uuidConfigurator = ExcelStreamImportConfigurator.NewInstance(url.toURI(), null, NomenclaturalCode.ICBN, null);
111
		assertNotNull("Configurator could not be created", configurator);
112
		
113
	}
114
	
115
	@Test
116
	public void testInit() {
117
		assertNotNull("normalExplicitImport should not be null", defaultImport);
118
		assertNotNull("nameService should not be null", nameService);
119
	}
120
	
121
	@Test
122
	@DataSet
123
	public void testDoInvoke() {
124
//		printDataSet(System.out, new String[]{"ANNOTATION"});
125
		boolean result = defaultImport.invoke(configurator);
126
		assertTrue("Return value for import.invoke should be true", result);
127
		commitAndStartNewTransaction(new String[]{"TAXONNAMEBASE", "ANNOTATION"});
128
		assertEquals("Number of TaxonNames should be 10", 10 /*TODO */, nameService.count(null));
129
		List<Classification> treeList = classificationService.list(null, null,null,null,null);
130
		assertEquals("Number of classifications should be 1", 1, treeList.size());
131
		Classification tree = treeList.get(0);
132
		Set<TaxonNode> rootNodes = tree.getChildNodes();
133
		assertEquals("Number of root nodes should be 1", 1, rootNodes.size());
134
		TaxonNode rootNode = rootNodes.iterator().next();
135
		
136
//		printDataSet(System.out, new String[]{"ANNOTATION"});
137
		Set<Annotation> annotationSet = rootNode.getTaxon().getAnnotations();
138
		assertTrue("Annotation is set for first Taxon", !annotationSet.isEmpty()); 
139

  
140
		assertEquals("Root taxon name should be Metazoa", "Metazoa", rootNode.getTaxon().getName().getTitleCache());
141
		TaxonNode secondTaxon = rootNode.getChildNodes().iterator().next();
142

  
143
		Set<Annotation> secondAnnotation = secondTaxon.getTaxon().getAnnotations();
144
		assertTrue("Annotation is empty for second Taxon", secondAnnotation.isEmpty()); 
145
		
146
		Set<TaxonDescription> taxonSet = secondTaxon.getTaxon().getDescriptions();
147
		assertTrue("Description is not Empty", !taxonSet.isEmpty());
148
		assertEquals("Number of Distributions should be 7", 7, descriptionService.listDescriptionElements(null, null, Distribution.class, null, null, null).size());
149
//		assertEquals("Number of Vernecular Names should be 7", 6, descriptionService.listDescriptionElements(null, null, CommonTaxonName.class, null, null, null).size());
150
		List<DescriptionElementBase> list = descriptionService.listDescriptionElements(null, null, CommonTaxonName.class, null, null, null);
151
		for(DescriptionElementBase db : list){
152
			System.out.println(db.toString());
153
		}
154
		//TODO: write test for Refences Sources
155
		Set<IdentifiableSource> sourcesSet = secondTaxon.getTaxon().getSources();
156
		assertTrue("Sources are set for second Taxon", !sourcesSet.isEmpty());
157
		for(IdentifiableSource s : sourcesSet){
158
			System.out.println(s.getId());
159
			System.out.println(s.getIdInSource());
160
			System.out.println(s.getIdNamespace());
161
			System.out.println(s.getCitation().toString());
162
		}
163
		
164
		//		assertEquals("Arthropoda node taxon name should be Arthropoda", "Arthropoda", arthropodaNode.getTaxon().getName().getTitleCache());
165
//		TaxonNode insectaNode = arthropodaNode.getChildNodes().iterator().next();
166
//		TaxonNode lepidopteraNode = insectaNode.getChildNodes().iterator().next();
167
//		TaxonNode noctuidaeNode = lepidopteraNode.getChildNodes().iterator().next();
168
//		TaxonNode noctuaNode = noctuidaeNode.getChildNodes().iterator().next();
169
//		assertEquals("Number of child nodes of noctuca should be 2", 2, noctuaNode.getChildNodes().size());
170
//		
171
//		Iterator<TaxonNode> it = noctuaNode.getChildNodes().iterator();
172
//		TaxonNode childNode1 = it.next();
173
//		TaxonNode childNode2 = it.next();
174
//		
175
//		TaxonNode noctuaPronubaNode;
176
//		if (childNode1.getTaxon().getName().getTitleCache().startsWith("Noctua pronuba")){
177
//			noctuaPronubaNode = childNode1;
178
//		}else{
179
//			noctuaPronubaNode = childNode2;
180
//		}
181
//		
182
//		assertEquals("Noctua pronuba taxon name should be ", "Noctua pronuba", noctuaPronubaNode.getTaxon().getName().getTitleCache());
183
//		Taxon noctuaPronubaTaxon = noctuaPronubaNode.getTaxon();
184
//		Set<Synonym> synonyms = noctuaPronubaTaxon.getSynonyms();
185
//		assertEquals("Number of synonyms should be 1", 3 /*TODO*/, synonyms.size());
186
//		Synonym synonym = synonyms.iterator().next();
187
//		assertEquals("Synonym name should be ", "Noctua atlantica", (CdmBase.deproxy(synonym.getName(), NonViralName.class )).getNameCache());
188
//		Set<TaxonDescription> descriptions = noctuaPronubaTaxon.getDescriptions();
189
//		Assert.assertEquals("Number of descriptions should be 1", 1, descriptions.size());
190
//		TaxonDescription taxonDescription = descriptions.iterator().next();
191
//		Set<DescriptionElementBase> elements = taxonDescription.getElements();
192
//		List<CommonTaxonName> commonNames = new ArrayList<CommonTaxonName>();
193
//		for (DescriptionElementBase element : elements){
194
//			if (element.isInstanceOf(CommonTaxonName.class)){
195
//				commonNames.add((CommonTaxonName)element);
196
//			}
197
//		}
198
//		Assert.assertEquals("Number of common names should be 2", 2, commonNames.size());
199
//		Set<String> commonNameStrings = new HashSet<String>();
200
//		commonNameStrings.add(commonNames.get(0).getName());
201
//		commonNameStrings.add(commonNames.get(1).getName());
202
//		Assert.assertTrue("Common names must include Yellow Underwing", commonNameStrings.contains("Large Sunshine Underwing"));
203
//		Assert.assertTrue("Common names must include Yellow Underwing", commonNameStrings.contains("Yellow Underwing"));
204
	}
205
	
206
//	@Test
207
//	@DataSet(value="NormalExplicitImportTest.testUuid.xml")
208
//	public void testUUID() throws URISyntaxException{
209
//		UUID taxonUuid = UUID.fromString("aafce7fe-0c5f-42ed-814b-4c7c2c715660");
210
//		UUID synonymUuid = UUID.fromString("fc4a995b-37a9-4984-afe6-e352c6c04d92");
211
//		
212
//		
213
//		//test data set
214
//		assertEquals("Number of taxon bases should be 2", 2, taxonService.count(null));
215
//		Taxon taxon = (Taxon)taxonService.find(taxonUuid);
216
//		assertNotNull("Taxon with given uuid should exist", taxon);
217
//		assertEquals("Taxon should have no description", 0, taxon.getDescriptions().size());
218
//		Synonym synonym = (Synonym)taxonService.find(synonymUuid);
219
//		assertNotNull("Synonym with given uuid should exist", synonym);
220
//		assertEquals("Synonym should have 1 accepted taxon", 1, synonym.getAcceptedTaxa().size());
221
//		
222
//		//import
223
//		boolean result = defaultImport.invoke(uuidConfigurator);
224
//		//test result
225
//		assertTrue("Return value for import.invoke should be true", result);
226
//		assertEquals("Number of taxon names should be 2", 2, nameService.count(null));
227
//		assertEquals("Number of taxa should be 2", 2, taxonService.count(null));
228
//		taxon = (Taxon)taxonService.find(taxonUuid);
229
//		assertEquals("Taxon should have 1 description", 1, taxon.getDescriptions().size());
230
//		TaxonDescription description = taxon.getDescriptions().iterator().next();
231
//		assertEquals("Number of description elements should be 2", 2, description.getElements().size());
232
//		
233
//		String expectedText = "Description for the first taxon";
234
//		TextData textData = getTextElement(description, expectedText);
235
//		assertNotNull("The element should exists", textData);
236
//		Feature feature = textData.getFeature();
237
//		assertEquals("Unexpected feature", Feature.DESCRIPTION(), feature);
238
//		assertEquals("There should be exactly 1 language", 1,textData.getMultilanguageText().size());
239
//		Language language = textData.getMultilanguageText().keySet().iterator().next();
240
//		assertEquals("Language should be German", Language.GERMAN(), language);
241
//		String text = textData.getText(language);
242
//		assertEquals("Unexpected description text", expectedText, text);
243
//		assertEquals("Number of source elements should be 1", 1, textData.getSources().size());
244
//		DescriptionElementSource source = textData.getSources().iterator().next();
245
//		Reference ref = source.getCitation();
246
//		assertNotNull("Citation should not be null", ref);
247
//		assertNotNull("AuthorTeam should not be null", ref.getAuthorTeam());
248
//		assertEquals("Source author should be 'Meyer et. al.'", "Meyer et. al.",ref.getAuthorTeam().getTitleCache());
249
//		assertEquals("Publication title should be 'My first book'", "My first book", ref.getTitle());
250
//		assertEquals("Publication year should be '1987'", "1987", ref.getYear());
251
//		TaxonNameBase nameUsedInSource = source.getNameUsedInSource();
252
//		assertNotNull("Name used in source should not be null", nameUsedInSource);
253
//		assertEquals("Name used in source title should be ", "Abies", nameUsedInSource.getTitleCache());
254
//		
255
//		
256
//		//synonym
257
//		expectedText = "A synonym description";
258
//		textData = getTextElement(description, expectedText);
259
//		assertNotNull("The element should exists", textData);
260
//		feature = textData.getFeature();
261
//		assertEquals("Unexpected feature", Feature.DESCRIPTION(), feature);
262
//		assertEquals("There should be exactly 1 language", 1,textData.getMultilanguageText().size());
263
//		language = textData.getMultilanguageText().keySet().iterator().next();
264
//		assertEquals("Language should be Spanish", Language.SPANISH_CASTILIAN(), language);
265
//		text = textData.getText(language);
266
//		assertEquals("Unexpected description text", expectedText, text);
267
//		assertEquals("Number of source elements should be 1", 1, textData.getSources().size());
268
//		source = textData.getSources().iterator().next();
269
//		ref = source.getCitation();
270
//		assertNotNull("Citation should not be null", ref);
271
//		assertNotNull("AuthorTeam should not be null", ref.getAuthorTeam());
272
//		assertEquals("Source author should be 'Theys, A.'", "Theys, A.",ref.getAuthorTeam().getTitleCache());
273
//		assertEquals("Publication title should be 'The ultimate book'", "The ultimate book", ref.getTitle());
274
//		assertEquals("Publication year should be '2011'", "2011", ref.getYear());
275
//		nameUsedInSource = source.getNameUsedInSource();
276
//		assertNotNull("Name used in source should not be null", nameUsedInSource);
277
//		assertEquals("Name used in source title should be Pinus", "Pinus", nameUsedInSource.getTitleCache());
278
//		
279
//	}
280

  
281
	/**
282
	 * Returns description element for record id 1
283
	 * @param description
284
	 * @return
285
	 */
286
	private TextData getTextElement(TaxonDescription description, String descriptionText) {
287
		for (DescriptionElementBase element : description.getElements()){
288
			if (element.isInstanceOf(TextData.class)){
289
				TextData textData = CdmBase.deproxy(element, TextData.class);
290
				for (LanguageString ls :textData.getMultilanguageText().values()){
291
					if (ls.getText().equals(descriptionText)){
292
						return textData;
293
					}
294
				}
295
			}
296
		}
297
		return null;
298
	}
299

  
300
}
cdmlib-io/src/test/resources/eu/etaxonomy/cdm/io/excel/bfn/ExcelStreamImportTest.xml
1
<?xml version='1.0' encoding='UTF-8'?>
2
<dataset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../dataset.xsd">
3
<!--  <TAXONBASE DTYPE="Taxon" ID="4" CREATED="2009-02-03 17:52:26.0" UUID="aafce7fe-0c5f-42ed-814b-4c7c2c715660" TITLECACHE="Abies sec. ???" PROTECTEDTITLECACHE="false" DOUBTFUL="false" TAXONSTATUSUNKNOWN="false" TAXONOMICCHILDRENCOUNT="0" TAXONNAME_FK="4"/>-->
4
<!--  <TAXONBASE DTYPE="Taxon" ID="5" CREATED="2009-02-03 17:52:26.0" UUID="5c1a3d10-3a32-45d1-a5ae-1e982533b79f" TITLECACHE="Abies alba sec. ???" PROTECTEDTITLECACHE="false" DOUBTFUL="false" TAXONSTATUSUNKNOWN="false" TAXONOMICCHILDRENCOUNT="0" TAXONNAME_FK="5"/>-->
5
<!--  <TAXONBASE DTYPE="Synonym" ID="6" CREATED="2009-02-03 17:52:26.0" UUID="4de9d002-d68c-49af-84f1-7f9eddaa1226" TITLECACHE="Abies alba sec. ???" PROTECTEDTITLECACHE="false" DOUBTFUL="false" TAXONNAME_FK="6"/>-->
6
<!--  <TAXONNAMEBASE DTYPE="BotanicalName" ID="1" CREATED="2009-02-03 17:52:26.0" UUID="88fab5b3-0d9a-42c3-9915-71fc17266116" TITLECACHE="" PROTECTEDTITLECACHE="false" PARSINGPROBLEM="0" FULLTITLECACHE="" PROBLEMENDS="-1" PROBLEMSTARTS="-1" PROTECTEDFULLTITLECACHE="false" AUTHORSHIPCACHE="" NAMECACHE="" PROTECTEDAUTHORSHIPCACHE="false" PROTECTEDNAMECACHE="false" ANAMORPHIC="false" BINOMHYBRID="false" HYBRIDFORMULA="false" MONOMHYBRID="false" TRINOMHYBRID="false" HOMOTYPICALGROUP_ID="1"/>-->
7
<!--  <TAXONNAMEBASE DTYPE="BotanicalName" ID="2" CREATED="2009-02-03 17:52:26.0" UUID="984e4304-57b0-4ce8-8f94-7c39be7396d9" TITLECACHE="Abies" PROTECTEDTITLECACHE="false" PARSINGPROBLEM="0" FULLTITLECACHE="Abies" PROBLEMENDS="-1" PROBLEMSTARTS="-1" PROTECTEDFULLTITLECACHE="false" AUTHORSHIPCACHE="" GENUSORUNINOMIAL="Abies" NAMECACHE="Abies" PROTECTEDAUTHORSHIPCACHE="false" PROTECTEDNAMECACHE="false" ANAMORPHIC="false" BINOMHYBRID="false" HYBRIDFORMULA="false" MONOMHYBRID="false" TRINOMHYBRID="false" HOMOTYPICALGROUP_ID="2" RANK_ID="774"/>-->
8
<!--  <TAXONNAMEBASE DTYPE="BotanicalName" ID="3" CREATED="2009-02-03 17:52:26.0" UUID="a7e666e7-0d96-4284-9cc4-8e5ccc3b9a36" TITLECACHE="Abies alba" PROTECTEDTITLECACHE="false" PARSINGPROBLEM="0" FULLTITLECACHE="Abies alba" PROBLEMENDS="-1" PROBLEMSTARTS="-1" PROTECTEDFULLTITLECACHE="false" AUTHORSHIPCACHE="" GENUSORUNINOMIAL="Abies" NAMECACHE="Abies alba" PROTECTEDAUTHORSHIPCACHE="false" PROTECTEDNAMECACHE="false" SPECIFICEPITHET="alba" ANAMORPHIC="false" BINOMHYBRID="false" HYBRIDFORMULA="false" MONOMHYBRID="false" TRINOMHYBRID="false" HOMOTYPICALGROUP_ID="3" RANK_ID="765"/>-->
9
<!--  <TAXONNAMEBASE DTYPE="BotanicalName" ID="4" CREATED="2009-02-03 17:52:26.0" UUID="ebd459a6-52ec-4f7c-a520-32c82aa31011" TITLECACHE="Abies" PROTECTEDTITLECACHE="false" PARSINGPROBLEM="0" FULLTITLECACHE="Abies" PROBLEMENDS="-1" PROBLEMSTARTS="-1" PROTECTEDFULLTITLECACHE="false" AUTHORSHIPCACHE="" GENUSORUNINOMIAL="Abies" NAMECACHE="Abies" PROTECTEDAUTHORSHIPCACHE="false" PROTECTEDNAMECACHE="false" ANAMORPHIC="false" BINOMHYBRID="false" HYBRIDFORMULA="false" MONOMHYBRID="false" TRINOMHYBRID="false" HOMOTYPICALGROUP_ID="4" RANK_ID="774" COMBINATIONAUTHORTEAM_ID="1"/>-->
10
<!--  <TAXONNAMEBASE DTYPE="BotanicalName" ID="5" CREATED="2009-02-03 17:52:26.0" UUID="5d74500b-9fd5-4d18-b9cd-cc1c8a372fec" TITLECACHE="Abies alba" PROTECTEDTITLECACHE="false" PARSINGPROBLEM="0" FULLTITLECACHE="Abies alba" PROBLEMENDS="-1" PROBLEMSTARTS="-1" PROTECTEDFULLTITLECACHE="false" AUTHORSHIPCACHE="" GENUSORUNINOMIAL="Abies" NAMECACHE="Abies alba" PROTECTEDAUTHORSHIPCACHE="false" PROTECTEDNAMECACHE="false" SPECIFICEPITHET="alba" ANAMORPHIC="false" BINOMHYBRID="false" HYBRIDFORMULA="false" MONOMHYBRID="false" TRINOMHYBRID="false" HOMOTYPICALGROUP_ID="5" RANK_ID="765" COMBINATIONAUTHORTEAM_ID="1"/>-->
11
<!--  <TAXONNAMEBASE DTYPE="BotanicalName" ID="6" CREATED="2009-02-03 17:52:26.0" UUID="55e6ee55-371e-418e-8775-d885d28453c4" TITLECACHE="Abies alba" PROTECTEDTITLECACHE="false" PARSINGPROBLEM="0" FULLTITLECACHE="Abies alba" PROBLEMENDS="-1" PROBLEMSTARTS="-1" PROTECTEDFULLTITLECACHE="false" AUTHORSHIPCACHE="" GENUSORUNINOMIAL="Abies" NAMECACHE="Abies alba" PROTECTEDAUTHORSHIPCACHE="false" PROTECTEDNAMECACHE="false" SPECIFICEPITHET="alba" ANAMORPHIC="false" BINOMHYBRID="false" HYBRIDFORMULA="false" MONOMHYBRID="false" TRINOMHYBRID="false" HOMOTYPICALGROUP_ID="6" RANK_ID="765" COMBINATIONAUTHORTEAM_ID="2"/>-->
12
<TAXONNAMEBASE/>
13
<CLASSIFICATION/>
14
</dataset>
cdmlib-io/src/test/resources/eu/etaxonomy/cdm/io/specimen/excel/in/.~lock.ExcelSpecimenImportExampleTest-input.xls#
1
,alex,alex-OptiPlex-790,13.06.2013 11:10,file:///home/alex/.config/libreoffice/4;

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)