Revision 29024880
Added by Andreas Müller over 6 years ago
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/stream/StreamImportStateBase.java | ||
---|---|---|
35 | 35 |
* @author a.mueller |
36 | 36 |
* @created 23.11.2011 |
37 | 37 |
*/ |
38 |
public abstract class StreamImportStateBase<CONFIG extends StreamImportConfiguratorBase, IO extends StreamImportBase> extends ImportStateBase<CONFIG, IO>{ |
|
38 |
public abstract class StreamImportStateBase<CONFIG extends StreamImportConfiguratorBase, IO extends StreamImportBase> |
|
39 |
extends ImportStateBase<CONFIG, IO>{ |
|
39 | 40 |
private static final Logger logger = Logger.getLogger(StreamImportStateBase.class); |
40 | 41 |
|
41 | 42 |
private UUID uuid = UUID.randomUUID(); |
... | ... | |
101 | 102 |
return get(namespace, sourceKey, null); |
102 | 103 |
} |
103 | 104 |
|
104 |
public <CLASS extends IdentifiableEntity> List<CLASS> get(String namespace, String sourceKey,Class<CLASS> destinationClass){ |
|
105 |
List<CLASS> result = new ArrayList<CLASS>();
|
|
105 |
public <CLASS extends IdentifiableEntity> List<CLASS> get(String namespace, String sourceKey, Class<CLASS> destinationClass){
|
|
106 |
List<CLASS> result = new ArrayList<>(); |
|
106 | 107 |
if (this.partitionStore != null){ |
107 | 108 |
Map<String, IdentifiableEntity> namespaceMap = this.partitionStore.get(namespace); |
108 | 109 |
if (namespaceMap != null){ |
... | ... | |
144 | 145 |
for (MappingEntry<String, String, Class, Integer> entry : mappingEntryList){ |
145 | 146 |
Set<Integer> idSet = destinationNamespaceMap.get(entry.getDestinationNamespace()); |
146 | 147 |
if (idSet == null){ |
147 |
idSet = new HashSet<Integer>();
|
|
148 |
idSet = new HashSet<>(); |
|
148 | 149 |
destinationNamespaceMap.put(entry.getDestinationNamespace(), idSet); |
149 | 150 |
} |
150 | 151 |
idSet.add(entry.getDestinationId()); |
... | ... | |
169 | 170 |
|
170 | 171 |
//fill related object map |
171 | 172 |
for (MappingEntry<String, String, Class, Integer> entry : mappingEntryList){ |
172 |
IdentifiableEntity cdmBase = getCdmObject(classMap, entry); |
|
173 |
IdentifiableEntity<?> cdmBase = getCdmObject(classMap, entry);
|
|
173 | 174 |
|
174 | 175 |
Map<String, IdentifiableEntity> namespaceMap = getOrMakeNamespaceMap(result, entry.getNamespace()); |
175 | 176 |
if (cdmBase != null){ |
... | ... | |
193 | 194 |
} |
194 | 195 |
} |
195 | 196 |
|
196 |
|
|
197 |
// public Map<String, Map<String, IdentifiableEntity>> getPartitionStore() { |
|
198 |
// return partitionStore; |
|
199 |
// } |
|
200 |
|
|
201 | 197 |
public void unloadPartitionStore(Map<String, Map<String, IdentifiableEntity>> partitionStore) { |
202 | 198 |
this.partitionStore = new HashMap<>(); |
203 | 199 |
} |
... | ... | |
207 | 203 |
} |
208 | 204 |
|
209 | 205 |
|
210 |
private Map<String, IdentifiableEntity> getOrMakeNamespaceMap(Map<String, Map<String, IdentifiableEntity>> relatedObjectMap2, String namespace) {
|
|
211 |
Map<String, IdentifiableEntity> namespaceMap = relatedObjectMap2.get(namespace);
|
|
206 |
private Map<String, IdentifiableEntity> getOrMakeNamespaceMap(Map<String, Map<String, IdentifiableEntity>> relatedObjectMap, String namespace) { |
|
207 |
Map<String, IdentifiableEntity> namespaceMap = relatedObjectMap.get(namespace); |
|
212 | 208 |
if (namespaceMap == null){ |
213 | 209 |
namespaceMap = new HashMap<>(); |
214 |
relatedObjectMap2.put(namespace, namespaceMap);
|
|
210 |
relatedObjectMap.put(namespace, namespaceMap); |
|
215 | 211 |
} |
216 | 212 |
return namespaceMap; |
217 | 213 |
} |
... | ... | |
247 | 243 |
return references.get(0); |
248 | 244 |
} |
249 | 245 |
|
250 |
|
|
251 |
|
|
252 | 246 |
} |
253 | 247 |
|
254 | 248 |
|
255 | 249 |
|
256 |
|
|
257 |
|
|
258 |
|
|
259 | 250 |
} |
Also available in: Unified diff
cleanup