bugfix use of application context in io (until now the defaultIoApplicationContext...
[cdmlib.git] / cdmlib-io / src / main / java / eu / etaxonomy / cdm / io / common / DbExportStateBase.java
1 // $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;
12
13 import java.util.HashMap;
14 import java.util.Map;
15 import java.util.UUID;
16
17 import org.apache.log4j.Logger;
18
19 import eu.etaxonomy.cdm.model.common.CdmBase;
20
21 /**
22 * @author a.mueller
23 * @created 11.05.2009
24 * @version 1.0
25 */
26 public abstract class DbExportStateBase<CONFIG extends DbExportConfiguratorBase> extends ExportStateBase<CONFIG> {
27 private static final Logger logger = Logger.getLogger(DbExportStateBase.class);
28
29 protected Map<UUID, Integer> dbIdMap = new HashMap<UUID, Integer>();
30
31
32 public DbExportStateBase(CONFIG config) {
33 super(config);
34 }
35
36 public void putDbId(CdmBase cdmBase, int dbId){
37 if (cdmBase != null){
38 dbIdMap.put(cdmBase.getUuid(), dbId);
39 }else{
40 logger.warn("CdmBase was (null) and could not be added to dbIdMap");
41 }
42 }
43
44 public Integer getDbId(CdmBase cdmBase){
45 if (cdmBase != null){
46 return dbIdMap.get(cdmBase.getUuid());
47 }else{
48 logger.warn("CdmBase was (null). No entries in dbIdMap available");
49 return null;
50 }
51 }
52
53 }