Project

General

Profile

Download (1.19 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
    /* (non-Javadoc)
26
     * @see com.vaadin.data.util.converter.Converter#convertToPresentation(java.lang.Object, java.lang.Class, java.util.Locale)
27
     */
28
    @Override
29
    public String convertToPresentation(UUID value, Class<? extends String> targetType, Locale locale) throws ConversionException {
30
        if(value != null) {
31
            try {
32
               return CdmSpringContextHelper.getTaxonNodeService().load(value).getTaxon().getTitleCache();
33
            }catch(IllegalArgumentException iae) {
34
               return null;
35
            }
36
        }
37
        return null;
38
    }
39
}
(10-10/13)