Revision 79276af0
Added by Andreas Müller over 4 years ago
cdm-pesi/src/main/java/eu/etaxonomy/cdm/io/pesi/indexFungorum/IndexFungorumImportState.java | ||
---|---|---|
26 | 26 |
/** |
27 | 27 |
* @author a.mueller |
28 | 28 |
* @since 11.05.2009 |
29 |
* @version 1.0 |
|
30 | 29 |
*/ |
31 | 30 |
public class IndexFungorumImportState extends DbImportStateBase<IndexFungorumImportConfigurator, IndexFungorumImportState>{ |
32 | 31 |
@SuppressWarnings("unused") |
33 | 32 |
private static final Logger logger = Logger.getLogger(IndexFungorumImportState.class); |
34 | 33 |
|
35 |
Map<String, DefinedTermBase> dbCdmDefTermMap = new HashMap<String, DefinedTermBase>();
|
|
34 |
Map<String, DefinedTermBase> dbCdmDefTermMap = new HashMap<>(); |
|
36 | 35 |
|
37 |
Map<String, User> usernameMap = new HashMap<String, User>();
|
|
36 |
Map<String, User> usernameMap = new HashMap<>(); |
|
38 | 37 |
|
39 | 38 |
private Map<Integer, Map<Integer,Rank>> rankMap; |
40 | 39 |
|
41 | 40 |
private Map<String, TaxonBase> speciesMap; |
42 | 41 |
|
43 |
private List<UUID> infraspecificTaxaUUIDs = new ArrayList<UUID>();
|
|
42 |
private List<UUID> infraspecificTaxaUUIDs = new ArrayList<>(); |
|
44 | 43 |
|
45 | 44 |
|
46 | 45 |
|
47 |
|
|
48 |
public List<UUID> getInfraspecificTaxaUUIDs() { |
|
49 |
return infraspecificTaxaUUIDs; |
|
50 |
} |
|
51 |
|
|
52 |
|
|
53 |
public void setInfraspecificTaxaUUIDs(List<UUID> infraspecificTaxaUUIDs) { |
|
54 |
this.infraspecificTaxaUUIDs = infraspecificTaxaUUIDs; |
|
55 |
} |
|
56 |
|
|
57 |
|
|
58 | 46 |
public IndexFungorumImportState(IndexFungorumImportConfigurator config) { |
59 | 47 |
super(config); |
60 | 48 |
} |
61 | 49 |
|
62 |
|
|
63 |
/* (non-Javadoc) |
|
64 |
* @see eu.etaxonomy.cdm.io.common.IoStateBase#initialize(eu.etaxonomy.cdm.io.common.IoConfiguratorBase) |
|
65 |
*/ |
|
66 | 50 |
@Override |
67 | 51 |
public void initialize(IndexFungorumImportConfigurator config) { |
68 | 52 |
// super(config); |
69 | 53 |
} |
70 | 54 |
|
55 |
public List<UUID> getInfraspecificTaxaUUIDs() { |
|
56 |
return infraspecificTaxaUUIDs; |
|
57 |
} |
|
58 |
public void setInfraspecificTaxaUUIDs(List<UUID> infraspecificTaxaUUIDs) { |
|
59 |
this.infraspecificTaxaUUIDs = infraspecificTaxaUUIDs; |
|
60 |
} |
|
71 | 61 |
|
72 | 62 |
public Map<String, DefinedTermBase> getDbCdmDefinedTermMap(){ |
73 | 63 |
return this.dbCdmDefTermMap; |
74 | 64 |
} |
75 |
|
|
76 | 65 |
public void putDefinedTermToMap(String tableName, String id, DefinedTermBase term){ |
77 | 66 |
this.dbCdmDefTermMap.put(tableName + "_" + id, term); |
78 | 67 |
} |
79 |
|
|
80 | 68 |
public void putDefinedTermToMap(String tableName, int id, DefinedTermBase term){ |
81 | 69 |
putDefinedTermToMap(tableName, String.valueOf(id), term); |
82 | 70 |
} |
... | ... | |
85 | 73 |
public User getUser(String username){ |
86 | 74 |
return usernameMap.get(username); |
87 | 75 |
} |
88 |
|
|
89 | 76 |
@Override |
90 | 77 |
public void putUser(String username, User user){ |
91 | 78 |
usernameMap.put(username, user); |
92 | 79 |
} |
93 |
/** |
|
94 |
* @return the speciesMap |
|
95 |
*/ |
|
80 |
|
|
96 | 81 |
public Map<String, TaxonBase> getSpeciesMap() { |
97 | 82 |
return speciesMap; |
98 | 83 |
} |
99 |
|
|
100 |
|
|
101 |
/** |
|
102 |
* @param speciesMap the speciesMap to set |
|
103 |
*/ |
|
104 | 84 |
public void setSpeciesMap(Map<String, TaxonBase> speciesMap) { |
105 | 85 |
this.speciesMap = speciesMap; |
106 | 86 |
} |
107 | 87 |
|
108 |
/** |
|
109 |
* @param rankMap the rankMap to set |
|
110 |
*/ |
|
111 | 88 |
public void setRankMap(Map<Integer, Map<Integer,Rank>> rankMap) { |
112 | 89 |
this.rankMap = rankMap; |
113 | 90 |
} |
114 | 91 |
|
115 |
// /** |
|
116 |
// * @return the rankMap |
|
117 |
// */ |
|
118 |
// public Map<Integer, Map<Integer,Rank>> getRankMap() { |
|
119 |
// return rankMap; |
|
120 |
// } |
|
121 |
|
|
122 |
|
|
123 |
/** |
|
124 |
* Returns the CDM rank depending on the ERMS rankId and the ERMS kingdomId. Returns <code> |
|
125 |
* null</code> if the rank does not exist. |
|
126 |
* Throws a RuntimeException if the rank map has not been initialized before. |
|
127 |
* @param rankId |
|
128 |
* @param kingdomId |
|
129 |
* @return |
|
130 |
* @throws RuntimeException |
|
131 |
**/ |
|
132 |
public Rank getRank (int rankId, int kingdomId){ |
|
133 |
Rank result = null; |
|
134 |
if (this.rankMap == null){ |
|
135 |
throw new RuntimeException("rank map not initialized"); |
|
136 |
} |
|
137 |
if (kingdomId == 147415 && rankId == 10){ |
|
138 |
result = Rank.KINGDOM(); |
|
139 |
}else{ |
|
140 |
Map<Integer, Rank> kingdomMap = rankMap.get(rankId); |
|
141 |
if (kingdomMap != null){ |
|
142 |
result = kingdomMap.get(kingdomId); |
|
143 |
} |
|
144 |
} |
|
145 |
return result; |
|
146 |
} |
|
147 |
|
|
148 |
|
|
149 | 92 |
} |
Also available in: Unified diff
cleanup