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
.DbSingleAttributeExportMapperBase
;
21 import eu
.etaxonomy
.cdm
.io
.common
.mapping
.out
.IDbExportMapper
;
22 import eu
.etaxonomy
.cdm
.io
.common
.mapping
.out
.IndexCounter
;
23 import eu
.etaxonomy
.cdm
.model
.common
.CdmBase
;
30 public class ExpertsAndLastActionMapper
extends MultipleAttributeMapperBase
<DbSingleAttributeExportMapperBase
<DbExportStateBase
<?
>>> implements IDbExportMapper
<DbExportStateBase
<?
>>{
31 @SuppressWarnings("unused")
32 private static final Logger logger
= Logger
.getLogger(ExpertsAndLastActionMapper
.class);
34 public static ExpertsAndLastActionMapper
NewInstance(){
35 return new ExpertsAndLastActionMapper(true);
40 * @param dbAttributString
41 * @param cdmAttributeString
43 private ExpertsAndLastActionMapper(boolean withUpdate
) {
44 // singleMappers.add(DbUserMapper.NewInstance("createdBy", "Created_Who"));
45 // singleMappers.add(DbDateMapper.NewInstance("created", "Created_When"));
46 // singleMappers.add(MethodMapper.NewInstance("Notes", this.getClass(), "getNotes", AnnotatableEntity.class));
48 // singleMappers.add(DbUserMapper.NewInstance("updatedBy", "Updated_Who"));
49 // singleMappers.add(DbDateMapper.NewInstance("updated", "Updated_When"));
55 * @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)
57 public void initialize(PreparedStatement stmt
, IndexCounter index
, DbExportStateBase
<?
> state
, String tableName
) {
58 for (DbSingleAttributeExportMapperBase
<DbExportStateBase
<?
>> mapper
: singleMappers
){
59 mapper
.initialize(stmt
, index
, state
, tableName
);
65 * @see eu.etaxonomy.cdm.io.berlinModel.out.mapper.IDbExportMapper#invoke(eu.etaxonomy.cdm.model.common.CdmBase)
67 public boolean invoke(CdmBase cdmBase
) throws SQLException
{
68 boolean result
= true;
69 for (DbSingleAttributeExportMapperBase
<DbExportStateBase
<?
>> mapper
: singleMappers
){
70 result
&= mapper
.invoke(cdmBase
);
75 // //used by MethodMapper
76 // @SuppressWarnings("unused")
77 // private static String getNotes(AnnotatableEntity obj){
78 // String result = "";
79 // String separator = ";";
80 // for (Annotation annotation :obj.getAnnotations()){
81 // if (! AnnotationType.TECHNICAL().equals(annotation.getAnnotationType())){
82 // if (! ( annotation.getText() != null && annotation.getText().startsWith("ORDER:"))){ //TODO casus Salvador, should be stored in Extension ones extensions are also for annotatable entities
83 // result = CdmUtils.concat(separator, result, annotation.getText());
87 // return (result.trim().equals("")? null : result);