3 * Copyright (C) 2007 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
7 * The contents of this file are subject to the Mozilla Public License Version 1.1
8 * See LICENSE.TXT at the top of this package for the full license terms.
11 package eu
.etaxonomy
.cdm
.io
.common
.mapping
.out
;
13 import java
.sql
.PreparedStatement
;
14 import java
.sql
.SQLException
;
16 import org
.apache
.commons
.lang
.StringUtils
;
17 import org
.apache
.log4j
.Logger
;
19 import eu
.etaxonomy
.cdm
.io
.common
.DbExportStateBase
;
20 import eu
.etaxonomy
.cdm
.model
.common
.CdmBase
;
23 * This mapper does not change any import object, but keeps the information that a database
24 * attribute needs to be mapped but is not yet mapped.
29 public class DbExportNotYetImplementedMapper
extends DbSingleAttributeExportMapperBase
<DbExportStateBase
> {
30 private static final Logger logger
= Logger
.getLogger(DbExportNotYetImplementedMapper
.class);
32 public static DbExportNotYetImplementedMapper
NewInstance(String dbAttributeToIgnore
){
33 return new DbExportNotYetImplementedMapper(dbAttributeToIgnore
, null, null, null);
36 public static DbExportNotYetImplementedMapper
NewInstance(String dbAttributeToIgnore
, String reason
){
37 return new DbExportNotYetImplementedMapper(dbAttributeToIgnore
, null, null, reason
);
40 //*************************** VARIABLES ***************************************************************//
41 private String unimplementedReason
;
43 //*************************** CONSTRUCTOR ***************************************************************//
46 * @param dbAttributString
47 * @param cdmAttributeString
50 protected DbExportNotYetImplementedMapper(String dbAttributString
, String cdmAttributeString
, Object defaultValue
, String unimplementedReason
) {
51 super(dbAttributString
, cdmAttributeString
, defaultValue
);
52 this.unimplementedReason
= unimplementedReason
;
56 public void initialize(PreparedStatement stmt
, IndexCounter index
, DbExportStateBase state
, String tableName
) {
57 String attributeName
= this.getSourceAttribute();
58 String localReason
= "";
59 if (StringUtils
.isNotBlank(unimplementedReason
)){
60 localReason
= " (" + unimplementedReason
+")";
62 logger
.warn(attributeName
+ " not yet implemented . " + localReason
);
63 exportMapperHelper
.initializeNull(stmt
, state
, tableName
);
67 protected boolean doInvoke(CdmBase cdmBase
) throws SQLException
{
68 return true; // do nothing
73 * @see eu.etaxonomy.cdm.io.common.CdmSingleAttributeMapperBase#getTypeClass()
76 public Class
getTypeClass() {
77 return null; //not needed
82 protected int getSqlType() {
83 return -1; // not needed