1
|
/**
|
2
|
* Copyright (C) 2017 EDIT
|
3
|
* European Distributed Institute of Taxonomy
|
4
|
* http://www.e-taxonomy.eu
|
5
|
*
|
6
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
7
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
8
|
*/
|
9
|
package eu.etaxonomy.cdm.io.terms;
|
10
|
|
11
|
import java.io.InputStreamReader;
|
12
|
import java.util.UUID;
|
13
|
|
14
|
import eu.etaxonomy.cdm.database.ICdmDataSource;
|
15
|
import eu.etaxonomy.cdm.io.common.SimpleImportConfiguratorBase;
|
16
|
import eu.etaxonomy.cdm.model.reference.Reference;
|
17
|
import eu.etaxonomy.cdm.model.reference.ReferenceFactory;
|
18
|
|
19
|
/**
|
20
|
* @author a.mueller
|
21
|
* @since 14.03.2017
|
22
|
*/
|
23
|
public class RepresentationCsvImportConfigurator
|
24
|
extends SimpleImportConfiguratorBase<InputStreamReader>{
|
25
|
|
26
|
private static final long serialVersionUID = -3602889553095677715L;
|
27
|
|
28
|
private boolean overrideWithEmpty;
|
29
|
private UUID languageUuid;
|
30
|
|
31
|
public static RepresentationCsvImportConfigurator NewInstance(InputStreamReader file,
|
32
|
ICdmDataSource cdmDestination) {
|
33
|
return new RepresentationCsvImportConfigurator(file, cdmDestination);
|
34
|
}
|
35
|
|
36
|
// ****************** CONSTRUCTOR *****************************/
|
37
|
|
38
|
private RepresentationCsvImportConfigurator(InputStreamReader file,
|
39
|
ICdmDataSource cdmDestination){
|
40
|
super(file, cdmDestination, null);
|
41
|
}
|
42
|
|
43
|
// *************************************
|
44
|
|
45
|
@Override
|
46
|
@SuppressWarnings("unchecked")
|
47
|
protected void makeIoClassList(){
|
48
|
ioClassList = new Class[]{
|
49
|
RepresentationCsvImport.class,
|
50
|
};
|
51
|
}
|
52
|
|
53
|
public boolean isOverrideWithEmpty() {
|
54
|
return overrideWithEmpty;
|
55
|
}
|
56
|
public void setOverrideWithEmpty(boolean overrideWithEmpty) {
|
57
|
this.overrideWithEmpty = overrideWithEmpty;
|
58
|
}
|
59
|
|
60
|
public UUID getLanguageUuid() {
|
61
|
return languageUuid;
|
62
|
}
|
63
|
|
64
|
public void setLanguageUuid(UUID languageUuid) {
|
65
|
this.languageUuid = languageUuid;
|
66
|
}
|
67
|
|
68
|
@Override
|
69
|
public Reference getSourceReference() {
|
70
|
if (this.sourceReference == null){
|
71
|
sourceReference = ReferenceFactory.newGeneric();
|
72
|
if (this.getSource() == null){
|
73
|
sourceReference.setTitleCache("Term Representation Import " + getDateString(), true);
|
74
|
}else{
|
75
|
sourceReference.setTitleCache(getSource().toString(), true);
|
76
|
}
|
77
|
}
|
78
|
return sourceReference;
|
79
|
}
|
80
|
}
|