1 |
180fef01
|
Patrick Plitzner
|
/**
|
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.view.search.facet.term;
|
10 |
|
|
|
11 |
|
|
import java.util.HashSet;
|
12 |
|
|
import java.util.Set;
|
13 |
|
|
|
14 |
e1c30665
|
Andreas Müller
|
import eu.etaxonomy.cdm.api.service.l10n.TermRepresentation_L10n;
|
15 |
b9dc6bb1
|
Andreas Müller
|
import eu.etaxonomy.cdm.model.term.TermType;
|
16 |
2d38478f
|
Katja Luther
|
import eu.etaxonomy.cdm.persistence.dto.AbstractTermDto;
|
17 |
77e3fddf
|
Patrick Plitzner
|
import eu.etaxonomy.cdm.persistence.dto.TermDto;
|
18 |
180fef01
|
Patrick Plitzner
|
import eu.etaxonomy.taxeditor.view.search.facet.Facet;
|
19 |
|
|
import eu.etaxonomy.taxeditor.view.search.facet.SearchResult;
|
20 |
|
|
|
21 |
|
|
/**
|
22 |
|
|
* @author pplitzner
|
23 |
|
|
* @since Jan 24, 2019
|
24 |
|
|
*
|
25 |
|
|
*/
|
26 |
2d38478f
|
Katja Luther
|
public class TermSearchResult extends SearchResult<AbstractTermDto> {
|
27 |
180fef01
|
Patrick Plitzner
|
|
28 |
2d38478f
|
Katja Luther
|
public TermSearchResult(AbstractTermDto content) {
|
29 |
180fef01
|
Patrick Plitzner
|
super(content);
|
30 |
|
|
}
|
31 |
|
|
|
32 |
|
|
@Override
|
33 |
2d38478f
|
Katja Luther
|
protected Set<Facet> initFacets(AbstractTermDto content) {
|
34 |
180fef01
|
Patrick Plitzner
|
Set<Facet> facets = new HashSet<>();
|
35 |
77e3fddf
|
Patrick Plitzner
|
content.localize(new TermRepresentation_L10n());
|
36 |
219d7e87
|
Patrick Plitzner
|
TermType termType = content.getTermType();
|
37 |
2d38478f
|
Katja Luther
|
if (content instanceof TermDto){
|
38 |
|
|
facets.add(new Facet(((TermDto)content).getVocRepresentation_L10n(), termType!=null?termType.getMessage():null));
|
39 |
|
|
}else{
|
40 |
|
|
facets.add(new Facet(content.getRepresentation_L10n(), termType!=null?termType.getMessage():null));
|
41 |
|
|
}
|
42 |
180fef01
|
Patrick Plitzner
|
return facets;
|
43 |
|
|
}
|
44 |
|
|
|
45 |
|
|
}
|