Project

General

Profile

Download (1.66 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
* Copyright (C) 2019 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.taxeditor.preference.wizard;
10

    
11
import java.util.ArrayList;
12
import java.util.Collection;
13
import java.util.List;
14
import java.util.UUID;
15

    
16
import org.apache.commons.lang.StringUtils;
17

    
18
import eu.etaxonomy.cdm.api.service.ITermService;
19
import eu.etaxonomy.cdm.model.term.TermType;
20
import eu.etaxonomy.cdm.persistence.dto.TermDto;
21
import eu.etaxonomy.taxeditor.store.CdmStore;
22

    
23
/**
24
 * @author k.luther
25
 * @since 26.09.2019
26
 */
27
public abstract class TermSelectionWizardPage extends AbstractTermSelectionWizardPage<TermDto> {
28

    
29
    /**
30
     * @param pageName
31
     * @param type
32
     */
33
    protected TermSelectionWizardPage(String pageName, TermType type) {
34
        super(pageName, type);
35

    
36
    }
37

    
38
    @Override
39
    protected List<TermDto> getTermsFromStringValues(List<String> listValue) {
40
        Collection<TermDto> termlist = null ;
41
        ITermService termService = CdmStore.getService(ITermService.class);
42
        List<UUID> uuidList = new ArrayList();
43
        for (String s : listValue) {
44
            if (!StringUtils.isBlank(s)){
45
                UUID uuid = UUID.fromString(s);
46
                uuidList.add(uuid);
47
            }
48
        }
49
        if (!uuidList.isEmpty()){
50
            termlist = termService.findByUUIDsAsDto(uuidList);
51
        }
52

    
53
        if (listValue == null || listValue.isEmpty() ){
54
            termlist = termService.findByTitleAsDto("", type);
55
        }
56
        return new ArrayList(termlist);
57
    }
58
}
(16-16/18)