Project

General

Profile

Download (1.04 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
* Copyright (C) 2017 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
package eu.etaxonomy.cdm.vaadin.util.converter;
10

    
11
import java.util.Locale;
12
import java.util.UUID;
13

    
14
import eu.etaxonomy.cdm.vaadin.util.CdmSpringContextHelper;
15

    
16
/**
17
 * @author freimeier
18
 * @since 22.11.2017
19
 *
20
 */
21
public class TaxonNodeUuidTitleStringConverter extends UuidTitleStringConverter {
22

    
23
    private static final long serialVersionUID = 2372327533920312233L;
24

    
25
    @Override
26
    public String convertToPresentation(UUID value, Class<? extends String> targetType, Locale locale) throws ConversionException {
27
        if(value != null) {
28
            try {
29
               return CdmSpringContextHelper.getTaxonNodeService().load(value).getTaxon().getTitleCache();
30
            }catch(IllegalArgumentException iae) {
31
               return null;
32
            }
33
        }
34
        return null;
35
    }
36
}
(11-11/14)