1
|
/**
|
2
|
* Copyright (C) 2007 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
|
|
10
|
package eu.etaxonomy.cdm.io.common;
|
11
|
|
12
|
import org.apache.log4j.Logger;
|
13
|
|
14
|
import eu.etaxonomy.cdm.database.ICdmDataSource;
|
15
|
import eu.etaxonomy.cdm.io.common.mapping.out.IExportTransformer;
|
16
|
import eu.etaxonomy.cdm.model.reference.IDatabase;
|
17
|
import eu.etaxonomy.cdm.model.reference.ReferenceFactory;
|
18
|
|
19
|
|
20
|
/**
|
21
|
* @author a.mueller
|
22
|
* @since 20.03.2008
|
23
|
*/
|
24
|
public abstract class DbExportConfiguratorBase<STATE extends ExportStateBase, TRANSFORM extends IExportTransformer, DEST extends Source>
|
25
|
extends ExportConfiguratorBase<STATE, TRANSFORM, Source>
|
26
|
implements IExportConfigurator<STATE, TRANSFORM>{
|
27
|
|
28
|
private static final long serialVersionUID = 3776529518379378810L;
|
29
|
@SuppressWarnings("unused")
|
30
|
private static Logger logger = Logger.getLogger(DbExportConfiguratorBase.class);
|
31
|
|
32
|
|
33
|
public enum IdType{
|
34
|
CDM_ID,
|
35
|
CDM_ID_WITH_EXCEPTIONS,
|
36
|
ORIGINAL_SOURCE_ID,
|
37
|
MAX_ID
|
38
|
}
|
39
|
|
40
|
private IdType idType = IdType.CDM_ID;
|
41
|
|
42
|
public DbExportConfiguratorBase(TRANSFORM transformer) {
|
43
|
super(transformer);
|
44
|
}
|
45
|
|
46
|
|
47
|
/**
|
48
|
* @return the idType
|
49
|
*/
|
50
|
public IdType getIdType() {
|
51
|
return idType;
|
52
|
}
|
53
|
|
54
|
/**
|
55
|
* @param idType the idType to set
|
56
|
*/
|
57
|
public void setIdType(IdType idType) {
|
58
|
this.idType = idType;
|
59
|
}
|
60
|
|
61
|
|
62
|
/* (non-Javadoc)
|
63
|
* @see eu.etaxonomy.cdm.io.common.IIoConfigurator#getDestinationNameString()
|
64
|
*/
|
65
|
@Override
|
66
|
public String getDestinationNameString() {
|
67
|
if (getDestination() != null){
|
68
|
return getDestination().getDatabase();
|
69
|
}else{
|
70
|
return null;
|
71
|
}
|
72
|
}
|
73
|
|
74
|
|
75
|
@Override
|
76
|
public ICdmDataSource getSource() {
|
77
|
return super.getSource();
|
78
|
}
|
79
|
@Override
|
80
|
public void setSource(ICdmDataSource cdmSource) {
|
81
|
super.setSource(cdmSource);
|
82
|
}
|
83
|
|
84
|
/* (non-Javadoc)
|
85
|
* @see eu.etaxonomy.cdm.io.common.IImportConfigurator#getSourceNameString()
|
86
|
*/
|
87
|
@Override
|
88
|
public String getSourceNameString() {
|
89
|
if (this.getSource() == null){
|
90
|
return null;
|
91
|
}else{
|
92
|
return this.getSource().getDatabase();
|
93
|
}
|
94
|
}
|
95
|
|
96
|
|
97
|
/* (non-Javadoc)
|
98
|
* @see eu.etaxonomy.cdm.io.tcsrdf.IImportConfigurator#getSourceReference()
|
99
|
*/
|
100
|
@Override
|
101
|
public IDatabase getSourceReference() {
|
102
|
|
103
|
if (sourceReference == null){
|
104
|
sourceReference = ReferenceFactory.newDatabase();
|
105
|
if (getSource() != null){
|
106
|
sourceReference.setTitleCache(getSource().getDatabase(), true);
|
107
|
}
|
108
|
}
|
109
|
return sourceReference;
|
110
|
}
|
111
|
}
|