Project

General

Profile

Download (3.21 KB) Statistics
| Branch: | Tag: | Revision:
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;
11

    
12
import java.sql.ResultSet;
13
import java.sql.SQLException;
14

    
15
import org.apache.log4j.Logger;
16

    
17
import eu.etaxonomy.cdm.io.common.DbImportStateBase;
18
import eu.etaxonomy.cdm.model.description.Distribution;
19
import eu.etaxonomy.cdm.model.description.PresenceAbsenceTerm;
20

    
21
/**
22
 * This Mapper creates a distribution and adds it to a taxon.
23
 * @author a.mueller
24
 * @since 11.03.2010
25
 * @version 1.0
26
 */
27
public class DbImportDistributionCreationMapper<STATE extends DbImportStateBase<?,?>> extends DbImportDescriptionElementCreationMapperBase<Distribution, DbImportStateBase<?,?>> {
28
	@SuppressWarnings("unused")
29
	private static final Logger logger = Logger.getLogger(DbImportDistributionCreationMapper.class);
30

    
31
//******************************** FACTORY METHOD ***************************************************/
32

    
33
	
34
	/**
35
	 * Creates a Distribution and adds it to the description of a taxon. 
36
	 * @param dbIdAttribute
37
	 * @param objectToCreateNamespace
38
	 * @param dbTaxonFkAttribute
39
	 * @param taxonNamespace
40
	 * @return
41
	 */
42
	public static DbImportDistributionCreationMapper<?> NewInstance(String dbIdAttribute, String objectToCreateNamespace, String dbTaxonFkAttribute, String taxonNamespace){
43
		PresenceAbsenceTerm status = null;
44
		return new DbImportDistributionCreationMapper(dbIdAttribute, objectToCreateNamespace, dbTaxonFkAttribute, taxonNamespace, status);
45
	}
46
	
47
	
48
	/**
49
	 * Creates a Distribution with status <code>status</code> and adds it to the description of a taxon. 
50
	 * @param dbIdAttribute
51
	 * @param objectToCreateNamespace
52
	 * @param dbTaxonFkAttribute
53
	 * @param taxonNamespace
54
	 * @param status
55
	 * @return
56
	 */
57
	public static DbImportDistributionCreationMapper<?> NewFixedStatusInstance(String dbIdAttribute, String objectToCreateNamespace, String dbTaxonFkAttribute, String taxonNamespace, PresenceAbsenceTerm status){
58
		return new DbImportDistributionCreationMapper(dbIdAttribute, objectToCreateNamespace, dbTaxonFkAttribute, taxonNamespace, status);
59
	}
60
	
61
//******************************* ATTRIBUTES ***************************************/
62

    
63
	protected PresenceAbsenceTerm status;
64
	
65
//********************************* CONSTRUCTOR ****************************************/
66
	/**
67
	 * @param dbIdAttribute
68
	 * @param objectToCreateNamespace
69
	 * @param dbTaxonFkAttribute
70
	 * @param taxonNamespace
71
	 */
72
	protected DbImportDistributionCreationMapper(String dbIdAttribute, String objectToCreateNamespace, String dbTaxonFkAttribute, String taxonNamespace, PresenceAbsenceTerm status) {
73
		super(dbIdAttribute, objectToCreateNamespace, dbTaxonFkAttribute, taxonNamespace);
74
	}
75

    
76
//************************************ METHODS *******************************************/
77

    
78
	@Override
79
	protected Distribution createObject(ResultSet rs) throws SQLException {
80
		Distribution distribution = Distribution.NewInstance(null, null);
81
		distribution.setStatus(status);
82
		return distribution;
83
	}
84

    
85
}
(12-12/51)