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.mapping.out;
|
11
|
|
12
|
import java.sql.PreparedStatement;
|
13
|
import java.sql.SQLException;
|
14
|
|
15
|
import org.apache.commons.lang.StringUtils;
|
16
|
import org.apache.log4j.Logger;
|
17
|
|
18
|
import eu.etaxonomy.cdm.io.common.DbExportStateBase;
|
19
|
import eu.etaxonomy.cdm.model.common.CdmBase;
|
20
|
|
21
|
/**
|
22
|
* This mapper does not change any import object, but keeps the information that a database
|
23
|
* attribute needs to be mapped but is not yet mapped.
|
24
|
* @author a.mueller
|
25
|
* @created 25.02.2010
|
26
|
* @version 1.0
|
27
|
*/
|
28
|
public class DbExportNotYetImplementedMapper extends DbSingleAttributeExportMapperBase<DbExportStateBase<?, IExportTransformer>> {
|
29
|
private static final Logger logger = Logger.getLogger(DbExportNotYetImplementedMapper.class);
|
30
|
|
31
|
public static DbExportNotYetImplementedMapper NewInstance(String dbAttributeToIgnore){
|
32
|
return new DbExportNotYetImplementedMapper(dbAttributeToIgnore, null, null, null);
|
33
|
}
|
34
|
|
35
|
public static DbExportNotYetImplementedMapper NewInstance(String dbAttributeToIgnore, String reason){
|
36
|
return new DbExportNotYetImplementedMapper(dbAttributeToIgnore, null, null, reason);
|
37
|
}
|
38
|
|
39
|
//*************************** VARIABLES ***************************************************************//
|
40
|
private String unimplementedReason;
|
41
|
|
42
|
//*************************** CONSTRUCTOR ***************************************************************//
|
43
|
|
44
|
/**
|
45
|
* @param dbAttributString
|
46
|
* @param cdmAttributeString
|
47
|
* @param defaultValue
|
48
|
*/
|
49
|
protected DbExportNotYetImplementedMapper(String dbAttributString, String cdmAttributeString, Object defaultValue, String unimplementedReason) {
|
50
|
super(dbAttributString, cdmAttributeString, defaultValue);
|
51
|
this.unimplementedReason = unimplementedReason;
|
52
|
}
|
53
|
|
54
|
@Override
|
55
|
public void initialize(PreparedStatement stmt, IndexCounter index, DbExportStateBase state, String tableName) {
|
56
|
String attributeName = this.getSourceAttribute();
|
57
|
String localReason = "";
|
58
|
if (StringUtils.isNotBlank(unimplementedReason)){
|
59
|
localReason = " (" + unimplementedReason +")";
|
60
|
}
|
61
|
logger.warn(attributeName + " not yet implemented . " + localReason);
|
62
|
exportMapperHelper.initializeNull(stmt, state, tableName);
|
63
|
}
|
64
|
|
65
|
@Override
|
66
|
protected boolean doInvoke(CdmBase cdmBase) throws SQLException {
|
67
|
return true; // do nothing
|
68
|
}
|
69
|
|
70
|
|
71
|
/* (non-Javadoc)
|
72
|
* @see eu.etaxonomy.cdm.io.common.CdmSingleAttributeMapperBase#getTypeClass()
|
73
|
*/
|
74
|
@Override
|
75
|
public Class getTypeClass() {
|
76
|
return null; //not needed
|
77
|
}
|
78
|
|
79
|
|
80
|
@Override
|
81
|
protected int getSqlType() {
|
82
|
return -1; // not needed
|
83
|
}
|
84
|
|
85
|
|
86
|
|
87
|
|
88
|
}
|