(no commit message)
[cdmlib.git] / cdmlib-io / src / main / java / eu / etaxonomy / cdm / io / common / CdmIoMapping.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;
11
12 import java.util.ArrayList;
13 import java.util.HashSet;
14 import java.util.List;
15 import java.util.Set;
16
17 import org.apache.log4j.Logger;
18
19
20 /**
21 * @author a.mueller
22 * @created 27.07.2008
23 * @version 1.0
24 */
25 public class CdmIoMapping {
26 private static final Logger logger = Logger.getLogger(CdmIoMapping.class);
27
28 List<CdmIoMapperBase> mapperList = new ArrayList<CdmIoMapperBase>();
29 Set<String> sourceAttributes = new HashSet<String>();
30 Set<String> destinationAttributes = new HashSet<String>();
31 List<String> sourceAttributeList = new ArrayList<String>();
32 List<String> destinationAttributeList = new ArrayList<String>();
33
34
35 public void addMapper(CdmIoMapperBase mapper){
36 mapperList.add(mapper);
37 sourceAttributes.add(mapper.getSourceAttribute());
38 sourceAttributeList.add(mapper.getSourceAttribute());
39 destinationAttributes.add(mapper.getDestinationAttribute());
40 destinationAttributeList.add(mapper.getDestinationAttribute());
41 }
42
43 public Set<String> getSourceAttributes(){
44 Set<String> result = new HashSet<String>();
45 result.addAll(sourceAttributes);
46 return result;
47 }
48
49 public Set<String> getSourceAttributesLowerCase(){
50 Set<String> result = new HashSet<String>();
51 for(String attr : sourceAttributes){
52 if (attr != null){
53 result.add(attr.toLowerCase());
54 }else{
55 result.add(null);
56 }
57 }
58 return result;
59 }
60
61 public Set<String> getDestinationAttributes(){
62 Set<String> result = new HashSet<String>();
63 result.addAll(destinationAttributes);
64 return result;
65 }
66
67 }