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
.pesi
.out
;
13 import java
.sql
.PreparedStatement
;
14 import java
.sql
.SQLException
;
16 import org
.apache
.log4j
.Logger
;
18 import eu
.etaxonomy
.cdm
.io
.common
.DbExportStateBase
;
19 import eu
.etaxonomy
.cdm
.io
.common
.mapping
.MultipleAttributeMapperBase
;
20 import eu
.etaxonomy
.cdm
.io
.common
.mapping
.out
.DbExportNotYetImplementedMapper
;
21 import eu
.etaxonomy
.cdm
.io
.common
.mapping
.out
.DbLastActionMapper
;
22 import eu
.etaxonomy
.cdm
.io
.common
.mapping
.out
.DbSingleAttributeExportMapperBase
;
23 import eu
.etaxonomy
.cdm
.io
.common
.mapping
.out
.IDbExportMapper
;
24 import eu
.etaxonomy
.cdm
.io
.common
.mapping
.out
.IExportTransformer
;
25 import eu
.etaxonomy
.cdm
.io
.common
.mapping
.out
.IndexCounter
;
26 import eu
.etaxonomy
.cdm
.model
.common
.CdmBase
;
33 public class ExpertsAndLastActionMapper
extends MultipleAttributeMapperBase
<DbSingleAttributeExportMapperBase
<DbExportStateBase
<?
, IExportTransformer
>>> implements IDbExportMapper
<DbExportStateBase
<?
, IExportTransformer
>, IExportTransformer
>{
34 @SuppressWarnings("unused")
35 private static final Logger logger
= Logger
.getLogger(ExpertsAndLastActionMapper
.class);
37 private static final boolean IS_ACTION_TYPE
= true;
39 public static ExpertsAndLastActionMapper
NewInstance(){
40 return new ExpertsAndLastActionMapper();
45 * @param dbAttributString
46 * @param cdmAttributeString
48 private ExpertsAndLastActionMapper() {
49 singleMappers
.add(DbLastActionMapper
.NewInstance("LastActionDate", ! IS_ACTION_TYPE
));
50 singleMappers
.add(DbLastActionMapper
.NewInstance("LastAction", IS_ACTION_TYPE
));
51 singleMappers
.add(DbExportNotYetImplementedMapper
.NewInstance("SpeciesExpertName", "Need to better understand what the species expert name is"));
52 singleMappers
.add(DbExportNotYetImplementedMapper
.NewInstance("SpeciesExpertGUID", "SpeciesExpertGUID derives from an external mapeing list: name to GUID from expertsDB"));
57 * @see eu.etaxonomy.cdm.io.berlinModel.out.mapper.IDbExportMapper#initialize(java.sql.PreparedStatement, eu.etaxonomy.cdm.io.berlinModel.out.mapper.IndexCounter, eu.etaxonomy.cdm.io.berlinModel.out.DbExportState)
59 public void initialize(PreparedStatement stmt
, IndexCounter index
, DbExportStateBase
<?
, IExportTransformer
> state
, String tableName
) {
60 for (DbSingleAttributeExportMapperBase
<DbExportStateBase
<?
, IExportTransformer
>> mapper
: singleMappers
){
61 mapper
.initialize(stmt
, index
, state
, tableName
);
67 * @see eu.etaxonomy.cdm.io.berlinModel.out.mapper.IDbExportMapper#invoke(eu.etaxonomy.cdm.model.common.CdmBase)
69 public boolean invoke(CdmBase cdmBase
) throws SQLException
{
70 boolean result
= true;
71 for (DbSingleAttributeExportMapperBase
<DbExportStateBase
<?
, IExportTransformer
>> mapper
: singleMappers
){
72 result
&= mapper
.invoke(cdmBase
);