Project

General

Profile

Download (1.47 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;
11

    
12
import java.util.HashMap;
13
import java.util.Map;
14
import java.util.UUID;
15

    
16
import org.apache.log4j.Logger;
17

    
18
import eu.etaxonomy.cdm.io.common.mapping.out.IExportTransformer;
19
import eu.etaxonomy.cdm.model.common.CdmBase;
20

    
21
/**
22
 * @author a.mueller
23
 * @since 11.05.2009
24
 */
25
public abstract class DbExportStateBase<CONFIG extends DbExportConfiguratorBase<? extends DbExportStateBase<CONFIG, TRANSFORM>, TRANSFORM, Source>, TRANSFORM extends IExportTransformer>
26
        extends ExportStateBase<CONFIG, TRANSFORM, Source> {
27
	
28
    private static final Logger logger = Logger.getLogger(DbExportStateBase.class);
29

    
30
	protected Map<UUID, Integer> dbIdMap = new HashMap<UUID, Integer>();
31

    
32

    
33
	public DbExportStateBase(CONFIG config) {
34
		super(config);
35
	}
36

    
37
	public void putDbId(CdmBase cdmBase, int dbId){
38
		if (cdmBase != null){
39
			dbIdMap.put(cdmBase.getUuid(), dbId);
40
		}else{
41
			logger.warn("CdmBase was (null) and could not be added to dbIdMap");
42
		}
43
	}
44

    
45
	public Integer getDbId(CdmBase cdmBase){
46
		if (cdmBase != null){
47
			return dbIdMap.get(cdmBase.getUuid());
48
		}else{
49
			logger.warn("CdmBase was (null). No entries in dbIdMap available");
50
			return null;
51
		}
52
	}
53

    
54
}
(12-12/65)