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.identifier;
|
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.common.IdentifiableEntity;
|
17
|
import eu.etaxonomy.cdm.model.reference.Reference;
|
18
|
|
19
|
/**
|
20
|
* Configurator for importing Identifier via csv for a given class.
|
21
|
*
|
22
|
* @author a.mueller
|
23
|
\* @since 14.03.2017
|
24
|
*/
|
25
|
public class IdentifierImportConfigurator
|
26
|
extends SimpleImportConfiguratorBase<InputStreamReader>{
|
27
|
|
28
|
private static final long serialVersionUID = 2399625330102810465L;
|
29
|
|
30
|
private Class<? extends IdentifiableEntity> cdmClass;
|
31
|
private UUID uuidIdentifierType;
|
32
|
|
33
|
private boolean ignoreEmptyIdentifier = true;
|
34
|
|
35
|
|
36
|
/**
|
37
|
* @param source
|
38
|
* @param cdmDestination
|
39
|
* @return
|
40
|
*/
|
41
|
public static IdentifierImportConfigurator NewInstance(InputStreamReader file,
|
42
|
ICdmDataSource cdmDestination) {
|
43
|
return new IdentifierImportConfigurator(file, cdmDestination);
|
44
|
}
|
45
|
|
46
|
// ****************** CONSTRUCTOR *****************************/
|
47
|
|
48
|
private IdentifierImportConfigurator(InputStreamReader file,
|
49
|
ICdmDataSource cdmDestination){
|
50
|
super(file, cdmDestination, null);
|
51
|
}
|
52
|
|
53
|
// *************************************
|
54
|
|
55
|
|
56
|
@Override
|
57
|
@SuppressWarnings("unchecked")
|
58
|
protected void makeIoClassList(){
|
59
|
ioClassList = new Class[]{
|
60
|
IdentifierImport.class,
|
61
|
};
|
62
|
}
|
63
|
|
64
|
public Class<? extends IdentifiableEntity> getCdmClass() {
|
65
|
return this.cdmClass;
|
66
|
}
|
67
|
public void setCdmClass(Class<? extends IdentifiableEntity> cdmClass) {
|
68
|
this.cdmClass = cdmClass;
|
69
|
}
|
70
|
|
71
|
|
72
|
public UUID getIdentifierTypeUuid() {
|
73
|
return uuidIdentifierType;
|
74
|
}
|
75
|
|
76
|
public void setIdentifierTypeUuid(UUID uuidIdentifierType) {
|
77
|
this.uuidIdentifierType = uuidIdentifierType;
|
78
|
}
|
79
|
|
80
|
|
81
|
/**
|
82
|
* {@inheritDoc}
|
83
|
*/
|
84
|
@Override
|
85
|
public Reference getSourceReference() {
|
86
|
// TODO Auto-generated method stub
|
87
|
return null;
|
88
|
}
|
89
|
|
90
|
/**
|
91
|
* @return the ignoreEmptyIdentifier
|
92
|
*/
|
93
|
public boolean isIgnoreEmptyIdentifier() {
|
94
|
return ignoreEmptyIdentifier;
|
95
|
}
|
96
|
|
97
|
/**
|
98
|
* @param ignoreEmptyIdentifier the ignoreEmptyIdentifier to set
|
99
|
*/
|
100
|
public void setIgnoreEmptyIdentifier(boolean ignoreEmptyIdentifier) {
|
101
|
this.ignoreEmptyIdentifier = ignoreEmptyIdentifier;
|
102
|
}
|
103
|
|
104
|
}
|