Project

General

Profile

« Previous | Next » 

Revision f905a388

Added by Andreas Müller almost 2 years ago

cleanup

View differences:

cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/common/mapping/out/DbConstantMapper.java
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.out;
11

  
12
import org.apache.logging.log4j.LogManager;import org.apache.logging.log4j.Logger;
13

  
14
import eu.etaxonomy.cdm.io.common.DbExportStateBase;
15
import eu.etaxonomy.cdm.model.common.CdmBase;
16

  
17
/**
18
 * Maps to a constant value.
19
 *
20
 * TODO deduplicate with {@link DbFixedIntegerMapper} and {@link DbFixedStringMapper}.
21
 *
22
 * @author a.mueller
23
 * @since 12.05.2009
24
 */
25
public class DbConstantMapper
26
        extends DbSingleAttributeExportMapperBase<DbExportStateBase<?, IExportTransformer>>{
27

  
28
	@SuppressWarnings("unused")
29
	private static final Logger logger = LogManager.getLogger(DbConstantMapper.class);
30

  
31
	private int sqlType;
32
	private Object value;
33

  
34
	public static DbConstantMapper NewInstance(String dbIdAttributeString, int sqlType, Object value){
35
		return new DbConstantMapper(dbIdAttributeString, sqlType, value);
36
	}
37

  
38
	protected DbConstantMapper(String dbAttributeString, int sqlType, Object value) {
39
		super(null, dbAttributeString, null);
40
		this.sqlType = sqlType;
41
		this.value = value;
42
	}
43

  
44
	@Override
45
	public Class<?> getTypeClass() {
46
		return Integer.class;
47
	}
48

  
49
	@Override
50
	protected Object getValue(CdmBase cdmBase) {
51
		return value;
52
	}
53

  
54
	@Override
55
	protected int getSqlType() {
56
		return this.sqlType;
57
	}
58
}
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.out;
11

  
12
import org.apache.logging.log4j.LogManager;
13
import org.apache.logging.log4j.Logger;
14

  
15
import eu.etaxonomy.cdm.io.common.DbExportStateBase;
16
import eu.etaxonomy.cdm.model.common.CdmBase;
17

  
18
/**
19
 * Maps to a constant value.
20
 *
21
 * TODO deduplicate with {@link DbFixedIntegerMapper} and {@link DbFixedStringMapper}.
22
 *
23
 * @author a.mueller
24
 * @since 12.05.2009
25
 */
26
public class DbConstantMapper
27
        extends DbSingleAttributeExportMapperBase<DbExportStateBase<?, IExportTransformer>>{
28

  
29
	@SuppressWarnings("unused")
30
	private static final Logger logger = LogManager.getLogger();
31

  
32
	private int sqlType;
33
	private Object value;
34

  
35
	public static DbConstantMapper NewInstance(String dbIdAttributeString, int sqlType, Object value){
36
		return new DbConstantMapper(dbIdAttributeString, sqlType, value);
37
	}
38

  
39
	protected DbConstantMapper(String dbAttributeString, int sqlType, Object value) {
40
		super(null, dbAttributeString, null);
41
		this.sqlType = sqlType;
42
		this.value = value;
43
	}
44

  
45
	@Override
46
	public Class<?> getTypeClass() {
47
		return Integer.class;
48
	}
49

  
50
	@Override
51
	protected Object getValue(CdmBase cdmBase) {
52
		return value;
53
	}
54

  
55
	@Override
56
	protected int getSqlType() {
57
		return this.sqlType;
58
	}
59
}

Also available in: Unified diff