1 |
3245a132
|
Andreas Müller
|
// $Id$
|
2 |
|
|
/**
|
3 |
|
|
* Copyright (C) 2007 EDIT
|
4 |
|
|
* European Distributed Institute of Taxonomy
|
5 |
|
|
* http://www.e-taxonomy.eu
|
6 |
|
|
*
|
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.
|
9 |
|
|
*/
|
10 |
|
|
|
11 |
|
|
package eu.etaxonomy.cdm.io.common.mapping;
|
12 |
|
|
|
13 |
|
|
import java.sql.ResultSet;
|
14 |
|
|
import java.sql.SQLException;
|
15 |
|
|
|
16 |
|
|
import org.apache.log4j.Logger;
|
17 |
|
|
|
18 |
|
|
import eu.etaxonomy.cdm.io.common.DbImportStateBase;
|
19 |
e3d1ace6
|
Katja Luther
|
import eu.etaxonomy.cdm.model.common.AnnotatableEntity;
|
20 |
3245a132
|
Andreas Müller
|
|
21 |
|
|
/**
|
22 |
|
|
* @author a.mueller
|
23 |
|
|
* @created 12.05.2009
|
24 |
|
|
* @version 1.0
|
25 |
|
|
*/
|
26 |
e3d1ace6
|
Katja Luther
|
public class DbImportObjectCreationMapper<ANNOTATABLE extends AnnotatableEntity, STATE extends DbImportStateBase<?,?>> extends DbImportObjectCreationMapperBase<ANNOTATABLE, STATE> {
|
27 |
3245a132
|
Andreas Müller
|
@SuppressWarnings("unused")
|
28 |
|
|
private static final Logger logger = Logger.getLogger(DbImportObjectCreationMapper.class);
|
29 |
|
|
|
30 |
9cc4226b
|
Katja Luther
|
//******************************** FACTORY METHOD ***************************************************/
|
31 |
|
|
|
32 |
|
|
public static DbImportObjectCreationMapper<?,?> NewInstance(IMappingImport mappingImport, String dbIdAttribute, String namespace){
|
33 |
|
|
return new DbImportObjectCreationMapper(mappingImport, dbIdAttribute, namespace);
|
34 |
3245a132
|
Andreas Müller
|
}
|
35 |
|
|
|
36 |
e3d1ace6
|
Katja Luther
|
//******************************* ATTRIBUTES ***************************************/
|
37 |
|
|
private IMappingImport<ANNOTATABLE, STATE> mappingImport;
|
38 |
|
|
|
39 |
3245a132
|
Andreas Müller
|
|
40 |
9cc4226b
|
Katja Luther
|
//********************************* CONSTRUCTOR ****************************************/
|
41 |
3245a132
|
Andreas Müller
|
/**
|
42 |
9cc4226b
|
Katja Luther
|
* @param mappingImport
|
43 |
3245a132
|
Andreas Müller
|
*/
|
44 |
e3d1ace6
|
Katja Luther
|
protected DbImportObjectCreationMapper(IMappingImport<ANNOTATABLE, STATE> mappingImport, String dbIdAttribute, String objectToCreateNamespace) {
|
45 |
|
|
super(dbIdAttribute, objectToCreateNamespace);
|
46 |
|
|
this.mappingImport = mappingImport;
|
47 |
3245a132
|
Andreas Müller
|
}
|
48 |
|
|
|
49 |
9cc4226b
|
Katja Luther
|
//************************************ METHODS *******************************************/
|
50 |
|
|
|
51 |
e3d1ace6
|
Katja Luther
|
|
52 |
3245a132
|
Andreas Müller
|
/* (non-Javadoc)
|
53 |
e3d1ace6
|
Katja Luther
|
* @see eu.etaxonomy.cdm.io.common.mapping.DbImportObjectCreationMapperBase#doInvoke(java.sql.ResultSet, eu.etaxonomy.cdm.model.common.VersionableEntity)
|
54 |
3245a132
|
Andreas Müller
|
*/
|
55 |
e3d1ace6
|
Katja Luther
|
@Override
|
56 |
|
|
protected ANNOTATABLE doInvoke(ResultSet rs, ANNOTATABLE createdObject) throws SQLException {
|
57 |
|
|
// do nothing
|
58 |
|
|
return createdObject;
|
59 |
3245a132
|
Andreas Müller
|
}
|
60 |
|
|
|
61 |
e3d1ace6
|
Katja Luther
|
/* (non-Javadoc)
|
62 |
|
|
* @see eu.etaxonomy.cdm.io.common.mapping.DbImportObjectCreationMapperBase#createObject(java.sql.ResultSet)
|
63 |
|
|
*/
|
64 |
|
|
@Override
|
65 |
|
|
protected ANNOTATABLE createObject(ResultSet rs) throws SQLException {
|
66 |
|
|
ANNOTATABLE result = mappingImport.createObject(rs, importMapperHelper.getState());
|
67 |
|
|
return result;
|
68 |
|
|
}
|
69 |
|
|
|
70 |
9cc4226b
|
Katja Luther
|
|
71 |
3245a132
|
Andreas Müller
|
}
|