Revision 0d6a5e24
Added by Andreas Müller over 6 years ago
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/dwca/in/DatabaseMapping.java | ||
---|---|---|
57 | 57 |
|
58 | 58 |
private ICdmDataSource datasource; |
59 | 59 |
private final String mappingId; |
60 |
private final Map<String, Class> shortCuts = new HashMap<String, Class>();
|
|
61 |
private final Map<Class, String> reverseShortCuts = new HashMap<Class, String>();
|
|
60 |
private final Map<String, Class> shortCuts = new HashMap<>(); |
|
61 |
private final Map<Class, String> reverseShortCuts = new HashMap<>(); |
|
62 | 62 |
|
63 | 63 |
|
64 | 64 |
@Override |
... | ... | |
81 | 81 |
|
82 | 82 |
@Override |
83 | 83 |
public void putMapping(String namespace, String sourceKey, IdentifiableEntity destinationObject){ |
84 |
CdmKey<IdentifiableEntity<?>> cdmKey = new CdmKey(destinationObject); |
|
84 |
CdmKey<IdentifiableEntity<?>> cdmKey = new CdmKey<>(destinationObject);
|
|
85 | 85 |
putMapping(namespace, sourceKey, cdmKey); |
86 | 86 |
} |
87 | 87 |
|
... | ... | |
149 | 149 |
|
150 | 150 |
@Override |
151 | 151 |
public Set<CdmKey> get(String sourceNamespace, String sourceId) { |
152 |
Set<CdmKey> result = new HashSet<CdmKey>();
|
|
152 |
Set<CdmKey> result = new HashSet<>(); |
|
153 | 153 |
String normalizedKey = normalizeKey(sourceId); |
154 | 154 |
String selectMappingSql = " SELECT %s, %s FROM %s" + |
155 | 155 |
" WHERE %s = '%s' AND %s = '%s' AND %s = '%s' "; |
... | ... | |
166 | 166 |
throw new RuntimeException("Destination id for import mapping is 'null'"); |
167 | 167 |
} |
168 | 168 |
|
169 |
Class clazz = getCdmClass(clazzStr); |
|
169 |
Class<?> clazz = getCdmClass(clazzStr);
|
|
170 | 170 |
|
171 |
CdmKey<?> key = new CdmKey(clazz, Integer.valueOf(String.valueOf(id))); |
|
171 |
CdmKey<?> key = new CdmKey<>(clazz, Integer.valueOf(String.valueOf(id)));
|
|
172 | 172 |
result.add(key); |
173 | 173 |
} |
174 | 174 |
} catch (NumberFormatException e) { |
... | ... | |
257 | 257 |
* @return |
258 | 258 |
* @throws ClassNotFoundException |
259 | 259 |
*/ |
260 |
private Class getCdmClass(String clazzStr) throws ClassNotFoundException { |
|
261 |
Class clazz = shortCuts.get(clazzStr); |
|
260 |
private Class<?> getCdmClass(String clazzStr) throws ClassNotFoundException {
|
|
261 |
Class<?> clazz = shortCuts.get(clazzStr);
|
|
262 | 262 |
if (clazz == null){ |
263 | 263 |
clazz = Class.forName(clazzStr); |
264 | 264 |
} |
Also available in: Unified diff
cleanup