Revision 3e57d368
Added by Andreas Müller over 11 years ago
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/common/CdmImportBase.java | ||
---|---|---|
311 | 311 |
} |
312 | 312 |
|
313 | 313 |
protected NamedArea getNamedArea(STATE state, UUID uuid, String label, String text, String labelAbbrev, NamedAreaType areaType, NamedAreaLevel level, TermVocabulary voc, TermMatchMode matchMode){ |
314 |
Class<NamedArea> clazz = NamedArea.class; |
|
314 | 315 |
if (uuid == null){ |
315 | 316 |
uuid = UUID.randomUUID(); |
316 | 317 |
} |
... | ... | |
320 | 321 |
NamedArea namedArea = state.getNamedArea(uuid); |
321 | 322 |
if (namedArea == null){ |
322 | 323 |
//TODO matching still experimental |
323 |
namedArea = (NamedArea)getTermService().find(uuid); |
|
324 |
if (namedArea == null && matchMode.equals(TermMatchMode.UUID_LABEL)){ |
|
325 |
logger.warn("UUID_LABEL not yet implemented"); |
|
326 |
} |
|
327 |
if (namedArea == null && matchMode.equals(TermMatchMode.UUID_ABBREVLABEL)){ |
|
328 |
Pager<NamedArea> areaPager = getTermService().findByRepresentationAbbreviation(labelAbbrev, NamedArea.class, null, null); |
|
324 |
namedArea = CdmBase.deproxy(getTermService().find(uuid),NamedArea.class); |
|
325 |
if (namedArea == null && (matchMode.equals(TermMatchMode.UUID_LABEL) || matchMode.equals(TermMatchMode.UUID_LABEL_ABBREVLABEL ))){ |
|
326 |
//TODO test |
|
327 |
Pager<NamedArea> areaPager = (Pager)getTermService().findByTitle(clazz, label, null, null, null, null, null, null); |
|
329 | 328 |
namedArea = findBestMatchingArea(areaPager, uuid, label, text, labelAbbrev, areaType, level, voc); |
330 | 329 |
} |
331 |
if (namedArea == null && matchMode.equals(TermMatchMode.UUID_LABEL_ABBREVLABEL)){ |
|
332 |
logger.warn("UUID_LABEL not yet implemented"); |
|
330 |
if (namedArea == null && (matchMode.equals(TermMatchMode.UUID_ABBREVLABEL) || matchMode.equals(TermMatchMode.UUID_LABEL_ABBREVLABEL))){ |
|
331 |
Pager<NamedArea> areaPager = getTermService().findByRepresentationAbbreviation(labelAbbrev, clazz, null, null); |
|
332 |
namedArea = findBestMatchingArea(areaPager, uuid, label, text, labelAbbrev, areaType, level, voc); |
|
333 | 333 |
} |
334 | 334 |
|
335 | 335 |
if (namedArea == null){ |
Also available in: Unified diff
TermMatchMode for label implemented in getNamedArea