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.wfo.in;
|
10
|
|
11
|
import java.io.IOException;
|
12
|
import java.io.InputStreamReader;
|
13
|
import java.util.UUID;
|
14
|
|
15
|
import eu.etaxonomy.cdm.common.URI;
|
16
|
import eu.etaxonomy.cdm.database.ICdmDataSource;
|
17
|
import eu.etaxonomy.cdm.io.csv.in.CsvImportConfiguratorBase;
|
18
|
import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
|
19
|
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
|
20
|
|
21
|
/**
|
22
|
* @author a.mueller
|
23
|
* @since 15.11.2017
|
24
|
*/
|
25
|
public class WfoAccessImportConfigurator extends CsvImportConfiguratorBase {
|
26
|
|
27
|
private static final long serialVersionUID = -1176968167300861330L;
|
28
|
|
29
|
private UUID parentNodeUuid;
|
30
|
private String classificationName;
|
31
|
private boolean unplaced = true; //if new nodes should be created, should they be marked as unplaced?
|
32
|
|
33
|
private boolean reportDuplicateIdentifier = true;
|
34
|
|
35
|
private boolean addAuthorsToReference = true;
|
36
|
|
37
|
public static WfoAccessImportConfigurator NewInstance(InputStreamReader inputStream, ICdmDataSource cdmDestination) {
|
38
|
return new WfoAccessImportConfigurator(inputStream, cdmDestination);
|
39
|
}
|
40
|
|
41
|
public static WfoAccessImportConfigurator NewInstance(URI uri, ICdmDataSource cdmDestination)
|
42
|
throws IOException {
|
43
|
return new WfoAccessImportConfigurator(uri, cdmDestination);
|
44
|
}
|
45
|
|
46
|
private WfoAccessImportConfigurator(InputStreamReader inputStream, ICdmDataSource cdmDestination) {
|
47
|
super(inputStream, cdmDestination);
|
48
|
}
|
49
|
|
50
|
private WfoAccessImportConfigurator(URI uri, ICdmDataSource cdmDestination)
|
51
|
throws IOException {
|
52
|
super(uri, cdmDestination, null);
|
53
|
this.setNomenclaturalCode(NomenclaturalCode.ICNAFP);
|
54
|
}
|
55
|
|
56
|
@Override
|
57
|
protected void makeIoClassList() {
|
58
|
ioClassList = new Class[]{
|
59
|
WfoAccessTaxonImport.class,
|
60
|
WfoAccessClassificationImport.class
|
61
|
};
|
62
|
}
|
63
|
|
64
|
@Override
|
65
|
public WfoAccessImportState getNewState() {
|
66
|
return new WfoAccessImportState(this);
|
67
|
}
|
68
|
|
69
|
/**
|
70
|
* If {@link #isCreateTaxa()} is <code>true</code> the taxon
|
71
|
* to be created will be imported below the {@link TaxonNode taxon node}
|
72
|
* with the given taxon node uuid.
|
73
|
*/
|
74
|
public UUID getParentNodeUuid() {
|
75
|
return parentNodeUuid;
|
76
|
}
|
77
|
public void setParentNodeUuid(UUID parentNodeUuid) {
|
78
|
this.parentNodeUuid = parentNodeUuid;
|
79
|
}
|
80
|
|
81
|
/**
|
82
|
* If {@link #isCreateTaxa()} is <code>true</code> and if no
|
83
|
* {@link #getParentNodeUuid() parent node uuid} is given
|
84
|
* the taxon to be created will be imported into a newly created
|
85
|
* classification with the given classification name.
|
86
|
*/
|
87
|
@Override
|
88
|
public String getClassificationName() {
|
89
|
return classificationName;
|
90
|
}
|
91
|
@Override
|
92
|
public void setClassificationName(String classificationName) {
|
93
|
this.classificationName = classificationName;
|
94
|
}
|
95
|
|
96
|
/**
|
97
|
* If taxa are created ({@link #isCreateTaxa()} should the according
|
98
|
* taxon nodes be marked as unplaced?
|
99
|
* @see #isCreateTaxa()
|
100
|
* @see #getClassificationName()
|
101
|
* @see #getParentNodeUuid()
|
102
|
* @return the unplaced
|
103
|
*/
|
104
|
public boolean isUnplaced() {
|
105
|
return unplaced;
|
106
|
}
|
107
|
public void setUnplaced(boolean unplaced) {
|
108
|
this.unplaced = unplaced;
|
109
|
}
|
110
|
|
111
|
/**
|
112
|
* If <code>true</code> the name authors will be added
|
113
|
* to the nomenclatural reference (Book or Article) though
|
114
|
* it might not be the exact same author.<BR>
|
115
|
* Default is <code>true</code>
|
116
|
*/
|
117
|
public boolean isAddAuthorsToReference() {
|
118
|
return addAuthorsToReference;
|
119
|
}
|
120
|
/**
|
121
|
* @see #isAddAuthorsToReference()
|
122
|
*/
|
123
|
public void setAddAuthorsToReference(boolean addAuthorsToReference) {
|
124
|
this.addAuthorsToReference = addAuthorsToReference;
|
125
|
}
|
126
|
|
127
|
/**
|
128
|
* if <code>true</code> duplicate identifiers like
|
129
|
* {@link #isAllowTropicosDuplicates() Tropicos IDs}
|
130
|
* {@link #isAllowIpniDuplicates() IPNI IDs} or
|
131
|
* {@link #isAllowWfoDuplicates() WFO IDs} will be reported.
|
132
|
* This is only relevant if duplicates are allowed,
|
133
|
* otherwise the duplicates will be reported anyway.
|
134
|
*/
|
135
|
public boolean isReportDuplicateIdentifier() {
|
136
|
return reportDuplicateIdentifier;
|
137
|
}
|
138
|
/**
|
139
|
* @see #isReportDuplicateIdentifier()
|
140
|
*/
|
141
|
public void setReportDuplicateIdentifier(boolean reportDuplicateIdentifier) {
|
142
|
this.reportDuplicateIdentifier = reportDuplicateIdentifier;
|
143
|
}
|
144
|
|
145
|
}
|